/**
 * 通讯录 - 微信联系人风格
 * 简洁、高效、按拼音首字母分组排序
 */

/* ==================== 整体布局 ==================== */
.txl-wechat-container {
    padding: 0;
    margin: 0;
    padding-bottom: 80px;
}

/* ==================== 搜索栏 ==================== */
.wechat-search-bar {
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 10px 16px;
    background: #f5f5f5;
}

.wechat-search-input {
    width: 100%;
    padding: 8px 12px;
    border: none;
    border-radius: 6px;
    background: #fff;
    font-size: 14px;
    outline: none;
}

.wechat-search-input:focus {
    box-shadow: 0 0 0 2px rgba(26, 173, 25, 0.3);
}

/* ==================== 联系人列表 ==================== */
.wechat-contact-list {
    background: #fff;
}

.wechat-contact-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 0.5px solid #e5e5e5;
    cursor: pointer;
    transition: background 0.2s;
    text-decoration: none;
    color: inherit;
}

.wechat-contact-item:hover {
    background: #f5f5f5;
}

.wechat-contact-item:active {
    background: #e5e5e5;
}

/* 头像 */
.wechat-avatar {
    width: 48px;
    height: 48px;
    border-radius: 4px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 500;
    margin-right: 12px;
    flex-shrink: 0;
    overflow: hidden;
}

.wechat-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* 名字和信息 */
.wechat-contact-info {
    flex: 1;
    min-width: 0;
}

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

.wechat-contact-detail {
    font-size: 13px;
    color: #888;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}

/* ==================== 字母索引栏 ==================== */
.wechat-sidebar-index {
    position: fixed;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 0;
    background: transparent;
    pointer-events: none;
}

.wechat-sidebar-index span {
    font-size: 10px;
    color: #666;
    width: 20px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    pointer-events: auto;
    transition: color 0.2s, font-weight 0.2s;
}

.wechat-sidebar-index span:hover,
.wechat-sidebar-index span.active {
    color: #1aad19;
    font-weight: 700;
}

.wechat-sidebar-index span.special {
    font-size: 9px;
}

/* ==================== 字母分组标题 ==================== */
.wechat-letter-header {
    padding: 8px 16px;
    background: #f5f5f5;
    font-size: 13px;
    color: #888;
    font-weight: 500;
    letter-spacing: 0.5px;
    position: sticky;
    top: 54px;
    z-index: 50;
}

/* ==================== 搜索结果 ==================== */
.wechat-search-result {
    display: none;
}

.wechat-search-result.show {
    display: block;
}

.wechat-search-empty {
    padding: 40px 16px;
    text-align: center;
    color: #888;
    font-size: 14px;
}

/* ==================== 离我最近模块 ==================== */
.wechat-nearest-section {
    padding: 0;
    background: #fff;
    margin-bottom: 10px;
}

.wechat-section-header {
    padding: 10px 16px;
    font-size: 13px;
    color: #888;
    background: #f5f5f5;
    display: flex;
    align-items: center;
    gap: 6px;
}

.wechat-section-header::before {
    content: '📍';
    font-size: 12px;
}

.wechat-nearest-item {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    border-bottom: 0.5px solid #e5e5e5;
    cursor: pointer;
}

.wechat-nearest-item:last-child {
    border-bottom: none;
}

.wechat-nearest-info {
    flex: 1;
}

.wechat-nearest-name {
    font-size: 15px;
    color: #191919;
}

.wechat-nearest-location {
    font-size: 12px;
    color: #888;
    margin-top: 2px;
}

.wechat-nearest-distance {
    font-size: 12px;
    color: #1aad19;
}

/* ==================== 详情页入口 ==================== */
.wechat-contact-item .arrow {
    color: #c5c5c5;
    font-size: 14px;
}

/* ==================== 夜间模式适配 ==================== */
.night-mode .wechat-search-bar {
    background: #1f1f1f;
}

.night-mode .wechat-search-input {
    background: #2f2f2f;
    color: #fff;
}

.night-mode .wechat-contact-list,
.night-mode .wechat-nearest-section {
    background: #1f1f1f;
}

.night-mode .wechat-contact-item {
    border-bottom-color: #333;
}

.night-mode .wechat-contact-item:hover,
.night-mode .wechat-contact-item:active {
    background: #2f2f2f;
}

.night-mode .wechat-contact-name {
    color: #fff;
}

.night-mode .wechat-contact-detail {
    color: #888;
}

.night-mode .wechat-letter-header,
.night-mode .wechat-section-header {
    background: #1a1a1a;
    color: #666;
}

.night-mode .wechat-sidebar-index span {
    color: #666;
}

.night-mode .wechat-sidebar-index span:hover,
.night-mode .wechat-sidebar-index span.active {
    color: #1aad19;
}

/* ==================== 动画效果 ==================== */
@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.wechat-contact-item {
    animation: slideInRight 0.3s ease-out backwards;
}

/* 交错动画延迟 - 每组20ms */
.wechat-contact-item:nth-child(1) { animation-delay: 0ms; }
.wechat-contact-item:nth-child(2) { animation-delay: 20ms; }
.wechat-contact-item:nth-child(3) { animation-delay: 40ms; }
.wechat-contact-item:nth-child(4) { animation-delay: 60ms; }
.wechat-contact-item:nth-child(5) { animation-delay: 80ms; }
.wechat-contact-item:nth-child(6) { animation-delay: 100ms; }
.wechat-contact-item:nth-child(7) { animation-delay: 120ms; }
.wechat-contact-item:nth-child(8) { animation-delay: 140ms; }
.wechat-contact-item:nth-child(9) { animation-delay: 160ms; }
.wechat-contact-item:nth-child(10) { animation-delay: 180ms; }

/* ==================== 高亮定位效果 ==================== */
.highlight {
    animation: highlight-pulse 1.5s ease-out;
}

@keyframes highlight-pulse {
    0% { background: rgba(26, 173, 25, 0.3); }
    100% { background: transparent; }
}
