/* ============================================
   THEME SYSTEM - LIGHT & DARK MODE
   ============================================ */

:root {
    /* Light Theme (Default) */
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-tertiary: #f5f5f5;
    --bg-accent: #e9ecef;
    
    --text-primary: #212529;
    --text-secondary: #6c757d;
    --text-muted: #495057;
    
    --border-primary: #e0e0e0;
    --border-secondary: #dee2e6;
    
    --accent-primary: #000000;
    --accent-secondary: #333333;
    --accent-hover: #666666;
    
    /* Interactive colors */
    --interactive-bg: #f8f9fa;
    --interactive-hover: #e9ecef;
    --interactive-active: #dee2e6;
    
    /* Shadow */
    --shadow-light: rgba(0, 0, 0, 0.1);
    --shadow-medium: rgba(0, 0, 0, 0.15);
    --shadow-heavy: rgba(0, 0, 0, 0.2);
}

/* Dark Theme Variables */
:root.dark-mode {
    --bg-primary: #1a1a1a;
    --bg-secondary: #242424;
    --bg-tertiary: #2d2d2d;
    --bg-accent: #404040;
    
    --text-primary: #f1f3f4;
    --text-secondary: #9aa0a6;
    --text-muted: #bdc1c6;
    
    --border-primary: #404040;
    --border-secondary: #5f6368;
    
    --accent-primary: #ffffff;
    --accent-secondary: #e8eaed;
    --accent-hover: #dadce0;
    
    --interactive-bg: #2d2d2d;
    --interactive-hover: #404040;
    --interactive-active: #5f6368;
    
    --shadow-light: rgba(0, 0, 0, 0.3);
    --shadow-medium: rgba(0, 0, 0, 0.4);
    --shadow-heavy: rgba(0, 0, 0, 0.5);
}

/* ============================================
   GLOBAL BASE STYLES WITH THEME SUPPORT
   ============================================ */

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* ============================================
   THEME TOGGLE BUTTON
   ============================================ */

.theme-toggle-btn {
    display: flex;
    align-items: center;
    background: transparent;
    color: var(--text-primary);
    border: none;
    font-size: 16px;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    white-space: nowrap;
    margin-right: 8px;
    transition: background 0.2s ease, padding 0.2s ease;
}

.theme-toggle-btn:hover {
    background: var(--interactive-hover);
    padding: 10px 18px;
}

.theme-toggle-btn i {
    font-size: 18px;
}

/* Theme toggle animations */
@keyframes moon-spin {
    0%   { transform: rotate(0deg) scale(1); }
    40%  { transform: rotate(-30deg) scale(1.2); }
    100% { transform: rotate(0deg) scale(1); }
}

@keyframes sun-pulse {
    0%   { transform: scale(1); }
    40%  { transform: scale(1.35); opacity: 0.8; }
    100% { transform: scale(1); opacity: 1; }
}

.theme-toggle-btn i.anim-moon {
    animation: moon-spin 0.5s ease forwards;
}

.theme-toggle-btn i.anim-sun {
    animation: sun-pulse 0.5s ease forwards;
}

/* Hover: icon stays in transformed state while cursor is over button, returns on mouseout */
.theme-toggle-btn i {
    transition: transform 0.4s ease, opacity 0.4s ease;
    display: inline-block;
}

.theme-toggle-btn:hover i.fa-moon {
    transform: rotate(-25deg) scale(1.2);
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.theme-toggle-btn:hover i.fa-sun {
    transform: scale(1.3);
    opacity: 0.85;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

/* Navigation */
.nav-item {
    color: var(--text-primary) !important;
    font-weight: 500 !important;
    background: transparent !important;
    transition: background 0.2s ease, padding 0.2s ease !important;
}

.nav-item:hover {
    background: var(--interactive-hover) !important;
    color: var(--accent-primary) !important;
    padding-left: 20px !important;
    padding-right: 20px !important;
}

.nav-item i {
    color: var(--text-primary) !important;
}

/* Account Button */
.account-btn {
    background: transparent !important;
    color: var(--text-primary) !important;
    border: none !important;
    font-weight: 500 !important;
    transition: background 0.2s ease, padding 0.2s ease !important;
}

.account-btn:hover {
    background: var(--interactive-hover) !important;
    border: none !important;
    padding-left: 20px !important;
    padding-right: 20px !important;
}

.account-btn i {
    color: var(--text-primary) !important;
}

/* Account dropdown button — special styling for logged-in user */
#accountBtn {
    background: var(--bg-primary) !important;
    border: 2px solid var(--border-secondary) !important;
    border-radius: 8px !important;
    padding: 8px 14px !important;
    transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease !important;
}

#accountBtn:hover {
    background: var(--bg-secondary) !important;
    border-color: var(--text-muted) !important;
    box-shadow: 0 2px 8px var(--shadow-light) !important;
    padding-left: 14px !important;
    padding-right: 14px !important;
}

/* ============================================
   HEADER & NAVIGATION
   ============================================ */

