/* ============================================
   PP Chat — QQ/微信风格主题系统
   三种主题: light / dark / system
   ============================================ */

/* --- 日间主题 (默认) --- */
:root,
[data-theme="light"] {
    --bg-primary: #f0f2f5;
    --bg-secondary: #ffffff;
    --bg-tertiary: #e4e6eb;
    --bg-hover: #e8eaed;
    --bg-active: #d2d5da;
    --bg-nav: #f7f8fa;
    --bg-nav-hover: #ecedf0;
    --bg-nav-active: #07c160;
    --bg-input: #ffffff;
    --bg-card: #ffffff;
    --bg-overlay: rgba(0,0,0,0.45);
    --text-primary: #1a1a1a;
    --text-secondary: #555555;
    --text-tertiary: #888888;
    --text-inverse: #ffffff;
    --text-link: #576b95;
    --text-nav: #666666;
    --text-nav-active: #ffffff;
    --border-color: #d0d0d0;
    --border-light: #e0e0e0;
    --accent: #07c160;
    --accent-hover: #06ad56;
    --accent-light: #e8f8ee;
    --danger: #fa5151;
    --danger-hover: #e04848;
    --warning: #ffc300;
    --bubble-self: #95ec69;
    --bubble-self-text: #1a1a1a;
    --bubble-other: #ffffff;
    --bubble-other-text: #1a1a1a;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.10);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.14);
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 9999px;
    --scrollbar-thumb: #c1c1c1;
}

/* --- 夜间主题 --- */
[data-theme="dark"] {
    --bg-primary: #111111;
    --bg-secondary: #1e1e1e;
    --bg-tertiary: #2a2a2a;
    --bg-hover: #333333;
    --bg-active: #3a3a3a;
    --bg-nav: #171717;
    --bg-nav-hover: #2a2a2a;
    --bg-nav-active: #07c160;
    --bg-input: #2a2a2a;
    --bg-card: #1e1e1e;
    --bg-overlay: rgba(0,0,0,0.65);
    --text-primary: #e5e5e5;
    --text-secondary: #999999;
    --text-tertiary: #666666;
    --text-inverse: #1a1a1a;
    --text-link: #7b9cc0;
    --text-nav: #888888;
    --text-nav-active: #ffffff;
    --border-color: #333333;
    --border-light: #2a2a2a;
    --accent: #07c160;
    --accent-hover: #06ad56;
    --accent-light: #1a3a2a;
    --danger: #fa5151;
    --danger-hover: #e04848;
    --bubble-self: #3eb575;
    --bubble-self-text: #ffffff;
    --bubble-other: #2a2a2a;
    --bubble-other-text: #e5e5e5;
    --shadow-sm: 0 1px 2px 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);
    --scrollbar-thumb: #444444;
}

/* --- 跟随系统 --- */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]):not([data-theme="dark"]) {
        --bg-primary: #111111;
        --bg-secondary: #1e1e1e;
        --bg-tertiary: #2a2a2a;
        --bg-hover: #333333;
        --bg-active: #3a3a3a;
        --bg-nav: #171717;
        --bg-nav-hover: #2a2a2a;
        --bg-nav-active: #07c160;
        --bg-input: #2a2a2a;
        --bg-card: #1e1e1e;
        --bg-overlay: rgba(0,0,0,0.65);
        --text-primary: #e5e5e5;
        --text-secondary: #999999;
        --text-tertiary: #666666;
        --text-inverse: #1a1a1a;
        --text-link: #7b9cc0;
        --text-nav: #888888;
        --text-nav-active: #ffffff;
        --border-color: #333333;
        --border-light: #2a2a2a;
        --bubble-self: #3eb575;
        --bubble-self-text: #ffffff;
        --bubble-other: #2a2a2a;
        --bubble-other-text: #e5e5e5;
        --shadow-sm: 0 1px 2px 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);
        --scrollbar-thumb: #444444;
    }
}

/* ============================================
   基础重置与全局动效
   ============================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    font-size: 14px; line-height: 1.5;
    color: var(--text-primary);
    background: var(--bg-primary);
    -webkit-font-smoothing: antialiased;
}
a { color: var(--text-link); text-decoration: none; }
a:hover { color: var(--accent); }
img { max-width: 100%; display: block; }
svg { display: inline-block; vertical-align: middle; flex-shrink: 0; }
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 3px; }

/* 全局入场动画 */
@keyframes fadeSlideUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}
.anim-fade-up { animation: fadeSlideUp 0.4s ease both; }
.anim-fade-in { animation: fadeIn 0.3s ease both; }
.anim-scale-in { animation: scaleIn 0.25s ease both; }

/* ============================================
   通用组件
   ============================================ */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 8px 20px; font-size: 14px; font-weight: 500;
    border: none; border-radius: var(--radius-md);
    cursor: pointer; transition: all 0.2s ease; white-space: nowrap;
    position: relative; overflow: hidden;
}
.btn::after {
    content: ''; position: absolute; inset: 0;
    background: rgba(255,255,255,0); transition: background 0.2s;
}
.btn:hover::after { background: rgba(255,255,255,0.08); }
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); box-shadow: 0 4px 12px rgba(7,193,96,.3); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger-hover); box-shadow: 0 4px 12px rgba(250,81,81,.3); }
.btn-ghost { background: transparent; color: var(--text-secondary); border: 1px solid var(--border-color); }
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); }
.btn-sm { padding: 4px 12px; font-size: 12px; }
.btn-lg { padding: 10px 28px; font-size: 15px; }
.btn-block { display: flex; width: 100%; }

