/* ====== 最近搜索联系人插件样式 ====== */

/* 最近联系人区块 —— 跟在搜索历史后面 */
.recent-contacts-section {
    padding: 12px 20px 8px;
}

.recent-contacts-group {
    margin-bottom: 16px;
}
.recent-contacts-group:last-child {
    margin-bottom: 0;
}

/* 标题栏 */
.recent-contacts-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    user-select: none;
}

.recent-contacts-title {
    font-size: 14px;
    font-weight: 500;
    color: #333333;
}

.recent-contacts-clear {
    font-size: 12px;
    color: #008af3;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    transition: background 0.15s ease, color 0.15s ease;
}

.recent-contacts-clear:hover {
    background: rgba(0, 138, 243, 0.08);
    color: #0070d6;
}

/* 联系人网格容器 */
.recent-contacts-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 0;
    margin: 0;
    list-style: none;
}

/* 联系人块 */
.recent-contact-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 76px;
    padding: 10px 6px 8px;
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.12s ease;
    user-select: none;
    position: relative;
}

.recent-contact-block:hover {
    background: #ecf0f6;
}

.recent-contact-block:active {
    background: #e0e8f2;
}

/* 头像 */
.recent-contact-avatar {
    width: 46px;
    height: 46px;
    border-radius: 6px;
    flex-shrink: 0;
    background-color: #ddd;
    overflow: hidden;
    margin-bottom: 5px;
}

/* 文字头像 */
.recent-contact-avatar-text {
    width: 46px;
    height: 46px;
    border-radius: 6px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 500;
    color: #fff;
    user-select: none;
    margin-bottom: 5px;
}

.recent-contact-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* 拼合群聊头像网格 */
.recent-contact-avatar-grid {
    display: flex;
    flex-wrap: wrap;
    align-content: center;
    justify-content: center;
    gap: 1.5px;
    background-color: #e5e5e5;
    padding: 1.5px;
    box-sizing: border-box;
}

.recent-contact-avatar-grid[data-count="2"] img,
.recent-contact-avatar-grid[data-count="3"] img,
.recent-contact-avatar-grid[data-count="4"] img {
    width: calc(50% - 0.75px);
    height: calc(50% - 0.75px);
}

.recent-contact-avatar-grid img {
    width: calc(33.33% - 1px);
    height: calc(33.33% - 1px);
    border-radius: 2px;
}

/* 名称 */
.recent-contact-name {
    font-size: 11px;
    color: #555;
    line-height: 1.3;
    text-align: center;
    width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 删除按钮（右上角） */
.recent-contact-remove {
    display: none;
    position: absolute;
    top: 2px;
    right: 2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.35);
    color: #fff;
    font-size: 10px;
    line-height: 16px;
    text-align: center;
    cursor: pointer;
    z-index: 2;
    transition: background 0.15s ease;
}

.recent-contact-block:hover .recent-contact-remove {
    display: block;
}

.recent-contact-remove:hover {
    background: rgba(255, 71, 87, 0.85);
}


/* ====== 暗色模式适配 ====== */
html[data-theme="dark"] .recent-contacts-title {
    color: #ffffff;
}

html[data-theme="dark"] .recent-contacts-clear {
    color: #56b0ff;
}

html[data-theme="dark"] .recent-contacts-clear:hover {
    background: rgba(86, 176, 255, 0.1);
    color: #7cc4ff;
}

html[data-theme="dark"] .recent-contact-block:hover {
    background: #3a3a3a;
}

html[data-theme="dark"] .recent-contact-block:active {
    background: #444;
}

html[data-theme="dark"] .recent-contact-avatar {
    background-color: #444;
}

html[data-theme="dark"] .recent-contact-name {
    color: #aaa;
}

html[data-theme="dark"] .recent-contact-remove {
    background: rgba(255, 255, 255, 0.25);
}

html[data-theme="dark"] .recent-contact-remove:hover {
    background: rgba(255, 107, 122, 0.85);
}