/* Header Override */
.header {
    background: var(--bg-primary) !important;
    border-bottom: 2px solid var(--border-primary) !important;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.logo a {
    color: var(--accent-primary) !important;
}

.logo i {
    color: var(--accent-primary) !important;
}

/* Search Bar */
.search-bar {
    background: var(--bg-secondary) !important;
    border: 2px solid var(--border-primary) !important;
    transition: all 0.3s ease;
}

.search-bar input {
    color: var(--text-primary) !important;
    background: transparent !important;
}

.search-bar input::placeholder {
    color: var(--text-secondary) !important;
}

.search-btn {
    background: var(--accent-primary) !important;
    color: var(--bg-primary) !important;
    border-radius: 6px !important;
    padding: 8px 12px !important;
    transition: all 0.3s ease;
}

.search-btn:hover {
    background: var(--accent-secondary) !important;
}

#accountBtn span {
    color: var(--text-primary) !important;
    font-weight: 600 !important;
}

#accountBtn i {
    color: var(--text-primary) !important;
}

/* ============================================
   DROPDOWN MENUS
   ============================================ */

.dropdown-menu {
    background: var(--bg-primary) !important;
    border: 1px solid var(--border-primary) !important;
    box-shadow: 0 4px 20px var(--shadow-medium) !important;
    transition: all 0.3s ease;
}

.dropdown-header {
    padding: 12px 16px !important;
    border-bottom: 1px solid var(--border-primary) !important;
    background: transparent !important;
}

.dropdown-header strong {
    display: block !important;
    color: var(--text-primary) !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    margin-bottom: 2px !important;
}

.dropdown-header small {
    display: block !important;
    color: var(--text-secondary) !important;
    font-size: 13px !important;
    font-weight: 400 !important;
}

.dropdown-menu a {
    color: var(--text-primary) !important;
    padding: 10px 16px !important;
    display: flex !important;
    align-items: center !important;
    text-decoration: none !important;
    transition: background 0.2s !important;
}

.dropdown-menu a i {
    margin-right: 10px !important;
    width: 16px !important;
    color: var(--text-secondary) !important;
}

.dropdown-menu a:hover {
    background: var(--interactive-hover) !important;
}

.dropdown-divider {
    border-top: 1px solid var(--border-primary) !important;
    margin: 4px 0 !important;
}

/* ============================================
   BUTTONS
   ============================================ */

.btn-primary,
.btn.btn-primary {
    background: var(--accent-primary) !important;
    color: var(--bg-primary) !important;
    border: none !important;
    transition: all 0.3s ease;
}

.btn-primary:hover,
.btn.btn-primary:hover {
    background: var(--accent-secondary) !important;
    transform: translateY(-1px);
}

.btn-secondary,
.btn.btn-secondary {
    background: var(--bg-primary) !important;
    color: var(--accent-primary) !important;
    border: 2px solid var(--border-primary) !important;
    transition: all 0.3s ease;
}

.btn-secondary:hover,
.btn.btn-secondary:hover {
    background: var(--interactive-hover) !important;
    border-color: var(--accent-primary) !important;
}

/* ============================================
   CARDS & COMPONENTS
   ============================================ */

.subject-card,
.lesson-card,
.domain-card,
.category-card,
.dashboard-card {
    background: var(--bg-primary) !important;
    border: 1px solid var(--border-primary) !important;
    color: var(--text-primary) !important;
    transition: all 0.3s ease;
}

.subject-card:hover,
.lesson-card:hover,
.domain-card:hover,
.category-card:hover {
    border-color: var(--accent-primary) !important;
    box-shadow: 0 4px 12px var(--shadow-medium) !important;
    transform: translateY(-2px);
}

.subject-card h3,
.lesson-card h3,
.domain-card h3,
.category-card h3,
.dashboard-card h3 {
    color: var(--text-primary) !important;
}

.subject-card p,
.lesson-card p,
.domain-card p,
.category-card p {
    color: var(--text-secondary) !important;
}

/* Subject Icon */
.subject-icon {
    background: var(--bg-secondary) !important;
    color: var(--accent-primary) !important;
}

.subject-icon i {
    color: var(--accent-primary) !important;
}

/* ============================================
   LAYOUT COMPONENTS
   ============================================ */

/* Sidebar */
.sidebar {
    background: var(--bg-primary) !important;
    border-right: 1px solid var(--border-primary) !important;
}

.sidebar-header {
    background: var(--bg-secondary) !important;
    color: var(--text-primary) !important;
    border-bottom: 1px solid var(--border-primary) !important;
}

.sidebar-item {
    color: var(--text-primary) !important;
}

.sidebar-item:hover,
.sidebar-item.active {
    background: var(--interactive-hover) !important;
    color: var(--accent-primary) !important;
}

.sidebar-item i {
    color: var(--text-primary) !important;
}

/* Main Content */
.main-content {
    background: transparent !important;
}

/* Hero Section */
.hero {
    background: var(--bg-primary) !important;
    border: 1px solid var(--border-primary) !important;
}

