/* ==========================================
   深色模式覆盖样式
   通过 :root[data-theme="dark"] 激活
   ========================================== */

:root[data-theme="dark"] {
    /* 品牌色（保持不变） */
    --primary: #3B8AFF;
    --primary-hover: #5A9FFF;
    --primary-active: #2070E0;
    --primary-light: rgba(59, 138, 255, 0.15);
    --primary-bg: rgba(59, 138, 255, 0.08);
    --primary-border: rgba(59, 138, 255, 0.3);

    /* 语义色 */
    --success: #2DD4A0;
    --success-light: rgba(45, 212, 160, 0.12);
    --success-border: rgba(45, 212, 160, 0.3);
    --warning: #FFB347;
    --warning-light: rgba(255, 179, 71, 0.12);
    --warning-border: rgba(255, 179, 71, 0.3);
    --danger: #FF6B6B;
    --danger-light: rgba(255, 107, 107, 0.12);
    --danger-border: rgba(255, 107, 107, 0.3);
    --info: #3B8AFF;
    --info-light: rgba(59, 138, 255, 0.12);

    /* 中性色（深色反转） */
    --white: #1a1a2e;
    --gray-50: #16213e;
    --gray-100: #1a2744;
    --gray-200: #243352;
    --gray-300: #2d3f5e;
    --gray-400: #4a5a7a;
    --gray-500: #7b8ba8;
    --gray-600: #9caaba;
    --gray-700: #c4cdd9;
    --gray-800: #e0e5ec;
    --gray-900: #f0f2f5;

    /* 阴影（更深） */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.35);
    --shadow-xl: 0 12px 32px rgba(0, 0, 0, 0.4);
}

/* ===== 全局基础 ===== */
:root[data-theme="dark"] body {
    background: var(--gray-50);
    color: var(--gray-800);
}

:root[data-theme="dark"] a {
    color: inherit;
}

/* ===== 导航栏深色 ===== */
:root[data-theme="dark"] .navbar {
    background: rgba(26, 26, 46, 0.92);
    border-bottom-color: var(--gray-200);
}

:root[data-theme="dark"] .navbar.scrolled {
    box-shadow: var(--shadow-md);
    border-bottom-color: var(--gray-200);
}

:root[data-theme="dark"] .navbar-brand {
    color: var(--primary);
}

:root[data-theme="dark"] .nav-link {
    color: var(--gray-600);
}

:root[data-theme="dark"] .nav-link:hover,
:root[data-theme="dark"] .nav-link.active {
    color: var(--primary);
}

:root[data-theme="dark"] .btn-login {
    color: var(--gray-700);
    border-color: var(--gray-300);
}

:root[data-theme="dark"] .btn-login:hover {
    background: var(--gray-200);
    color: var(--gray-900);
}

:root[data-theme="dark"] .btn-register {
    background: var(--primary);
    color: #fff;
}

/* ===== 卡片深色 ===== */
:root[data-theme="dark"] .card,
:root[data-theme="dark"] .hero-card,
:root[data-theme="dark"] .feature-card,
:root[data-theme="dark"] .pricing-card,
:root[data-theme="dark"] .model-card,
:root[data-theme="dark"] .package-card,
:root[data-theme="dark"] .article-card,
:root[data-theme="dark"] .download-card {
    background: var(--gray-100);
    border-color: var(--gray-200);
    color: var(--gray-800);
}

:root[data-theme="dark"] .card:hover,
:root[data-theme="dark"] .model-card:hover,
:root[data-theme="dark"] .package-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--primary-border);
}

/* ===== 表格深色 ===== */
:root[data-theme="dark"] table {
    color: var(--gray-800);
}

:root[data-theme="dark"] thead {
    background: var(--gray-200);
}

:root[data-theme="dark"] tbody tr {
    border-bottom-color: var(--gray-200);
}

:root[data-theme="dark"] tbody tr:hover {
    background: var(--gray-200);
}

/* ===== 表单深色 ===== */
:root[data-theme="dark"] input,
:root[data-theme="dark"] select,
:root[data-theme="dark"] textarea {
    background: var(--gray-200);
    border-color: var(--gray-300);
    color: var(--gray-800);
}

