/* 联系人模块样式 */

/* 遮罩层 - 仅在桌面端显示联系人视图时需要 */
#contacts-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1029;
}

/* 联系人视图容器 */
#contacts-view {
    display: none;
    position: fixed;
    background: #fff;
    z-index: 2000; /* 提高层级，确保在最上层 */
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    flex-direction: column;
}

/* 移动端 (默认) - 全屏覆盖 */
#contacts-view {
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%; /* 回退到 100% 以确保兼容性 */
    height: 100vh; /* 尝试使用视口高度 */
}

/* 桌面端 - 居中弹窗 */
@media (min-width: 768px) {
    #contacts-view {
        width: 400px;
        height: 650px;
        max-height: 80vh;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        border-radius: 12px;
        box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    }
}

/* 头部样式 */
.contacts-header {
    padding: 10px 15px;
    border-bottom: 1px solid #eee;
    background: #f8f9fa;
    display: block;
    height: 100px; /* 固定高度 */
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10;
}

/* 列表主体区域 - 改用绝对定位以强制滚动 */
.contacts-body {
    position: absolute;
    top: 100px; /* 对应 header 高度 */
    bottom: 0;
    left: 0;
    right: 0;
    overflow-y: scroll; /* 强制显示滚动条 */
    -webkit-overflow-scrolling: touch;
    background: #fff;
}

/* 联系人列表 */
#contacts-list {
    margin-bottom: 0;
    width: 100%;
    height: auto; /* 让内容撑开高度 */
    min-height: 101%; /* 确保可滚动 */
    /* 确保滚动条不被索引条遮挡，索引条宽度为20px */
    margin-right: 20px;
    padding-bottom: 100px; /* 增加底部内边距 */
}

/* 自定义滚动条样式 */
#contacts-list::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
#contacts-list::-webkit-scrollbar-track {
    background: transparent;
}
#contacts-list::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}
#contacts-list::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

/* 索引条 */
#contacts-index-bar {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    height: 100%;
    width: 20px;
    padding: 10px 0;
    background: rgba(255,255,255,0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 10;
}

.index-bar-item {
    flex: 1;
    width: 100%;
    text-align: center;
    cursor: pointer;
    font-size: 12px;
    color: #007aff;
}

/* 加载提示 */
#contacts-loading {
    text-align: center;
    padding: 20px;
    display: none;
    position: absolute;
    top: 100px;
    width: 100%;
    z-index: 20;
}

/* 分组标题 */
.contact-group-title {
    background-color: #f0f0f0;
    padding: 5px 15px;
    font-weight: bold;
    color: #333;
    position: sticky;
    top: 0;
    z-index: 5;
}

/* 列表项样式 */
.contact-item-main {
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    padding: 10px 15px; 
    cursor: pointer;
}

.contact-expand-actions {
    display: none; 
    background: #f9f9f9; 
    padding: 10px 15px; 
    text-align: right; 
    border-top: 1px solid #f0f0f0;
}
