/**
 * Premium UI v2.0 — 现代化微信/Telegram风格UI
 * 暗夜模式 | 毛玻璃效果 | 动画过渡 | 无障碍
 * Version: 2026-05-31 (Complete Redesign)
 */

/* ====== CSS 变量系统 ====== */
:root {
    --primary: #07c160;
    --primary-dark: #06ad56;
    --primary-light: #e8f8ef;
    --danger: #fa5151;
    --warning: #ffc300;
    --info: #10aeff;
    --bg: #ededed;
    --bg-white: #ffffff;
    --bg-card: #ffffff;
    --text-primary: #191919;
    --text-secondary: #999999;
    --text-muted: #b0b0b0;
    --border: #e5e5e5;
    --divider: #f0f0f0;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.12);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.16);
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-full: 9999px;
    --transition: cubic-bezier(0.4, 0, 0.2, 1);
    --duration: 0.25s;
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

[data-theme="dark"] {
    --bg: #111111;
    --bg-white: #1e1e1e;
    --bg-card: #2c2c2c;
    --text-primary: #e5e5e5;
    --text-secondary: #999999;
    --text-muted: #666666;
    --border: #333333;
    --divider: #2a2a2a;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.5);
}

* { box-sizing: border-box; }
body {
    font-family: var(--font-family);
    font-size: 15px;
    color: var(--text-primary);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

/* ====== Header ====== */
.wc__headerBar {
    background: var(--bg-white) !important;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    transition: background var(--duration) var(--transition);
}
.wc__headerBar .barTit {
    font-size: 17px; font-weight: 600;
    color: var(--text-primary); letter-spacing: -0.3px;
}

/* ====== Chat List Items ====== */
.wc__material-cell {
    background: var(--bg-white) !important;
    margin: 4px 8px !important;
    border-radius: var(--radius-md) !important;
    transition: all var(--duration) var(--transition);
    animation: slideIn 0.3s ease-out;
}
.wc__material-cell:active {
    transform: scale(0.97); background: var(--divider) !important;
}
.wc__material-cell .img img {
    width: 48px !important; height: 48px !important;
    border-radius: var(--radius-md) !important; object-fit: cover;
}
.wc__material-cell .title {
    font-size: 15px; font-weight: 500; color: var(--text-primary);
}

/* ====== Message Bubbles ====== */
.chatMsg-cnt li { position: relative; padding: 8px 16px; animation: messageIn 0.25s ease-out; }
.chatMsg-cnt li.self .msg-bubble {
    background: var(--primary); color: #fff;
    border-radius: var(--radius-lg) var(--radius-sm) var(--radius-lg) var(--radius-lg);
    float: right; max-width: 75%; padding: 10px 14px;
    box-shadow: 0 2px 8px rgba(7,193,96,0.25);
}
.chatMsg-cnt li.other .msg-bubble {
    background: var(--bg-white); color: var(--text-primary);
    border-radius: var(--radius-sm) var(--radius-lg) var(--radius-lg) var(--radius-lg);
    float: left; max-width: 75%; padding: 10px 14px;
    box-shadow: var(--shadow-sm); border: 1px solid var(--border);
}
.msg-status { font-size: 10px; color: var(--text-muted); text-align: right; margin-top: 2px; }
.msg-status.read { color: var(--primary); }

/* ====== Input Area ====== */
.wc__editor-panel {
    background: var(--bg-white) !important;
    border-top: 1px solid var(--border) !important;
    padding: 8px 12px !important;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.06);
}
.wc__editor-panel .editor {
    background: var(--bg) !important;
    border: 1px solid transparent !important;
    border-radius: var(--radius-full) !important;
    padding: 8px 16px !important; font-size: 15px;
    line-height: 1.5; max-height: 120px; overflow-y: auto;
    transition: border-color var(--duration) var(--transition);
}
.wc__editor-panel .editor:focus {
    border-color: var(--primary) !important; outline: none;
    box-shadow: 0 0 0 3px rgba(7,193,96,0.15);
}
.J__wchatSubmit {
    background: var(--primary) !important; color: #fff !important;
    border: none !important; border-radius: var(--radius-full) !important;
    padding: 8px 20px !important; font-size: 15px; font-weight: 500;
    cursor: pointer; transition: all var(--duration) var(--transition);
}
.J__wchatSubmit:hover { background: var(--primary-dark) !important; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(7,193,96,0.3); }
.J__wchatSubmit:active { transform: scale(0.95); }

/* ====== Enhanced Buttons ====== */
.enhance-btn-group { display: inline-flex; align-items: center; gap: 4px; margin-right: 8px; }
.enhance-btn.pro-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 30px; height: 30px; font-size: 16px;
    border-radius: var(--radius-full); cursor: pointer;
    transition: all var(--duration) var(--transition);
    opacity: 0.7; user-select: none;
}
.enhance-btn.pro-btn:hover { opacity: 1; background: var(--divider); transform: scale(1.1); }
.enhance-btn.pro-btn:active { transform: scale(0.9); }