.input {
    width: 100%; padding: 10px 14px; font-size: 14px;
    color: var(--text-primary); background: var(--bg-input);
    border: 1px solid var(--border-color); border-radius: var(--radius-md);
    outline: none; transition: border-color 0.2s, box-shadow 0.2s;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(7,193,96,.12); }
.input::placeholder { color: var(--text-tertiary); }
textarea.input { resize: vertical; min-height: 80px; }

.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 500; color: var(--text-secondary); }
.form-error { margin-top: 6px; font-size: 12px; color: var(--danger); }

.card { background: var(--bg-card); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }

.avatar {
    width: 40px; height: 40px; border-radius: var(--radius-md);
    object-fit: cover; background: var(--bg-tertiary); flex-shrink: 0;
}
.avatar-sm { width: 32px; height: 32px; }
.avatar-lg { width: 56px; height: 56px; }
.avatar-xl { width: 80px; height: 80px; }
.avatar-placeholder {
    display: flex; align-items: center; justify-content: center;
    background: var(--accent); color: #fff; font-weight: 600; font-size: 16px;
}

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

.empty-state {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    height: 100%; padding: 40px; color: var(--text-tertiary); text-align: center;
}
.empty-state svg { width: 64px; height: 64px; margin-bottom: 16px; opacity: 0.4; }
.empty-state p { font-size: 14px; }

.toast-container {
    position: fixed; top: 20px; right: 20px; z-index: 9999;
    display: flex; flex-direction: column; gap: 8px;
}
.toast {
    padding: 12px 20px; background: var(--bg-card);
    border-radius: var(--radius-md); box-shadow: var(--shadow-lg);
    font-size: 14px; animation: toastIn 0.3s ease;
    border-left: 3px solid var(--accent);
}
.toast.error { border-left-color: var(--danger); }
@keyframes toastIn { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: translateX(0); } }