:root[data-theme="dark"] input::placeholder,
:root[data-theme="dark"] textarea::placeholder {
    color: var(--gray-500);
}

:root[data-theme="dark"] input:focus,
:root[data-theme="dark"] select:focus,
:root[data-theme="dark"] textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 138, 255, 0.2);
}

/* ===== 按钮深色 ===== */
:root[data-theme="dark"] .btn-primary {
    background: var(--primary);
    color: #fff;
}

:root[data-theme="dark"] .btn-secondary {
    background: var(--gray-200);
    color: var(--gray-800);
    border-color: var(--gray-300);
}

:root[data-theme="dark"] .btn-secondary:hover {
    background: var(--gray-300);
}

/* ===== 页脚深色 ===== */
:root[data-theme="dark"] .footer {
    background: var(--gray-100);
    color: var(--gray-600);
    border-top-color: var(--gray-200);
}

:root[data-theme="dark"] .footer a {
    color: var(--gray-500);
}

:root[data-theme="dark"] .footer a:hover {
    color: var(--primary);
}

:root[data-theme="dark"] .footer-title {
    color: var(--gray-800);
}

:root[data-theme="dark"] .footer-desc {
    color: var(--gray-500);
}

:root[data-theme="dark"] .footer-bottom {
    border-top-color: var(--gray-200);
}

:root[data-theme="dark"] .footer-social-icon {
    color: var(--gray-500);
    background: var(--gray-200);
}

:root[data-theme="dark"] .footer-social-icon:hover {
    color: var(--primary);
    background: var(--primary-light);
}

/* ===== Hero区域深色 ===== */
:root[data-theme="dark"] .hero {
    background: linear-gradient(135deg, var(--gray-100) 0%, var(--gray-200) 100%);
}

:root[data-theme="dark"] .hero h1,
:root[data-theme="dark"] .hero h2 {
    color: var(--gray-900);
}

:root[data-theme="dark"] .hero p {
    color: var(--gray-500);
}

/* ===== 标签/Badge深色 ===== */
:root[data-theme="dark"] .badge {
    border-color: var(--gray-300);
}

:root[data-theme="dark"] .badge-light {
    background: var(--gray-200);
    color: var(--gray-600);
}

/* ===== 区块/Section深色 ===== */
:root[data-theme="dark"] section,
:root[data-theme="dark"] .section {
    color: var(--gray-800);
}

:root[data-theme="dark"] .section-title {
    color: var(--gray-900);
}

:root[data-theme="dark"] .section-desc {
    color: var(--gray-500);
}

/* ===== 主题切换按钮样式 ===== */
.theme-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    border: 1px solid var(--gray-200);
    background: transparent;
    color: var(--gray-600);
    cursor: pointer;
    transition: var(--transition-fast);
    font-size: 16px;
}

.theme-toggle-btn:hover {
    background: var(--gray-100);
    color: var(--primary);
    border-color: var(--primary-border);
}

:root[data-theme="dark"] .theme-toggle-btn {
    border-color: var(--gray-300);
    color: var(--gray-500);
}

:root[data-theme="dark"] .theme-toggle-btn:hover {
    background: var(--gray-200);
    color: var(--primary);
}

/* ===== 后台布局深色（admin.css 覆盖） ===== */
:root[data-theme="dark"] .dashboard-layout {
    background: var(--gray-50);
}

:root[data-theme="dark"] .header {
    background: var(--gray-100);
    border-bottom-color: var(--gray-200);
}

:root[data-theme="dark"] .header-title {
    color: var(--gray-800);
}

:root[data-theme="dark"] .sidebar {
    background: var(--gray-100);
    border-right-color: var(--gray-200);
}

:root[data-theme="dark"] .sidebar .nav-link {
    color: var(--gray-600);
}

:root[data-theme="dark"] .sidebar .nav-link:hover,
:root[data-theme="dark"] .sidebar .nav-link.active {
    background: var(--primary-light);
    color: var(--primary);
}

:root[data-theme="dark"] .content-wrapper {
    background: var(--gray-50);
}

:root[data-theme="dark"] .main-content {
    background: var(--gray-50);
}

