/* ============================================
   EduPrime - Theme System (Dark/Light)
   ============================================ */

/* ----- LIGHT MODE OVERRIDES ----- */
html[data-theme="light"] {
    --bg: #f5f6fb;
    --bg-2: #eaecf5;
    --text: #1a1a2e;
    --muted: #5a5a7a;
    --primary: #4f46e5;
    --violet: #7c3aed;
    --cyan: #0891b2;
    --pink: #db2777;
    --border: rgba(0, 0, 0, 0.08);
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-brd: rgba(0, 0, 0, 0.08);
    --shadow: 0 20px 60px -20px rgba(60, 60, 120, 0.15);
}

html[data-theme="light"] body {
    background:
        radial-gradient(1200px 800px at 80% -10%, #e0e7ff 0%, transparent 60%),
        radial-gradient(900px 600px at -10% 30%, #ede9fe 0%, transparent 60%),
        var(--bg);
}

html[data-theme="light"] .glass {
    background: rgba(255, 255, 255, 0.75);
    border-color: rgba(0, 0, 0, 0.06);
    box-shadow: 0 12px 40px -12px rgba(60, 60, 120, 0.15);
}

html[data-theme="light"] .logo,
html[data-theme="light"] .sidebar-brand { color: #1a1a2e; }

html[data-theme="light"] .nav,
html[data-theme="light"] .topbar {
    background: rgba(255, 255, 255, 0.75);
    border-bottom-color: rgba(0, 0, 0, 0.06);
}

html[data-theme="light"] .sidebar {
    background: rgba(255, 255, 255, 0.9);
    border-right-color: rgba(0, 0, 0, 0.06);
}

html[data-theme="light"] .sidebar-link {
    color: #5a5a7a;
}
html[data-theme="light"] .sidebar-link:hover {
    background: rgba(0, 0, 0, 0.04);
    color: #1a1a2e;
}
html[data-theme="light"] .sidebar-link.active {
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.12), rgba(124, 58, 237, 0.12));
    border-color: rgba(124, 58, 237, 0.25);
    color: #1a1a2e;
}

html[data-theme="light"] .sidebar-user {
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.06);
}
html[data-theme="light"] .sidebar-user-name { color: #1a1a2e; }

html[data-theme="light"] .btn-ghost {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.08);
    color: #1a1a2e;
}
html[data-theme="light"] .btn-ghost:hover {
    background: rgba(0, 0, 0, 0.08);
}

html[data-theme="light"] .field input,
html[data-theme="light"] .field select,
html[data-theme="light"] .field textarea {
    background: rgba(255, 255, 255, 0.8);
    border-color: rgba(0, 0, 0, 0.1);
    color: #1a1a2e;
}
html[data-theme="light"] .field input::placeholder {
    color: #9a9ab8;
}

html[data-theme="light"] .topbar-search input {
    background: rgba(255, 255, 255, 0.8);
    border-color: rgba(0, 0, 0, 0.08);
    color: #1a1a2e;
}

html[data-theme="light"] .topbar-btn,
html[data-theme="light"] .user-menu-trigger,
html[data-theme="light"] .topbar-toggle {
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.08);
    color: #5a5a7a;
}
html[data-theme="light"] .topbar-btn:hover,
html[data-theme="light"] .user-menu-trigger:hover {
    background: rgba(0, 0, 0, 0.06);
    color: #1a1a2e;
}

html[data-theme="light"] .user-menu-name { color: #1a1a2e; }

html[data-theme="light"] .user-menu-dropdown {
    background: rgba(255, 255, 255, 0.98);
    border-color: rgba(0, 0, 0, 0.08);
    box-shadow: 0 20px 50px -10px rgba(60, 60, 120, 0.2);
}
html[data-theme="light"] .user-menu-dropdown a,
html[data-theme="light"] .user-menu-dropdown button {
    color: #5a5a7a;
}
html[data-theme="light"] .user-menu-dropdown a:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #1a1a2e;
}

html[data-theme="light"] .stat-card,
html[data-theme="light"] .table-card {
    background: rgba(255, 255, 255, 0.75);
    border-color: rgba(0, 0, 0, 0.06);
}
html[data-theme="light"] .table-card th {
    background: rgba(0, 0, 0, 0.02);
}
html[data-theme="light"] .table-card tbody tr:hover {
    background: rgba(0, 0, 0, 0.02);
}
html[data-theme="light"] .table-card th,
html[data-theme="light"] .table-card td {
    border-bottom-color: rgba(0, 0, 0, 0.06);
}

html[data-theme="light"] .badge {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.08);
    color: #5a5a7a;
}

html[data-theme="light"] .footer,
html[data-theme="light"] .footer-dash {
    border-top-color: rgba(0, 0, 0, 0.06);
    color: #5a5a7a;
}

html[data-theme="light"] .page-date {
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.06);
    color: #5a5a7a;
}

html[data-theme="light"] .nav-links a { color: #5a5a7a; }
html[data-theme="light"] .nav-links a:hover { color: #1a1a2e; }
html[data-theme="light"] .nav-burger span { background: #1a1a2e; }

/* Landing light overrides */
html[data-theme="light"] .hero-blob { opacity: 0.25; }
html[data-theme="light"] .feature h3,
html[data-theme="light"] .program h3 { color: #1a1a2e; }
html[data-theme="light"] .cta-card {
    background:
        radial-gradient(600px 300px at 50% 0%, rgba(99, 102, 241, 0.15), transparent 70%),
        rgba(255, 255, 255, 0.75);
}
html[data-theme="light"] .card-float {
    background: rgba(255, 255, 255, 0.85);
}

/* Auth pages light */
html[data-theme="light"] .auth-card {
    background: rgba(255, 255, 255, 0.85);
}
html[data-theme="light"] .auth-card h1 { color: #1a1a2e; }
html[data-theme="light"] .auth-back { color: #5a5a7a; }
html[data-theme="light"] .auth-hint code {
    background: rgba(0, 0, 0, 0.06);
    color: #1a1a2e;
}

/* ----- THEME TOGGLE BUTTON ----- */
.theme-toggle {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--muted);
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    font-size: 17px;
    padding: 0;
}

html[data-theme="light"] .theme-toggle {
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.08);
    color: #5a5a7a;
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    transform: rotate(15deg);
}
html[data-theme="light"] .theme-toggle:hover {
    background: rgba(0, 0, 0, 0.06);
    color: #1a1a2e;
}

.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
    position: absolute;
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.theme-toggle .icon-sun {
    opacity: 0;
    transform: rotate(-90deg) scale(0.5);
}
.theme-toggle .icon-moon {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

html[data-theme="light"] .theme-toggle .icon-sun {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}
html[data-theme="light"] .theme-toggle .icon-moon {
    opacity: 0;
    transform: rotate(90deg) scale(0.5);
}

/* Navbar variant (landing) */
.nav-actions .theme-toggle { margin-right: 4px; }

/* ----- SMOOTH TRANSITION ON THEME SWITCH ----- */
html.theme-transition,
html.theme-transition *,
html.theme-transition *::before,
html.theme-transition *::after {
    transition: background-color 0.35s ease, border-color 0.35s ease, color 0.35s ease !important;
    transition-delay: 0s !important;
}

@media (prefers-reduced-motion: reduce) {
    .theme-toggle,
    .theme-toggle .icon-sun,
    .theme-toggle .icon-moon {
        transition: none !important;
    }
}