.theme-switcher {
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    padding: 3px; background: rgba(255,255,255,.08); border-radius: var(--radius-md);
}
.landing-header .theme-switcher,
.index-header .theme-switcher,
.mgmt-header .theme-switcher {
    flex-direction: row;
    background: var(--bg-tertiary);
}
.landing-header .theme-switcher button,
.index-header .theme-switcher button,
.mgmt-header .theme-switcher button {
    width: 32px; height: 32px; font-size: 14px;
}
.landing-header .theme-switcher button.active,
.index-header .theme-switcher button.active,
.mgmt-header .theme-switcher button.active {
    background: var(--bg-card); color: var(--text-primary); box-shadow: var(--shadow-sm);
}
.theme-switcher button {
    width: 24px; height: 24px;
    display: flex; align-items: center; justify-content: center;
    border: none; border-radius: var(--radius-sm);
    background: transparent; color: var(--text-tertiary);
    cursor: pointer; font-size: 12px; transition: all 0.2s;
}
.theme-switcher button.active { background: rgba(255,255,255,.15); color: #fff; box-shadow: none; }

/* ============================================
   登录 / 注册页 — 深蓝渐变 + 玻璃态
   ============================================ */
.auth-page {
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh; padding: 20px;
    background: #0a0a1a;
    position: relative; overflow: hidden;
}
.auth-page::before {
    content: ''; position: absolute; inset: 0;
    background:
        radial-gradient(ellipse 600px 400px at 20% 40%, rgba(91,141,239,.18), transparent),
        radial-gradient(ellipse 500px 350px at 80% 60%, rgba(65,211,189,.14), transparent),
        radial-gradient(ellipse 400px 300px at 50% 20%, rgba(155,89,182,.08), transparent);
    animation: authBgFloat 20s ease-in-out infinite;
}
@keyframes authBgFloat {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(2%, -2%) rotate(1deg); }
    66% { transform: translate(-1%, 1%) rotate(-1deg); }
}
.auth-card {
    width: 100%; max-width: 420px; padding: 44px 40px;
    background: rgba(255,255,255,.08); backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-radius: 20px;
    border: 1px solid rgba(255,255,255,.12);
    box-shadow: 0 8px 40px rgba(0,0,0,.4), inset 0 1px 0 rgba(255,255,255,.06);
    position: relative; z-index: 1;
    animation: scaleIn 0.5s ease both;
}
.auth-card .logo {
    text-align: center; margin-bottom: 36px;
}
.auth-card .logo h1 {
    font-size: 36px; font-weight: 800; color: #fff;
    margin-bottom: 6px;
    background: linear-gradient(135deg, #5b8def, #41d3bd);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text;
}
.auth-card .logo p {
    font-size: 13px; color: rgba(255,255,255,.5); letter-spacing: 1px;
}
.auth-card .error-msg {
    padding: 10px 14px; margin-bottom: 16px;
    background: rgba(250,81,81,.15); color: #ff8e92;
    border-radius: var(--radius-md); font-size: 13px;
    border: 1px solid rgba(250,81,81,.3);
    animation: fadeSlideUp 0.3s ease both;
}
.auth-card .success-msg {
    padding: 10px 14px; margin-bottom: 16px;
    background: rgba(7,193,96,.15); color: #4ade80;
    border-radius: var(--radius-md); font-size: 13px;
    border: 1px solid rgba(7,193,96,.3);
    animation: fadeSlideUp 0.3s ease both;
}
.auth-card .form-footer {
    text-align: center; margin-top: 24px;
    font-size: 13px; color: rgba(255,255,255,.45);
}
.auth-card .form-footer a { color: rgba(108,167,255,.9); transition: color 0.2s; }
.auth-card .form-footer a:hover { color: #82b4ff; }
.auth-card label { color: rgba(255,255,255,.65); font-size: 13px; }
.auth-card .input {
    background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.12);
    color: #fff; border-radius: 10px; padding: 11px 16px;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.auth-card .input:hover { background: rgba(255,255,255,.08); }
.auth-card .input::placeholder { color: rgba(255,255,255,.3); }
.auth-card .input:focus { border-color: rgba(91,141,239,.6); box-shadow: 0 0 0 3px rgba(91,141,239,.15); background: rgba(255,255,255,.1); }
.auth-card .btn-primary {
    margin-top: 8px; padding: 12px 20px; border-radius: 10px;
    font-size: 15px; font-weight: 600; letter-spacing: 0.5px;
    background: linear-gradient(135deg, #5b8def, #41d3bd);
    border: none; box-shadow: 0 4px 16px rgba(91,141,239,.3);
    transition: box-shadow 0.2s, transform 0.2s;
}
.auth-card .btn-primary:hover {
    box-shadow: 0 6px 24px rgba(91,141,239,.45); transform: translateY(-1px);
}

/* Auth page — light mode */
[data-theme="light"] .auth-page {
    background: linear-gradient(135deg, #f0f4ff 0%, #e8f4f0 50%, #f5f0ff 100%);
}
[data-theme="light"] .auth-page::before {
    background: radial-gradient(circle at 25% 25%, rgba(91,141,239,.12), transparent 40%),
                radial-gradient(circle at 75% 75%, rgba(65,211,189,.1), transparent 40%),
                radial-gradient(circle at 50% 50%, rgba(155,89,182,.06), transparent 50%);
}
[data-theme="light"] .auth-card {
    background: rgba(255,255,255,.75);
    border: 1px solid rgba(255,255,255,.8);
    box-shadow: 0 8px 40px rgba(0,0,0,.08), inset 0 1px 0 rgba(255,255,255,.9);
}
[data-theme="light"] .auth-card .logo h1 {
    background: linear-gradient(135deg, #5b8def, #41d3bd);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
[data-theme="light"] .auth-card .logo p { color: rgba(0,0,0,.45); }
[data-theme="light"] .auth-card label { color: rgba(0,0,0,.55); }
[data-theme="light"] .auth-card .input {
    background: rgba(0,0,0,.04); border-color: rgba(0,0,0,.1); color: #1a1a2e;
}
[data-theme="light"] .auth-card .input:hover { background: rgba(0,0,0,.06); }
[data-theme="light"] .auth-card .input::placeholder { color: rgba(0,0,0,.3); }
[data-theme="light"] .auth-card .input:focus {
    border-color: rgba(91,141,239,.6); box-shadow: 0 0 0 3px rgba(91,141,239,.12); background: #fff;
}
[data-theme="light"] .auth-card .error-msg {
    background: rgba(250,81,81,.1); color: #dc2626; border-color: rgba(250,81,81,.2);
}
[data-theme="light"] .auth-card .success-msg {
    background: rgba(7,193,96,.1); color: #16a34a; border-color: rgba(7,193,96,.2);
}
[data-theme="light"] .auth-card .form-footer { color: rgba(0,0,0,.4); }
[data-theme="light"] .auth-card .form-footer a { color: rgba(91,141,239,.9); }
[data-theme="light"] .auth-card .form-footer a:hover { color: #4a7de8; }

/* Auth page — system theme (follows OS preference) */
@media (prefers-color-scheme: light) {
    :root:not([data-theme="dark"]) .auth-page {
        background: linear-gradient(135deg, #f0f4ff 0%, #e8f4f0 50%, #f5f0ff 100%);
    }
    :root:not([data-theme="dark"]) .auth-page::before {
        background: radial-gradient(circle at 25% 25%, rgba(91,141,239,.12), transparent 40%),
                    radial-gradient(circle at 75% 75%, rgba(65,211,189,.1), transparent 40%),
                    radial-gradient(circle at 50% 50%, rgba(155,89,182,.06), transparent 50%);
    }
    :root:not([data-theme="dark"]) .auth-card {
        background: rgba(255,255,255,.75);
        border: 1px solid rgba(255,255,255,.8);
        box-shadow: 0 8px 40px rgba(0,0,0,.08), inset 0 1px 0 rgba(255,255,255,.9);
    }
    :root:not([data-theme="dark"]) .auth-card .logo p { color: rgba(0,0,0,.45); }
    :root:not([data-theme="dark"]) .auth-card label { color: rgba(0,0,0,.55); }
    :root:not([data-theme="dark"]) .auth-card .input {
        background: rgba(0,0,0,.04); border-color: rgba(0,0,0,.1); color: #1a1a2e;
    }
    :root:not([data-theme="dark"]) .auth-card .input:hover { background: rgba(0,0,0,.06); }
    :root:not([data-theme="dark"]) .auth-card .input::placeholder { color: rgba(0,0,0,.3); }
    :root:not([data-theme="dark"]) .auth-card .input:focus {
        border-color: rgba(91,141,239,.6); box-shadow: 0 0 0 3px rgba(91,141,239,.12); background: #fff;
    }
    :root:not([data-theme="dark"]) .auth-card .error-msg {
        background: rgba(250,81,81,.1); color: #dc2626; border-color: rgba(250,81,81,.2);
    }
    :root:not([data-theme="dark"]) .auth-card .success-msg {
        background: rgba(7,193,96,.1); color: #16a34a; border-color: rgba(7,193,96,.2);
    }
    :root:not([data-theme="dark"]) .auth-card .form-footer { color: rgba(0,0,0,.4); }
    :root:not([data-theme="dark"]) .auth-card .form-footer a { color: rgba(91,141,239,.9); }
    :root:not([data-theme="dark"]) .auth-card .form-footer a:hover { color: #4a7de8; }
}

/* ============================================
   Landing Page — 深色渐变 + 动态光晕
   ============================================ */
.landing-page {
    min-height: 100vh; display: flex; flex-direction: column;
    background: #0a0a1a;
}
.landing-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 28px; height: 64px;
    background: rgba(10,10,26,.8); backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(255,255,255,.06);
    position: sticky; top: 0; z-index: 10;
}
.landing-header .brand {
    font-size: 22px; font-weight: 800;
    background: linear-gradient(135deg, #5b8def, #41d3bd);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.landing-header .nav-links { display: flex; align-items: center; gap: 8px; }
.landing-header .nav-links a {
    padding: 6px 16px; border-radius: var(--radius-md);
    color: rgba(255,255,255,.6); font-size: 14px; transition: all 0.2s;
}
.landing-header .nav-links a:hover { color: #fff; background: rgba(255,255,255,.08); }

.landing-hero {
    display: flex; align-items: center; justify-content: center;
    padding: 120px 20px 100px; text-align: center; position: relative;
    background: #0a0a1a; overflow: hidden;
}
.landing-hero::before {
    content: ''; position: absolute; inset: 0;
    background:
        radial-gradient(ellipse 600px 400px at 20% 40%, rgba(91,141,239,.18), transparent),
        radial-gradient(ellipse 500px 350px at 80% 60%, rgba(65,211,189,.14), transparent),
        radial-gradient(ellipse 400px 300px at 50% 20%, rgba(155,89,182,.08), transparent);
    animation: heroGlow 10s ease-in-out infinite alternate;
}
@keyframes heroGlow {
    0% { opacity: 0.6; transform: scale(1) translateY(0); }
    100% { opacity: 1; transform: scale(1.08) translateY(-10px); }
}
.landing-hero-content { position: relative; z-index: 1; max-width: 640px; animation: fadeSlideUp 0.8s ease both; }
.landing-hero-content h1 {
    font-size: 64px; font-weight: 900; color: #fff;
    margin-bottom: 16px; letter-spacing: -2px; line-height: 1.1;
    background: linear-gradient(135deg, #fff 30%, rgba(255,255,255,.6));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.landing-tagline {
    font-size: 20px; color: rgba(255,255,255,.7); margin-bottom: 20px; font-weight: 400;
    letter-spacing: 2px;
}
.landing-desc {
    font-size: 15px; color: rgba(255,255,255,.4); margin-bottom: 44px; line-height: 1.8;
    max-width: 480px; margin-left: auto; margin-right: auto;
}
.landing-actions { display: flex; gap: 14px; justify-content: center; }
.landing-actions .btn {
    padding: 14px 36px; border-radius: 12px; font-size: 15px; font-weight: 600;
    transition: all 0.3s ease;
}
.landing-actions .btn-primary {
    background: linear-gradient(135deg, #5b8def, #41d3bd);
    box-shadow: 0 6px 24px rgba(91,141,239,.3);
    border: none;
}
.landing-actions .btn-primary:hover {
    box-shadow: 0 10px 40px rgba(91,141,239,.45); transform: translateY(-2px);
}

.landing-features {
    padding: 80px 28px 100px; flex: 1;
    display: flex; align-items: center; justify-content: center;
    background: #0a0a1a;
}
.landing-features-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px; max-width: 1024px; width: 100%;
}
.landing-feature-card {
    padding: 28px; background: rgba(255,255,255,.04);
    border-radius: 16px;
    transition: all 0.35s ease;
    border: 1px solid rgba(255,255,255,.06);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    animation: fadeSlideUp 0.6s ease both;
}
.landing-feature-card:nth-child(1) { animation-delay: 0.1s; }
.landing-feature-card:nth-child(2) { animation-delay: 0.2s; }
.landing-feature-card:nth-child(3) { animation-delay: 0.3s; }
.landing-feature-card:nth-child(4) { animation-delay: 0.4s; }
.landing-feature-card:nth-child(5) { animation-delay: 0.5s; }
.landing-feature-card:nth-child(6) { animation-delay: 0.6s; }
.landing-feature-card:hover {
    transform: translateY(-4px);
    background: rgba(255,255,255,.07);
    border-color: rgba(91,141,239,.25);
    box-shadow: 0 12px 40px rgba(0,0,0,.3);
}
.landing-feature-card .lf-icon {
    margin-bottom: 16px; color: rgba(91,141,239,.8);
    display: inline-block;
}
.landing-feature-card .lf-icon svg {
    stroke: rgba(91,141,239,.7);
}
.landing-feature-card:hover .lf-icon svg {
    stroke: #5b8def;
}
.landing-feature-card h3 { font-size: 16px; font-weight: 700; margin-bottom: 8px; color: rgba(255,255,255,.9); }
.landing-feature-card p { font-size: 13px; color: rgba(255,255,255,.4); line-height: 1.7; }
.landing-footer {
    padding: 24px; text-align: center;
    font-size: 12px; color: rgba(255,255,255,.25);
    border-top: 1px solid rgba(255,255,255,.04);
    background: #0a0a1a;
}

/* --- Landing: light / system-light overrides --- */
html[data-theme="light"] .landing-page,
html[data-theme="light"] .landing-header,
html[data-theme="light"] .landing-features,
html[data-theme="light"] .landing-footer {
    background: var(--bg-primary);
}
html[data-theme="light"] .landing-hero {
    background: linear-gradient(135deg, #f5f7fa 0%, #e8edf5 50%, #f0f2f5 100%);
}
html[data-theme="light"] .landing-hero::before {
    background:
        radial-gradient(ellipse 600px 400px at 20% 40%, rgba(91,141,239,.10), transparent),
        radial-gradient(ellipse 500px 350px at 80% 60%, rgba(65,211,189,.08), transparent),
        radial-gradient(ellipse 400px 300px at 50% 20%, rgba(155,89,182,.05), transparent);
}
html[data-theme="light"] .landing-hero-content h1 {
    background: linear-gradient(135deg, #1a1a2e 30%, #3a3a5c);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
html[data-theme="light"] .landing-tagline {
    color: var(--text-secondary);
}
html[data-theme="light"] .landing-desc {
    color: var(--text-tertiary);
}
html[data-theme="light"] .landing-header {
    background: rgba(247,248,250,.85);
    border-bottom: 1px solid var(--border-light);
}
html[data-theme="light"] .landing-header .nav-links a {
    color: var(--text-secondary);
    border: 1px solid var(--border-light);
}
html[data-theme="light"] .landing-header .nav-links a:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}
html[data-theme="light"] .landing-header .theme-switcher {
    background: var(--bg-tertiary);
}
html[data-theme="light"] .landing-features {
    border-top: 1px solid var(--border-light);
}
html[data-theme="light"] .landing-feature-card {
    background: var(--bg-card);
    border-color: var(--border-light);
    box-shadow: var(--shadow-sm);
}
html[data-theme="light"] .landing-feature-card:hover {
    background: var(--bg-card);
    border-color: var(--accent);
    box-shadow: var(--shadow-md);
}
html[data-theme="light"] .landing-feature-card .lf-icon svg {
    stroke: #5b8def;
}
html[data-theme="light"] .landing-feature-card h3 {
    color: var(--text-primary);
}
html[data-theme="light"] .landing-feature-card p {
    color: var(--text-secondary);
}
html[data-theme="light"] .landing-footer {
    color: var(--text-tertiary);
    border-top: 1px solid var(--border-light);
}
/* System theme (no data-theme) with light OS preference */
@media (prefers-color-scheme: light) {
    :root:not([data-theme="dark"]) .landing-page,
    :root:not([data-theme="dark"]) .landing-header,
    :root:not([data-theme="dark"]) .landing-features,
    :root:not([data-theme="dark"]) .landing-footer { background: var(--bg-primary); }
    :root:not([data-theme="dark"]) .landing-hero { background: linear-gradient(135deg, #f5f7fa 0%, #e8edf5 50%, #f0f2f5 100%); }
    :root:not([data-theme="dark"]) .landing-hero::before { background: radial-gradient(ellipse 600px 400px at 20% 40%, rgba(91,141,239,.10), transparent), radial-gradient(ellipse 500px 350px at 80% 60%, rgba(65,211,189,.08), transparent), radial-gradient(ellipse 400px 300px at 50% 20%, rgba(155,89,182,.05), transparent); }
    :root:not([data-theme="dark"]) .landing-hero-content h1 { background: linear-gradient(135deg, #1a1a2e 30%, #3a3a5c); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
    :root:not([data-theme="dark"]) .landing-tagline { color: var(--text-secondary); }
    :root:not([data-theme="dark"]) .landing-desc { color: var(--text-tertiary); }
    :root:not([data-theme="dark"]) .landing-header { background: rgba(247,248,250,.85); border-bottom: 1px solid var(--border-light); }
    :root:not([data-theme="dark"]) .landing-header .nav-links a { color: var(--text-secondary); border: 1px solid var(--border-light); }
    :root:not([data-theme="dark"]) .landing-header .nav-links a:hover { color: var(--text-primary); background: var(--bg-hover); }
    :root:not([data-theme="dark"]) .landing-header .theme-switcher { background: var(--bg-tertiary); }
    :root:not([data-theme="dark"]) .landing-features { border-top: 1px solid var(--border-light); }
    :root:not([data-theme="dark"]) .landing-feature-card { background: var(--bg-card); border-color: var(--border-light); box-shadow: var(--shadow-sm); }
    :root:not([data-theme="dark"]) .landing-feature-card:hover { background: var(--bg-card); border-color: var(--accent); box-shadow: var(--shadow-md); }
    :root:not([data-theme="dark"]) .landing-feature-card .lf-icon svg { stroke: #5b8def; }
    :root:not([data-theme="dark"]) .landing-feature-card h3 { color: var(--text-primary); }
    :root:not([data-theme="dark"]) .landing-feature-card p { color: var(--text-secondary); }
    :root:not([data-theme="dark"]) .landing-footer { color: var(--text-tertiary); border-top: 1px solid var(--border-light); }
}

/* ============================================
   首页 (index)
   ============================================ */
.index-page {
    min-height: 100vh;
    display: flex; flex-direction: column;
}
.index-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 24px; height: 56px;
    background: var(--bg-secondary); border-bottom: 1px solid var(--border-light);
}
.index-header .brand { font-size: 18px; font-weight: 700; color: var(--accent); }
.index-header .nav-links { display: flex; align-items: center; gap: 16px; }
.index-header .nav-links a {
    padding: 6px 14px; border-radius: var(--radius-md);
    color: var(--text-secondary); font-size: 14px; transition: all 0.2s;
}
.index-header .nav-links a:hover { background: var(--bg-hover); color: var(--text-primary); }
.index-content {
    flex: 1; display: flex; align-items: center; justify-content: center;
    padding: 40px 20px;
}
.index-hero { text-align: center; max-width: 500px; }
.index-hero h2 { font-size: 32px; font-weight: 700; margin-bottom: 12px; color: var(--text-primary); }
.index-hero p { font-size: 16px; color: var(--text-secondary); margin-bottom: 32px; line-height: 1.7; }
.index-actions { display: flex; gap: 12px; justify-content: center; }
.index-cards {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px; margin-top: 48px; max-width: 720px; width: 100%;
}
.index-card {
    padding: 24px; background: var(--bg-card);
    border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
    text-decoration: none; color: var(--text-primary);
    transition: transform 0.2s, box-shadow 0.2s;
}
.index-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.index-card .icon { font-size: 28px; margin-bottom: 12px; }
.index-card h3 { font-size: 15px; font-weight: 600; margin-bottom: 6px; }
.index-card p { font-size: 13px; color: var(--text-secondary); }

/* ============================================
   聊天页 — 三栏布局
   ============================================ */
.chat-app {
    display: flex; height: 100vh; overflow: hidden;
}

/* 左侧导航栏 */
.chat-nav {
    width: 64px; flex-shrink: 0;
    display: flex; flex-direction: column; align-items: center;
    padding: 16px 0; gap: 4px;
    background: var(--bg-nav);
}
.chat-nav .nav-avatar {
    width: 40px; height: 40px; border-radius: var(--radius-md);
    object-fit: cover; cursor: pointer; margin-bottom: 12px;
}
.chat-nav .nav-avatar-placeholder {
    width: 40px; height: 40px; border-radius: var(--radius-md);
    display: flex; align-items: center; justify-content: center;
    background: var(--accent); color: #fff; font-weight: 600; font-size: 14px;
    cursor: pointer; margin-bottom: 12px;
}
.chat-nav button {
    width: 48px; height: 48px;
    display: flex; align-items: center; justify-content: center;
    border: none; border-radius: var(--radius-md);
    background: transparent; color: var(--text-nav);
    cursor: pointer; font-size: 20px; transition: all 0.15s;
    position: relative;
}
.chat-nav button:hover { background: var(--bg-nav-hover); }
.chat-nav button.active { background: var(--bg-nav-active); color: var(--text-nav-active); }
.chat-nav .nav-badge {
    position: absolute; top: 6px; right: 6px;
}
.chat-nav .nav-bottom { margin-top: auto; }

/* 中间会话列表 */
.chat-sidebar {
    width: 280px; flex-shrink: 0;
    display: flex; flex-direction: column;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-light);
}
.chat-sidebar-header {
    padding: 16px; border-bottom: 1px solid var(--border-light);
}
.chat-sidebar-header .search-box {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 12px; background: var(--bg-primary);
    border-radius: var(--radius-md);
}
.chat-sidebar-header .search-box input {
    flex: 1; border: none; background: transparent;
    font-size: 13px; color: var(--text-primary); outline: none;
}
.chat-sidebar-header .search-box input::placeholder { color: var(--text-tertiary); }
.chat-sidebar-header .search-box svg { width: 16px; height: 16px; color: var(--text-tertiary); flex-shrink: 0; }
.chat-sidebar-list { flex: 1; overflow-y: auto; }
.chat-item {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 16px; cursor: pointer;
    transition: background 0.15s; position: relative;
}
.chat-item:hover { background: var(--bg-hover); }
.chat-item.active { background: var(--bg-active); }
.chat-item .avatar { width: 44px; height: 44px; border-radius: var(--radius-md); }
.chat-item .chat-info { flex: 1; min-width: 0; }
.chat-item .chat-name {
    font-size: 14px; font-weight: 500;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chat-item .chat-preview {
    font-size: 12px; color: var(--text-tertiary);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    margin-top: 2px;
}
.chat-item .chat-meta {
    display: flex; flex-direction: column; align-items: flex-end; gap: 4px;
    flex-shrink: 0;
}
.chat-item .chat-time { font-size: 11px; color: var(--text-tertiary); }
.chat-item .unread-badge {
    min-width: 18px; height: 18px; padding: 0 5px;
    display: flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 600; color: #fff;
    background: var(--danger); border-radius: var(--radius-full);
}

/* 右侧聊天区 */
.chat-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.chat-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 20px; height: 56px;
    background: var(--bg-secondary); border-bottom: 1px solid var(--border-light);
}
.chat-header .chat-title { font-size: 16px; font-weight: 600; }
.chat-header .chat-actions { display: flex; gap: 8px; }
.chat-header .chat-actions button {
    width: 32px; height: 32px;
    display: flex; align-items: center; justify-content: center;
    border: none; border-radius: var(--radius-sm);
    background: transparent; color: var(--text-secondary);
    cursor: pointer; font-size: 16px;
}
.chat-header .chat-actions button:hover { background: var(--bg-hover); }

/* 消息区域 */
.chat-messages {
    flex: 1; overflow-y: auto; padding: 16px 20px;
    display: flex; flex-direction: column; gap: 16px;
}
.msg-time-divider {
    text-align: center; font-size: 12px; color: var(--text-tertiary);
    padding: 8px 0;
}
.msg-row { display: flex; gap: 10px; max-width: 70%; }
.msg-row.self { margin-left: auto; flex-direction: row-reverse; }
.msg-row .msg-avatar { width: 36px; height: 36px; border-radius: var(--radius-sm); flex-shrink: 0; }
.msg-bubble {
    padding: 10px 14px; border-radius: var(--radius-lg);
    font-size: 14px; line-height: 1.6; word-break: break-word;
    position: relative;
}
.msg-row:not(.self) .msg-bubble {
    background: var(--bubble-other); color: var(--bubble-other-text);
    border-top-left-radius: var(--radius-sm);
}
.msg-row.self .msg-bubble {
    background: var(--bubble-self); color: var(--bubble-self-text);
    border-top-right-radius: var(--radius-sm);
}
.msg-sender {
    font-size: 12px; color: var(--text-tertiary);
    margin-bottom: 4px;
}

/* 语音消息 */
.msg-audio {
    display: flex; align-items: center; gap: 8px;
    cursor: pointer; min-width: 120px;
}
.msg-audio .audio-icon { font-size: 18px; }
.msg-audio .audio-bar {
    flex: 1; height: 3px; background: currentColor; opacity: 0.3;
    border-radius: 2px; position: relative;
}
.msg-audio .audio-duration { font-size: 12px; opacity: 0.7; }

/* 输入区域 */
.chat-input-area {
    padding: 12px 20px; background: var(--bg-secondary);
    border-top: 1px solid var(--border-light);
}
.chat-toolbar {
    display: flex; align-items: center; gap: 4px; margin-bottom: 8px;
}
.chat-toolbar button {
    width: 32px; height: 32px;
    display: flex; align-items: center; justify-content: center;
    border: none; border-radius: var(--radius-sm);
    background: transparent; color: var(--text-secondary);
    cursor: pointer; font-size: 18px; transition: all 0.15s;
}
.chat-toolbar button:hover { background: var(--bg-hover); color: var(--text-primary); }
.chat-toolbar button.recording { color: var(--danger); animation: pulse 1s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
.chat-input-row { display: flex; gap: 8px; align-items: flex-end; }
.chat-input-row textarea {
    flex: 1; padding: 10px 14px; font-size: 14px;
    color: var(--text-primary); background: var(--bg-primary);
    border: 1px solid var(--border-color); border-radius: var(--radius-md);
    outline: none; resize: none; min-height: 40px; max-height: 120px;
    font-family: inherit; line-height: 1.5;
}
.chat-input-row textarea:focus { border-color: var(--accent); }
.chat-input-row textarea::placeholder { color: var(--text-tertiary); }

/* 聊天页搜索面板 */
.chat-search-panel {
    width: 300px; flex-shrink: 0;
    background: var(--bg-secondary); border-left: 1px solid var(--border-light);
    display: flex; flex-direction: column;
}
.chat-search-panel.hidden { display: none; }
.chat-search-panel .panel-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px; border-bottom: 1px solid var(--border-light);
}
.chat-search-panel .panel-header h3 { font-size: 15px; font-weight: 600; }
.chat-search-panel .panel-body { flex: 1; overflow-y: auto; padding: 16px; }
.search-result-item {
    padding: 10px; border-radius: var(--radius-md);
    margin-bottom: 8px; cursor: pointer;
    transition: background 0.15s;
}
.search-result-item:hover { background: var(--bg-hover); }
.search-result-item .result-time { font-size: 11px; color: var(--text-tertiary); }
.search-result-item .result-content { font-size: 13px; margin-top: 4px; }
.search-result-item .result-content mark { background: var(--warning); color: var(--text-primary); border-radius: 2px; padding: 0 2px; }

/* ============================================
   管理页面 — 好友 / 群 / 个人中心
   ============================================ */
.mgmt-page {
    min-height: 100vh; display: flex; flex-direction: column;
}
.mgmt-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 24px; height: 56px;
    background: var(--bg-secondary); border-bottom: 1px solid var(--border-light);
}
.mgmt-header .brand { font-size: 18px; font-weight: 700; color: var(--accent); }
.mgmt-header .nav-links { display: flex; align-items: center; gap: 12px; }
.mgmt-header .nav-links a {
    padding: 6px 14px; border-radius: var(--radius-md);
    color: var(--text-secondary); font-size: 14px; transition: all 0.2s;
}
.mgmt-header .nav-links a:hover { background: var(--bg-hover); color: var(--text-primary); }
.mgmt-header .nav-links a.active { background: var(--accent-light); color: var(--accent); font-weight: 500; }
.mgmt-body {
    flex: 1; display: flex; max-width: 960px; width: 100%;
    margin: 24px auto; padding: 0 24px; gap: 24px;
}
.mgmt-sidebar {
    width: 240px; flex-shrink: 0;
}
.mgmt-content { flex: 1; min-width: 0; }

/* 好友列表 */
.friend-list { display: flex; flex-direction: column; gap: 2px; }
.friend-group-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 12px; font-size: 13px; font-weight: 600;
    color: var(--text-secondary); cursor: pointer;
    border-radius: var(--radius-md);
}
.friend-group-header:hover { background: var(--bg-hover); }
.friend-group-header .count { font-weight: 400; color: var(--text-tertiary); }
.friend-group-items { display: flex; flex-direction: column; gap: 1px; }
.friend-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px; border-radius: var(--radius-md);
    cursor: pointer; transition: background 0.15s;
}
.friend-item:hover { background: var(--bg-hover); }
.friend-item .friend-info { flex: 1; min-width: 0; }
.friend-item .friend-name {
    font-size: 14px; font-weight: 500;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.friend-item .friend-remark {
    font-size: 12px; color: var(--text-tertiary);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.friend-item .friend-actions { display: flex; gap: 4px; opacity: 0; transition: opacity 0.15s; }
.friend-item:hover .friend-actions { opacity: 1; }

/* 好友申请 */
.request-item {
    display: flex; align-items: center; gap: 12px;
    padding: 14px 16px; background: var(--bg-card);
    border-radius: var(--radius-md); margin-bottom: 8px;
    box-shadow: var(--shadow-sm);
}
.request-item .request-info { flex: 1; }
.request-item .request-name { font-size: 14px; font-weight: 500; }
.request-item .request-msg { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }
.request-item .request-time { font-size: 11px; color: var(--text-tertiary); margin-top: 4px; }
.request-item .request-actions { display: flex; gap: 8px; }

/* 群列表 */
.group-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}
.group-card {
    padding: 20px; background: var(--bg-card);
    border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
    cursor: pointer; transition: transform 0.2s, box-shadow 0.2s;
    text-decoration: none; color: var(--text-primary);
}
.group-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.group-card .group-name { font-size: 15px; font-weight: 600; margin-bottom: 6px; }
.group-card .group-meta { font-size: 12px; color: var(--text-tertiary); }

/* 群详情 */
.group-detail { display: flex; flex-direction: column; gap: 20px; }
.group-info-card {
    padding: 24px; background: var(--bg-card);
    border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
}
.group-info-card h2 { font-size: 20px; font-weight: 700; margin-bottom: 8px; }
.group-info-card .meta { font-size: 13px; color: var(--text-secondary); }
.member-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
}
.member-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; background: var(--bg-card);
    border-radius: var(--radius-md);
}
.member-item .member-name { font-size: 14px; flex: 1; }
.member-item .member-role {
    font-size: 11px; padding: 2px 8px;
    background: var(--accent-light); color: var(--accent);
    border-radius: var(--radius-full);
}

/* 个人中心 — 紧凑布局 */
.profile-card {
    max-width: 400px; padding: 24px;
    background: var(--bg-card); border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}
.profile-card .form-group { margin-bottom: 12px; }
.profile-card .input { max-width: 100%; }
.profile-avatar-section {
    display: flex; flex-direction: column; align-items: center;
    margin-bottom: 20px;
}
.profile-avatar-section .avatar-xl { margin-bottom: 12px; }
.profile-avatar-section .change-avatar {
    font-size: 13px; color: var(--text-link); cursor: pointer;
}
.profile-stats {
    display: flex; gap: 24px; justify-content: center;
    margin-bottom: 20px; padding: 14px 0;
    border-top: 1px solid var(--border-light);
    border-bottom: 1px solid var(--border-light);
}
.profile-stat { text-align: center; }
.profile-stat .stat-value { font-size: 20px; font-weight: 700; color: var(--accent); }
.profile-stat .stat-label { font-size: 12px; color: var(--text-tertiary); margin-top: 2px; }

/* ============================================
   消息发送状态指示器
   ============================================ */
.msg-status-indicator {
    display: inline-flex; align-items: center; margin-left: 6px;
    vertical-align: middle; flex-shrink: 0;
}
.msg-status-indicator.msg-sending { opacity: 0.6; }
.msg-status-indicator.msg-failed { color: var(--danger); cursor: pointer; }
.msg-status-indicator.msg-failed:hover { opacity: 0.8; }
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
.spin { animation: spin 1s linear infinite; }
