/* 经典模板：主题变量 / 防闪 / 基础 body */

[v-cloak] {
    display: none !important;
}

el-dialog,
el-input,
el-button {
    display: none !important;
}

[data-page-loading] #app {
    visibility: hidden !important;
}

[data-page-loading] body,
[data-page-loading] html {
    background-color: #f5f5f5 !important;
}

[data-theme="red"] body,
[data-theme="red"] html,
[data-theme="orange"] body,
[data-theme="orange"] html,
[data-theme="green"] body,
[data-theme="green"] html,
[data-theme="purple"] body,
[data-theme="purple"] html {
    background-color: #f5f5f5 !important;
}

[data-theme="blue"] body,
[data-theme="blue"] html {
    background-color: #f0f5ff !important;
}

[data-theme="dark"] body,
[data-theme="dark"] html {
    background-color: #0f0f1a !important;
}

/* 主题配色方案 - 默认红 */
:root,
[data-theme="red"] {
    --theme-primary: #ff6b6b;
    --theme-primary-light: #ff8e53;
    --theme-primary-gradient: linear-gradient(135deg, #ff6b6b 0%, #ff8e53 100%);
    --theme-primary-hover: #ff5252;
    --theme-secondary-gradient: linear-gradient(135deg, #ff8e53 0%, #ffa940 100%);
    --theme-tertiary-gradient: linear-gradient(135deg, #ffa940 0%, #ffc53d 100%);
    --theme-background: #f5f5f5;
    --theme-surface: #ffffff;
    --theme-card: #fff8f0;
    --theme-card-gradient: linear-gradient(135deg, #fff8f0 0%, #fff0f0 100%);
    --theme-text: #333333;
    --theme-text-secondary: #666666;
    --theme-border: #f0f0f0;
}

[data-theme="blue"] {
    --theme-primary: #4a90e2;
    --theme-primary-light: #5fa3f0;
    --theme-primary-gradient: linear-gradient(135deg, #4a90e2 0%, #5fa3f0 100%);
    --theme-primary-hover: #3a7bc8;
    --theme-secondary-gradient: linear-gradient(135deg, #5fa3f0 0%, #7eb8f7 100%);
    --theme-tertiary-gradient: linear-gradient(135deg, #7eb8f7 0%, #9dcdff 100%);
    --theme-background: #f0f4f8;
    --theme-surface: #ffffff;
    --theme-card: #f0f8ff;
    --theme-card-gradient: linear-gradient(135deg, #f0f8ff 0%, #e6f2ff 100%);
    --theme-text: #2c3e50;
    --theme-text-secondary: #5a6c7d;
    --theme-border: #e1e8ed;
}

[data-theme="green"] {
    --theme-primary: #27ae60;
    --theme-primary-light: #2ecc71;
    --theme-primary-gradient: linear-gradient(135deg, #27ae60 0%, #2ecc71 100%);
    --theme-primary-hover: #229954;
    --theme-secondary-gradient: linear-gradient(135deg, #2ecc71 0%, #58d68d 100%);
    --theme-tertiary-gradient: linear-gradient(135deg, #58d68d 0%, #82e0aa 100%);
    --theme-background: #f0f7f4;
    --theme-surface: #ffffff;
    --theme-card: #f0faf4;
    --theme-card-gradient: linear-gradient(135deg, #f0faf4 0%, #e6f5eb 100%);
    --theme-text: #1e3a2f;
    --theme-text-secondary: #4a6356;
    --theme-border: #d4e6dc;
}

[data-theme="dark"] {
    /* 深海军蓝 + 青绿色：与参考图保持一致 */
    --theme-primary: #1599ff;
    --theme-primary-light: #25c8b8;
    --theme-primary-gradient: linear-gradient(110deg, #168cff 0%, #20c7b8 100%);
    --theme-primary-hover: #087bdc;
    --theme-secondary-gradient: linear-gradient(110deg, #168cff 0%, #20c7b8 100%);
    --theme-tertiary-gradient: linear-gradient(110deg, #20c7b8 0%, #36d6b4 100%);
    --theme-background: #06131f;
    --theme-surface: #091b2a;
    --theme-card: #0d2638;
    --theme-card-gradient: linear-gradient(135deg, #103149 0%, #0b3038 100%);
    --theme-text: #e7f2fb;
    --theme-text-secondary: #91aabd;
    --theme-text-muted: #7895a8;
    --theme-border: #18394d;

    /* 旧版 app.css 使用的变量名；上一版遗漏了这组映射 */
    --theme-color: #e7f2fb;
    --theme-other_background: #0b2030;
    --theme-theme: #20b9d1;
    --theme-text-light: #91aabd;
}

/* 全站内容区与顶栏共用宽度：外框 --layout-max，左右 gutter 后内容为 --layout-inner */
:root {
    --layout-max: 1280px;
    --layout-pad: 16px;
    --layout-inner: calc(var(--layout-max) - var(--layout-pad) * 2);
    --layout-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

html {
    height: 100%;
}

body {
    min-height: 100%;
    background-color: var(--theme-background) !important;
    color: var(--theme-text);
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* 全站页面壳：顶栏固定高度，内容区撑满剩余视口，避免短内容露出大块灰底 */
#app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

#app > .top-nav {
    flex-shrink: 0;
}

#app > .footerBox {
    margin-top: auto;
    flex-shrink: 0;
}

.board-page,
.ranking-page-container,
.latest-page-container,
.home-container {
    flex: 1 1 auto;
    width: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    min-height: 0;
}


/* ================= 夜间模式全站组件适配 ================= */
html[data-theme="dark"],
html[data-theme="dark"] body {
    background:
        radial-gradient(circle at 2% 2%, rgba(20, 105, 180, .24) 0, transparent 19%),
        radial-gradient(circle at 99% 31%, rgba(0, 153, 139, .17) 0, transparent 18%),
        radial-gradient(circle at 63% 100%, rgba(0, 118, 94, .12) 0, transparent 17%),
        #06131f !important;
    color: #e7f2fb !important;
}

/* 页面主容器、卡片、侧栏、统计面板 */
html[data-theme="dark"] .search-section,
html[data-theme="dark"] .stats-section,
html[data-theme="dark"] .stats-card,
html[data-theme="dark"] .info-card,
html[data-theme="dark"] .resource-card,
html[data-theme="dark"] .ranking-content,
html[data-theme="dark"] .latest-content,
html[data-theme="dark"] .filter-section,
html[data-theme="dark"] .search-panel,
html[data-theme="dark"] .content-panel,
html[data-theme="dark"] .home .block,
html[data-theme="dark"] .home .block .content,
html[data-theme="dark"] .top-nav-box {
    background: #091b2a !important;
    border-color: #18394d !important;
    color: #e7f2fb !important;
    box-shadow: 0 10px 30px rgba(0,0,0,.18) !important;
}

/* 内层输入框、搜索区域、标签和列表项 */
html[data-theme="dark"] .search-input-box,
html[data-theme="dark"] .search-input-box:focus-within,
html[data-theme="dark"] .search-box,
html[data-theme="dark"] .searchBox .search,
html[data-theme="dark"] .headerBox .box .search,
html[data-theme="dark"] .hot-keywords,
html[data-theme="dark"] .hot-keyword,
html[data-theme="dark"] .hot-keyword-item,
html[data-theme="dark"] .filter-option,
html[data-theme="dark"] .ranking-content-tab,
html[data-theme="dark"] .latest-item,
html[data-theme="dark"] .resourceList .item,
html[data-theme="dark"] .resource-item,
html[data-theme="dark"] .tmdb-info {
    background: #0d2638 !important;
    border-color: #21465d !important;
    color: #dceaf5 !important;
}

/* 所有常见文字颜色 */
html[data-theme="dark"] .search-title,
html[data-theme="dark"] .search-subtitle,
html[data-theme="dark"] .filter-section-title,
html[data-theme="dark"] .filter-label,
html[data-theme="dark"] .latest-content-title,
html[data-theme="dark"] .latest-item-title,
html[data-theme="dark"] .ranking-page-title,
html[data-theme="dark"] .ranking-content-title,
html[data-theme="dark"] .hot-keywords-title,
html[data-theme="dark"] .hot-keyword-text,
html[data-theme="dark"] .nav-menu-item,
html[data-theme="dark"] .logo-name,
html[data-theme="dark"] .footerBox,
html[data-theme="dark"] .footerBox p,
html[data-theme="dark"] .search-tips,
html[data-theme="dark"] .latest-total,
html[data-theme="dark"] .latest-page-info {
    color: #dceaf5 !important;
}

/* 输入文字、占位符、下拉菜单 */
html[data-theme="dark"] input,
html[data-theme="dark"] textarea,
html[data-theme="dark"] select,
html[data-theme="dark"] .search-input-box input {
    background-color: transparent !important;
    color: #e7f2fb !important;
    caret-color: #20c7b8 !important;
}
html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder {
    color: #7895a8 !important;
}
html[data-theme="dark"] .theme-dropdown,
html[data-theme="dark"] .nav-menu-dropdown {
    background: #0b2030 !important;
    color: #e7f2fb !important;
}
html[data-theme="dark"] .nav-menu-dropdown {
    border: 1px solid #21465d !important;
}
html[data-theme="dark"] .theme-dropdown {
    border: 0 solid #21465d !important;
}
html[data-theme="dark"] .theme-option,
html[data-theme="dark"] .nav-drawer-item {
    color: #dceaf5 !important;
}
html[data-theme="dark"] .theme-option:hover,
html[data-theme="dark"] .nav-drawer-item:hover {
    background: #12364a !important;
}

/* 弹窗与 Element Plus 对话框 */
html[data-theme="dark"] .el-dialog,
html[data-theme="dark"] .el-message-box,
html[data-theme="dark"] .el-popover,
html[data-theme="dark"] .el-select-dropdown,
html[data-theme="dark"] .el-picker-panel {
    background: #0b2030 !important;
    border-color: #21465d !important;
    color: #e7f2fb !important;
}
html[data-theme="dark"] .el-dialog__title,
html[data-theme="dark"] .el-dialog__body,
html[data-theme="dark"] .el-form-item__label {
    color: #dceaf5 !important;
}

/* 分割线与表格 */
html[data-theme="dark"] hr,
html[data-theme="dark"] .latest-content-header,
html[data-theme="dark"] .ranking-content-header,
html[data-theme="dark"] .latest-pagination {
    border-color: #21465d !important;
}
html[data-theme="dark"] table,
html[data-theme="dark"] th,
html[data-theme="dark"] td {
    border-color: #21465d !important;
    color: #dceaf5 !important;
}

/* 过渡避免切换时闪白 */
html[data-theme="dark"] #app,
html[data-theme="dark"] .top-nav-box,
html[data-theme="dark"] .search-section,
html[data-theme="dark"] .stats-section,
html[data-theme="dark"] .ranking-content,
html[data-theme="dark"] .latest-content {
    transition: background-color .25s ease, color .25s ease, border-color .25s ease;
}


/* 两种主题：白天模式变量（与夜间模式互斥） */
[data-theme="light"] {
    --theme-primary: #258bff;
    --theme-primary-light: #20c7b8;
    --theme-primary-gradient: linear-gradient(110deg, #268bff 0%, #20cbbd 100%);
    --theme-primary-hover: #087bdc;
    --theme-secondary-gradient: linear-gradient(110deg, #168cff 0%, #20c7b8 100%);
    --theme-tertiary-gradient: linear-gradient(110deg, #20c7b8 0%, #36d6b4 100%);
    --theme-background: #f5f8fb;
    --theme-surface: #ffffff;
    --theme-card: #f7fbff;
    --theme-card-gradient: linear-gradient(135deg, #ffffff 0%, #f4f9fd 100%);
    --theme-text: #233d55;
    --theme-text-secondary: #66829e;
    --theme-text-muted: #8ba2b8;
    --theme-border: #dceaf4;
    --theme-color: #233d55;
    --theme-other_background: #f5f8fb;
    --theme-theme: #258bff;
    --theme-text-light: #66829e;
}