.hero.hero-with-bg {
    background-color: transparent !important;
    border: none !important;
}

.hero h1 {
    color: var(--text-primary) !important;
}

.hero p {
    color: var(--text-secondary) !important;
}

/* ============================================
   STATISTICS & DISPLAY ELEMENTS
   ============================================ */

/* Stats */
.stat-number {
    color: var(--text-primary) !important;
}

.stat-label {
    color: var(--text-secondary) !important;
}

/* Lesson Type Badge */
.lesson-type {
    background: var(--bg-secondary) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border-primary) !important;
}

/* Rating Stars */
.star {
    color: #ffc107 !important;
}

.star.empty {
    color: var(--border-primary) !important;
}

/* ============================================
   DASHBOARD & FORMS
   ============================================ */

/* Dashboard Specific */
.dashboard-container {
    background: var(--bg-secondary) !important;
}

.dashboard-header h1 {
    color: var(--text-primary) !important;
}

.dashboard-header p {
    color: var(--text-secondary) !important;
}

.invite-code-item {
    background: var(--bg-primary) !important;
    border: 1px solid var(--border-primary) !important;
}

.code-text {
    color: var(--text-primary) !important;
    background: var(--bg-secondary) !important;
    padding: 8px 12px !important;
    border-radius: 6px !important;
    font-family: monospace !important;
    font-weight: bold !important;
}

.code-status {
    background: var(--bg-secondary) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border-primary) !important;
}

.code-status.available {
    background: #d4edda !important;
    color: #155724 !important;
    border-color: #c3e6cb !important;
}

/* Forms */
.form-group label {
    color: var(--text-primary) !important;
    font-weight: 600 !important;
}

.form-group input,
.form-group select,
.form-group textarea {
    background: var(--bg-primary) !important;
    color: var(--text-primary) !important;
    border: 2px solid var(--border-primary) !important;
    transition: all 0.3s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--accent-primary) !important;
    box-shadow: 0 0 0 2px var(--interactive-hover);
}

.form-group small {
    color: var(--text-secondary) !important;
}

/* ============================================
   TYPOGRAPHY & TEXT ELEMENTS
   ============================================ */

/* Ensure text is always visible */
h1, h2, h3, h4, h5, h6 {
    color: var(--text-primary) !important;
}

p {
    color: var(--text-secondary) !important;
}

a {
    color: var(--accent-primary) !important;
    transition: color 0.3s ease;
}

a:hover {
    color: var(--accent-hover) !important;
}

/* Badge */
.badge {
    background: var(--accent-primary) !important;
    color: var(--bg-primary) !important;
}

/* ============================================
   FOOTER
   ============================================ */

.site-footer {
    background: var(--bg-primary) !important;
    color: var(--text-primary) !important;
    border-top: 3px solid var(--accent-primary) !important;
    transition: all 0.3s ease;
}

.footer-brand-name {
    color: var(--accent-primary) !important;
}

.footer-brand-name i {
    color: var(--accent-primary) !important;
}

.footer-brand-desc {
    color: var(--text-secondary) !important;
}

.footer-social a {
    background: var(--bg-secondary) !important;
    border: 2px solid var(--border-primary) !important;
    color: var(--text-primary) !important;
}

.footer-social a:hover {
    background: var(--accent-primary) !important;
    border-color: var(--accent-primary) !important;
    color: var(--bg-primary) !important;
}

.footer-col-title {
    color: var(--accent-primary) !important;
    border-bottom: 2px solid var(--border-primary) !important;
}

.footer-col a {
    color: var(--text-secondary) !important;
}

.footer-col a:hover {
    color: var(--accent-primary) !important;
}

.footer-col a i {
    color: var(--border-primary) !important;
}

.footer-col a:hover i {
    color: var(--accent-primary) !important;
}

.footer-bottom {
    border-top: 1px solid var(--border-primary) !important;
}

.footer-bottom-copy {
    color: var(--text-muted) !important;
}

.footer-bottom-credit {
    color: var(--text-muted) !important;
}

.footer-bottom-credit a {
    color: var(--accent-primary) !important;
}

.footer-bottom-credit a:hover {
    color: var(--accent-hover) !important;
}

/* ============================================
   COLORED ELEMENTS (PRESERVE ORIGINAL COLORS)
   ============================================ */

/* Profile page colored badges - override theme */
.badge-colored {
    background: unset !important;
    color: unset !important;
}