:root[data-theme="dark"] .user-dropdown {
    color: var(--gray-800);
}

:root[data-theme="dark"] .dropdown-menu {
    background: var(--gray-100);
    border-color: var(--gray-200);
    box-shadow: var(--shadow-lg);
}

:root[data-theme="dark"] .dropdown-item {
    color: var(--gray-700);
}

:root[data-theme="dark"] .dropdown-item:hover {
    background: var(--gray-200);
    color: var(--gray-900);
}

:root[data-theme="dark"] .header-btn {
    color: var(--gray-500);
}

:root[data-theme="dark"] .header-btn:hover {
    background: var(--gray-200);
}

/* ===== 统计卡片深色 ===== */
:root[data-theme="dark"] .stats-grid .stat-card,
:root[data-theme="dark"] .stat-card {
    background: var(--gray-100);
    border-color: var(--gray-200);
}

:root[data-theme="dark"] .stat-card .stat-label {
    color: var(--gray-500);
}

:root[data-theme="dark"] .stat-card .stat-value {
    color: var(--gray-900);
}

:root[data-theme="dark"] .stat-card .stat-info h3 {
    color: var(--gray-800);
}

:root[data-theme="dark"] .stat-card .stat-info div[style*="color:#9CA3AF"] {
    color: var(--gray-500) !important;
}

:root[data-theme="dark"] .stat-card .stat-value[style*="color:#4F46E5"] {
    color: var(--primary) !important;
}

/* ===== 认证页面深色 ===== */
:root[data-theme="dark"] .auth-brand {
    background: linear-gradient(135deg, #0f1629 0%, #1a2744 100%);
}

:root[data-theme="dark"] .auth-form-wrapper {
    background: var(--gray-50);
}

:root[data-theme="dark"] .auth-form-container {
    background: var(--gray-100);
}

:root[data-theme="dark"] .auth-form-title {
    color: var(--gray-900);
}

:root[data-theme="dark"] .auth-form-subtitle {
    color: var(--gray-500);
}

:root[data-theme="dark"] .form-label {
    color: var(--gray-700);
}

:root[data-theme="dark"] .form-input-wrapper {
    background: var(--gray-200);
    border-color: var(--gray-300);
}

:root[data-theme="dark"] .form-input-wrapper input {
    color: var(--gray-800);
}

:root[data-theme="dark"] .btn-submit {
    background: var(--primary);
    color: #fff;
}

:root[data-theme="dark"] .auth-divider span {
    background: var(--gray-100);
    color: var(--gray-500);
}

:root[data-theme="dark"] .auth-divider::before,
:root[data-theme="dark"] .auth-divider::after {
    background: var(--gray-300);
}

:root[data-theme="dark"] .btn-social {
    background: var(--gray-200);
    border-color: var(--gray-300);
    color: var(--gray-700);
}

:root[data-theme="dark"] .btn-social:hover {
    background: var(--gray-300);
}

/* ===== 语言切换下拉深色 ===== */
:root[data-theme="dark"] .lang-dropdown {
    background: var(--gray-100);
    border-color: var(--gray-200);
}

:root[data-theme="dark"] .lang-dropdown-item {
    color: var(--gray-700);
}

:root[data-theme="dark"] .lang-dropdown-item:hover,
:root[data-theme="dark"] .lang-dropdown-item.active {
    background: var(--primary-light);
    color: var(--primary);
}

/* ===== Toast深色 ===== */
:root[data-theme="dark"] .toast {
    background: var(--gray-200);
    color: var(--gray-800);
    box-shadow: var(--shadow-md);
}

/* ===== 空状态深色 ===== */
:root[data-theme="dark"] .empty-state-text {
    color: var(--gray-500);
}

/* ===== 分页深色 ===== */
:root[data-theme="dark"] .pagination button,
:root[data-theme="dark"] .pagination a {
    background: var(--gray-100);
    color: var(--gray-600);
    border-color: var(--gray-200);
}

:root[data-theme="dark"] .pagination button:hover,
:root[data-theme="dark"] .pagination a:hover {
    background: var(--gray-200);
}

:root[data-theme="dark"] .pagination button.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}
