/* ======================================================
   V3.1.3 完整主题系统
   包含: 默认 · 暗夜 · 清新 · 暖阳 · 极客
   特性: 线性颗粒点阵 + 渐变色哑光 + 毛玻璃
   ====================================================== */

/* ========== CSS 变量 - 主题系统 ========== */
:root {
    /* 默认主题 (蓝白) */
    --bg-gradient: linear-gradient(145deg, #f0f4fc 0%, #e8edf8 100%);
    --primary-gradient: linear-gradient(135deg, #2563eb, #7c3aed);
    --card-bg: rgba(255, 255, 255, 0.65);
    --card-border: rgba(255, 255, 255, 0.5);
    --card-shadow: 0 12px 40px rgba(0, 20, 40, 0.08);
    --text-primary: #0f2b5b;
    --text-secondary: #334155;
    --text-muted: #94a3b8;
    --sidebar-bg: rgba(255, 255, 255, 0.75);
    --sidebar-border: rgba(255, 255, 255, 0.6);
    --nav-hover: rgba(37, 99, 235, 0.06);
    --nav-active: rgba(37, 99, 235, 0.10);
    --nav-active-border: #2563eb;
    --stat-bg: rgba(255, 255, 255, 0.6);
    --table-bg: rgba(255, 255, 255, 0.55);
    --table-row-bg: rgba(255, 255, 255, 0.7);
    --table-row-hover: rgba(255, 255, 255, 0.9);
    --input-bg: rgba(255, 255, 255, 0.6);
    --input-focus-border: #2563eb;
    --input-focus-shadow: rgba(37, 99, 235, 0.12);
    --btn-soft-bg: rgba(255, 255, 255, 0.7);
    --btn-soft-hover: white;
    --btn-primary-soft: rgba(37, 99, 235, 0.12);
    --btn-primary-soft-hover: rgba(37, 99, 235, 0.2);
    --btn-success-soft: rgba(34, 197, 94, 0.12);
    --btn-danger-soft: rgba(239, 68, 68, 0.10);
    --btn-warning-soft: rgba(234, 179, 8, 0.12);
    --modal-bg: rgba(255, 255, 255, 0.85);
    --modal-border: rgba(255, 255, 255, 0.4);
    --glass-blur: 12px;
    --glass-saturate: 180%;
}

/* ========== 暗夜主题 ========== */
body.theme-dark {
    --bg-gradient: linear-gradient(145deg, #0f0f1a 0%, #1a1a2e 100%);
    --primary-gradient: linear-gradient(135deg, #00d4ff, #7c3aed);
    --card-bg: rgba(30, 30, 60, 0.65);
    --card-border: rgba(255, 255, 255, 0.08);
    --card-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
    --text-primary: #e0e0e0;
    --text-secondary: #a0aec0;
    --text-muted: #4a5568;
    --sidebar-bg: rgba(20, 20, 40, 0.85);
    --sidebar-border: rgba(255, 255, 255, 0.05);
    --nav-hover: rgba(0, 212, 255, 0.08);
    --nav-active: rgba(0, 212, 255, 0.15);
    --nav-active-border: #00d4ff;
    --stat-bg: rgba(30, 30, 60, 0.6);
    --table-bg: rgba(30, 30, 60, 0.55);
    --table-row-bg: rgba(40, 40, 70, 0.7);
    --table-row-hover: rgba(60, 60, 90, 0.9);
    --input-bg: rgba(40, 40, 70, 0.6);
    --input-focus-border: #00d4ff;
    --input-focus-shadow: rgba(0, 212, 255, 0.15);
    --btn-soft-bg: rgba(60, 60, 90, 0.7);
    --btn-soft-hover: rgba(80, 80, 110, 0.9);
    --btn-primary-soft: rgba(0, 212, 255, 0.12);
    --btn-primary-soft-hover: rgba(0, 212, 255, 0.25);
    --btn-success-soft: rgba(34, 197, 94, 0.15);
    --btn-danger-soft: rgba(239, 68, 68, 0.15);
    --btn-warning-soft: rgba(234, 179, 8, 0.15);
    --modal-bg: rgba(30, 30, 60, 0.85);
    --modal-border: rgba(255, 255, 255, 0.08);
    --glass-blur: 16px;
    --glass-saturate: 150%;
}

/* ========== 清新主题 ========== */
body.theme-fresh {
    --bg-gradient: linear-gradient(145deg, #e8f5e9 0%, #c8e6c9 100%);
    --primary-gradient: linear-gradient(135deg, #2e7d32, #43a047);
    --card-bg: rgba(255, 255, 255, 0.6);
    --card-border: rgba(255, 255, 255, 0.5);
    --text-primary: #1b5e20;
    --text-secondary: #2e7d32;
    --sidebar-bg: rgba(255, 255, 255, 0.7);
    --nav-active: rgba(46, 125, 50, 0.1);
    --nav-active-border: #2e7d32;
    --stat-bg: rgba(255, 255, 255, 0.6);
    --table-row-bg: rgba(255, 255, 255, 0.7);
    --input-bg: rgba(255, 255, 255, 0.6);
    --input-focus-border: #2e7d32;
    --input-focus-shadow: rgba(46, 125, 50, 0.12);
    --btn-primary-soft: rgba(46, 125, 50, 0.12);
    --btn-primary-soft-hover: rgba(46, 125, 50, 0.2);
}

/* ========== 暖阳主题 ========== */
body.theme-warm {
    --bg-gradient: linear-gradient(145deg, #fff3e0 0%, #ffe0b2 100%);
    --primary-gradient: linear-gradient(135deg, #ef6c00, #f57c00);
    --card-bg: rgba(255, 255, 255, 0.6);
    --card-border: rgba(255, 255, 255, 0.5);
    --text-primary: #e65100;
    --text-secondary: #bf360c;
    --sidebar-bg: rgba(255, 255, 255, 0.7);
    --nav-active: rgba(239, 108, 0, 0.1);
    --nav-active-border: #ef6c00;
    --stat-bg: rgba(255, 255, 255, 0.6);
    --table-row-bg: rgba(255, 255, 255, 0.7);
    --input-bg: rgba(255, 255, 255, 0.6);
    --input-focus-border: #ef6c00;
    --input-focus-shadow: rgba(239, 108, 0, 0.12);
    --btn-primary-soft: rgba(239, 108, 0, 0.12);
    --btn-primary-soft-hover: rgba(239, 108, 0, 0.2);
}

/* ========== 极客主题 ========== */
body.theme-geek {
    --bg-gradient: linear-gradient(145deg, #f3e5f5 0%, #e1bee7 100%);
    --primary-gradient: linear-gradient(135deg, #6a1b9a, #ab47bc);
    --card-bg: rgba(255, 255, 255, 0.6);
    --card-border: rgba(255, 255, 255, 0.5);
    --text-primary: #4a148c;
    --text-secondary: #6a1b9a;
    --sidebar-bg: rgba(255, 255, 255, 0.7);
    --nav-active: rgba(106, 27, 154, 0.1);
    --nav-active-border: #6a1b9a;
    --stat-bg: rgba(255, 255, 255, 0.6);
    --table-row-bg: rgba(255, 255, 255, 0.7);
    --input-bg: rgba(255, 255, 255, 0.6);
    --input-focus-border: #6a1b9a;
    --input-focus-shadow: rgba(106, 27, 154, 0.12);
    --btn-primary-soft: rgba(106, 27, 154, 0.12);
    --btn-primary-soft-hover: rgba(106, 27, 154, 0.2);
}

/* ========== 全局基础样式 ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', 'Segoe UI', 'PingFang SC', Roboto, sans-serif;
    background: var(--bg-gradient);
    /* 线性颗粒点阵 - 核心视觉效果 */
    background-image: 
        radial-gradient(circle at 20% 30%, rgba(255,255,255,0.03) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(255,255,255,0.02) 0%, transparent 50%),
        linear-gradient(rgba(200, 212, 230, 0.08) 1px, transparent 1px),
        linear-gradient(90deg, rgba(200, 212, 230, 0.08) 1px, transparent 1px);
    background-size: 100% 100%, 100% 100%, 24px 24px, 24px 24px;
    color: var(--text-secondary);
    line-height: 1.6;
    min-height: 100vh;
    transition: background 0.4s ease;
}

/* ========== 毛玻璃卡片 ========== */
.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
    border: 1px solid var(--card-border);
    border-radius: 24px;
    box-shadow: var(--card-shadow);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.glass-card:hover {
    box-shadow: 0 20px 60px rgba(0, 20, 40, 0.12);
    transform: translateY(-3px);
    border-color: rgba(255, 255, 255, 0.7);
}

body.theme-dark .glass-card:hover {
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

/* ========== 侧边栏 ========== */
.sidebar {
    background: var(--sidebar-bg);
    backdrop-filter: blur(16px) saturate(200%);
    -webkit-backdrop-filter: blur(16px) saturate(200%);
    border-right: 1px solid var(--sidebar-border);
    width: 260px;
    min-height: 100vh;
    padding: 2rem 1rem;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.03);
}

.sidebar .brand {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    padding: 0 0.5rem 2rem 0.5rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar .brand i {
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar .nav-link {
    color: var(--text-secondary);
    font-weight: 500;
    padding: 0.75rem 1rem;
    border-radius: 14px;
    margin-bottom: 0.25rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
}

.sidebar .nav-link i {
    width: 1.5rem;
    text-align: center;
    font-size: 1.1rem;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.sidebar .nav-link:hover {
    background: var(--nav-hover);
    color: var(--text-primary);
    transform: translateX(4px);
}

.sidebar .nav-link:hover i {
    opacity: 1;
}

.sidebar .nav-link.active {
    background: var(--nav-active);
    color: var(--text-primary);
    font-weight: 600;
    box-shadow: inset 3px 0 0 var(--nav-active-border);
}

.sidebar .nav-link.active i {
    opacity: 1;
}

.sidebar-footer {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(0, 0, 0, 0.04);
    font-size: 0.85rem;
    color: var(--text-muted);
}

body.theme-dark .sidebar-footer {
    border-top-color: rgba(255, 255, 255, 0.05);
}

/* ========== 主内容 ========== */
.main-content {
    margin-left: 260px;
    padding: 2rem 2.5rem;
    min-height: 100vh;
}

/* ========== 顶部栏 ========== */
.top-bar {
    background: var(--card-bg);
    backdrop-filter: blur(8px);
    border-radius: 20px;
    padding: 0.75rem 1.5rem;
    margin-bottom: 2rem;
    border: 1px solid var(--card-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.02);
}

.top-bar .page-title {
    font-weight: 600;
    font-size: 1.25rem;
    color: var(--text-primary);
}

.top-bar .user-badge {
    background: rgba(255, 255, 255, 0.5);
    padding: 0.3rem 1rem 0.3rem 1.5rem;
    border-radius: 40px;
    border: 1px solid rgba(0, 0, 0, 0.03);
}

body.theme-dark .top-bar .user-badge {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.05);
}

/* ========== 统计卡片 ========== */
.stat-card {
    background: var(--stat-bg);
    backdrop-filter: blur(8px);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 1.5rem 1.5rem 1.2rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.stat-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 16px 48px rgba(0, 20, 40, 0.08);
    border-color: rgba(255, 255, 255, 0.8);
}

body.theme-dark .stat-card:hover {
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.3);
}

.stat-card .number {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.stat-card .label {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
}

.stat-card .icon {
    font-size: 2.5rem;
    opacity: 0.4;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* ========== 表格 ========== */
.table-wrapper {
    background: var(--table-bg);
    backdrop-filter: blur(8px);
    border-radius: 20px;
    border: 1px solid var(--card-border);
    padding: 1.5rem;
    overflow-x: auto;
}

.table {
    font-size: 0.95rem;
    border-collapse: separate;
    border-spacing: 0 6px;
    margin-bottom: 0;
}

.table thead th {
    background: rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(4px);
    border: none;
    font-weight: 600;
    color: var(--text-primary);
    padding: 0.9rem 0.8rem;
    border-radius: 12px 12px 0 0;
}

body.theme-dark .table thead th {
    background: rgba(255, 255, 255, 0.05);
}

.table tbody tr {
    background: var(--table-row-bg);
    backdrop-filter: blur(4px);
    border-radius: 12px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
}

.table tbody tr:hover {
    background: var(--table-row-hover);
    transform: scale(1.01);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.04);
}

body.theme-dark .table tbody tr:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.table tbody td {
    border: none;
    padding: 0.9rem 0.8rem;
    vertical-align: middle;
}

/* ========== 按钮 ========== */
.btn-soft {
    border-radius: 40px;
    padding: 0.45rem 1.2rem;
    font-weight: 500;
    border: none;
    background: var(--btn-soft-bg);
    backdrop-filter: blur(4px);
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.btn-soft:hover {
    background: var(--btn-soft-hover);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
    transform: translateY(-1px);
}

.btn-primary-soft {
    background: var(--btn-primary-soft);
    color: var(--nav-active-border);
}
.btn-primary-soft:hover {
    background: var(--btn-primary-soft-hover);
}

.btn-success-soft {
    background: var(--btn-success-soft);
    color: #16a34a;
}
.btn-success-soft:hover {
    background: rgba(34, 197, 94, 0.2);
}

.btn-danger-soft {
    background: var(--btn-danger-soft);
    color: #dc2626;
}
.btn-danger-soft:hover {
    background: rgba(239, 68, 68, 0.2);
}

.btn-warning-soft {
    background: var(--btn-warning-soft);
    color: #ca8a04;
}
.btn-warning-soft:hover {
    background: rgba(234, 179, 8, 0.2);
}

/* ========== 表单 ========== */
.form-control,
.form-select {
    border-radius: 14px;
    border: 1px solid rgba(0, 0, 0, 0.04);
    background: var(--input-bg);
    backdrop-filter: blur(4px);
    padding: 0.6rem 1rem;
    transition: all 0.2s ease;
    color: var(--text-secondary);
}

body.theme-dark .form-control,
body.theme-dark .form-select {
    border-color: rgba(255, 255, 255, 0.05);
    color: #e0e0e0;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--input-focus-border);
    box-shadow: 0 0 0 4px var(--input-focus-shadow);
    background: rgba(255, 255, 255, 0.8);
}

body.theme-dark .form-control:focus,
body.theme-dark .form-select:focus {
    background: rgba(40, 40, 70, 0.8);
}

/* ========== 模态框 ========== */
.modal-content {
    background: var(--modal-bg);
    backdrop-filter: blur(20px);
    border-radius: 24px;
    border: 1px solid var(--modal-border);
}

/* ========== 广告卡片（预览） ========== */
.ad-card {
    border-radius: 16px;
    padding: 12px 16px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.02);
    transition: all 0.3s ease;
    cursor: pointer;
    border: 1px solid rgba(0, 0, 0, 0.02);
    background: rgba(255, 255, 255, 0.5);
}

.ad-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
}

.ad-card .ad-icon {
    font-size: 0.7rem;
    background: linear-gradient(135deg, #ff6b6b, #ee5a24);
    color: white;
    padding: 0.15rem 0.6rem;
    border-radius: 20px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

/* ========== 滚动公告预览 ========== */
.marquee-preview {
    background: var(--marquee-bg, #f0f4fc);
    color: var(--marquee-color, #1a237e);
    padding: 8px 16px;
    border-radius: 12px;
    overflow: hidden;
    white-space: nowrap;
    font-size: 0.95rem;
}

/* ========== 登录页 ========== */
.login-card {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    border-radius: 32px;
    border: 1px solid var(--card-border);
    padding: 2.5rem;
    max-width: 420px;
    margin: auto;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.04);
}

body.theme-dark .login-card {
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.3);
}

/* ========== 响应式 ========== */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        position: relative;
        min-height: auto;
        padding: 1rem;
    }
    .main-content {
        margin-left: 0;
        padding: 1rem;
    }
    .top-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }
    .stat-card .number {
        font-size: 1.6rem;
    }
}

/* ========== 滚动条美化 ========== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.02);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.2);
}

body.theme-dark ::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
}
body.theme-dark ::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ========== 渐变色文本工具类 ========== */
.text-gradient {
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* ========== 徽章 ========== */
.badge {
    font-weight: 500;
    padding: 0.3rem 0.7rem;
    border-radius: 40px;
}

/* ========== 列表组 ========== */
.list-unstyled li {
    padding: 0.4rem 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.02);
}

body.theme-dark .list-unstyled li {
    border-bottom-color: rgba(255, 255, 255, 0.03);
}

.list-unstyled li:last-child {
    border-bottom: none;
}

.list-unstyled i {
    width: 1.8rem;
    text-align: center;
    opacity: 0.6;
}

/* ========== 标签页 ========== */
.nav-tabs {
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

body.theme-dark .nav-tabs {
    border-bottom-color: rgba(255, 255, 255, 0.05);
}

.nav-tabs .nav-link {
    color: var(--text-secondary);
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 12px 12px 0 0;
    font-weight: 500;
    transition: all 0.2s;
}

.nav-tabs .nav-link:hover {
    background: rgba(0, 0, 0, 0.02);
}

body.theme-dark .nav-tabs .nav-link:hover {
    background: rgba(255, 255, 255, 0.03);
}

.nav-tabs .nav-link.active {
    background: var(--card-bg);
    color: var(--text-primary);
    border-bottom: 3px solid var(--nav-active-border);
}

body.theme-dark .nav-tabs .nav-link.active {
    background: rgba(30, 30, 60, 0.5);
}

/* ========== 前台首页额外适配 ========== */
body.theme-dark .hero {
    background: rgba(20, 20, 40, 0.6);
}

body.theme-dark .contact-info {
    background: rgba(20, 20, 40, 0.3);
}

body.theme-dark .footer a {
    color: #a0aec0;
}
body.theme-dark .footer a:hover {
    color: #00d4ff;
}