/* ==========================================
   峰仔OICQ - 仿OICQ经典界面样式
   ========================================== */

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --primary: #07c160;
    --primary-dark: #06ad56;
    --primary-light: #e8f8f0;
    --danger: #e74c3c;
    --danger-hover: #c0392b;
    --warning: #f39c12;
    --info: #3498db;
    --bg: #f5f6fa;
    --bg-white: #ffffff;
    --border: #e0e0e0;
    --text: #333333;
    --text-secondary: #666666;
    --text-light: #999999;
    --shadow: 0 2px 12px rgba(0,0,0,0.08);
    --radius: 8px;
    --transition: all 0.2s ease;
    --title-bar-height: 48px;
}

body {
    font-family: 'Microsoft YaHei', 'PingFang SC', 'Helvetica Neue', sans-serif;
    font-size: 14px;
    color: var(--text);
    background: #e8ecf1;
    height: 100vh;
    overflow: hidden;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ========== 按钮 ========== */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 8px 20px; border: none; border-radius: 4px;
    font-size: 14px; cursor: pointer; transition: var(--transition);
    outline: none; text-decoration: none; gap: 5px;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger-hover); }
.btn-secondary { background: #eee; color: #666; border: 1px solid #ddd; }
.btn-secondary:hover { background: #ddd; color: #333; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-warning:hover { background: #e67e22; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-block { width: 100%; }
.btn-sm { padding: 4px 12px; font-size: 12px; }
.btn-xs { padding: 2px 8px; font-size: 11px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ========== 表单 ========== */
.form-group { margin-bottom: 15px; }
.form-group label { display: block; margin-bottom: 5px; font-size: 13px; color: var(--text-secondary); font-weight: 500; }
.form-group input, .form-group textarea {
    width: 100%; padding: 10px 12px; border: 1px solid var(--border);
    border-radius: 4px; font-size: 14px; outline: none; transition: var(--transition);
    font-family: inherit;
}
.form-group input:focus, .form-group textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(7,193,96,0.1); }
.form-group textarea { resize: vertical; min-height: 60px; }

/* ========== 登录/注册 ========== */
.auth-container {
    display: flex; justify-content: center; align-items: center;
    min-height: 100vh; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}
.auth-box {
    background: #fff; border-radius: 12px; padding: 40px;
    width: 400px; box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}
.auth-header { text-align: center; margin-bottom: 30px; }
.auth-logo { width: 64px; height: 64px; margin-bottom: 10px; }
.auth-header h1 { font-size: 24px; color: var(--primary); margin-bottom: 5px; }
.auth-header p { color: var(--text-light); font-size: 13px; }
.auth-form { display: none; }
.auth-form.active { display: block; }
.auth-form h2 { font-size: 18px; margin-bottom: 20px; text-align: center; color: var(--text); }
.form-switch { text-align: center; margin-top: 15px; font-size: 13px; color: var(--text-light); }

/* ========== 主界面布局 ========== */
.main-container {
    display: flex; flex-direction: column; height: 100vh; background: var(--bg);
}

/* 标题栏 */
.title-bar {
    height: var(--title-bar-height); background: linear-gradient(180deg, #0a8cd2 0%, #0973b0 100%);
    color: #fff; display: flex; align-items: center; justify-content: space-between;
    padding: 0 15px; flex-shrink: 0;
    -webkit-app-region: no-drag;
}
.title-bar-left { display: flex; align-items: center; gap: 8px; }
.title-logo { width: 24px; height: 24px; }
.title-text { font-size: 14px; font-weight: bold; letter-spacing: 1px; }
.title-bar-right { display: flex; align-items: center; gap: 10px; }
.user-info-bar { display: flex; align-items: center; gap: 6px; }
.avatar-small { width: 28px; height: 28px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.5); object-fit: cover; }
.oicq-badge { background: rgba(255,255,255,0.2); padding: 2px 8px; border-radius: 10px; font-size: 11px; }

/* 主体区域 */
.main-body {
    display: flex; flex: 1; overflow: hidden;
}

/* 左侧面板 */
.left-panel {
    width: 280px; min-width: 280px; background: #e9ecf0;
    display: flex; flex-direction: column; border-right: 1px solid #d5d8dc;
}

.search-bar {
    padding: 10px; position: relative;
}
.search-bar input {
    width: 100%; padding: 8px 12px; border: 1px solid #c8ccd0; border-radius: 4px;
    font-size: 13px; outline: none; background: #fff;
}
.search-bar input:focus { border-color: var(--primary); }
.search-results {
    position: absolute; top: 45px; left: 10px; right: 10px;
    background: #fff; border-radius: 4px; box-shadow: var(--shadow);
    max-height: 300px; overflow-y: auto; z-index: 100;
}

.tab-bar {
    display: flex; border-bottom: 1px solid #d5d8dc;
}
.tab-item {
    flex: 1; text-align: center; padding: 10px 5px; cursor: pointer;
    font-size: 13px; color: var(--text-secondary); transition: var(--transition);
    position: relative; border-bottom: 2px solid transparent;
}
.tab-item:hover { color: var(--text); background: rgba(255,255,255,0.5); }
.tab-item.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 500; }
.tab-icon { font-size: 16px; }
.badge {
    position: absolute; top: 4px; right: 8px; background: var(--danger);
    color: #fff; font-size: 10px; padding: 1px 5px; border-radius: 10px; min-width: 18px;
}

.tab-content { display: none; flex: 1; overflow-y: auto; }
.tab-content.active { display: flex; flex-direction: column; }

.list-header {
    padding: 8px 12px; font-size: 12px; color: var(--text-light); font-weight: 500;
    border-bottom: 1px solid #e0e0e0; background: #f0f2f5;
}

.contact-list { flex: 1; overflow-y: auto; }

.contact-item {
    display: flex; align-items: center; padding: 10px 12px; cursor: pointer;
    transition: var(--transition); gap: 10px; border-bottom: 1px solid #f0f0f0;
}
.contact-item:hover { background: #dce8f5; }
.contact-item.active { background: #c5d9f0; }
.contact-item .avatar { width: 40px; height: 40px; border-radius: 4px; object-fit: cover; flex-shrink: 0; }
.contact-item .contact-info { flex: 1; min-width: 0; }
.contact-item .contact-name { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.contact-item .contact-detail { font-size: 11px; color: var(--text-light); }
.contact-item .contact-status {
    width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.contact-item .contact-status.online { background: var(--primary); }
.contact-item .contact-status.offline { background: #ccc; }
.contact-item .unread-badge {
    display: inline-block;
    background: #ff4d4f;
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
    line-height: 16px;
    margin-left: 6px;
    vertical-align: middle;
    animation: badgePopIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes badgePopIn {
    0% { transform: scale(0); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}
/* 有未读消息的联系人整行加轻微背景 */
.contact-item.has-unread {
    background: rgba(255, 77, 79, 0.06);
}
.contact-item.has-unread .contact-name {
    font-weight: 600;
}

/* 右侧聊天面板 */
.right-panel { flex: 1; display: flex; flex-direction: column; background: #f5f7fa; }

.chat-placeholder {
    flex: 1; display: flex; align-items: center; justify-content: center;
}
.placeholder-content { text-align: center; color: var(--text-light); }
.placeholder-icon { font-size: 64px; margin-bottom: 15px; opacity: 0.5; }
.placeholder-content h2 { font-size: 20px; margin-bottom: 8px; color: var(--text-secondary); }

.chat-area { flex: 1; display: flex; flex-direction: column; min-height: 0; overflow: hidden; }

.chat-header {
    height: 56px; display: flex; align-items: center; justify-content: space-between;
    padding: 0 15px; background: #fff; border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.chat-header-info { display: flex; align-items: center; gap: 10px; }
.chat-avatar { width: 36px; height: 36px; border-radius: 4px; object-fit: cover; }
.chat-header-text { display: flex; flex-direction: column; align-items: flex-start; }
.chat-header-name { font-size: 15px; font-weight: 500; }
.chat-header-status { font-size: 12px; color: var(--text-light); }
.chat-header-actions { display: flex; gap: 8px; }

.chat-messages {
    flex: 1; overflow-y: auto; padding: 15px;
    display: flex; flex-direction: column; gap: 15px;
    min-height: 0;
}
.messages-loading { text-align: center; color: var(--text-light); padding: 40px; }

.message-row { display: flex; gap: 10px; max-width: 75%; }
.message-row.mine { align-self: flex-end; flex-direction: row-reverse; }
.message-row.system { align-self: center; max-width: 90%; }

/* @提及高亮 */
.message-row.mentioned .message-bubble {
    background: linear-gradient(135deg, #fff7e6, #fffbe6) !important;
    border-color: #faad14 !important;
    box-shadow: 0 0 0 2px rgba(250, 173, 20, 0.2);
}
.message-row.mentioned .message-sender {
    color: #d48806;
    font-weight: 600;
}
/* 暗色/私密模式下@高亮适配 */
.secret-chat-mode .message-row.mentioned .message-bubble {
    background: linear-gradient(135deg, rgba(250, 173, 20, 0.18), rgba(250, 200, 20, 0.12)) !important;
    border-color: rgba(250, 173, 20, 0.5) !important;
    color: #ffe8a0 !important;
}

.message-avatar { width: 36px; height: 36px; border-radius: 4px; object-fit: cover; flex-shrink: 0; }

/* @提及 - 群聊中可点击头像 */
.mention-avatar {
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.mention-avatar:hover {
    transform: scale(1.2);
    box-shadow: 0 2px 8px rgba(24, 144, 255, 0.4);
    border: 2px solid #1890ff;
    border-radius: 50%;
}
.mention-avatar:active {
    transform: scale(1.05);
}

/* @输入自动补全下拉 */
.mention-dropdown {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    max-height: 200px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px 8px 0 0;
    box-shadow: 0 -4px 16px rgba(0,0,0,0.1);
    z-index: 100;
    margin-bottom: 4px;
}
.mention-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    cursor: pointer;
    transition: background 0.1s;
}
.mention-item:hover,
.mention-item.active {
    background: #e6f7ff;
}
.mention-item:first-child { border-radius: 8px 8px 0 0; }
.mention-avatar {
    width: 28px;
    height: 28px;
    border-radius: 4px;
    object-fit: cover;
    flex-shrink: 0;
}
.mention-name {
    font-size: 13px;
    color: #333;
    font-weight: 500;
}
.mention-oicq {
    font-size: 11px;
    color: #999;
    margin-left: auto;
}

.message-body { display: flex; flex-direction: column; gap: 2px; }
.message-sender { font-size: 11px; color: var(--text-light); padding: 0 4px; }
.message-row.mine .message-sender { text-align: right; }

.message-bubble {
    padding: 10px 14px; border-radius: 8px; font-size: 14px; line-height: 1.5;
    word-break: break-word; position: relative;
}
.message-row:not(.mine) .message-bubble {
    background: #fff; border: 1px solid #e8e8e8;
}
.message-row.mine .message-bubble {
    background: #d2f0e0; border: 1px solid #b7e4cc;
}
.message-row.system .message-bubble {
    background: transparent; border: none; color: var(--text-light);
    font-size: 12px; text-align: center; padding: 4px 10px;
}

.message-time { font-size: 11px; color: var(--text-light); padding: 0 4px; }
.message-row.mine .message-time { text-align: right; }
.message-recalled { font-style: italic; color: var(--text-light); }

.chat-input-area {
    background: #fff; border-top: 1px solid var(--border); flex-shrink: 0;
}
.chat-input-toolbar {
    display: flex; align-items: center; padding: 5px 10px; border-bottom: 1px solid #f0f0f0;
}
.toolbar-btn {
    background: none; border: none; font-size: 18px; cursor: pointer;
    padding: 4px 8px; border-radius: 4px; transition: var(--transition);
}
.toolbar-btn:hover { background: #f0f0f0; }
.toolbar-btn.voice-active { background: #e74c3c; color: #fff; transform: scale(1.1); }
.toolbar-btn.voice-active:hover { background: #e74c3c; }

/* ========== 表情选择器 ========== */
.emoji-picker {
    position: absolute; bottom: 100%; left: 0;
    background: #fff; border: 1px solid #e0e0e0; border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    padding: 10px; z-index: 100; width: 340px;
    margin-bottom: 6px; max-height: 240px; overflow-y: auto;
}
.emoji-item {
    display: inline-block; font-size: 24px; cursor: pointer;
    padding: 4px; border-radius: 4px; text-align: center;
    width: 30px; height: 30px; line-height: 30px;
    transition: background 0.15s;
}
.emoji-item:hover { background: #f0f0f0; transform: scale(1.2); }

.chat-input-box { padding: 8px 12px; }
.chat-input-box textarea {
    width: 100%; border: none; outline: none; resize: none;
    font-size: 14px; font-family: inherit; line-height: 1.6;
}
.chat-input-footer {
    display: flex; align-items: center; justify-content: flex-end;
    padding: 5px 12px 10px; gap: 10px;
}
.char-count { font-size: 12px; color: var(--text-light); }

/* ========== 右侧信息面板（嵌入分栏） ========== */
.chat-area { flex-direction: row !important; }
.chat-main { flex: 1; display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.chat-info-panel {
    width: 260px; flex-shrink: 0;
    background: #fff; border-left: 1px solid var(--border);
    display: flex; flex-direction: column; overflow-y: auto;
    transition: width 0.25s ease, opacity 0.2s ease;
    position: relative;
}
.chat-info-panel.collapsed { width: 0; min-width: 0; overflow: hidden; border-left: none; opacity: 0; }
.info-panel-collapse {
    position: absolute; top: 50%; left: -18px; transform: translateY(-50%);
    width: 18px; height: 48px; background: #e8e8e8; border-radius: 4px 0 0 4px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; font-size: 10px; color: #999; z-index: 10;
    transition: background 0.15s;
}
.info-panel-collapse:hover { background: #d0d0d0; color: #333; }
.chat-info-panel.collapsed .info-panel-collapse { left: -18px; border-radius: 4px; }
.chat-info-panel.collapsed .info-panel-collapse { content: '▶'; }
.info-panel-header {
    padding: 20px 16px 12px; text-align: center;
    border-bottom: 1px solid #f0f0f0;
    background: linear-gradient(180deg, #f8f9ff 0%, #fff 100%);
}
.info-panel-avatar { width: 56px; height: 56px; border-radius: 50%; border: 3px solid #e8f0fe; object-fit: cover; }
.info-panel-name { font-size: 15px; font-weight: 600; margin: 8px 0 2px; color: #333; }
.info-panel-oicq { font-size: 11px; color: #999; }
.info-panel-status { font-size: 12px; margin-top: 4px; }
.info-panel-status.online { color: #27ae60; }
.info-panel-status.offline { color: #999; }
.info-panel-section { padding: 12px 16px; border-bottom: 1px solid #f5f5f5; }
.info-panel-section h5 { font-size: 11px; color: #999; margin: 0 0 8px; text-transform: uppercase; letter-spacing: 0.5px; }
.info-panel-section .info-row { display: flex; justify-content: space-between; align-items: center; padding: 3px 0; font-size: 12px; }
.info-panel-section .info-row .info-label { color: #888; }
.info-panel-section .info-row .info-value { color: #333; font-weight: 500; }
.info-panel-signature { font-size: 12px; color: #666; line-height: 1.5; word-break: break-all; }
.info-panel-members { display: flex; flex-wrap: wrap; gap: 5px; }
.info-panel-member { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; border: 2px solid #f0f0f0; cursor: pointer; position: relative; }
.info-panel-member:hover { border-color: #3498db; }
.info-panel-member .mem-tip { display: none; position: absolute; bottom: -20px; left: 50%; transform: translateX(-50%); background: #333; color: #fff; font-size: 10px; padding: 2px 6px; border-radius: 3px; white-space: nowrap; z-index: 10; }
.info-panel-member:hover .mem-tip { display: block; }
.info-panel-actions { padding: 12px 16px; }
.info-panel-actions .action-btn { display: block; width: 100%; padding: 7px 0; margin-bottom: 5px; border-radius: 6px; border: 1px solid #e0e0e0; background: #fff; color: #333; font-size: 12px; cursor: pointer; transition: all 0.15s; text-align: center; }
.info-panel-actions .action-btn:hover { background: #f5f7fa; border-color: #3498db; color: #3498db; }
.info-panel-actions .action-btn.danger:hover { border-color: #e74c3c; color: #e74c3c; background: #fef2f2; }
@media (max-width: 768px) {
    .chat-info-panel { position: absolute; right: 0; top: 0; bottom: 0; width: 280px; z-index: 60; display: none; }
    .chat-info-panel.open { display: flex; }
}
[data-theme="dark"] .chat-info-panel { background: #1a1a30; border-color: #2a2a45; }
[data-theme="dark"] .info-panel-collapse { background: #2a2a45; color: #888; }
[data-theme="dark"] .info-panel-collapse:hover { background: #3a3a55; }
[data-theme="dark"] .info-panel-header { background: linear-gradient(180deg, #1e1e38, #1a1a30); border-color: #2a2a45; }
[data-theme="dark"] .info-panel-section { border-color: #1e1e36; }
[data-theme="dark"] .info-panel-section h5 { color: #666; }
[data-theme="dark"] .info-panel-name { color: #e0e0e0; }
[data-theme="dark"] .info-panel-signature { color: #aaa; }
[data-theme="dark"] .info-panel-actions .action-btn { background: #1e1e32; color: #ccc; border-color: #2a2a45; }
[data-theme="dark"] .info-panel-actions .action-btn:hover { background: #2a2a45; }

/* ========== 图片预览栏（输入框内部） ========== */
.image-preview-bar {
    padding: 6px 8px 2px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.image-preview-inner {
    position: relative;
    display: inline-block;
}
.image-preview-thumb {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #ddd;
    display: block;
}
.image-preview-close {
    position: absolute;
    top: -6px;
    right: -6px;
    background: rgba(0,0,0,0.55);
    border: none;
    color: #fff;
    font-size: 12px;
    cursor: pointer;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}
.image-preview-close:hover {
    background: #ff4d4f;
}

/* ========== 图片消息 ========== */
.message-image-bubble {
    padding: 4px !important;
    background: transparent !important;
    border: none !important;
    cursor: pointer;
    max-width: 240px;
    overflow: hidden;
    border-radius: 8px;
}
.chat-image-thumb {
    width: 100%;
    max-width: 240px;
    max-height: 240px;
    object-fit: cover;
    border-radius: 8px;
    display: block;
    transition: transform 0.15s;
}
.chat-image-thumb:hover {
    transform: scale(1.02);
}

/* ========== 图片灯箱 ========== */
.image-lightbox {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.85);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.image-lightbox img {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    cursor: default;
    border-radius: 4px;
    box-shadow: 0 4px 30px rgba(0,0,0,0.5);
}
.lightbox-close {
    position: absolute;
    top: 20px;
    right: 30px;
    background: rgba(255,255,255,0.15);
    border: none;
    color: #fff;
    font-size: 28px;
    cursor: pointer;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}
/* ========== 录音浮层 ========== */
.voice-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    z-index: 9998; display: flex; align-items: center; justify-content: center;
}
.voice-overlay-bg {
    position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.75);
}
.voice-overlay-content {
    position: relative; z-index: 1; text-align: center; color: #fff;
}
.voice-cancel-zone {
    font-size: 13px; color: rgba(255,255,255,0.5);
    padding: 8px 20px; margin-bottom: 30px;
    border: 2px dashed rgba(255,255,255,0.2); border-radius: 8px;
    transition: all 0.2s;
}
.voice-overlay.cancelling .voice-cancel-zone {
    color: #ff4d4f; border-color: #ff4d4f; background: rgba(255,77,79,0.15);
}
.voice-wave { display: flex; align-items: flex-end; justify-content: center; gap: 4px; height: 50px; margin: 20px 0; }
.voice-wave span {
    width: 6px; border-radius: 3px; background: #1890ff;
    transition: height 0.2s;
}
.voice-wave span.animating {
    animation: waveAnim 0.6s ease-in-out infinite alternate;
}
.voice-wave span:nth-child(1) { height: 12px; animation-delay: 0s; }
.voice-wave span:nth-child(2) { height: 24px; animation-delay: 0.1s; }
.voice-wave span:nth-child(3) { height: 36px; animation-delay: 0.2s; }
.voice-wave span:nth-child(4) { height: 48px; animation-delay: 0.3s; }
.voice-wave span:nth-child(5) { height: 36px; animation-delay: 0.2s; }
.voice-wave span:nth-child(6) { height: 24px; animation-delay: 0.1s; }
.voice-wave span:nth-child(7) { height: 12px; animation-delay: 0s; }
@keyframes waveAnim {
    0% { height: 10px; }
    100% { height: 50px; }
}
.voice-timer { font-size: 32px; font-weight: 300; letter-spacing: 2px; margin: 10px 0; }
.voice-hint { font-size: 12px; color: rgba(255,255,255,0.5); margin-top: 15px; }
.voice-overlay.cancelling .voice-hint { color: #ff4d4f; }
.voice-btn-hold {
    width: 80px; height: 80px; border-radius: 50%;
    background: rgba(255,255,255,0.15); margin: 20px auto 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; color: rgba(255,255,255,0.6);
}

/* ========== 语音消息气泡 ========== */
.message-voice-bubble {
    display: flex; align-items: center; gap: 8px;
    padding: 10px 14px !important; cursor: pointer;
    min-width: 130px; user-select: none;
}
.message-voice-bubble.playing { background: #e6f7ff !important; }
.voice-icon { font-size: 20px; }
.voice-wave-bar {
    font-size: 18px; letter-spacing: 2px; color: #1890ff;
    transition: color 0.2s;
}
.message-voice-bubble.playing .voice-wave-bar { color: #ff4d4f; }
.voice-dur { font-size: 12px; color: #999; margin-left: auto; white-space: nowrap; }

.lightbox-close:hover {
    background: rgba(255,255,255,0.3);
}

/* ========== 聊天搜索栏 ========== */
.chat-search-bar {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 14px; background: #fff; border-bottom: 1px solid var(--border);
}
.chat-search-bar input {
    flex: 1; padding: 6px 10px; border: 1px solid #3498db; border-radius: 4px;
    font-size: 13px; outline: none; box-shadow: 0 0 0 2px rgba(52,152,219,0.15);
}
.chat-search-count { font-size: 11px; color: #999; white-space: nowrap; }
.chat-search-close { background: none; border: none; cursor: pointer; font-size: 14px; color: #999; }
.search-highlight { background: #fff3a8 !important; border-radius: 2px; }
.search-active { background: #ffd700 !important; border-radius: 2px; }
[data-theme="dark"] .chat-search-bar { background: #1a1a30; border-color: #2a2a45; }
[data-theme="dark"] .chat-search-bar input { background: #1e1e32; color: #e0e0e0; border-color: #3498db; }
[data-theme="dark"] .mobile-dropdown { background: #1e1e32; }
[data-theme="dark"] .mobile-dropdown-item { color: #e0e0e0; border-color: #2a2a45; }
[data-theme="dark"] .mobile-dropdown-item:hover { background: #2a2a45; }
[data-theme="dark"] .mobile-dropdown-item.danger { color: #ff6b6b; }

/* ========== 弹窗（美化版） ========== */
.modal { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 1000; }
.modal.active { display: flex; align-items: center; justify-content: center; animation: modalFadeIn 0.2s ease; }
@keyframes modalFadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-overlay {
    position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.45); backdrop-filter: blur(2px);
}
.modal-box {
    position: relative; background: #fff; border-radius: 12px; width: 420px;
    max-height: 85vh; overflow-y: auto; box-shadow: 0 20px 50px rgba(0,0,0,0.25);
    z-index: 1; animation: modalSlideUp 0.25s ease;
}
@keyframes modalSlideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 18px 24px; border-bottom: 1px solid #f0f0f0;
    background: linear-gradient(180deg, #fafbff 0%, #fff 100%);
}
.modal-header h3 { font-size: 16px; font-weight: 600; color: #333; }
.modal-close {
    background: #f5f5f5; border: none; font-size: 14px; cursor: pointer;
    color: #999; padding: 6px 10px; border-radius: 6px; transition: all 0.15s;
}
.modal-close:hover { background: #fee; color: #e74c3c; }
.modal-body { padding: 24px; }
.modal-body label { display: block; margin-bottom: 5px; font-size: 13px; color: #666; font-weight: 500; }
.modal-body input, .modal-body select, .modal-body textarea {
    width: 100%; padding: 10px 14px; border: 1.5px solid #e0e0e0; border-radius: 8px;
    font-size: 14px; margin-bottom: 14px; outline: none; font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.modal-body input:focus, .modal-body select:focus, .modal-body textarea:focus {
    border-color: #667eea; box-shadow: 0 0 0 3px rgba(102,126,234,0.1);
}
.modal-body textarea { resize: vertical; min-height: 60px; }
[data-theme="dark"] .modal-box { background: #1e1e32; }
[data-theme="dark"] .modal-header { background: linear-gradient(180deg, #1e1e3a, #1e1e32); border-color: #2a2a45; }
[data-theme="dark"] .modal-header h3 { color: #e0e0e0; }
[data-theme="dark"] .modal-close { background: #2a2a45; color: #888; }
[data-theme="dark"] .modal-body label { color: #aaa; }
[data-theme="dark"] .modal-body input, [data-theme="dark"] .modal-body select, [data-theme="dark"] .modal-body textarea {
    background: #1a1a30; color: #e0e0e0; border-color: #2a2a45;
}
[data-theme="dark"] .modal-body input:focus, [data-theme="dark"] .modal-body select:focus { border-color: #667eea; }

/* 个人资料弹窗 - 紧凑型（旧样式已移除，使用inline样式） */

/* 头像fallback - img加载失败时CSS背景显示人物剪影 */
.avatar, .chat-avatar, .avatar-small, .message-avatar, .avatar-sm {
    background: #e8e8e8 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Ccircle cx='50' cy='35' r='20' fill='%23c0c0c0'/%3E%3Cellipse cx='50' cy='80' rx='35' ry='25' fill='%23c0c0c0'/%3E%3C/svg%3E") center/cover no-repeat;
}

/* ========== 创建群 - 成员选择 ========== */
.member-search-box { position: relative; }
.member-search-box input { width: 100%; box-sizing: border-box; }

.search-dropdown {
    position: absolute; top: 100%; left: 0; right: 0;
    max-height: 200px; overflow-y: auto;
    background: #fff; border: 1px solid var(--border);
    border-radius: 4px; z-index: 10; box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.search-item {
    display: flex; align-items: center; padding: 8px 12px; cursor: pointer;
    border-bottom: 1px solid #f0f0f0; gap: 10px;
}
.search-item:hover { background: #f5f5f5; }
.search-item:last-child { border-bottom: none; }
.avatar-sm { width: 32px; height: 32px; border-radius: 4px; object-fit: cover; flex-shrink: 0; }
.search-item-info { flex: 1; min-width: 0; }
.search-item-name { font-size: 13px; font-weight: 500; color: var(--text); }
.search-item-detail { font-size: 11px; color: var(--text-light); }

.create-group-avatar-section img {
    display: block; margin: 0 auto; border: 2px solid #eee;
    transition: border-color 0.2s;
}
.create-group-avatar-section img:hover {
    border-color: var(--primary);
}

.selected-members { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.member-tag {
    display: inline-flex; align-items: center; gap: 4px;
    background: #e8f0fe; color: #1a73e8;
    padding: 3px 8px; border-radius: 12px; font-size: 12px;
}
.member-tag-remove {
    background: none; border: none; cursor: pointer;
    color: #1a73e8; font-size: 12px; padding: 0 2px;
    line-height: 1;
}
.member-tag-remove:hover { color: #d93025; }

/* ========== Toast ========== */
.toast {
    position: fixed; top: 20px; left: 50%; transform: translateX(-50%);
    padding: 12px 24px; border-radius: 6px; color: #fff; font-size: 14px;
    z-index: 9999; box-shadow: 0 4px 12px rgba(0,0,0,0.15); max-width: 400px; text-align: center;
}
.toast.success { background: var(--primary); }
.toast.error { background: var(--danger); }
.toast.info { background: var(--info); }
.toast.warning { background: var(--warning); }

/* ========== 搜索下拉 ========== */
.search-result-item {
    display: flex; align-items: center; padding: 10px 12px; cursor: pointer;
    gap: 10px; border-bottom: 1px solid #f5f5f5; transition: var(--transition);
}
.search-result-item:hover { background: #f0f7ff; }
.search-result-item img { width: 36px; height: 36px; border-radius: 4px; object-fit: cover; }

/* ========== 群信息弹窗 ========== */
.group-info-section { margin-bottom: 10px; }
.group-info-section h4 { font-size: 13px; margin-bottom: 6px; padding-bottom: 4px; border-bottom: 1px solid #f5f5f5; }
.group-member-item {
    display: flex; align-items: center; padding: 4px 0; gap: 6px;
    font-size: 12px; border-bottom: 1px solid #fafafa;
}
.group-member-item img { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; }
.member-role-badge {
    font-size: 10px; padding: 1px 5px; border-radius: 6px;
    background: #f0f0f0; color: var(--text-light);
}
.member-role-badge.owner { background: #fff3cd; color: #856404; }
.member-role-badge.admin { background: #d4edda; color: #155724; }

/* ========== 私密聊天模式 ========== */
.secret-chat-mode .chat-messages {
    background: #fff0f5;
}
.secret-chat-mode .message-bubble {
    background: #fff !important;
    border: 1px solid #f0c0d0 !important;
    color: #333 !important;
}
.secret-chat-mode .message-row.mine .message-bubble {
    background: #ffe0ea !important;
    border-color: #f5b0c5 !important;
    color: #444 !important;
}
.secret-chat-mode .chat-header {
    background: linear-gradient(135deg, #f2a5b9, #e8879e);
    color: #fff;
    border-color: #d9728b;
}
.secret-chat-mode .chat-header .btn,
.secret-chat-mode .chat-header .btn-outline {
    color: #fff;
    border-color: rgba(255,255,255,0.5);
}
.secret-chat-mode .chat-input-area {
    background: #fef0f4;
    border-color: #f0c0d0;
}
.secret-chat-mode .chat-input-box textarea {
    background: #fff;
    color: #333;
    border-color: #f0c0d0;
}
.secret-chat-mode .message-time {
    color: #b0808a;
}
.secret-chat-mode .message-sender {
    color: #c06078;
}

/* 私密消息锁定状态卡片 */
.secret-locked-bubble {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: linear-gradient(135deg, #fdf0f5, #fde8ef);
    border: 1px dashed rgba(220, 120, 150, 0.3);
    border-radius: 10px;
    max-width: 220px;
    min-width: 170px;
    text-align: center;
    transition: all 0.3s ease;
}
.secret-locked-body {
    display: flex;
    align-items: center;
    gap: 6px;
}
.secret-locked-icon-sm {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(220, 120, 150, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.secret-locked-label {
    font-size: 12px;
    color: #b07080;
    line-height: 1.4;
}
.secret-locked-action {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 14px;
    background: linear-gradient(135deg, #e8879e, #d06080);
    color: #fff;
    border-radius: 16px;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    transition: all 0.25s ease;
    box-shadow: 0 2px 6px rgba(220, 120, 150, 0.3);
}
.secret-locked-action:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(220, 120, 150, 0.45);
}
.secret-locked-action:active {
    transform: translateY(0);
}

/* 私密模式下的锁定卡片适配 */
.secret-chat-mode .secret-locked-bubble {
    background: linear-gradient(135deg, rgba(230, 140, 160, 0.1), rgba(210, 100, 130, 0.1));
    border-color: rgba(210, 110, 140, 0.22);
}
.secret-chat-mode .secret-locked-label {
    color: #a06878;
}

/* 私密模式确认弹窗 */
.secret-modal-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(230, 120, 150, 0.12), rgba(200, 90, 120, 0.12));
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 8px;
    border: 2px solid rgba(220, 130, 155, 0.2);
}
.secret-features {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px 16px;
    background: #fef4f7;
    border-radius: 8px;
    text-align: left;
}
.secret-feature-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #555;
}
.secret-feature-item .feature-icon {
    font-size: 15px;
    width: 22px;
    text-align: center;
    flex-shrink: 0;
}
.watermark-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    pointer-events: none; z-index: 9998; opacity: 0.03;
    font-size: 14px; color: #000; overflow: hidden;
    user-select: none; -webkit-user-select: none;
}

/* 滚动条 */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #c0c0c0; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #a0a0a0; }

/* ========== 响应式 ========== */
.mobile-back-btn { display: none; }
.mobile-nav { display: none; }
.mobile-menu-btn { display: none; }
.mobile-dropdown { display: none; }
.mobile-tab-bar { display: none; }

/* ===== 平板 (≤1024px) ===== */
@media (max-width: 1024px) {
    .left-panel { width: 240px; min-width: 240px; }
    .contact-item { padding: 9px 10px; }
    .contact-item .avatar { width: 36px; height: 36px; }
    .contact-item .contact-name { font-size: 13px; }
    .chat-header { height: 50px; padding: 0 12px; }
    .chat-messages { padding: 12px; gap: 12px; }
    .message-row { max-width: 82%; }
    .modal-box { width: 90% !important; max-width: 480px; }
    .emoji-picker { width: 280px; }
    .search-bar input { font-size: 14px; }
}

/* ===== 手机端 (≤768px) - 单列模式 ===== */
@media (max-width: 768px) {
    html, body { height: 100%; overflow: hidden; -webkit-tap-highlight-color: transparent; }
    
    .main-container { height: 100%; }
    .main-body { position: relative; flex: 1; min-height: 0; }
    
    /* 左侧面板 - 全屏覆盖 */
    .left-panel {
        width: 100%; min-width: auto; position: absolute;
        top: 0; left: 0; right: 0; bottom: 0; z-index: 20;
        transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
        border-right: none; box-shadow: 2px 0 20px rgba(0,0,0,0.1);
    }
    .left-panel.hidden-mobile {
        transform: translateX(-105%);
    }
    .right-panel {
        width: 100%; min-width: auto;
    }

    /* 标题栏 - 移动端精简 */
    .title-bar { 
        padding: 0 10px; height: 48px; 
        background: linear-gradient(135deg, #667eea, #764ba2); color: #fff;
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    }
    .title-bar .title-bar-left { gap: 6px; }
    .title-text { font-size: 15px; font-weight: 600; }
    .title-logo { width: 24px; height: 24px; }
    .title-bar-right { gap: 6px; }
    .title-bar-right .btn { padding: 4px 8px; font-size: 10px; }
    .title-bar-right .user-info-bar { display: flex !important; gap: 4px; }
    .title-bar-right .btn-outline { background: rgba(255,255,255,0.15); border-color: rgba(255,255,255,0.3); color: #fff; }
    .title-bar-right .btn-outline:hover { background: rgba(255,255,255,0.25); }
    .title-bar-right .btn-danger { background: rgba(231,76,60,0.3); border: none; padding: 4px 6px !important; font-size: 10px !important; }
    .theme-toggle { display: flex !important; width: 26px; height: 26px; font-size: 14px; }
    .avatar-small { width: 24px; height: 24px; }
    .oicq-badge { display: none !important; }
    .user-info-bar span { font-size: 11px; max-width: 60px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; }
    
    /* 移动端深色模式标题栏 - 深紫色渐变 */
    [data-theme="dark"] .title-bar {
        background: linear-gradient(135deg, #3d3057, #2d1f4a);
    }
    /* 移动端深色模式标题栏按钮 - 保持半透明效果 */
    [data-theme="dark"] .title-bar-right .btn-outline {
        background: rgba(255,255,255,0.12);
        border-color: rgba(255,255,255,0.25);
        color: #ddd;
    }
    [data-theme="dark"] .title-bar-right .btn-outline:hover {
        background: rgba(255,255,255,0.22);
    }
    [data-theme="dark"] .title-bar-right .btn-danger {
        background: rgba(231,76,60,0.4);
        border: none;
        color: #fdd;
    }
    [data-theme="dark"] .theme-toggle {
        background: rgba(255,255,255,0.12);
    }
    
    /* 移动端菜单按钮 */
    .mobile-menu-btn {
        display: flex; align-items: center; justify-content: center;
        width: 32px; height: 32px; border: none; background: rgba(255,255,255,0.15);
        color: #fff; font-size: 18px; border-radius: 6px; cursor: pointer;
        margin-right: 2px;
    }
    .mobile-menu-btn:hover { background: rgba(255,255,255,0.25); }
    
    /* 移动端下拉菜单 */
    .mobile-dropdown {
        display: none; position: fixed; top: 48px; left: 0; right: 0;
        background: #fff; z-index: 100; border-radius: 0 0 12px 12px;
        box-shadow: 0 8px 24px rgba(0,0,0,0.16); overflow: hidden;
        animation: dropdownSlide 0.2s ease;
    }
    .mobile-dropdown.active { display: block; }
    @keyframes dropdownSlide { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
    .mobile-dropdown-item {
        padding: 14px 20px; border-bottom: 1px solid #f5f5f5;
        font-size: 14px; color: #333; cursor: pointer; transition: background 0.15s;
    }
    .mobile-dropdown-item:hover { background: #f5f7fa; }
    .mobile-dropdown-item:last-child { border-bottom: none; }
    .mobile-dropdown-item.danger { color: #e74c3c; }
    
    /* 左侧面板内的tab栏 - 移动端隐藏 */
    .left-panel .tab-bar { display: none !important; }
    /* 移动端确保tab-content正确显示 */
    .left-panel .tab-content.active { display: flex !important; flex-direction: column; }
    
    /* 移动端固定Tab栏 - 标题栏下方，放大醒目 */
    .mobile-tab-bar {
        display: flex !important; background: #fff;
        border-bottom: 2px solid #e8e8e8; z-index: 25;
    }
    .mobile-tab-item {
        flex: 1; text-align: center; padding: 14px 0;
        font-size: 16px; color: #666; cursor: pointer;
        border-bottom: 3px solid transparent; transition: all 0.2s;
        position: relative;
    }
    .mobile-tab-item.active { 
        color: #667eea; border-bottom-color: #667eea; 
        font-weight: 600; background: linear-gradient(180deg, #f8f9ff 0%, #fff 100%);
    }
    .mobile-tab-badge {
        display: inline-block; position: relative; top: -10px;
        background: #e74c3c; color: #fff; font-size: 10px;
        padding: 1px 6px; border-radius: 10px; min-width: 18px;
        text-align: center; margin-left: 2px; line-height: 16px;
        font-weight: 600; animation: badgePopIn 0.3s ease;
    }
    .main-body { margin-top: 0; }
    .left-panel { top: 0 !important; }
    
    /* 隐藏底部导航 */
    .mobile-nav { display: none !important; }
    .main-body { padding-bottom: 0 !important; }
    
    /* 列表头部 */
    .list-header { padding: 10px 12px; display: flex; align-items: center; justify-content: space-between; }
    
    /* 联系人列表 */
    .contact-item { padding: 10px 12px; }
    .contact-item .avatar { width: 42px; height: 42px; border-radius: 6px; }
    .contact-item .contact-name { font-size: 15px; }
    .contact-item .contact-detail { font-size: 12px; margin-top: 2px; }
    
    /* 聊天区 */
    .chat-header { height: 50px; padding: 0 10px; }
    .chat-header-name { font-size: 15px; }
    .chat-avatar { width: 34px; height: 34px; }
    .chat-messages { padding: 12px 10px; gap: 12px; }
    .chat-input-box { padding: 6px 8px; }
    .chat-input-box textarea { font-size: 16px; padding: 8px 10px; border-radius: 8px; background: #f5f5f5; }
    .chat-input-footer { padding: 4px 10px 10px; }
    .char-count { font-size: 11px; }
    .chat-input-area { padding-bottom: env(safe-area-inset-bottom, 8px); }
    
    /* 消息气泡 */
    .message-row { max-width: 88%; }
    .message-bubble { font-size: 15px; padding: 10px 13px; border-radius: 10px; }
    .message-avatar { width: 32px; height: 32px; }
    .message-sender { font-size: 11px; }
    .message-time { font-size: 10px; }
    /* 移动端已发送/已读状态 - 放大字体 */
    .read-status { font-size: 11px !important; margin-left: 6px; }
    .read-status .check { font-size: 13px; }
    
    /* 工具按钮 - 放大触控区域 */
    .chat-input-toolbar { padding: 8px 10px; position: relative; }
    .toolbar-btn { font-size: 20px; padding: 6px 10px; min-width: 36px; min-height: 36px; }
    .chat-header-actions { flex-wrap: wrap; gap: 4px; }
    .chat-header-actions .btn { font-size: 10px; padding: 3px 6px; border-radius: 4px; white-space: nowrap; }
    
    /* 搜索 */
    .search-bar { padding: 8px 10px; }
    .search-bar input { padding: 10px 12px; border-radius: 8px; font-size: 15px; }
    .search-results { top: 42px; left: 8px; right: 8px; border-radius: 8px; }
    
    /* 弹窗 */
    .modal-box { width: 92% !important; max-width: none; border-radius: 12px; }
    .modal-body { padding: 16px; }
    .auth-box { width: 92%; padding: 25px 18px; border-radius: 12px; }
    .form-group input, .form-group textarea { font-size: 16px; padding: 10px 12px; border-radius: 8px; }
    
    /* 表情 - 移动端在工具栏上方弹出 */
    .chat-input-toolbar > div {
        position: static !important; /* 解除内层div的限制，让emoji-picker相对toolbar定位 */
    }
    .emoji-picker { 
        width: auto; left: 0 !important; right: 0 !important;
        bottom: 100% !important; position: absolute !important;
        border-radius: 12px 12px 0 0; padding: 8px 6px 4px;
        max-height: 45vh; margin: 0 0 4px 0 !important; z-index: 200;
    }
    .emoji-tabs { margin-bottom: 4px; font-size: 12px; display: flex; }
    .emoji-tab { padding: 6px 4px; font-size: 12px; flex: 1; }
    .emoji-panel { max-height: none; }
    .emoji-item { font-size: 24px; width: 30px; height: 30px; line-height: 30px; padding: 3px; }
    
    /* 表单全局 */
    input, textarea, select { font-size: 16px !important; }
    .btn { padding: 10px 20px; font-size: 15px; border-radius: 8px; }
    .btn-xs { padding: 5px 10px; font-size: 12px !important; border-radius: 4px; }
    
    /* 群信息 */
    .group-member-item { padding: 8px 10px; }
    .group-member-item img { width: 34px; height: 34px; border-radius: 6px; }
}

/* ===== 小屏 (≤480px) ===== */
@media (max-width: 480px) {
    .contact-item { padding: 8px 10px; }
    .contact-item .avatar { width: 38px; height: 38px; }
    .contact-item .contact-name { font-size: 14px; }
    .message-row { max-width: 92%; }
    .message-bubble { font-size: 14px; padding: 8px 11px; }
    .message-avatar { width: 28px; height: 28px; }
    .chat-header-name { font-size: 14px; }
    .chat-avatar { width: 30px; height: 30px; }
    .tab-item { font-size: 11px; padding: 8px 0; }
    .tab-icon { font-size: 15px; }
    .emoji-picker { max-height: 60vh; padding: 6px 4px 3px; }
    .emoji-item { font-size: 20px; width: 24px; height: 24px; line-height: 24px; padding: 2px; }
    .emoji-tab { font-size: 10px; padding: 5px 2px; }
    .chat-header-actions .btn { font-size: 10px; padding: 3px 5px; }
}

/* ============================================
   深色模式
   ============================================ */
[data-theme="dark"] {
    --bg: #1a1a2e;
    --bg-white: #1e1e32;
    --border: #2a2a45;
    --text: #e0e0e0;
    --text-secondary: #a0a0a0;
    --text-light: #777777;
}
[data-theme="dark"] body { background: #0f0f1a; color: var(--text); }
[data-theme="dark"] .main-container { background: #0f0f1a; }
[data-theme="dark"] .left-panel { background: #12122a; border-right-color: #1e1e3a; }
[data-theme="dark"] .right-panel { background: #16162e; }
[data-theme="dark"] .chat-header { background: #1a1a30; border-bottom-color: #2a2a45; }
[data-theme="dark"] .chat-input-area { background: #1a1a30; border-top-color: #2a2a45; }
[data-theme="dark"] .chat-input-toolbar { border-bottom-color: #1e1e36; }
[data-theme="dark"] .chat-input-box textarea { background: #1a1a30; color: #e0e0e0; }
[data-theme="dark"] .toolbar-btn:hover { background: #2a2a45; }
[data-theme="dark"] .contact-item { border-bottom-color: #1e1e36; }
[data-theme="dark"] .contact-item:hover { background: #1e1e38; }
[data-theme="dark"] .contact-item.active { background: #252545; }
[data-theme="dark"] .contact-item.has-unread { background: rgba(255,77,79,0.08); }
[data-theme="dark"] .search-bar input { background: #1e1e32; border-color: #2a2a45; color: #e0e0e0; }
[data-theme="dark"] .search-results { background: #1e1e32; }
[data-theme="dark"] .search-result-item { border-bottom-color: #1e1e36; }
[data-theme="dark"] .search-result-item:hover { background: #252545; }
[data-theme="dark"] .tab-bar { border-bottom-color: #1e1e3a; }
[data-theme="dark"] .tab-item:hover { background: rgba(255,255,255,0.05); }
[data-theme="dark"] .mobile-tab-bar { background: #15152a; border-bottom-color: #1e1e3a; }
[data-theme="dark"] .mobile-tab-item { color: #888; }
[data-theme="dark"] .mobile-tab-item.active { color: #8599ff; border-bottom-color: #667eea; background: linear-gradient(180deg, #1a1a35 0%, #15152a 100%); }
[data-theme="dark"] .list-header { background: #15152a; border-bottom-color: #1e1e3a; }
[data-theme="dark"] .message-row:not(.mine) .message-bubble { background: #1e1e36; border-color: #2a2a45; color: #e0e0e0; }
[data-theme="dark"] .message-row.mine .message-bubble { background: #0d3320; border-color: #1a4a30; color: #c0e8d0; }
[data-theme="dark"] .message-row.system .message-bubble { color: #556; }
[data-theme="dark"] .message-row.mentioned .message-bubble { background: linear-gradient(135deg, #3d2e0a, #332a08) !important; border-color: #8a6d14 !important; }
[data-theme="dark"] .message-row.mentioned .message-sender { color: #e8b730; }
[data-theme="dark"] .message-time { color: #556; }
[data-theme="dark"] .read-status.sent { color: #889; }
[data-theme="dark"] .read-status.read { color: #5baeff; }
[data-theme="dark"] .message-sender { color: #778; }
[data-theme="dark"] .emoji-picker { background: #1e1e32; border-color: #2a2a45; }
[data-theme="dark"] .emoji-item:hover { background: #2a2a45; }
[data-theme="dark"] .mention-dropdown { background: #1e1e32; border-color: #2a2a45; }
[data-theme="dark"] .mention-item:hover, [data-theme="dark"] .mention-item.active { background: #252545; }
[data-theme="dark"] .mention-name { color: #e0e0e0; }
[data-theme="dark"] .mention-oicq { color: #777; }
[data-theme="dark"] .btn-outline { border-color: #2a2a45; color: #e0e0e0; background: #1e1e32; }
[data-theme="dark"] .btn-outline:hover { border-color: var(--primary); color: var(--primary); background: #1a2e1a; }
/* 桌面端深色模式标题栏 */
@media (min-width: 769px) {
    [data-theme="dark"] .title-bar { background: linear-gradient(180deg, #1a3a5c 0%, #152d4a 100%); }
}
[data-theme="dark"] .modal-box { background: #1e1e32; }
[data-theme="dark"] .modal-header { border-bottom-color: #2a2a45; }
[data-theme="dark"] .modal-body label { color: #a0a0a0; }
[data-theme="dark"] .modal-body input, [data-theme="dark"] .modal-body select, [data-theme="dark"] .modal-body textarea { background: #16162e; border-color: #2a2a45; color: #e0e0e0; }
[data-theme="dark"] .image-preview-thumb { border-color: #2a2a45; }
[data-theme="dark"] .auth-container { background: linear-gradient(135deg, #1a1a3e, #2a1a4e); }
[data-theme="dark"] .auth-box { background: #1e1e32; }
[data-theme="dark"] .stat-card { background: #1a1a30; }
[data-theme="dark"] table { background: #1a1a30; }
[data-theme="dark"] th { background: #15152a; color: #a0a0a0; }
[data-theme="dark"] td { border-bottom-color: #1e1e36; color: #e0e0e0; }
[data-theme="dark"] tr:hover { background: #1e1e38; }
[data-theme="dark"] .toast { box-shadow: 0 4px 12px rgba(0,0,0,0.4); }
[data-theme="dark"] .char-count { color: #555; }
[data-theme="dark"] .contact-item .contact-status.offline { background: #444; }
[data-theme="dark"] .messages-loading { color: #555; }
[data-theme="dark"] .image-lightbox { background: rgba(0,0,0,0.92); }
[data-theme="dark"] .form-group input, [data-theme="dark"] .form-group textarea { background: #16162e; border-color: #2a2a45; color: #e0e0e0; }
[data-theme="dark"] .image-preview-close { background: rgba(255,255,255,0.25); }

/* 深色模式开关按钮 */
.theme-toggle {
    background: rgba(255,255,255,0.15); border: none; color: #fff;
    cursor: pointer; font-size: 18px; width: 32px; height: 32px;
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    transition: all 0.2s; line-height: 1;
}
.theme-toggle:hover { background: rgba(255,255,255,0.25); transform: rotate(20deg); }

/* 消息右键菜单 */
.context-menu {
    position: fixed; z-index: 9999;
    background: var(--bg-white); border: 1px solid var(--border);
    border-radius: 8px; box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    min-width: 120px; padding: 4px 0; display: none;
}
.context-menu .menu-item {
    padding: 8px 16px; cursor: pointer; font-size: 13px; color: var(--text);
    transition: background 0.1s; white-space: nowrap;
}
.context-menu .menu-item:hover { background: var(--primary-light); color: var(--primary); }
[data-theme="dark"] .context-menu { background: #1e1e32; box-shadow: 0 4px 16px rgba(0,0,0,0.5); }
[data-theme="dark"] .context-menu .menu-item:hover { background: #252545; }

/* 引用栏（输入区上方） */
.quote-bar {
    margin: 0 12px 8px; padding: 8px 12px;
    background: #f0f2f5; border-left: 3px solid var(--primary);
    border-radius: 4px; display: flex; align-items: center; gap: 8px;
    font-size: 12px;
}
[data-theme="dark"] .quote-bar { background: #1e1e36; }
.quote-bar-content { flex: 1; min-width: 0; overflow: hidden; }
.quote-bar-sender { color: var(--primary); font-weight: 500; }
.quote-bar-text { color: var(--text-light); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.quote-bar-close {
    background: none; border: none; color: var(--text-light);
    cursor: pointer; font-size: 16px; line-height: 1; padding: 2px 4px;
}

/* 消息中的引用气泡 */
.message-quote-bubble {
    margin-bottom: 6px; padding: 6px 10px;
    background: rgba(0,0,0,0.04); border-left: 3px solid var(--primary);
    border-radius: 4px; font-size: 12px; cursor: pointer;
}
[data-theme="dark"] .message-quote-bubble { background: rgba(255,255,255,0.05); }
.message-quote-bubble .quote-sender { color: var(--primary); font-weight: 500; margin-bottom: 2px; }
.message-quote-bubble .quote-text { color: var(--text-light); }

/* 聊天置顶 */
.pin-btn {
    display: none; background: none; border: none; cursor: pointer;
    font-size: 14px; color: var(--text-light); padding: 2px 4px;
    border-radius: 3px; transition: all 0.15s; line-height: 1;
}
.contact-item:hover .pin-btn { display: inline-block; }
.pin-btn:hover { background: var(--primary-light); color: var(--primary); }
.pin-btn.pinned { display: inline-block; color: var(--primary); }
.pinned-separator {
    padding: 4px 12px; font-size: 11px; color: var(--primary);
    background: var(--primary-light); font-weight: 500;
}
[data-theme="dark"] .pinned-separator { background: rgba(7,193,96,0.1); }

/* ============================================
   文件传输
   ============================================ */
.file-card {
    display: flex; align-items: center; gap: 10px; padding: 10px 14px;
    background: rgba(0,0,0,0.04); border: 1px solid var(--border);
    border-radius: 8px; cursor: pointer; transition: all 0.15s;
    min-width: 200px; max-width: 280px;
}
.file-card:hover { background: rgba(7,193,96,0.06); border-color: var(--primary); }
[data-theme="dark"] .file-card { background: rgba(255,255,255,0.04); }
[data-theme="dark"] .file-card:hover { background: rgba(7,193,96,0.1); }
.file-card-icon { font-size: 32px; flex-shrink: 0; }
.file-card-info { flex: 1; min-width: 0; }
.file-card-name { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-card-meta { font-size: 11px; color: var(--text-light); }
.file-card-hint { font-size: 10px; color: var(--primary); margin-top: 2px; }

/* 文件预览栏 */
.file-preview-bar {
    margin: 0 12px; padding: 6px 10px; display: flex;
    align-items: center; gap: 8px; background: #f8f9fa;
    border-radius: 6px; border: 1px solid var(--border);
}
[data-theme="dark"] .file-preview-bar { background: #1e1e36; }
.file-preview-icon { font-size: 24px; }
.file-preview-info { flex: 1; min-width: 0; font-size: 12px; }
.file-preview-name { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-preview-size { color: var(--text-light); }

/* ============================================
   已读回执
   ============================================ */
.message-row.mine .read-status {
    font-size: 10px; margin-left: 4px;
}
.read-status.sent { color: var(--text-light); }
.read-status.read { color: var(--info); font-weight: 500; }
.read-status .check { font-size: 12px; }

/* ============================================
   聊天背景
   ============================================ */
.chat-bg-overlay {
    position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    background-size: cover; background-position: center;
    opacity: 0.12; pointer-events: none; z-index: 0;
}
[data-theme="dark"] .chat-bg-overlay { opacity: 0.06; }
.chat-area { position: relative; }
.chat-area > *:not(.chat-bg-overlay) { position: relative; z-index: 1; }

/* 背景选择器 */
.bg-picker-grid {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px;
    margin-bottom: 15px;
}
.bg-picker-item {
    width: 100%; aspect-ratio: 16/10; border-radius: 8px;
    cursor: pointer; border: 2px solid transparent;
    transition: all 0.2s; position: relative; overflow: hidden;
}
.bg-picker-item:hover { border-color: var(--primary); transform: scale(1.03); }
.bg-picker-item.active { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(7,193,96,0.2); }
.bg-picker-item.active::after {
    content: '✓'; position: absolute; top: 4px; right: 6px;
    color: #fff; font-size: 14px; font-weight: bold;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}
.bg-reset-btn {
    width: 100%; aspect-ratio: 16/10; border-radius: 8px;
    cursor: pointer; border: 2px dashed var(--border);
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; color: var(--text-light); transition: all 0.2s;
}
.bg-reset-btn:hover { border-color: var(--danger); color: var(--danger); }

/* ============================================
   表情包 Tab
   ============================================ */
.emoji-tabs {
    display: flex; border-bottom: 1px solid var(--border);
    margin-bottom: 8px;
}
.emoji-tab {
    flex: 1; text-align: center; padding: 6px 0; cursor: pointer;
    font-size: 12px; color: var(--text-light); border-bottom: 2px solid transparent;
    transition: all 0.15s; white-space: nowrap;
}
.emoji-tab:hover { color: var(--text); }
.emoji-tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 500; }
.emoji-panel { max-height: 200px; overflow-y: auto; }
.emoji-panel .emoji-item { display: inline-flex; align-items: center; justify-content: center; position: relative; }
[data-theme="dark"] .emoji-tabs { border-bottom-color: #2a2a45; }
[data-theme="dark"] .emoji-tab { color: #888; }
[data-theme="dark"] .emoji-tab:hover { color: #ccc; }
[data-theme="dark"] .emoji-tab.active { color: var(--primary); }
.emoji-fav-star {
    position: absolute; top: 1px; right: 2px;
    font-size: 8px; opacity: 0; transition: opacity 0.15s;
}
.emoji-item:hover .emoji-fav-star { opacity: 1; }

/* ============================================
   闲置锁屏
   ============================================ */
#idle-lock-screen.active { display: flex !important; }
.idle-timeout-select {
    padding: 8px 12px; border: 1px solid var(--border); border-radius: 6px;
    font-size: 13px; width: 100%; background: var(--bg-white); color: var(--text);
}

/* ============================================
   群公告
   ============================================ */
.group-notice-bar {
    display: flex; align-items: center; gap: 8px;
    padding: 10px 14px; margin: 0 0 2px 0;
    background: linear-gradient(135deg, #fff5f5, #fff0f0);
    border-bottom: 2px solid #e74c3c;
    font-size: 13px; color: #c0392b;
    animation: noticeSlideIn 0.3s ease;
}
@keyframes noticeSlideIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}
.group-notice-icon { font-size: 16px; flex-shrink: 0; }
.group-notice-text { flex: 1; line-height: 1.5; }
.group-notice-close {
    background: none; border: none; font-size: 16px;
    cursor: pointer; color: #c0392b; opacity: 0.6;
    padding: 0 4px; flex-shrink: 0;
}
.group-notice-close:hover { opacity: 1; }
[data-theme="dark"] .group-notice-bar {
    background: linear-gradient(135deg, #2a1515, #201010);
    border-bottom-color: #c0392b;
    color: #e74c3c;
}
[data-theme="dark"] .group-notice-close { color: #e74c3c; }
