/* =============================================================
   AuroraAPI · Aurora Dimensional 设计系统
   -------------------------------------------------------------
   全局主题层：统一浅/深两套设计令牌 + 组件质感（阴影、圆角、玻璃、辉光）。
   - 浅色：靛紫立体感（柔和分层阴影、玻璃胶囊、大圆角）——参照“Design Dimensional”。
   - 深色：深邃 premium + 极光辉光（青→紫渐变、发光标题、玻璃卡片）——参照“Premium 数据平台”。
   各页面在自己的 <style> :root 里定义了同名令牌，本文件用更高优先级的
   html[data-theme="light|dark"] 覆盖其“值”，从而全站统一，无需逐页改写。
   本文件在各页内联 <style> 之后加载，故可覆盖。由 theme.js 在首屏前设 data-theme。
   ============================================================= */

/* ---------- 平滑主题过渡 ----------
   仅对“廉价”属性做全局过渡（背景/边框/文字色），并排除 SVG 内部节点。
   刻意不在通配符上过渡 box-shadow / fill：
   - box-shadow 逐元素动画需每帧重绘阴影模糊，卡片一多点击切换就会卡顿；
   - fill 会命中每个图标内部的大量 path/line 子节点。
   需要阴影平滑过渡的卡片，各自组件样式里已带 box-shadow 过渡，不受影响。 */
html.theme-ready,
html.theme-ready body,
html.theme-ready *:not(svg):not(svg *) {
    transition: background-color .25s ease, border-color .25s ease, color .2s ease;
}

/* =============================================================
   浅色主题令牌（Dimensional）
   ============================================================= */
