/* =========================================================================
   AGRA SIR - PREMIUM UNIFIED THEME SYSTEM
========================================================================= */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* --------------------------------------
       LIGHT THEME (Default)
    -------------------------------------- */
    /* Thrilling UI variables (Light) */
    --void: #94A3B8;
    --bg-1: #E2E8F0;
    --bg-2: #CBD5E1;
    --panel: #FFFFFF;
    --panel-hi: #FFFFFF;
    --rail: #F8FAFC;
    --line: rgba(0, 0, 0, 0.15);
    --line-hi: rgba(0, 0, 0, 0.3);
    --ink: #000000;
    --ink-dim: #1E293B;
    --ink-faint: #475569;
    --violet: #6366F1;
    --violet-soft: rgba(99, 102, 241, 0.12);
    --cyan: #0EA5E9;
    --cyan-soft: rgba(14, 165, 233, 0.12);
    --gold: #F59E0B;
    --gold-deep: #B45309;
    --danger: #EF4444;
    --font-display: 'Orbitron', sans-serif;
    --font-body: 'Inter', 'Noto Sans Sinhala', sans-serif;

    --bg: #f1f5f9;
    --bg-gradient: radial-gradient(circle at 10% 20%, #e2e8f0 0%, #f1f5f9 90%);
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --surface-hover: #f1f5f9;
    --text: #0f172a;
    --text-muted: #64748b;
    --muted: #64748b;
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --accent-magenta: #d946ef;
    --accent-gold: #fbbf24;
    --success: #10b981;
    --success-hover: #059669;
    --warning: #f59e0b;
    --danger: #ef4444;
    --wa-green: #25D366;
    --wa-green-hover: #128C7E;
    --border: rgba(226, 232, 240, 0.8);
    --border-light: rgba(241, 245, 249, 0.5);
    --radius-sm: 12px;
    --radius-md: 18px;
    --radius-lg: 24px;
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --shadow-md: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
    --shadow-glow: 0 0 20px rgba(79, 70, 229, 0.2);
    --glass-blur: blur(12px);
    
    /* --------------------------------------
       TAB BUTTON SPECIFICS (Light)
    -------------------------------------- */
    --tab-bg: rgba(255, 255, 255, 0.7);
    --tab-text: #64748b;
    --tab-active-bg: linear-gradient(135deg, #4f46e5, #4338ca);
    --tab-active-text: #ffffff;
    --tab-hover-bg: rgba(226, 232, 240, 0.8);
}

html.theme-dark {
    /* --------------------------------------
       DARK THEME (Premium Dark Mode)
    -------------------------------------- */
    /* Thrilling UI variables (Dark) */
    --void: #060914;
    --bg-1: #0B0F1E;
    --bg-2: #0F1530;
    --panel: #131A2E;
    --panel-hi: #1A2342;
    --rail: #0D1226;
    --line: rgba(140, 150, 200, 0.14);
    --line-hi: rgba(140, 150, 200, 0.28);
    --ink: #EAEBF5;
    --ink-dim: #8B92B5;
    --ink-faint: #565D80;
    --violet: #7C5CFC;
    --violet-soft: rgba(124, 92, 252, 0.16);
    --cyan: #22D3EE;
    --cyan-soft: rgba(34, 211, 238, 0.14);
    --gold: #FBBF24;
    --gold-deep: #B45309;
    --danger: #FB5C6A;

      --bg: #0B0F19; 
      --bg-gradient: radial-gradient(circle at top left, #111827 0%, #0B0F19 100%);
      --surface: #131A2A; 
      --surface-soft: #1A233A;
      --surface-hover: #222D4B;
      --text: #ffffff;
      --text-muted: #94a3b8;
      --muted: #94a3b8;
      --primary: #818cf8; 
      --primary-hover: #6366f1;
      --accent-magenta: #e879f9;
      --accent-gold: #fbbf24;
      --success: #34d399;
      --success-hover: #10b981;
      --warning: #fbbf24;
      --danger: #f87171;
      --wa-green: #25D366;
      --wa-green-hover: #128C7E;
      --border: rgba(255, 255, 255, 0.08);
      --border-light: rgba(255, 255, 255, 0.03);
      --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
      --shadow-md: 0 10px 25px -5px rgba(0, 0, 0, 0.4), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
      --shadow-lg: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
      --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.4);
    
    /* --------------------------------------
       TAB BUTTON SPECIFICS (Dark)
    -------------------------------------- */
    --tab-bg: rgba(44, 44, 54, 0.8);
    --tab-text: #9ca3af;
    --tab-active-bg: linear-gradient(135deg, #c084fc, #a855f7);
    --tab-active-text: #ffffff;
    --tab-hover-bg: rgba(69, 69, 85, 0.8);
}

/* Backward compatibility for landing page & profile */
:root {
    --text-main: var(--text);
    --bg-light: var(--bg);
    --bg-base: var(--bg);
    --bg-panel: var(--surface);
    --danger-bg: rgba(239, 68, 68, 0.1);
}

/* =========================================================================
   GLOBAL BASE STYLES
========================================================================= */

body {
    background: var(--bg);
    background-image: var(--bg-gradient);
    color: var(--text);
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    min-height: 100vh;
    transition: background 0.4s ease, color 0.4s ease;
    overflow-x: hidden;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.3s;
}

a:hover {
    color: var(--primary-hover);
}

/* =========================================================================
   UNIVERSAL THEME OVERRIDES (Applies globally to all buttons/cards)
========================================================================= */

/* Premium Tab Buttons */
.exam-tab {
    padding: 12px 24px;
    background: var(--tab-bg);
    color: var(--tab-text);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: var(--shadow-sm);
    backdrop-filter: var(--glass-blur);
}

.exam-tab:hover {
    background: var(--tab-hover-bg);
    color: var(--text);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary);
}

.exam-tab.active {
    color: var(--tab-active-text);
    border-color: transparent;
}

.exam-tab.tab-topics.active {
    background: linear-gradient(135deg, #4f46e5, #4338ca);
    box-shadow: 0 0 20px rgba(79, 70, 229, 0.3);
}

.exam-tab.tab-monthly.active {
    background: linear-gradient(135deg, #10b981, #059669);
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.3);
}

.exam-tab.tab-preterm.active {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.3);
}

.exam-tab.tab-arcade.active {
    background: linear-gradient(135deg, #d946ef, #c026d3);
    box-shadow: 0 0 20px rgba(217, 70, 239, 0.3);
}

/* Common Interactive Buttons */
button {
    font-family: inherit;
}

/* Premium Card Surfaces */
.premium-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    backdrop-filter: var(--glass-blur);
    color: var(--text);
    transition: all 0.3s ease;
}

.premium-card:hover {
    box-shadow: var(--shadow-lg);
    border-color: rgba(255, 255, 255, 0.1);
}

/* Common Headings */
h1, h2, h3, h4, h5, h6 {
    color: var(--text);
}

/* GLOBAL LOGO STYLES */
.logo-main, .agra-main { padding-bottom: 8px !important; display: inline-block; }
/* =========================================================================
   PREMIUM GLOBAL FOOTER
========================================================================= */
.fixed-brand-footer {
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 25px 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    flex-wrap: wrap;
    margin-top: auto;
    width: 100%;
    z-index: 10;
}

.footer-brand-name {
    color: var(--text);
    font-weight: 900;
    letter-spacing: -0.5px;
    font-size: 1rem;
}


/* GLOBAL NAVIGATION DOCK */
.global-nav-dock {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 15px;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    padding: 12px 25px;
    border-radius: 50px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3), inset 0 0 0 1px rgba(255,255,255,0.1);
    z-index: 1000;
    transition: all 0.3s ease;
}