/* ====== Quote Reply ====== */
blockquote.quote-reply {
    border-left: 3px solid var(--primary); padding: 6px 10px; margin: 0 0 8px 0;
    background: var(--primary-light); border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    font-size: 12px; color: var(--text-secondary); max-height: 60px; overflow: hidden;
}
blockquote.quote-reply b { color: var(--primary-dark); }

/* ====== Location Card ====== */
.chat-location-card {
    display: flex; align-items: center; gap: 10px; padding: 10px 14px;
    background: var(--bg-white); border: 1px solid var(--border);
    border-radius: var(--radius-md); text-decoration: none; color: var(--text-primary);
    box-shadow: var(--shadow-sm); transition: all var(--duration) var(--transition);
}
.location-pin { font-size: 24px; }
.location-main { flex: 1; display: flex; flex-direction: column; }
.location-main b { font-size: 15px; font-weight: 500; }
.location-main em { font-size: 12px; color: var(--text-muted); font-style: normal; }
.location-map { background: var(--primary); color: #fff; padding: 4px 12px; border-radius: var(--radius-sm); font-size: 12px; }

/* ====== Transfer Card ====== */
.chat-transfer-card {
    display: flex; align-items: center; gap: 10px; padding: 10px 14px;
    background: linear-gradient(135deg, #fff9e6, #fff3cd);
    border: 1px solid #ffc107; border-radius: var(--radius-md); box-shadow: var(--shadow-sm);
}
.transfer-symbol { font-size: 28px; color: #f59e0b; font-weight: bold; }
.transfer-main { flex: 1; display: flex; flex-direction: column; }
.transfer-main b { font-size: 17px; color: #e67e00; }
.transfer-main em { font-size: 12px; color: var(--text-muted); font-style: normal; }
.transfer-main i { font-size: 10px; color: var(--text-muted); font-style: normal; }
.transfer-status { font-size: 12px; color: var(--primary); font-weight: 500; }

/* ====== Search Highlight ====== */
em.search-highlight { background: #ffeb3b; color: #333; padding: 1px 3px; border-radius: 2px; font-style: normal; }

/* ====== Typing Indicator ====== */
#typingIndicator { display: none; padding: 4px 16px; font-size: 12px; color: var(--text-muted); font-style: italic; animation: fadeIn 0.2s ease; }
#typingIndicator span { animation: pulse 1.2s infinite; color: var(--primary); font-size: 18px; }

/* ====== Online Badge ====== */
.online-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--primary); border: 2px solid var(--bg-white); position: absolute; bottom: 2px; right: 2px; }
.online-dot.offline { background: var(--text-muted); }

/* ====== Unread Badge ====== */
.unread-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--radius-full); background: var(--danger); color: #fff; font-size: 10px; font-weight: 600; }

/* ====== E2E Badge ====== */
.e2e-badge { display: inline-flex; align-items: center; gap: 4px; font-size: 10px; color: var(--primary); padding: 2px 8px; background: var(--primary-light); border-radius: var(--radius-full); }

/* ====== Admin Dashboard ====== */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; padding: 16px; }
.stat-card { background: var(--bg-white); border-radius: var(--radius-md); padding: 20px; box-shadow: var(--shadow-sm); text-align: center; transition: all var(--duration) var(--transition); }
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-card .stat-value { font-size: 32px; font-weight: 700; color: var(--primary); }
.stat-card .stat-label { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

/* ====== Call UI ====== */
.call-container { position: fixed; inset: 0; background: #000; z-index: 9999; display: flex; flex-direction: column; }
.call-remote-video { flex: 1; width: 100%; object-fit: cover; }
.call-local-video { position: absolute; top: 20px; right: 20px; width: 120px; height: 160px; border-radius: var(--radius-md); border: 2px solid rgba(255,255,255,0.3); object-fit: cover; }
.call-controls { position: absolute; bottom: 60px; left: 0; right: 0; display: flex; justify-content: center; gap: 24px; }
.call-btn { width: 56px; height: 56px; border-radius: 50%; border: none; font-size: 24px; cursor: pointer; transition: all var(--duration) var(--transition); }
.call-btn:hover { transform: scale(1.1); }
.call-btn:active { transform: scale(0.9); }
.call-btn-hangup { background: var(--danger); color: #fff; transform: rotate(135deg); }
.call-btn-mute { background: rgba(255,255,255,0.2); color: #fff; }
.call-btn-video { background: rgba(255,255,255,0.2); color: #fff; }

/* ====== Animations ====== */
@keyframes messageIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideIn { from { opacity: 0; transform: translateX(-20px); } to { opacity: 1; transform: translateX(0); } }
@keyframes slideUp { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.2; } }

/* ====== Scrollbar ====== */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.15); border-radius: 2px; }
[data-theme="dark"] ::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); }

/* ====== Mobile ====== */
@media (max-width: 480px) {
    .chatMsg-cnt li.self .msg-bubble, .chatMsg-cnt li.other .msg-bubble { max-width: 85%; }
}