.badge-role-owner      { background: linear-gradient(135deg, #ff4d4d, #c0392b) !important; color: #fff !important; }
.badge-role-staff      { background: linear-gradient(135deg, #a855f7, #7c3aed) !important; color: #fff !important; }
.badge-role-editor     { background: linear-gradient(135deg, #06b6d4, #0284c7) !important; color: #fff !important; }
.badge-role-creator    { background: linear-gradient(135deg, #f97316, #ea580c) !important; color: #fff !important; }
.badge-role-user       { background: linear-gradient(135deg, #6b7280, #4b5563) !important; color: #fff !important; }
.badge-role-operator   { background: linear-gradient(135deg, #ef4444, #b91c1c) !important; color: #fff !important; }
.badge-role-translator { background: linear-gradient(135deg, #14b8a6, #0f766e) !important; color: #fff !important; }
.badge-commission-creator { background: linear-gradient(135deg, #8b5cf6, #6d28d9) !important; color: #fff !important; }
.badge-commission-editor  { background: linear-gradient(135deg, #3b82f6, #1d4ed8) !important; color: #fff !important; }
.badge-verified     { background: linear-gradient(135deg, #10b981, #059669) !important; color: #fff !important; }
.badge-veteran      { background: linear-gradient(135deg, #f59e0b, #d97706) !important; color: #fff !important; }

/* Achievement badges */
.badge-ach-author   { background: linear-gradient(135deg, #34d399, #059669) !important; color: #fff !important; }
.badge-ach-prolific { background: linear-gradient(135deg, #6ee7b7, #10b981) !important; color: #064e3b !important; }
.badge-ach-scholar  { background: linear-gradient(135deg, #667eea, #764ba2) !important; color: #fff !important; }
.badge-ach-legend   { background: linear-gradient(135deg, #f6d365, #fda085) !important; color: #7a3800 !important; }
.badge-ach-editor1  { background: linear-gradient(135deg, #89f7fe, #66a6ff) !important; color: #1e3a5f !important; }
.badge-ach-polisher { background: linear-gradient(135deg, #a18cd1, #fbc2eb) !important; color: #3b0764 !important; }
.badge-ach-refiner  { background: linear-gradient(135deg, #43e97b, #38f9d7) !important; color: #064e3b !important; }
.badge-ach-quality  { background: linear-gradient(135deg, #f7971e, #ffd200) !important; color: #7a3800 !important; }
.badge-ach-perfect  { background: linear-gradient(135deg, #f953c6, #b91d73) !important; color: #fff !important; }
.badge-ach-early    { background: linear-gradient(135deg, #4facfe, #00f2fe) !important; color: #0c3547 !important; }

/* Override theme.css heading color for accent elements */
.category-major-card .card-icon.stem-accent,
.stat-value.stem-accent {
    color: #667eea !important;
}

.category-major-card .card-icon.humanities-accent,
.stat-value.humanities-accent {
    color: #f093fb !important;
}

/* Hero section background overrides */
.hero-main {
    background: var(--bg-primary) !important;
}

/* Special colored elements that should retain their colors */
.cta-btn-primary {
    background: #007bff !important;
    color: white !important;
}

.cta-btn-primary:hover {
    background: #0056b3 !important;
    color: white !important;
}

.cta-btn-success {
    background: #28a745 !important;
    color: white !important;
}

.cta-btn-success:hover {
    background: #1e7e34 !important;
    color: white !important;
}

/* ============================================
   RESPONSIVE THEME ADJUSTMENTS
   ============================================ */

@media (max-width: 768px) {
    .theme-toggle-btn {
        padding: 8px 10px;
        font-size: 14px;
    }
    
    .theme-toggle-btn i {
        font-size: 16px;
    }
}


/* ============================================
   DARK MODE SPECIFIC OVERRIDES
   ============================================ */

/* Home page cards */
.dark-mode .category-major-card {
    background: var(--bg-secondary) !important;
    border-color: var(--border-primary) !important;
    color: var(--text-primary) !important;
    box-shadow: 0 10px 30px var(--shadow-medium) !important;
}

.dark-mode .category-major-card h2 {
    color: var(--text-primary) !important;
}

.dark-mode .category-major-card .card-description {
    color: var(--text-secondary) !important;
}

.dark-mode .category-stat-item {
    background: var(--bg-tertiary) !important;
    border-color: var(--border-primary) !important;
}

.dark-mode .category-stat-item .stat-label {
    color: var(--text-secondary) !important;
}

/* Info cards */
.dark-mode .info-card {
    background: var(--bg-secondary) !important;
    border-color: var(--border-primary) !important;
}

.dark-mode .info-card-header h3 {
    color: var(--text-primary) !important;
}

.dark-mode .info-card-body {
    color: var(--text-secondary) !important;
}

/* CTA Section */
.dark-mode .cta-section {
    background: var(--bg-secondary) !important;
    border: 1px solid var(--border-primary) !important;
}

.dark-mode .cta-section h3 {
    color: var(--text-primary) !important;
}

.dark-mode .cta-section p {
    color: var(--text-secondary) !important;
}

/* Hero quick buttons */
.dark-mode .hero-quick-btn {
    background: rgba(36, 36, 36, 0.95) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4) !important;
}

/* Breadcrumb */
.dark-mode .breadcrumb {
    background: var(--bg-secondary) !important;
    box-shadow: 0 1px 3px var(--shadow-light) !important;
}

.dark-mode .breadcrumb-item {
    color: var(--text-secondary) !important;
}

.dark-mode .breadcrumb-item.active {
    color: var(--text-primary) !important;
}

.dark-mode .breadcrumb-separator {
    color: var(--border-primary) !important;
}

/* Modal */
.dark-mode .modal-content {
    background: var(--bg-secondary) !important;
    border: 1px solid var(--border-primary) !important;
}

.dark-mode .modal-header {
    border-bottom-color: var(--border-primary) !important;
}

.dark-mode .modal-header h3 {
    color: var(--text-primary) !important;
}

.dark-mode .modal-close {
    color: var(--text-secondary) !important;
}

.dark-mode .modal-close:hover {
    color: var(--text-primary) !important;
}

/* Subject page */
.dark-mode .subject-header {
    background: rgba(36, 36, 36, 0.95) !important;
    box-shadow: 0 4px 12px var(--shadow-medium) !important;
}

.dark-mode .subject-title h1 {
    color: var(--text-primary) !important;
}

.dark-mode .subject-page-background::before {
    background: rgba(0, 0, 0, 0.6) !important;
}

.dark-mode .domain-card,
.dark-mode .category-card {
    background: rgba(36, 36, 36, 0.95) !important;
}

.dark-mode .domain-card h3,
.dark-mode .category-card h3 {
    color: var(--text-primary) !important;
}

.dark-mode .domain-card p,
.dark-mode .category-card p {
    color: var(--text-secondary) !important;
}

.dark-mode .domains-section h2,
.dark-mode .categories-section h2,
.dark-mode .lessons-section h2 {
    color: var(--text-primary) !important;
}

.dark-mode .lesson-card {
    background: rgba(36, 36, 36, 0.95) !important;
}

.dark-mode .lesson-header {
    border-bottom-color: var(--border-primary) !important;
}

.dark-mode .lesson-title {
    color: var(--text-primary) !important;
}

.dark-mode .lesson-description {
    color: var(--text-secondary) !important;
}

.dark-mode .rating-value {
    color: var(--text-muted) !important;
}

.dark-mode .sort-controls select,
.dark-mode .filter-controls select {
    background: var(--bg-secondary) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-primary) !important;
}

/* Featured subjects heading */
.dark-mode .featured-subjects h2 {
    color: var(--text-primary) !important;
}

/* Subject stats */
.dark-mode .subject-stats {
    border-top-color: var(--border-primary) !important;
}

/* Launch popup dark mode */
.dark-mode .launch-popup {
    background: var(--bg-secondary) !important;
    color: var(--text-primary) !important;
}

.dark-mode .launch-popup h2 {
    color: var(--text-primary) !important;
}

.dark-mode .launch-popup p {
    color: var(--text-secondary) !important;
}

.dark-mode .launch-popup-close {
    color: var(--text-secondary) !important;
}

/* Scrollbars */
.dark-mode ::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.dark-mode ::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

.dark-mode ::-webkit-scrollbar-thumb {
    background: var(--border-secondary);
    border-radius: 4px;
}

.dark-mode ::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Generic dark mode for any inline styles using white backgrounds */
.dark-mode [style*="background: white"],
.dark-mode [style*="background:white"],
.dark-mode [style*="background: #fff"],
.dark-mode [style*="background:#fff"],
.dark-mode [style*="background-color: white"],
.dark-mode [style*="background-color:#fff"] {
    background: var(--bg-secondary) !important;
}

.dark-mode [style*="color: #111"],
.dark-mode [style*="color:#111"],
.dark-mode [style*="color: #333"],
.dark-mode [style*="color:#333"] {
    color: var(--text-primary) !important;
}

.dark-mode [style*="color: #666"],
.dark-mode [style*="color:#666"],
.dark-mode [style*="color: #999"],
.dark-mode [style*="color:#999"],
.dark-mode [style*="color: #aaa"],
.dark-mode [style*="color:#aaa"],
.dark-mode [style*="color: #bbb"],
.dark-mode [style*="color:#bbb"] {
    color: var(--text-secondary) !important;
}

.dark-mode [style*="border: 1px solid #ddd"],
.dark-mode [style*="border:1px solid #ddd"],
.dark-mode [style*="border: 1px solid #e9e9e9"],
.dark-mode [style*="border-bottom:1px solid #f0f0f0"],
.dark-mode [style*="border-bottom: 1px solid #f0f0f0"],
.dark-mode [style*="border-top:1px solid #e9e9e9"] {
    border-color: var(--border-primary) !important;
}

/* Leaderboard modal dark mode */
.dark-mode #leaderboardModal > div {
    background: var(--bg-secondary) !important;
}

/* Upgrade modal dark mode */
.dark-mode #userUpgradeModal > div {
    background: var(--bg-secondary) !important;
    border-color: var(--border-primary) !important;
}

/* ============================================
   DARK MODE - INLINE STYLE OVERRIDES PER PAGE
   ============================================ */

/* ---- how-it-works.html ---- */
.dark-mode .contrib-section {
    background: var(--bg-secondary) !important;
    border-color: var(--border-primary) !important;
    box-shadow: 0 4px 15px var(--shadow-light) !important;
}
.dark-mode .contrib-section p,
.dark-mode .steps-list li,
.dark-mode .feature-list li {
    color: var(--text-secondary) !important;
}
.dark-mode .contrib-section-header h2 {
    color: var(--text-primary) !important;
}
.dark-mode .steps-list li {
    border-bottom-color: var(--border-primary) !important;
}
.dark-mode .feature-list li {
    border-bottom-color: var(--border-primary) !important;
}
.dark-mode .role-badge {
    border-color: var(--border-primary) !important;
    background: var(--bg-tertiary) !important;
}
.dark-mode .role-badge .role-name {
    color: var(--text-primary) !important;
}
.dark-mode .role-badge .role-desc {
    color: var(--text-secondary) !important;
}

/* ---- news.html ---- */
.dark-mode .news-article {
    background: var(--bg-secondary) !important;
    box-shadow: 0 4px 20px var(--shadow-medium) !important;
}
.dark-mode .news-header p {
    color: var(--text-secondary) !important;
}
.dark-mode .news-meta {
    color: var(--text-secondary) !important;
}
.dark-mode .news-title {
    color: var(--text-primary) !important;
}
.dark-mode .news-content {
    color: var(--text-muted) !important;
}
.dark-mode .news-content p {
    color: var(--text-muted) !important;
}
.dark-mode .highlight-box {
    background: var(--bg-tertiary) !important;
    border-left-color: #17a2b8 !important;
}
.dark-mode .highlight-box h4 {
    color: #17a2b8 !important;
}
.dark-mode .highlight-box p {
    color: var(--text-secondary) !important;
}
.dark-mode .back-link {
    color: #17a2b8 !important;
}

/* ---- propose-edits.html ---- */
.dark-mode .propose-card {
    background: var(--bg-secondary) !important;
    box-shadow: 0 2px 8px var(--shadow-light) !important;
}
.dark-mode .edit-item {
    background: var(--bg-tertiary) !important;
    border-left-color: #6f42c1 !important;
}
.dark-mode .edit-item h3 {
    color: var(--text-primary) !important;
}
.dark-mode .info-box {
    background: var(--bg-tertiary) !important;
    border-left-color: #2196f3 !important;
}
.dark-mode .info-box,
.dark-mode .info-box strong,
.dark-mode .info-box li {
    color: var(--text-secondary) !important;
}

/* ---- create-content.html ---- */
.dark-mode .content-type-selector {
    background: var(--bg-secondary) !important;
    box-shadow: 0 2px 8px var(--shadow-light) !important;
}
.dark-mode .content-type-selector h2 {
    color: var(--text-primary) !important;
}
.dark-mode .type-btn {
    border-color: var(--border-primary) !important;
    background: var(--bg-secondary) !important;
    color: var(--text-primary) !important;
}
.dark-mode .type-btn h3 {
    color: var(--text-primary) !important;
}
.dark-mode .type-btn p {
    color: var(--text-secondary) !important;
}
.dark-mode .type-btn:hover {
    border-color: #007bff !important;
    background: var(--bg-tertiary) !important;
}
.dark-mode .type-btn.active {
    border-color: #007bff !important;
    background: var(--bg-tertiary) !important;
}
.dark-mode .content-form {
    background: var(--bg-secondary) !important;
    box-shadow: 0 2px 8px var(--shadow-light) !important;
}
.dark-mode .content-form h2 {
    color: var(--text-primary) !important;
}
.dark-mode .attachment-item {
    background: var(--bg-tertiary) !important;
    border-color: var(--border-primary) !important;
}
.dark-mode .attachment-details h5 {
    color: var(--text-primary) !important;
}
.dark-mode .attachment-details small {
    color: var(--text-secondary) !important;
}
.dark-mode #editor {
    background: var(--bg-primary) !important;
    color: var(--text-primary) !important;
}
.dark-mode .ql-toolbar {
    background: var(--bg-tertiary) !important;
    border-color: var(--border-primary) !important;
}
.dark-mode .ql-container {
    border-color: var(--border-primary) !important;
    color: var(--text-primary) !important;
}
.dark-mode #tagsContainer {
    background: var(--bg-primary) !important;
    border-color: var(--border-primary) !important;
}
.dark-mode #tagInput {
    color: var(--text-primary) !important;
}

/* ---- profile.html ---- */
.dark-mode .profile-info {
    background: var(--bg-secondary) !important;
    box-shadow: 0 2px 8px var(--shadow-light) !important;
}
.dark-mode .profile-info h3 {
    color: var(--text-primary) !important;
}
.dark-mode .info-row {
    border-bottom-color: var(--border-primary) !important;
}
.dark-mode .info-label {
    color: var(--text-primary) !important;
}
.dark-mode .info-value {
    color: var(--text-secondary) !important;
}
.dark-mode .btn-secondary.btn-profile {
    background: var(--bg-tertiary) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-primary) !important;
}
.dark-mode .btn-secondary.btn-profile:hover {
    background: var(--interactive-hover) !important;
}

/* ---- settings.html ---- */
.dark-mode .settings-card {
    background: var(--bg-secondary) !important;
    box-shadow: 0 2px 8px var(--shadow-light) !important;
}
.dark-mode .settings-card h3 {
    color: var(--text-primary) !important;
}
.dark-mode .settings-card > p {
    color: var(--text-secondary) !important;
}
.dark-mode .current-info {
    background: var(--bg-tertiary) !important;
    border-left-color: #667eea !important;
}
.dark-mode .current-info strong {
    color: var(--text-primary) !important;
}
.dark-mode .current-info span {
    color: var(--text-secondary) !important;
}
.dark-mode .form-group input:focus {
    border-color: #667eea !important;
}
.dark-mode .success-message {
    background: #1a3a2a !important;
    color: #6ee7b7 !important;
}
.dark-mode .error-message {
    background: #3a1a1a !important;
    color: #fca5a5 !important;
}

/* ---- leaderboard modal (main.js inline HTML) ---- */
.dark-mode #leaderboardModal > div > div {
    background: var(--bg-secondary) !important;
}
.dark-mode .lb-row {
    background: var(--bg-secondary) !important;
    border-bottom-color: var(--border-primary) !important;
}
.dark-mode .lb-row:hover {
    background: var(--bg-tertiary) !important;
}
.dark-mode #lbScorePopup {
    background: var(--bg-tertiary) !important;
    border-color: var(--border-primary) !important;
    color: var(--text-secondary) !important;
}

/* ---- lesson attachment card (lesson.js renders it) ---- */
.dark-mode .attachment-card,
.dark-mode .lesson-attachment,
.dark-mode [class*="attachment"] {
    background: var(--bg-secondary) !important;
    border-color: var(--border-primary) !important;
    color: var(--text-primary) !important;
}
.dark-mode .attachment-card h5,
.dark-mode .attachment-card strong,
.dark-mode .lesson-attachment h5 {
    color: var(--text-primary) !important;
}
.dark-mode .attachment-card small,
.dark-mode .lesson-attachment small {
    color: var(--text-secondary) !important;
}

/* ============================================
   REPORT MODAL (report.js)
   ============================================ */

.report-modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.6);
    z-index: 10000;
    align-items: center;
    justify-content: center;
}

.report-modal-box {
    background: var(--bg-primary);
    border-radius: 12px;
    padding: 32px;
    max-width: 500px;
    width: 90%;
    position: relative;
    border: 1px solid var(--border-primary);
    box-shadow: 0 8px 32px var(--shadow-heavy);
}

.report-modal-close {
    position: absolute;
    top: 16px; right: 16px;
    background: none; border: none;
    font-size: 24px; cursor: pointer;
    color: var(--text-secondary);
    transition: color 0.2s;
}
.report-modal-close:hover { color: var(--text-primary); }

.report-modal-title {
    margin-bottom: 20px;
    color: #dc3545 !important;
    font-size: 20px;
}

.report-modal-desc {
    color: var(--text-secondary) !important;
    font-size: 14px;
    margin-bottom: 20px;
}

.report-modal-group { margin-bottom: 16px; }

.report-modal-label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 14px;
    color: var(--text-primary) !important;
}

.report-modal-select,
.report-modal-textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-primary);
    border-radius: 6px;
    font-size: 14px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    box-sizing: border-box;
    transition: border-color 0.2s;
}
.report-modal-textarea { resize: vertical; }
.report-modal-select:focus,
.report-modal-textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.report-modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 4px;
}

.report-modal-btn-cancel {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-primary);
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
}
.report-modal-btn-cancel:hover { background: var(--interactive-hover); }

.report-modal-btn-submit {
    background: #dc3545;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: background 0.2s;
}
.report-modal-btn-submit:hover { background: #c82333; }

/* ============================================
   SEARCH RESULTS (search-results.html)
   ============================================ */

.dark-mode .result-card {
    background: var(--bg-secondary) !important;
    border-color: var(--border-primary) !important;
}
.dark-mode .result-card:hover {
    border-color: #007bff !important;
    box-shadow: 0 4px 12px rgba(0,123,255,0.2) !important;
}
.dark-mode .result-icon {
    background: var(--bg-tertiary) !important;
    color: var(--text-secondary) !important;
}
.dark-mode .result-title {
    color: var(--text-primary) !important;
}
.dark-mode .result-meta,
.dark-mode .result-description {
    color: var(--text-secondary) !important;
}
.dark-mode .results-section h3 {
    color: var(--text-primary) !important;
    border-bottom-color: var(--border-primary) !important;
}
.dark-mode .search-query {
    color: var(--text-primary) !important;
}
.dark-mode .search-stats {
    color: var(--text-secondary) !important;
}
.dark-mode .no-results {
    color: var(--text-secondary) !important;
}
.dark-mode .no-results i {
    color: var(--border-secondary) !important;
}

/* ============================================
   CONTRIBUTORS (staff.html)
   ============================================ */

.dark-mode .staff-card {
    background: var(--bg-secondary) !important;
    box-shadow: 0 4px 20px var(--shadow-light) !important;
}
.dark-mode .staff-card:hover {
    box-shadow: 0 8px 30px var(--shadow-medium) !important;
}
.dark-mode .staff-name {
    color: var(--text-primary) !important;
}
.dark-mode .role-title {
    color: var(--text-primary) !important;
}
.dark-mode .role-count {
    color: var(--text-secondary) !important;
}
.dark-mode .staff-header p {
    color: var(--text-secondary) !important;
}
.dark-mode .empty-state {
    color: var(--text-secondary) !important;
}
/* "View Profile" text rendered inline in JS */
.dark-mode .staff-card [style*="color: #999"],
.dark-mode .staff-card [style*="color:#999"] {
    color: var(--text-secondary) !important;
}

/* ============================================
   OUR TEAM (team.html)
   ============================================ */

.dark-mode .team-member {
    background: var(--bg-secondary) !important;
    box-shadow: 0 4px 20px var(--shadow-light) !important;
}
.dark-mode .team-member:hover {
    box-shadow: 0 8px 30px var(--shadow-medium) !important;
}
.dark-mode .member-name {
    color: var(--text-primary) !important;
}
.dark-mode .team-header h1 {
    color: var(--text-primary) !important;
}
.dark-mode .team-header p {
    color: var(--text-secondary) !important;
}

/* ============================================
   OWNER DASHBOARD (dashboard.html)
   ============================================ */

.dark-mode .dashboard-card {
    background: var(--bg-secondary) !important;
    box-shadow: 0 2px 8px var(--shadow-light) !important;
}
.dark-mode .dashboard-card h3 {
    color: #667eea !important;
}
.dark-mode .dashboard-header h1 {
    color: var(--text-primary) !important;
}
.dark-mode .dashboard-header p {
    color: var(--text-secondary) !important;
}
.dark-mode .user-item,
.dark-mode .content-item {
    background: var(--bg-tertiary) !important;
    border-color: var(--border-primary) !important;
}
.dark-mode .user-name,
.dark-mode .content-title {
    color: var(--text-primary) !important;
}
.dark-mode .user-email,
.dark-mode .content-meta {
    color: var(--text-secondary) !important;
}
.dark-mode .invite-code-item {
    background: var(--bg-tertiary) !important;
}
.dark-mode #contentStats {
    background: var(--bg-tertiary) !important;
}
.dark-mode #contentStats [style*="color: #666"],
.dark-mode #contentStats [style*="color:#666"] {
    color: var(--text-secondary) !important;
}
.dark-mode #userSearchInput,
.dark-mode #contentSearchInput,
.dark-mode #contentTypeFilter {
    background: var(--bg-tertiary) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-primary) !important;
}
.dark-mode .modal-content {
    background: var(--bg-secondary) !important;
}
.dark-mode .modal-header {
    border-bottom-color: var(--border-primary) !important;
}
.dark-mode .modal-header h3 {
    color: var(--text-primary) !important;
}
.dark-mode .modal-close {
    color: var(--text-secondary) !important;
}

/* ============================================
   DARK MODE - PUBLIC PROFILE
   ============================================ */

.dark-mode .profile-card {
    background: var(--bg-secondary) !important;
    box-shadow: 0 1px 3px var(--shadow-medium) !important;
}

.dark-mode .profile-name {
    color: var(--text-primary) !important;
}

.dark-mode .profile-username {
    color: var(--text-secondary) !important;
}

.dark-mode .profile-avatar {
    background: var(--bg-tertiary) !important;
    border-color: var(--bg-secondary) !important;
    color: var(--text-primary) !important;
}

.dark-mode .profile-bio {
    background: var(--bg-tertiary) !important;
    color: var(--text-secondary) !important;
    border-left-color: #667eea !important;
}

.dark-mode .profile-stats {
    border-top-color: var(--border-primary) !important;
    border-bottom-color: var(--border-primary) !important;
}

.dark-mode .stat-value {
    color: var(--text-primary) !important;
}

.dark-mode .stat-label {
    color: var(--text-secondary) !important;
}

.dark-mode .info-item {
    background: var(--bg-tertiary) !important;
}

.dark-mode .info-label {
    color: var(--text-secondary) !important;
}

.dark-mode .info-value {
    color: var(--text-primary) !important;
}

.dark-mode .section-title {
    color: var(--text-primary) !important;
}

.dark-mode .lesson-card {
    background: var(--bg-tertiary) !important;
    border-left-color: #667eea !important;
}

.dark-mode .lesson-card:hover {
    background: var(--bg-accent) !important;
}

.dark-mode .lesson-title {
    color: var(--text-primary) !important;
}

.dark-mode .lesson-meta {
    color: var(--text-secondary) !important;
}

.dark-mode .actions {
    border-top-color: var(--border-primary) !important;
}

.dark-mode .btn-back {
    background: var(--bg-tertiary) !important;
    color: var(--text-primary) !important;
}

.dark-mode .btn-back:hover {
    background: var(--bg-accent) !important;
}

.dark-mode .empty-state {
    color: var(--text-secondary) !important;
}