html:not(.theme-dark) .global-nav-dock {
    background: rgba(255, 255, 255, 0.85);
    box-shadow: 0 10px 30px rgba(0,0,0,0.1), inset 0 0 0 1px rgba(0,0,0,0.05);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    text-decoration: none;
    min-width: 65px;
    transition: all 0.3s ease;
    gap: 6px;
    cursor: pointer;
}

.nav-item i {
    font-size: 1.3rem;
    transition: all 0.3s ease;
}

.nav-item span {
    font-size: 0.7rem;
    font-weight: 700;
    font-family: 'Inter', sans-serif;
    letter-spacing: 0.5px;
    opacity: 0.8;
}

.nav-item:hover {
    color: var(--primary);
    transform: translateY(-3px);
}

.nav-item.active {
    color: var(--accent-gold);
}

.nav-item.active i {
    transform: scale(1.15);
    filter: drop-shadow(0 0 5px rgba(251, 191, 36, 0.4));
}

@media (max-width: 768px) {
    .global-nav-dock {
        bottom: 0;
        left: 0;
        transform: none;
        width: 100%;
        border-radius: 25px 25px 0 0;
        padding: 15px 10px 25px 10px; /* Bottom padding for home indicator */
        justify-content: space-around;
        gap: 0;
        border-top: 1px solid var(--border-light);
        box-shadow: 0 -5px 20px rgba(0,0,0,0.2);
    }
    
    body {
        padding-bottom: 90px !important; 
    }
}


/* GLOBAL CUSTOM ALERT */
.global-alert-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 999999;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.global-alert-overlay.show {
    opacity: 1;
    visibility: visible;
}

.global-alert-modal {
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: 16px;
    padding: 25px;
    width: 90%;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 15px 35px rgba(0,0,0,0.3);
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

html:not(.theme-dark) .global-alert-modal {
    box-shadow: 0 15px 35px rgba(0,0,0,0.1);
}

.global-alert-overlay.show .global-alert-modal {
    transform: translateY(0) scale(1);
}

.global-alert-icon {
    font-size: 2.5rem;
    color: var(--primary);
    margin-bottom: 15px;
}

.global-alert-message {
    color: var(--text-main);
    font-size: 1.05rem;
    font-family: 'Noto Sans Sinhala', 'Inter', sans-serif;
    line-height: 1.5;
    margin-bottom: 25px;
    font-weight: 500;
}

.global-alert-btn {
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 12px 30px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
}

.global-alert-btn:hover {
    filter: brightness(1.1);
    transform: translateY(-2px);
}
