/* 联系人界面样式 */
.contact-section {
    display: flex;
    flex-direction: column;
}

/* 联系人列表 */
.contact-list {
    flex: 1;
    overflow-y: auto;
    background-color: #fff;
    position: relative;
}

/* 联系人分组 */
.contact-group {
    margin-bottom: 0;
}

.group-title {
    background-color: #f5f7fa;
    padding: 8px 15px;
    font-size: 14px;
    color: #909399;
    font-weight: 500;
    border-bottom: 1px solid #e4e7ed;
    position: sticky;
    top: 0;
    z-index: 5;
}

/* 联系人项 */
.contact-item {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background-color 0.2s;
    position: relative;
}

.contact-item:hover {
    background-color: #f5f7fa;
}

.contact-item:active {
    background-color: #e1f3d8;
}

/* 联系人头像 */
.contact-avatar {
    position: relative;
    margin-right: 12px;
    flex-shrink: 0;
}

/* 未读消息徽章 */
.contact-avatar .unread-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff4757;
    color: white;
    border-radius: 10px;
    padding: 2px 6px;
    font-size: 10px;
    font-weight: bold;
    min-width: 16px;
    height: 16px;
    line-height: 12px;
    text-align: center;
    border: 2px solid white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    z-index: 10;
}

/* 联系人元信息区域的未读消息徽章 */
.contact-meta .unread-badge {
    position: static;
    margin-top: 2px;
}

/* 联系人信息 */
.contact-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.contact-name {
    font-size: 16px;
    font-weight: 500;
    color: #303133;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.last-message {
    font-size: 14px;
    color: #909399;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

/* 联系人元信息 */
.contact-meta {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.message-time {
    font-size: 12px;
    color: #c0c4cc;
    white-space: nowrap;
}

/* 字母索引 */
.alphabet-index {
    position: fixed;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: 12px;
    padding: 8px 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 10;
}

.alphabet-item {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: #409eff;
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.2s;
}

.alphabet-item:hover {
    background-color: #409eff;
    color: #fff;
    transform: scale(1.2);
}

/* 搜索结果高亮 */
.contact-item.search-highlight .contact-name {
    color: #409eff;
}

.contact-item.search-highlight {
    background-color: #ecf5ff;
}

/* 在线状态指示 */
.contact-avatar::after {
    content: '';
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid #fff;
    background-color: #67c23a;
}

.contact-avatar.offline::after {
    background-color: #c0c4cc;
}

/* 置顶会话样式 */
.contact-item.pinned {
    background-color: #f0f9ff;
    border-left: 3px solid #409eff;
}

.contact-item.pinned .contact-name {
    color: #409eff;
}

/* 未读消息样式 */
.contact-item.has-unread .contact-name {
    font-weight: 600;
}

.contact-item.has-unread .last-message {
    color: #606266;
    font-weight: 500;
}

/* 滚动条样式 */
.contact-list::-webkit-scrollbar {
    width: 4px;
}

.contact-list::-webkit-scrollbar-track {
    background: transparent;
}

.contact-list::-webkit-scrollbar-thumb {
    background: #c0c4cc;
    border-radius: 2px;
}

.contact-list::-webkit-scrollbar-thumb:hover {
    background: #909399;
}

/* 空状态 */
.empty-contacts {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: #909399;
    font-size: 14px;
}

.empty-contacts i {
    font-size: 48px;
    margin-bottom: 16px;
    color: #c0c4cc;
}

/* 加载状态 */
.contact-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    color: #909399;
    font-size: 14px;
}

/* 搜索无结果 */
.no-search-results {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: #909399;
    font-size: 14px;
}

.no-search-results i {
    font-size: 36px;
    margin-bottom: 12px;
    color: #c0c4cc;
}

/* 响应式设计 */
@media (max-width: 480px) {
    .contact-item {
        padding: 10px 12px;
    }
    
    .contact-name {
        font-size: 15px;
    }
    
    .last-message {
        font-size: 13px;
    }
    
    .alphabet-index {
        right: 3px;
    }
    
    .alphabet-item {
        width: 18px;
        height: 18px;
        font-size: 11px;
    }
}

/* 长按选择效果 */
.contact-item.selecting {
    background-color: #e1f3d8;
    transform: scale(0.98);
    transition: all 0.1s;
}

/* 分组折叠 */
.contact-group.collapsed .contact-item {
    display: none;
}

.group-title.collapsible {
    cursor: pointer;
    position: relative;
}

.group-title.collapsible::after {
    content: '\e6d9';
    font-family: element-icons;
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    transition: transform 0.3s;
}

.group-title.collapsible.collapsed::after {
    transform: translateY(-50%) rotate(-90deg);
}

/* 联系人列表加载状态UI */
.refresh-indicator {
    text-align: center;
    padding: 10px;
    color: #909399;
    font-size: 14px;
    background-color: #f5f7fa;
    border-bottom: 1px solid #e4e7ed;
}

.load-more-indicator {
    text-align: center;
    padding: 15px;
    color: #909399;
    font-size: 14px;
    background-color: #f5f7fa;
}

.no-more-data {
    text-align: center;
    padding: 15px;
    color: #c0c4cc;
    font-size: 12px;
    background-color: #f5f7fa;
}

.refresh-indicator .el-icon-loading,
.load-more-indicator .el-icon-loading {
    margin-right: 5px;
    animation: rotating 2s linear infinite;
}

@keyframes rotating {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}