/* 学生首页配色方案 — 通过 html[data-student-dashboard-theme] 覆盖变量 */

html[data-student-dashboard-theme="mid"] .student-dashboard,
html:not([data-student-dashboard-theme]) .student-dashboard {
    /* 默认：中学稳重（与 student-dashboard.css 一致） */
}

/* 教育暖色：亲和、略活泼，适合初中低年级 */
html[data-student-dashboard-theme="warm"] .student-dashboard {
    --sd-text: #3d3429;
    --sd-text-muted: #7a6f63;
    --sd-border: #f0e6dc;
    --sd-border-soft: #f5ebe3;
    --sd-accent: #c45c4a;
    --sd-accent-hover: #a84a3a;
    --sd-accent-soft: rgba(196, 92, 74, 0.1);
    --sd-secondary: #3d9b8f;
    --sd-secondary-soft: rgba(61, 155, 143, 0.1);
    --sd-highlight: #d48806;
    --sd-page-bg: linear-gradient(165deg, #fff9f5 0%, #fff5eb 45%, #fef0e4 100%);
    --sd-welcome-bar: linear-gradient(180deg, #e8a090 0%, #c45c4a 100%);
    --sd-welcome-glow: rgba(196, 92, 74, 0.08);
    --sd-icon-bg: #c45c4a;
    --sd-name-color: #c45c4a;
    --sd-metric-1: #c45c4a;
    --sd-metric-2: #d48806;
    --sd-metric-3: #3d9b8f;
    --sd-metric-4: #d4a574;
    --sd-section-icon-bg: #c45c4a;
    --sd-todo-icon: #d48806;
    --sd-growth-2: #d48806;
    --sd-notif-border: rgba(196, 92, 74, 0.12);
    --sd-badge-bg: #c45c4a;
    --sd-unread-dot: #c45c4a;
}

html[data-student-dashboard-theme="warm"] .student-dashboard {
    background: var(--sd-page-bg);
}

html[data-student-dashboard-theme="warm"] .student-dashboard__welcome::before {
    background: var(--sd-welcome-bar);
}

html[data-student-dashboard-theme="warm"] .student-dashboard__welcome::after {
    background: radial-gradient(circle, var(--sd-welcome-glow) 0%, transparent 70%);
}

html[data-student-dashboard-theme="warm"] .student-dashboard__welcome h1 i {
    background: var(--sd-icon-bg);
    box-shadow: 0 2px 10px rgba(196, 92, 74, 0.28);
}

html[data-student-dashboard-theme="warm"] .student-dashboard__welcome h1 #studentName {
    color: var(--sd-name-color);
}

html[data-student-dashboard-theme="warm"] .student-dashboard__section-title i {
    background: var(--sd-section-icon-bg);
}

html[data-student-dashboard-theme="warm"] .student-dashboard__todo-header h2 i {
    color: var(--sd-todo-icon);
}

html[data-student-dashboard-theme="warm"] .student-dashboard__metric:nth-child(1)::before { background: var(--sd-metric-1); }
html[data-student-dashboard-theme="warm"] .student-dashboard__metric:nth-child(2)::before { background: var(--sd-metric-2); }
html[data-student-dashboard-theme="warm"] .student-dashboard__metric:nth-child(3)::before { background: var(--sd-metric-3); }
html[data-student-dashboard-theme="warm"] .student-dashboard__metric:nth-child(4)::before { background: var(--sd-metric-4); }

html[data-student-dashboard-theme="warm"] .student-dashboard__metric:nth-child(1) .student-dashboard__metric-label i {
    background: #fde8e4; color: var(--sd-metric-1);
}
html[data-student-dashboard-theme="warm"] .student-dashboard__metric:nth-child(2) .student-dashboard__metric-label i {
    background: #fff4e0; color: var(--sd-metric-2);
}
html[data-student-dashboard-theme="warm"] .student-dashboard__metric:nth-child(3) .student-dashboard__metric-label i {
    background: #e6f5f3; color: var(--sd-metric-3);
}
html[data-student-dashboard-theme="warm"] .student-dashboard__metric:nth-child(4) .student-dashboard__metric-label i {
    background: #faf0e6; color: var(--sd-metric-4);
}

html[data-student-dashboard-theme="warm"] .student-dashboard__growth-item:nth-child(2) .student-dashboard__growth-value {
    color: var(--sd-growth-2);
}

html[data-student-dashboard-theme="warm"] .student-dashboard .notifications-section {
    border-color: var(--sd-notif-border);
}

html[data-student-dashboard-theme="warm"] .student-dashboard .unread-badge,
html[data-student-dashboard-theme="warm"] .student-dashboard .unread-dot {
    background: var(--sd-badge-bg);
}

/* 校园蓝：清爽、偏政务/校园信息化 */
html[data-student-dashboard-theme="campus"] .student-dashboard {
    --sd-text: #1f2937;
    --sd-text-muted: #5b6573;
    --sd-border: #d8e2ef;
    --sd-border-soft: #e8eef5;
    --sd-accent: #1e5a8e;
    --sd-accent-hover: #164770;
    --sd-accent-soft: rgba(30, 90, 142, 0.08);
    --sd-secondary: #2a7f62;
    --sd-secondary-soft: rgba(42, 127, 98, 0.08);
    --sd-highlight: #3b82c4;
    --sd-page-bg: #eef3f8;
    --sd-welcome-bar: linear-gradient(180deg, #4a8fc4 0%, #1e5a8e 100%);
    --sd-welcome-glow: rgba(30, 90, 142, 0.06);
    --sd-icon-bg: #1e5a8e;
    --sd-name-color: #1e5a8e;
    --sd-metric-1: #1e5a8e;
    --sd-metric-2: #3b82c4;
    --sd-metric-3: #2a7f62;
    --sd-metric-4: #64748b;
    --sd-section-icon-bg: #475569;
    --sd-todo-icon: #3b82c4;
    --sd-growth-2: #3b82c4;
    --sd-notif-border: rgba(30, 90, 142, 0.12);
    --sd-badge-bg: #1e5a8e;
}

html[data-student-dashboard-theme="campus"] .student-dashboard {
    background: var(--sd-page-bg);
}

html[data-student-dashboard-theme="campus"] .student-dashboard__welcome::before {
    background: var(--sd-welcome-bar);
}

html[data-student-dashboard-theme="campus"] .student-dashboard__welcome::after {
    background: radial-gradient(circle, var(--sd-welcome-glow) 0%, transparent 70%);
}

html[data-student-dashboard-theme="campus"] .student-dashboard__welcome h1 i {
    background: var(--sd-icon-bg);
    box-shadow: 0 2px 8px rgba(30, 90, 142, 0.22);
}

html[data-student-dashboard-theme="campus"] .student-dashboard__welcome h1 #studentName {
    color: var(--sd-name-color);
}

html[data-student-dashboard-theme="campus"] .student-dashboard__section-title i {
    background: var(--sd-section-icon-bg);
}

html[data-student-dashboard-theme="campus"] .student-dashboard__todo-header h2 i {
    color: var(--sd-todo-icon);
}

html[data-student-dashboard-theme="campus"] .student-dashboard__metric:nth-child(1)::before { background: var(--sd-metric-1); }
html[data-student-dashboard-theme="campus"] .student-dashboard__metric:nth-child(2)::before { background: var(--sd-metric-2); }
html[data-student-dashboard-theme="campus"] .student-dashboard__metric:nth-child(3)::before { background: var(--sd-metric-3); }
html[data-student-dashboard-theme="campus"] .student-dashboard__metric:nth-child(4)::before { background: var(--sd-metric-4); }

html[data-student-dashboard-theme="campus"] .student-dashboard__metric:nth-child(1) .student-dashboard__metric-label i {
    background: #e3eef8; color: var(--sd-metric-1);
}
html[data-student-dashboard-theme="campus"] .student-dashboard__metric:nth-child(2) .student-dashboard__metric-label i {
    background: #e8f2fa; color: var(--sd-metric-2);
}
html[data-student-dashboard-theme="campus"] .student-dashboard__metric:nth-child(3) .student-dashboard__metric-label i {
    background: #e5f3ee; color: var(--sd-metric-3);
}
html[data-student-dashboard-theme="campus"] .student-dashboard__metric:nth-child(4) .student-dashboard__metric-label i {
    background: #eef1f5; color: var(--sd-metric-4);
}

html[data-student-dashboard-theme="campus"] .student-dashboard__quick-btn:nth-child(2) i { background: #e3eef8; color: #1e5a8e; }
html[data-student-dashboard-theme="campus"] .student-dashboard__quick-btn:nth-child(3) i { background: #eef1f5; color: #64748b; }
html[data-student-dashboard-theme="campus"] .student-dashboard__quick-btn:nth-child(4) i { background: #e5f3ee; color: #2a7f62; }

html[data-student-dashboard-theme="campus"] .student-dashboard__growth-item:nth-child(2) .student-dashboard__growth-value {
    color: var(--sd-growth-2);
}

html[data-student-dashboard-theme="campus"] .student-dashboard .notifications-section {
    border-color: var(--sd-notif-border);
}

html[data-student-dashboard-theme="campus"] .student-dashboard .unread-badge,
html[data-student-dashboard-theme="campus"] .student-dashboard .unread-dot {
    background: var(--sd-badge-bg);
}

/* 素墨灰：极简、高年级 / 专注学习 */
html[data-student-dashboard-theme="ink"] .student-dashboard {
    --sd-text: #262626;
    --sd-text-muted: #737373;
    --sd-border: #e0e0e0;
    --sd-border-soft: #ebebeb;
    --sd-accent: #404040;
    --sd-accent-hover: #262626;
    --sd-accent-soft: rgba(64, 64, 64, 0.08);
    --sd-secondary: #525252;
    --sd-secondary-soft: rgba(82, 82, 82, 0.08);
    --sd-highlight: #595959;
    --sd-page-bg: #f5f5f5;
    --sd-welcome-bar: #525252;
    --sd-welcome-glow: rgba(0, 0, 0, 0.04);
    --sd-icon-bg: #404040;
    --sd-name-color: #262626;
    --sd-metric-1: #404040;
    --sd-metric-2: #595959;
    --sd-metric-3: #525252;
    --sd-metric-4: #737373;
    --sd-section-icon-bg: #525252;
    --sd-todo-icon: #595959;
    --sd-notif-border: rgba(0, 0, 0, 0.08);
    --sd-badge-bg: #404040;
}

html[data-student-dashboard-theme="ink"] .student-dashboard {
    background: var(--sd-page-bg);
}

html[data-student-dashboard-theme="ink"] .student-dashboard__welcome::before {
    background: var(--sd-welcome-bar);
}

html[data-student-dashboard-theme="ink"] .student-dashboard__welcome::after {
    background: radial-gradient(circle, var(--sd-welcome-glow) 0%, transparent 70%);
}

html[data-student-dashboard-theme="ink"] .student-dashboard__welcome h1 i {
    background: var(--sd-icon-bg);
    box-shadow: none;
    border-radius: 8px;
}

html[data-student-dashboard-theme="ink"] .student-dashboard__welcome h1 #studentName {
    color: var(--sd-name-color);
}

html[data-student-dashboard-theme="ink"] .student-dashboard__section-title i {
    background: var(--sd-section-icon-bg);
}

html[data-student-dashboard-theme="ink"] .student-dashboard__metric:nth-child(1)::before,
html[data-student-dashboard-theme="ink"] .student-dashboard__metric:nth-child(2)::before,
html[data-student-dashboard-theme="ink"] .student-dashboard__metric:nth-child(3)::before,
html[data-student-dashboard-theme="ink"] .student-dashboard__metric:nth-child(4)::before {
    background: var(--sd-border);
    height: 2px;
}

html[data-student-dashboard-theme="ink"] .student-dashboard__metric:nth-child(n) .student-dashboard__metric-label i {
    background: #ebebeb;
    color: #525252;
}

html[data-student-dashboard-theme="ink"] .student-dashboard .unread-badge,
html[data-student-dashboard-theme="ink"] .student-dashboard .unread-dot {
    background: var(--sd-badge-bg);
}

/* 设置页：配色预览卡片 */
.student-theme-picker {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 14px;
    margin-top: 12px;
}

.student-theme-card {
    border: 2px solid #e8e8e8;
    border-radius: 12px;
    padding: 0;
    cursor: pointer;
    background: #fff;
    text-align: left;
    transition: border-color 0.2s, box-shadow 0.2s;
    overflow: hidden;
}

.student-theme-card:hover {
    border-color: #bbb;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.student-theme-card.is-selected {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

.student-theme-card__swatch {
    height: 56px;
    display: flex;
}

.student-theme-card__swatch span {
    flex: 1;
}

.student-theme-card__body {
    padding: 10px 12px 12px;
}

.student-theme-card__title {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin: 0 0 4px;
}

.student-theme-card__desc {
    font-size: 12px;
    color: #888;
    margin: 0;
    line-height: 1.35;
}

.student-theme-card[data-theme-id="mid"] .student-theme-card__swatch {
    background: linear-gradient(90deg, #8b4d3b 0%, #f3f1ed 50%, #2d5c5c 100%);
}

.student-theme-card[data-theme-id="warm"] .student-theme-card__swatch {
    background: linear-gradient(90deg, #c45c4a 0%, #fff5eb 50%, #3d9b8f 100%);
}

.student-theme-card[data-theme-id="campus"] .student-theme-card__swatch {
    background: linear-gradient(90deg, #1e5a8e 0%, #eef3f8 50%, #2a7f62 100%);
}

.student-theme-card[data-theme-id="ink"] .student-theme-card__swatch {
    background: linear-gradient(90deg, #404040 0%, #f5f5f5 50%, #737373 100%);
}

/* ========== 学生端全局壳层：侧边栏 + 主内容区（与首页配色联动） ========== */
/* 默认 mid：与中学稳重首页一致 */
html[data-student-dashboard-theme="mid"],
html:not([data-student-dashboard-theme]) {
    --sd-text: #2c2825;
    --sd-text-muted: #6b6560;
    --sd-border: #e3ded6;
    --sd-border-soft: #ebe7e0;
    --sd-accent: #8b4d3b;
    --sd-accent-soft: rgba(139, 77, 59, 0.08);
    --sd-surface: #ffffff;
    --student-shell-primary: #8b4d3b;
    --student-shell-primary-light: #a67c6a;
    --student-shell-secondary: #2d5c5c;
    --student-shell-page-bg: #f3f1ed;
    --sidebar-bg: #2a2622;
    --sidebar-text: #f5f2ee;
    --sidebar-hover-bg: rgba(139, 77, 59, 0.22);
    --sidebar-active-bg: #8b4d3b;
    --sidebar-active-text: #ffffff;
    --sidebar-group-title-color: rgba(245, 242, 238, 0.52);
    --sidebar-border-color: rgba(255, 255, 255, 0.08);
    --primary: #8b4d3b;
    --primary-light: #a67c6a;
    --primary-dark: #6f3d2f;
    --primary-hover: #a67c6a;
    --primary-active: #6f3d2f;
}

html[data-student-dashboard-theme="warm"] {
    --sd-text: #3d3429;
    --sd-text-muted: #7a6f63;
    --sd-border: #f0e6dc;
    --sd-border-soft: #f5ebe3;
    --sd-accent: #c45c4a;
    --sd-accent-soft: rgba(196, 92, 74, 0.1);
    --sd-surface: #ffffff;
    --student-shell-primary: #c45c4a;
    --student-shell-primary-light: #e8a090;
    --student-shell-secondary: #3d9b8f;
    --student-shell-page-bg: #fff5eb;
    --sidebar-bg: #3d2a26;
    --sidebar-text: #fff8f5;
    --sidebar-hover-bg: rgba(196, 92, 74, 0.24);
    --sidebar-active-bg: #c45c4a;
    --sidebar-active-text: #ffffff;
    --sidebar-group-title-color: rgba(255, 248, 245, 0.5);
    --sidebar-border-color: rgba(255, 255, 255, 0.09);
    --primary: #c45c4a;
    --primary-light: #e8a090;
    --primary-dark: #a84a3a;
    --primary-hover: #e8a090;
    --primary-active: #a84a3a;
}

html[data-student-dashboard-theme="campus"] {
    --sd-text: #1f2937;
    --sd-text-muted: #5b6573;
    --sd-border: #d8e2ef;
    --sd-border-soft: #e8eef5;
    --sd-accent: #1e5a8e;
    --sd-accent-soft: rgba(30, 90, 142, 0.08);
    --sd-surface: #ffffff;
    --student-shell-primary: #1e5a8e;
    --student-shell-primary-light: #4a8fc4;
    --student-shell-secondary: #2a7f62;
    --student-shell-page-bg: #eef3f8;
    --sidebar-bg: #152a3d;
    --sidebar-text: #eef4fa;
    --sidebar-hover-bg: rgba(59, 130, 196, 0.22);
    --sidebar-active-bg: #1e5a8e;
    --sidebar-active-text: #ffffff;
    --sidebar-group-title-color: rgba(238, 244, 250, 0.5);
    --sidebar-border-color: rgba(255, 255, 255, 0.1);
    --primary: #1e5a8e;
    --primary-light: #4a8fc4;
    --primary-dark: #164770;
    --primary-hover: #4a8fc4;
    --primary-active: #164770;
}

html[data-student-dashboard-theme="ink"] {
    --sd-text: #262626;
    --sd-text-muted: #737373;
    --sd-border: #e0e0e0;
    --sd-border-soft: #ebebeb;
    --sd-accent: #404040;
    --sd-accent-soft: rgba(64, 64, 64, 0.08);
    --sd-surface: #ffffff;
    --student-shell-primary: #404040;
    --student-shell-primary-light: #5c5c5c;
    --student-shell-secondary: #525252;
    --student-shell-page-bg: #f5f5f5;
    --sidebar-bg: #1f1f1f;
    --sidebar-text: #f0f0f0;
    --sidebar-hover-bg: rgba(255, 255, 255, 0.08);
    --sidebar-active-bg: #404040;
    --sidebar-active-text: #ffffff;
    --sidebar-group-title-color: rgba(240, 240, 240, 0.45);
    --sidebar-border-color: rgba(255, 255, 255, 0.08);
    --primary: #404040;
    --primary-light: #5c5c5c;
    --primary-dark: #262626;
    --primary-hover: #5c5c5c;
    --primary-active: #262626;
}

/* 主内容区背景（非首页的列表/设置等页面） */
html[data-student-dashboard-theme] body .app-container > .main-content {
    background: var(--student-shell-page-bg);
    min-height: 100vh;
}

/* 侧边栏细节：滚动条、分组标题、描述文字 */
html[data-student-dashboard-theme] .sidebar {
    box-shadow: 2px 0 16px rgba(0, 0, 0, 0.12);
}

html[data-student-dashboard-theme] .sidebar-nav::-webkit-scrollbar-thumb {
    background: color-mix(in srgb, var(--student-shell-primary) 35%, transparent);
}

html[data-student-dashboard-theme] .sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: color-mix(in srgb, var(--student-shell-primary) 55%, transparent);
}

@supports not (background: color-mix(in srgb, red, blue)) {
    html[data-student-dashboard-theme="mid"] .sidebar-nav::-webkit-scrollbar-thumb,
    html:not([data-student-dashboard-theme]) .sidebar-nav::-webkit-scrollbar-thumb {
        background: rgba(139, 77, 59, 0.35);
    }
    html[data-student-dashboard-theme="warm"] .sidebar-nav::-webkit-scrollbar-thumb {
        background: rgba(196, 92, 74, 0.35);
    }
    html[data-student-dashboard-theme="campus"] .sidebar-nav::-webkit-scrollbar-thumb {
        background: rgba(30, 90, 142, 0.35);
    }
    html[data-student-dashboard-theme="ink"] .sidebar-nav::-webkit-scrollbar-thumb {
        background: rgba(255, 255, 255, 0.2);
    }
}

html[data-student-dashboard-theme] .nav-group-title {
    color: var(--sidebar-group-title-color) !important;
}

html[data-student-dashboard-theme] .nav-divider {
    background: var(--sidebar-border-color) !important;
}

html[data-student-dashboard-theme] .nav-item .nav-desc {
    color: rgba(255, 255, 255, 0.42) !important;
}

html[data-student-dashboard-theme] .nav-item:hover .nav-desc,
html[data-student-dashboard-theme] .nav-item.active .nav-desc {
    color: rgba(255, 255, 255, 0.62) !important;
}

html[data-student-dashboard-theme] .nav-item:hover {
    border-left-color: var(--student-shell-primary-light) !important;
}

html[data-student-dashboard-theme] .nav-item.active {
    border-left-color: #fff !important;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

html[data-student-dashboard-theme] .sidebar-user {
    border-top: 1px solid var(--sidebar-border-color);
}

html[data-student-dashboard-theme] .sidebar-user .user-info:hover,
html[data-student-dashboard-theme] .sidebar-user .user-info.active {
    background: var(--sidebar-hover-bg) !important;
}

html[data-student-dashboard-theme] .sidebar-toggle {
    border-color: var(--sidebar-border-color);
    color: var(--student-shell-primary);
}

html[data-student-dashboard-theme] .sidebar-toggle:hover {
    background: var(--student-shell-page-bg);
    color: var(--student-shell-primary-dark, var(--primary-dark));
}

/* 整站深色模式时：略加深侧栏，保留色相 */
html[data-theme="dark"][data-student-dashboard-theme="mid"] .sidebar,
html[data-theme="dark"]:not([data-student-dashboard-theme]) .sidebar {
    --sidebar-bg: #1e1b18;
}

html[data-theme="dark"][data-student-dashboard-theme="warm"] .sidebar {
    --sidebar-bg: #2a1e1a;
}

html[data-theme="dark"][data-student-dashboard-theme="campus"] .sidebar {
    --sidebar-bg: #0f1f2e;
}

html[data-theme="dark"][data-student-dashboard-theme="ink"] .sidebar {
    --sidebar-bg: #141414;
}