html[data-theme="light"] {
    --bg-color: #FFFFFE;
    --bg-subtle: #F1F5F9;
    --content-bg: #ffffff;
    --card-bg: #ffffff;
    --sidebar-bg: #ffffff;

    --text-dark: #171717;
    --text-normal: #3F3F46;
    --text-light: #71717A;
    --text-subtle: #A1A1AA;

    --border-color: #E9ECF1;
    --border-subtle: #F1F2F5;

    --primary-color: #2F6BFF;
    --primary: #2F6BFF;
    --primary-hover: #2563EB;
    --primary-dark: #1D4ED8;
    --primary-light: #EFF6FF;
    --primary-lighter: #F4F8FF;
    --primary-gradient: linear-gradient(135deg, #2F6BFF 0%, #5B8CFF 100%);
    --hot-bar: linear-gradient(90deg, #2F6BFF, #A47BEA);

    --success: #07C160; --success-green: #07C160; --success-light: #D0FAE5; --success-bg: #ECFDF5;
    --warning: #F99C00; --warning-amber: #F99C00; --warning-light: #FEE685; --warning-bg: #FFFBEB;
    --error: #E5484D; --error-red: #E5484D; --error-light: #F87171; --error-bg: #FEF2F2;
    --info-blue: #2F6BFF; --info-light: #93C5FD; --info-bg: #EFF6FF;

    /* 立体分层阴影（中性微染） */
    --shadow-color: rgba(23, 23, 23, 0.06);
    --shadow-sm: 0 1px 2px rgba(23, 23, 23, 0.05);
    --shadow-md: 0 10px 26px -14px rgba(23, 23, 23, 0.12), 0 2px 6px rgba(23, 23, 23, 0.04);
    --shadow-medium: 0 10px 26px -14px rgba(23, 23, 23, 0.12), 0 2px 6px rgba(23, 23, 23, 0.04);
    --shadow-lg: 0 26px 52px -22px rgba(23, 23, 23, 0.16), 0 8px 18px -10px rgba(23, 23, 23, 0.07);
    --shadow-strong: 0 26px 52px -22px rgba(23, 23, 23, 0.16), 0 8px 18px -10px rgba(23, 23, 23, 0.07);
    --shadow-glow: 0 12px 30px -8px rgba(47, 107, 255, 0.35);
}

/* 浅色全局背景：近白、极淡暖意 */
html[data-theme="light"] body {
    background: var(--bg-color);
    background-image: none;
}

/* =============================================================
   深色主题令牌（Premium + Aurora Glow）
   ============================================================= */
html[data-theme="dark"] {
    --bg-color: #000000;
    --bg-subtle: #0c1020;
    --content-bg: #0A0A0C;
    --card-bg: #0A0A0C;
    --sidebar-bg: #08080A;

    --text-dark: #d5dbe6;
    --text-normal: #aeb7c6;
    --text-light: #7d8798;
    --text-subtle: #5b6575;

    --border-color: #222b45;
    --border-subtle: #1a2238;

    /* 主色提亮 + 极光副色（青） */
    --primary-color: #5B8CFF;
    --primary: #5B8CFF;
    --primary-hover: #2F6BFF;
    --primary-dark: #93C5FD;
    --primary-light: rgba(91, 140, 255, 0.16);
    --primary-lighter: rgba(91, 140, 255, 0.10);
    --primary-gradient: linear-gradient(135deg, #2F6BFF 0%, #22d3ee 100%);
    --hot-bar: linear-gradient(90deg, #2F6BFF, #22d3ee);
    --aurora-cyan: #22d3ee;

    --success: #34d399; --success-green: #34d399; --success-light: rgba(52,211,153,0.22); --success-bg: rgba(52,211,153,0.12);
    --warning: #fbbf24; --warning-amber: #fbbf24; --warning-light: rgba(251,191,36,0.22); --warning-bg: rgba(251,191,36,0.12);
    --error: #f87171; --error-red: #f87171; --error-light: rgba(248,113,113,0.22); --error-bg: rgba(248,113,113,0.12);
    --info-blue: #60a5fa; --info-light: rgba(96,165,250,0.22); --info-bg: rgba(96,165,250,0.12);

    --shadow-color: rgba(0, 0, 0, 0.5);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.45);
    --shadow-md: 0 10px 30px -10px rgba(0, 0, 0, 0.6);
    --shadow-medium: 0 10px 30px -10px rgba(0, 0, 0, 0.6);
    --shadow-lg: 0 24px 50px -18px rgba(0, 0, 0, 0.7);
    --shadow-strong: 0 24px 50px -18px rgba(0, 0, 0, 0.7);
    --shadow-glow: 0 0 40px rgba(99, 102, 241, 0.35);
}

/* 深色全局背景：纯黑 */
html[data-theme="dark"] body {
    background: #000000;
    background-image: none;
    color: var(--text-normal);
}

/* 深色下卡片/内容面板加一层极细高光描边，营造玻璃质感 */
html[data-theme="dark"] .card,
html[data-theme="dark"] .stat-card,
html[data-theme="dark"] .content-card,
html[data-theme="dark"] .api-card,
html[data-theme="dark"] .table-card,
html[data-theme="dark"] .content-section,
html[data-theme="dark"] .panel {
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.04), var(--shadow-sm);
}

/* ---------- 深色下常见硬编码表面兜底 ---------- */
html[data-theme="dark"] input,
html[data-theme="dark"] textarea,
html[data-theme="dark"] select {
    background-color: #0e1424;
    color: var(--text-dark);
    border-color: var(--border-color);
}
html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder { color: var(--text-subtle); }
html[data-theme="dark"] thead th { background: rgba(255,255,255,0.02); }
html[data-theme="dark"] tbody tr:hover { background: rgba(129,140,248,0.06); }
html[data-theme="dark"] pre,
html[data-theme="dark"] code { background: #0a0f1e !important; color: #cbd5e1; border-color: var(--border-color); }

/* ---------- 滚动条 ---------- */
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-thumb { background: #c9cce0; border-radius: 8px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #a5a9c8; background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }
html[data-theme="dark"] ::-webkit-scrollbar-thumb { background: #2a3a57; background-clip: content-box; }
html[data-theme="dark"] ::-webkit-scrollbar-thumb:hover { background: #3a4d70; background-clip: content-box; }

/* ---------- 可访问焦点环 ---------- */
a:focus-visible, button:focus-visible, input:focus-visible,
textarea:focus-visible, select:focus-visible, [tabindex]:focus-visible {
    outline: 2px solid var(--primary-color, #6366f1);
    outline-offset: 2px;
    border-radius: 6px;
}

/* ---------- 移动端点按高亮 ----------
   部分安卓 WebView 的点按高亮不裁圆角，会出现方块状浅蓝底，
   统一关闭；按钮类同时禁止长按选词产生的蓝色选区。 */
* { -webkit-tap-highlight-color: transparent; }
button, .chip, .cat-item, .cat-trigger, .rank-item,
.btn-auth, .btn-primary, .btn-details, .cta-primary {
    -webkit-user-select: none;
    user-select: none;
}

/* =============================================================
   全局组件质感增强（作用于两种主题；仅提升观感，不改结构）
   ============================================================= */
/* 渐变主按钮统一带柔和辉光 + 悬浮上移 */
.cta-primary, .btn-details, .btn-primary {
    box-shadow: var(--shadow-glow);
    transition: transform .22s cubic-bezier(.34,1.4,.64,1), box-shadow .22s ease, filter .22s ease;
}
.cta-primary:hover, .btn-details:hover, .btn-primary:hover {
    transform: translateY(-2px);
    filter: saturate(1.05);
}

/* 深色下发光标题（渐变文字 + 轻微光晕），用于 hero 大标题 */
html[data-theme="dark"] .top-header-content h1 {
    text-shadow: 0 0 40px rgba(99, 102, 241, 0.35);
}

@media print { #aurora-theme-toggle { display: none !important; } }

/* =============================================================
   浮动主题切换按钮（由 theme.js 注入 #aurora-theme-toggle）
   ============================================================= */
#aurora-theme-toggle {
    position: fixed; right: 16px; top: 14px; bottom: auto; z-index: 2147483000;
    width: 42px; height: 42px; border: none; border-radius: 50%; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--primary-gradient, linear-gradient(135deg,#667eea,#764ba2));
    color: #fff; box-shadow: 0 10px 28px rgba(99, 102, 234, 0.5);
    transition: transform .25s cubic-bezier(.34,1.56,.64,1), box-shadow .25s ease;
    -webkit-tap-highlight-color: transparent;
}
#aurora-theme-toggle:hover { transform: translateY(-3px) scale(1.06); box-shadow: 0 14px 34px rgba(99,102,234,.6); }
#aurora-theme-toggle:active { transform: translateY(-1px) scale(.98); }
#aurora-theme-toggle svg { width: 22px; height: 22px; }
#aurora-theme-toggle .icon-sun { display: none; }
#aurora-theme-toggle .icon-moon { display: block; }
/* 位于顶栏右侧时的紧凑样式（由 theme.js 注入到 .topbar .user-area） */
.topbar #aurora-theme-toggle {
    position: static; width: 34px; height: 34px; margin-right: 2px;
    background: transparent; color: inherit; box-shadow: none; opacity: .72;
    border-radius: 9px;
}
.topbar #aurora-theme-toggle:hover {
    background: rgba(127,127,127,.14); transform: none; box-shadow: none; opacity: 1;
}
.topbar #aurora-theme-toggle:active { transform: none; }
.topbar #aurora-theme-toggle svg { width: 19px; height: 19px; }

html[data-theme="dark"] #aurora-theme-toggle .icon-sun { display: block; }
html[data-theme="dark"] #aurora-theme-toggle .icon-moon { display: none; }
