/* ==========================================================================

   EduNotes Mastery - Premium Dashboard Stylesheet

   Theme: Modern EdTech / Clean & Minimal / Neumorphic Inspiration

   ========================================================================== */



/* 1. CSS VARIABLES (Color Palette & Theme) */
:root {
    /* Primary Colors: Indigo / Purple combo */
    --primary-color: #4f46e5;
    --primary-color-hover: #4338ca;
    
    /* Backgrounds: Off-white / light slate setup */
    --bg-main: #f8fafc;        /* Very light uniform background */
    --bg-surface: #ffffff;     /* White for cards and inner elements */
    --bg-sidebar: rgba(255, 255, 255, 0.75); /* Glassmorphism Base */
    --bg-highlight: #eef2ff;   /* Soft indigo for highlights */
    
    /* Typography Colors */
    --text-primary: #0f172a;   /* Deep slate for headings */
    --text-secondary: #334155; /* Soft slate for body text */
    --text-muted: #94a3b8;     /* Faint text for badges/footer */

    

    /* Accents & Borders */

    --border-light: #e2e8f0;

    --shadow-soft: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);

    --shadow-hover: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);

    

    /* Radii & Transitions */

    --radius-md: 8px;

    --radius-lg: 12px;

    --radius-xl: 16px;

    --transition-smooth: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);

}



/* 2. RESET & BASE SETTINGS */

* {

    box-sizing: border-box;

    margin: 0;

    padding: 0;

}



body {

    font-family: 'Poppins', sans-serif;

    background-color: var(--bg-main);

    color: var(--text-secondary);

    line-height: 1.6;

    overflow-x: hidden;

}



a {

    text-decoration: none;

    color: inherit;

}



/* 3. LAYOUT GRID */

.dashboard-container {

    display: flex;

    min-height: 100vh;

    width: 100%;

}



/* ==========================================

   4. SIDEBAR (Glassmorphism & Fixed)

   ========================================== */

.sidebar {

    width: 280px;

    background: linear-gradient(180deg, rgba(15, 23, 42, 0.88), rgba(30, 41, 59, 0.86));

    backdrop-filter: blur(12px);

    -webkit-backdrop-filter: blur(12px);

    border-right: 1px solid rgba(148, 163, 184, 0.28);

    display: flex;

    flex-direction: column;

    position: fixed;

    height: 100vh;

    z-index: 100;

    transition: transform 0.3s ease;

    box-shadow: 10px 0 34px rgba(2, 6, 23, 0.28);

}



.sidebar-header {

    height: 70px;

    padding: 0 1.5rem;

    display: flex;

    align-items: center;

    justify-content: space-between;

    border-bottom: 1px solid rgba(148, 163, 184, 0.22);

}



.logo {

    display: flex;

    align-items: center;

    gap: 0.75rem;

    font-size: 1.25rem;

    font-weight: 700;

    color: var(--primary-color);

}



.close-sidebar-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid rgba(148, 163, 184, 0.32);
    background: rgba(15, 23, 42, 0.45);
    font-size: 1.5rem;
    color: #f8fafc;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.close-sidebar-btn:hover {
    background: rgba(99, 102, 241, 0.28);
}



/* Sidebar Navigation */

.sidebar-nav {

    padding: 1.5rem 1rem;

    flex: 1;

    overflow-y: auto;

}



.nav-title {

    font-size: 0.75rem;

    font-weight: 600;

    color: #a5b4fc;

    letter-spacing: 0.1em;

    padding: 0 1rem;

    margin-bottom: 1rem;

}



.nav-item {

    margin-bottom: 0.5rem;

}

.sidebar-home-item {
    margin-bottom: 0.85rem;
}

.sidebar-home-link {
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.9), rgba(14, 165, 233, 0.88));
    color: #ffffff;
    box-shadow: 0 8px 20px rgba(79, 70, 229, 0.28);
}

.sidebar-home-link:hover {
    background: linear-gradient(135deg, rgba(67, 56, 202, 0.95), rgba(2, 132, 199, 0.92));
    color: #ffffff;
}



.nav-link {

    display: flex;

    align-items: center;

    gap: 1rem;

    padding: 0.75rem 1rem;

    border-radius: var(--radius-md);

    color: #e2e8f0;

    font-weight: 700;

    font-size: 1.02rem;

    transition: var(--transition-smooth);

}



.nav-link:hover,
.nav-item.has-dropdown.expanded > .nav-link {

    background: rgba(99, 102, 241, 0.24);

    color: #e0e7ff;

    box-shadow: 0 0 0 1px rgba(129, 140, 248, 0.35), 0 8px 20px rgba(67, 56, 202, 0.25);

}

.nav-link span {
    flex: 1;
}

.nav-chevron {
    color: #94a3b8;
    transition: transform 0.25s ease, color 0.25s ease;
}

.nav-item.has-dropdown.expanded .nav-chevron {
    transform: rotate(180deg);
    color: #c4b5fd;
}



/* Dropdown */

.dropdown-menu {

    display: flex;

    flex-direction: column;

    gap: 0.1rem;

    padding-left: 2.75rem;

    max-height: 0;

    opacity: 0;

    overflow: hidden;

    transform: translateY(-6px);

    pointer-events: none;

    transition: max-height 0.3s ease, opacity 0.25s ease, transform 0.25s ease;

}



.nav-item.has-dropdown.expanded .dropdown-menu {

    max-height: 500px;

    opacity: 1;

    transform: translateY(0);

    pointer-events: auto;

    margin-top: 0.3rem;

}



.dropdown-link {

    padding: 0.42rem 0.35rem;

    font-size: 0.84rem;

    color: #cbd5e1;

    font-weight: 500;

    border-radius: 8px;

    transition: var(--transition-smooth);

    position: relative;

}



.dropdown-link:hover {

    color: #e0e7ff;

    background: rgba(148, 163, 184, 0.12);

}



.dropdown-link.active-dropdown {

    color: #c4b5fd;

    font-weight: 600;

}

.dropdown-link.active-dropdown::before {

    content: "";

    position: absolute;

    left: -1rem;

    top: 50%;

    transform: translateY(-50%);

    width: 6px;

    height: 6px;

    background-color: var(--primary-color);

    border-radius: 50%;

}



/* ==========================================

   5. MAIN CONTENT WRAPPER 

   ========================================== */

.main-wrapper {

    flex: 1;

    margin-left: 280px; /* Offset for fixed sidebar */

    display: flex;

    flex-direction: column;

    min-height: 100vh;

}



/* TOP NAVBAR (Sticky header) */

.topbar {

    height: 70px;

    background: var(--bg-surface);

    border-bottom: 1px solid var(--border-light);

    display: flex;

    align-items: center;

    justify-content: space-between;

    padding: 0 2rem;

    position: sticky;

    top: 0;

    z-index: 50;

    box-shadow: 0 2px 4px rgba(0,0,0,0.02);

}



.menu-toggle-btn {

    display: none;

    background: none;

    border: none;

    color: var(--text-secondary);

    cursor: pointer;

    vertical-align: middle;

}



/* Search Bar */

.search-container {

    display: flex;

    align-items: center;

    background: var(--bg-main);

    border-radius: 50px;

    padding: 0.5rem 1rem;

    width: 300px;

    transition: var(--transition-smooth);

    border: 1px solid transparent;

}



.search-container:focus-within {

    border-color: var(--primary-color);

    background: var(--bg-surface);

    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);

}



.search-icon {

    color: var(--text-muted);

    margin-right: 0.5rem;

}



.search-input {

    border: none;

    background: transparent;

    outline: none;

    width: 100%;

    font-family: inherit;

    color: var(--text-primary);

    font-size: 0.95rem;

}



/* Theme Toggle */

.theme-btn {

    background: var(--bg-main);

    border: 1px solid var(--border-light);

    color: var(--text-secondary);

    width: 40px;

    height: 40px;

    border-radius: 50%;

    display: flex;

    align-items: center;

    justify-content: center;

    cursor: pointer;

    transition: var(--transition-smooth);

}

.theme-btn:hover {

    background: var(--bg-highlight);

    color: var(--primary-color);

}



/* ==========================================

   6. CONTENT AREA & FEED

   ========================================== */

.content-area {

    padding: 2.5rem 3rem;

    flex: 1;

    max-width: 100%;

    margin: 0 auto;

    width: 100%;

}



/* Chapter Banner Header */

.chapter-header-banner {

    background: linear-gradient(135deg, var(--primary-color), var(--primary-color-hover));

    border-radius: var(--radius-xl);

    padding: 2rem 2.5rem;

    color: #fff;

    margin-bottom: 2.5rem;

    box-shadow: var(--shadow-soft);

}



.banner-content .badge {

    display: inline-block;

    background: rgba(255, 255, 255, 0.2);

    padding: 0.25rem 0.75rem;

    border-radius: 50px;

    font-size: 0.85rem;

    font-weight: 500;

    margin-bottom: 1rem;

    backdrop-filter: blur(5px);

}



.banner-content h1 {

    font-size: 2rem;

    font-weight: 700;

    margin-bottom: 0.5rem;

    line-height: 1.2;

}



.banner-content p {

    font-size: 1rem;

    opacity: 0.9;

}



/* ==========================================

   7. QUESTION CARDS (Premium UI)

   ========================================== */

.questions-feed {

    display: flex;

    flex-direction: column;

    gap: 1.5rem;

}



.question-card {

    background: var(--bg-surface);

    border-radius: var(--radius-lg);

    padding: 1.5rem 2rem;

    border: 1px solid var(--border-light);

    box-shadow: var(--shadow-soft);

    transition: var(--transition-smooth);

}



.question-card:hover {

    transform: translateY(-3px);

    box-shadow: var(--shadow-hover);

    border-color: rgba(79, 70, 229, 0.3);

}



/* Header (The Question) */

.q-header {

    display: flex;

    align-items: flex-start;

    gap: 0.75rem;

    margin-bottom: 1rem;

    border-bottom: 1px solid var(--border-light);

    padding-bottom: 1rem;

    position: relative; /* Useful for precise positioning if needed */

}



.q-label {

    font-size: 1.5rem;

    font-weight: 700;

    color: var(--primary-color);

    line-height: 1.1;

}



.question-title {

    font-size: 1.25rem;

    font-weight: 600;

    color: var(--text-primary);

    line-height: 1.4;

    margin-top: 0.15rem;

    flex: 1; /* Pushes the copy button to the right */

    padding-right: 1rem; /* Prevent overlap with copy button */

}



/* Copy Button Styling */

.copy-btn {

    background: transparent;

    border: 1px solid transparent;

    color: var(--text-muted);

    border-radius: var(--radius-md);

    padding: 0.5rem;

    cursor: pointer;

    display: inline-flex;

    align-items: center;

    justify-content: center;

    transition: var(--transition-smooth);

    margin-left: auto; /* Pushes it to the far right of the flex container */

    margin-top: -0.2rem;

}



.copy-btn:hover {

    background: var(--bg-highlight);

    color: var(--primary-color);

    border-color: var(--border-light);

}



.copy-btn.copied {

    color: #10b981; /* Premium success green */

    border-color: #10b981;

    background: rgba(16, 185, 129, 0.1);

}



.copy-btn svg {

    pointer-events: none; /* Prevents target confusion in JS */

}



/* Body (The Answer) */

.a-body {

    display: flex;

    align-items: flex-start;

    gap: 0.75rem;

    margin-bottom: 1rem;

}



.a-label {

    font-size: 1.05rem;

    font-weight: 600;

    color: var(--text-muted);

}



.answer-text {
    font-size: 1.05rem;
    color: var(--text-primary);
    line-height: 1.7;
}

body.dark-mode .answer-text {
    color: var(--text-primary);
}



.answer-text strong {
    color: var(--primary-color);
    font-weight: 700;
    background-color: rgba(79, 70, 229, 0.1);
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
}

body.dark-mode .answer-text strong {
    color: #FFD700;
    background-color: rgba(255, 215, 0, 0.1);
}



/* Footer (Extra Info - Purpose, Example, etc) */

.card-footer {
    background: transparent;
    border-left: 2px solid rgba(79, 70, 229, 0.4);
    padding: 0.5rem 0 0.5rem 1rem;
    margin-top: 1.25rem;
    display: flex;
    gap: 0.5rem;
    align-items: baseline;
    border-radius: 0;
}



.extra-badge {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    min-width: max-content;
}



.extra-text {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.6;
}



/* Main Footer */

.main-footer {

    text-align: center;

    padding: 3rem 0;

    color: var(--text-muted);

    font-size: 0.9rem;

}



/* ==========================================

   8. DARK MODE THEME & UTILITIES

   ========================================== */

body.dark-mode {

    /* Main Backgrounds */

    --bg-main: #0f172a;               /* Deep Navy / Slate background */

    --bg-surface: #1e293b;            /* Dark surface for cards/navbar */

    --bg-sidebar: rgba(30, 41, 59, 0.85); /* Dark Glassmorphism */

    --bg-highlight: #334155;          /* Muted highlight for badges */



    /* Typography */

    --text-primary: #f8fafc;          /* Pure white headers */

    --text-secondary: #cbd5e1;        /* Light grey for readability */

    --text-muted: #94a3b8;            /* Stealthy text for footers */



    /* Borders & Shadows */

    --border-light: #334155;          /* Subtle dark stroke */

    --shadow-soft: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.2);

    --shadow-hover: 0 10px 15px -3px rgba(0, 0, 0, 0.6), 0 4px 6px -2px rgba(0, 0, 0, 0.3);

}



/* Smooth Transitions to Dark Mode for Core Elements */

body, .sidebar, .topbar, .question-card, .search-container, .card-footer, .theme-btn {

    transition: background-color 0.4s ease, color 0.4s ease, border-color 0.4s ease, box-shadow 0.4s ease, transform 0.3s ease;

}



/* Hidden Class for Live Search Filter */

.question-card.hidden-card {

    display: none !important;

}



/* ==========================================

   9. RESPONSIVE DESIGN (Mobile)

   ========================================== */

@media (max-width: 992px) {

    .content-area {

        padding: 2rem 1.5rem;

    }

}



@media (max-width: 768px) {

    .sidebar {

        transform: translateX(-100%); /* Hidden by default on mobile */

    }



    .sidebar.mobile-open {

        transform: translateX(0);

        box-shadow: 4px 0 15px rgba(0,0,0,0.1);

    }



    .close-sidebar-btn {

        display: inline-flex; /* Show close button internally on mobile */

        align-items: center;

        justify-content: center;

    }



    .main-wrapper {

        margin-left: 0; /* Full width */

    }



    .menu-toggle-btn {

        display: inline-flex; /* Show hamburger */

        align-items: center;

        justify-content: center;

    }



    .topbar {

        padding: 0 1.5rem;

        gap: 1rem;

    }



    .search-container {

        width: 100%; /* Flexible search bar on mobile */

    }



    .chapter-header-banner {

        padding: 1.5rem;

    }

    .banner-content h1 {

        font-size: 1.6rem;

    }



    .question-card {

        padding: 1.25rem;

    }

    

    .q-header {

        flex-direction: column;

        gap: 0.25rem;

    }

    

    .a-body {

        flex-direction: column;

        gap: 0.25rem;

    }



    .card-footer {
    background: transparent;
    border-left: 2px solid rgba(79, 70, 229, 0.4);
    padding: 0.5rem 0 0.5rem 1rem;
    margin-top: 1.25rem;
    display: flex;
    gap: 0.5rem;
    align-items: baseline;
    border-radius: 0;
}

}



/* ========================================== */

/* TABS NAVIGATION & PROGRESS BAR             */

/* ========================================== */



/* Scroll Progress Bar */

.progress-container {

    position: sticky;

    top: -2rem; /* Offsets padding inside content-area */

    left: 0;

    width: 100%;

    height: 5px;

    background-color: var(--border-light);

    z-index: 50; 

    margin-bottom: 2rem;

    border-radius: 4px;

    overflow: hidden;

}

.progress-bar {

    height: 100%;

    background: linear-gradient(90deg, var(--accent), var(--accent-hover));

    width: 0%;

    border-radius: 4px;

    transition: width 0.1s ease-out;

}



/* Tab Navigation System */

.tab-navigation {

    display: flex;

    gap: 1rem;

    margin-bottom: 2rem;

    padding: 0.5rem;

    position: sticky;

    top: 78px;

    z-index: 60;

    background: var(--bg-surface);

    border: 1px solid var(--border-light);

    border-radius: var(--radius-lg);

    box-shadow: var(--shadow-soft);

    flex-wrap: wrap; 

}



.tab-btn {

    flex: 1;

    display: flex;

    align-items: center;

    justify-content: center;

    gap: 0.5rem;

    padding: 1rem;

    background: transparent;

    border: none;

    border-radius: var(--radius-sm);

    color: var(--text-secondary);

    font-size: 0.95rem;

    font-weight: 600;

    cursor: pointer;

    transition: all var(--transition-fluid);

    position: relative;

    overflow: hidden;

    min-width: 150px;

}



.tab-btn:hover {

    color: var(--text-primary);

    background: rgba(79, 70, 229, 0.05); /* very light accent fallback */

}



.tab-btn.active {

    color: #1a1a1a;

    background: #e2e8f0;

    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);

    font-weight: 600;

}



body.dark-mode .tab-btn.active {

    color: white;

    background: var(--primary-color);

    box-shadow: 0 4px 15px rgba(79, 70, 229, 0.3);

}



.tab-icon {

    font-size: 1.2rem;

}



/* Tab Panes */

.tab-pane {

    display: none;

    animation: fadeScaleIn 0.5s cubic-bezier(0.25, 1, 0.3, 1) forwards;

}



.tab-pane.active {

    display: block;

}



@keyframes fadeScaleIn {

    0% {

        opacity: 0;

        transform: translateY(15px);

    }

    100% {

        opacity: 1;

        transform: translateY(0);

    }

}

/* Tab Panes */

.tab-pane {

    display: none;

    animation: liquidSlide 0.5s cubic-bezier(0.25, 1, 0.3, 1) forwards;

}



.tab-pane.active {

    display: block;

}



@keyframes liquidSlide {

    0% {

        opacity: 0;

        transform: translateX(20px);

    }

    100% {

        opacity: 1;

        transform: translateX(0);

    }

}

body.dark-mode strong { color: #FFD700; }



strong { color: var(--primary-color); }




/* Custom Additions */
.search-active { display: block !important; }
.hidden { display: none !important; }
.copy-btn { background: transparent; border: none; color: var(--text-muted); cursor: pointer; padding: 4px; border-radius: var(--radius-md); transition: var(--transition-smooth); display: flex; align-items: center; justify-content: center; }
.copy-btn:hover { color: var(--primary-color); background: var(--bg-highlight); }
.q-header { display: flex; align-items: flex-start; gap: 0.75rem; position: relative; width: 100%; }
.q-header .question-title { flex: 1; }
.q-header .copy-btn { margin-left: auto; }

/* Back To Top Button */
.back-to-top {
    position: fixed;
    right: 1.25rem;
    bottom: 1.25rem;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 1px solid var(--border-light);
    background: linear-gradient(135deg, var(--primary-color), var(--primary-color-hover));
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-soft);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: var(--transition-smooth);
    z-index: 120;
}

.back-to-top:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(0);
}

.back-to-top.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Scroll & Constraint Fixes */
body, html { max-width: 100%; overflow-x: hidden; width: 100%; }
.dashboard-container, .main-wrapper { max-width: 100%; overflow-x: hidden; }
* { box-sizing: border-box; }
.question-card, img { max-width: 100%; }
.question-title, .answer-text, .extra-text { word-wrap: break-word; overflow-wrap: anywhere; }
@media (max-width: 768px) {
  html, body { font-size: 14px; }
  .content-area { padding: 0.75rem 0.5rem; }
  .chapter-header-banner { padding: 1rem 1.25rem; }
  .questions-feed { gap: 0.75rem; }
  .question-card { padding: 0.85rem; }
  .banner-content h1 { font-size: 1.4rem; }
  .q-header { display: flex; flex-direction: row; flex-wrap: wrap; align-items: flex-start; }
  .q-header .question-title { flex: 1 1 0%; min-width: 0; }
  .q-header .copy-btn { margin-left: auto; }
}

/* Desktop & Universal Sidebar Toggle Enhancements */
.menu-toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--border-light);
    background: var(--bg-main);
    color: var(--text-secondary);
    transition: var(--transition-smooth);
    flex-shrink: 0;
}

.menu-toggle-btn:hover {
    background: var(--bg-highlight);
    color: var(--primary-color);
}

.main-wrapper {
    transition: margin-left 0.3s ease, width 0.3s ease;
}

.sidebar {
    transition: transform 0.3s ease;
}

body.sidebar-collapsed .sidebar {
    transform: translateX(-100%);
}

body.sidebar-collapsed .main-wrapper {
    margin-left: 0;
    width: 100%;
}

body.sidebar-collapsed .content-area {
    margin: 0 auto;
}

@media (min-width: 769px) {
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        overflow: hidden;
    }

    .sidebar-nav {
        overflow-y: auto;
        max-height: calc(100vh - 70px);
    }
}

@media (min-width: 1025px) {
    html, body {
        font-size: 16px;
    }

    .topbar {
        padding: 0 1.25rem;
    }

    .content-area {
        max-width: 920px;
        padding: 1.75rem 2rem;
        margin: 0 auto;
    }

    body.sidebar-collapsed .content-area {
        max-width: 920px;
        margin: 0 auto;
    }

    .chapter-header-banner {
        padding: 1.5rem 2rem;
        margin-bottom: 1.75rem;
    }

    .questions-feed {
        gap: 1rem;
    }

    .question-card {
        padding: 1.2rem 1.4rem;
    }

    .tab-navigation {
        gap: 0.5rem;
        padding: 0.35rem 0.4rem;
        margin-bottom: 1.25rem;
        flex-wrap: nowrap;
    }

    .tab-btn {
        min-width: 0;
        padding: 0.65rem 0.8rem;
    }

    .tab-icon {
        font-size: 1rem;
    }
}

/* First Visit Splash Screen */
html.returning-visitor .first-visit-splash {
    display: none;
}

body.splash-active {
    overflow: hidden;
}

.first-visit-splash {
    position: fixed;
    inset: 0;
    z-index: 300;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: radial-gradient(circle at 20% 20%, #4338ca 0%, #1e1b4b 55%, #0f172a 100%);
    color: #eef2ff;
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.7s ease, transform 0.7s ease, visibility 0.7s ease;
}

.first-visit-splash.is-exiting {
    opacity: 0;
    transform: translateY(-24px);
    visibility: hidden;
}

.first-visit-splash.is-hidden {
    display: none;
}

.splash-content {
    text-align: center;
    max-width: 780px;
}

.splash-logo-wrap {
    display: inline-flex;
    align-items: center;
    gap: 0.8rem;
    color: #c7d2fe;
    margin-bottom: 0.85rem;
    opacity: 0;
    transform: scale(0.92);
    animation: splashLogoIn 0.9s ease forwards;
}

.splash-title {
    font-size: clamp(1.6rem, 3vw, 2.2rem);
    font-weight: 700;
    letter-spacing: 0.01em;
}

.splash-subtext {
    max-width: min(62ch, 92vw);
    margin: 0 auto;
    white-space: normal;
    color: #e2e8f0;
    font-size: clamp(0.95rem, 1.6vw, 1.08rem);
    line-height: 1.55;
    text-wrap: balance;
    opacity: 0;
    transform: translateY(8px);
    animation: splashMessageIn 0.75s ease 0.35s forwards;
}

.splash-credit {
    margin-top: 0.5rem;
    color: rgba(199, 210, 254, 0.95);
    font-size: clamp(0.76rem, 1.2vw, 0.86rem);
    font-weight: 400;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    opacity: 0;
    transform: translateY(8px);
    animation: splashMessageIn 0.75s ease 0.55s forwards;
}

@keyframes splashLogoIn {
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes splashMessageIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (prefers-reduced-motion: reduce) {
    .splash-logo-wrap,
    .splash-subtext,
    .first-visit-splash {
        animation: none;
        transition: none;
    }

    .splash-logo-wrap {
        opacity: 1;
        transform: none;
    }

    .splash-subtext {
        opacity: 1;
        transform: none;
    }

    .splash-credit {
        opacity: 1;
        transform: none;
    }
}

@media (max-width: 768px) {
    .splash-content {
        max-width: min(94vw, 460px);
    }

    .splash-title {
        font-size: clamp(1.3rem, 5.8vw, 1.75rem);
    }

    .splash-subtext {
        max-width: 92vw;
        font-size: 0.96rem;
        line-height: 1.5;
        text-wrap: pretty;
    }

    .splash-credit {
        font-size: 0.72rem;
        letter-spacing: 0.07em;
    }
}

/* First Visit Feature Tour */
.theme-btn.feature-pulse {
    position: relative;
    isolation: isolate;
}

.theme-btn.feature-pulse::after {
    content: "";
    position: absolute;
    inset: -8px;
    border-radius: 999px;
    border: 2px solid rgba(99, 102, 241, 0.45);
    box-shadow: 0 0 0 6px rgba(99, 102, 241, 0.16);
    animation: featurePulseRing 1.8s ease-out infinite;
    pointer-events: none;
    z-index: -1;
}

.feature-tooltip {
    position: fixed;
    z-index: 240;
    padding: 0.55rem 0.8rem;
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: rgba(15, 23, 42, 0.76);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: #e2e8f0;
    font-size: 0.85rem;
    font-weight: 500;
    line-height: 1.25;
    box-shadow: var(--shadow-soft);
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transform: translateY(6px) scale(0.98);
    transition: opacity 0.22s ease, transform 0.22s ease;
}

.feature-tooltip::after {
    content: "";
    position: absolute;
    left: 50%;
    top: -6px;
    transform: translateX(-50%) rotate(45deg);
    width: 10px;
    height: 10px;
    border-left: 1px solid rgba(148, 163, 184, 0.35);
    border-top: 1px solid rgba(148, 163, 184, 0.35);
    background: rgba(15, 23, 42, 0.76);
}

.feature-tooltip.is-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    animation: featureTooltipBounce 1.8s ease-in-out infinite;
}

@keyframes featurePulseRing {
    0% {
        transform: scale(0.94);
        opacity: 0.95;
    }

    70% {
        transform: scale(1.16);
        opacity: 0.3;
    }

    100% {
        transform: scale(1.24);
        opacity: 0;
    }
}

@keyframes featureTooltipBounce {
    0%,
    100% {
        transform: translateY(0) scale(1);
    }

    50% {
        transform: translateY(-3px) scale(1.01);
    }
}

@media (max-width: 768px) {
    .feature-tooltip {
        white-space: normal;
        max-width: min(260px, 90vw);
        text-align: center;
    }
}

/* Subject Dashboard Flow */
.subject-dashboard-view,
.chapter-selection-view {
    margin-bottom: 1.5rem;
}

.subject-hero-banner {
    padding: 1.1rem 1.2rem;
    border-radius: var(--radius-lg);
    margin-bottom: 1rem;
    color: #eef2ff;
    background: linear-gradient(135deg, rgba(67, 56, 202, 0.9), rgba(30, 27, 75, 0.9));
    box-shadow: var(--shadow-soft);
}

.subject-hero-banner h1 {
    font-size: clamp(1rem, 2.2vw, 1.35rem);
    font-weight: 700;
    letter-spacing: 0.01em;
}

.subject-dashboard-header,
.chapter-selection-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.subject-dashboard-header h2,
.chapter-selection-header h2 {
    color: var(--text-primary);
    font-size: 1.35rem;
    font-weight: 700;
}

.subject-dashboard-header p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.subject-grid,
.chapter-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.9rem;
}

.subject-card,
.chapter-card {
    border: 1px solid rgba(226, 232, 240, 0.45);
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.55);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: var(--text-primary);
    padding: 1rem 1.1rem;
    cursor: pointer;
    text-align: left;
    transition: transform 0.28s ease, border-color 0.28s ease, box-shadow 0.28s ease, background-color 0.28s ease;
    box-shadow: var(--shadow-soft);
    width: 100%;
}

.subject-card {
    border-top: 4px solid rgba(148, 163, 184, 0.6);
}

.subject-card-computer { border-top-color: #3b82f6; }
.subject-card-english { border-top-color: #0ea5e9; }
.subject-card-physics { border-top-color: #8b5cf6; }
.subject-card-urdu { border-top-color: #f59e0b; }
.subject-card-islamiyat { border-top-color: #22c55e; }

.subject-card:hover,
.chapter-card:hover {
    transform: translateY(-3px) scale(1.03);
    border-color: rgba(79, 70, 229, 0.35);
    box-shadow: var(--shadow-hover);
}

.subject-card:focus-visible,
.chapter-card:focus-visible,
.persistent-back-btn:focus-visible {
    outline: 2px solid rgba(79, 70, 229, 0.4);
    outline-offset: 2px;
}

.subject-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(79, 70, 229, 0.1);
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.subject-name {
    display: block;
    font-size: 1rem;
    font-weight: 600;
}

body.dark-mode .subject-card {
    background: rgba(30, 41, 59, 0.82);
    border-color: rgba(148, 163, 184, 0.36);
}

body.dark-mode .subject-card:hover {
    background: rgba(51, 65, 85, 0.9);
    border-color: rgba(129, 140, 248, 0.45);
}

body.dark-mode .subject-name {
    color: #f8fafc;
}

body.dark-mode .subject-icon {
    color: #e2e8f0;
    background: rgba(99, 102, 241, 0.2);
    filter: brightness(1.2) drop-shadow(0 0 4px rgba(129, 140, 248, 0.45));
}

.chapter-card {
    font-weight: 600;
}

.back-to-subjects-btn {
    border: 1px solid var(--border-light);
    border-radius: 999px;
    background: var(--bg-surface);
    color: var(--text-secondary);
    padding: 0.45rem 0.9rem;
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.back-to-subjects-btn:hover {
    color: var(--primary-color);
    background: var(--bg-highlight);
}

.persistent-back-btn {
    position: static;
    z-index: 2;
    width: 46px;
    height: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(226, 232, 240, 0.38);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.32);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: var(--text-primary);
    padding: 0;
    margin: 0 0 0.85rem 0;
    align-self: flex-start;
    cursor: pointer;
    transition: transform 0.24s ease, background-color 0.24s ease, box-shadow 0.24s ease, color 0.24s ease;
    box-shadow: var(--shadow-soft);
}

.persistent-back-btn:hover {
    color: #ffffff;
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.95), rgba(67, 56, 202, 0.95));
    transform: translateY(-1px) scale(1.03);
}

.chapter-empty-state {
    border: 1px dashed var(--border-light);
    border-radius: var(--radius-lg);
    padding: 1rem;
    color: var(--text-muted);
    text-align: center;
    background: var(--bg-surface);
}

@media (max-width: 768px) {
    .subject-dashboard-header,
    .chapter-selection-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .subject-hero-banner {
        padding: 0.85rem 0.9rem;
        margin-bottom: 0.85rem;
    }

    .subject-grid,
    .chapter-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.65rem;
    }

    .subject-card,
    .chapter-card {
        padding: 0.72rem;
        border-radius: var(--radius-md);
    }

    .subject-name,
    .chapter-card {
        font-size: 0.9rem;
    }

    .subject-icon {
        width: 32px;
        height: 32px;
    }

    .persistent-back-btn {
        width: 42px;
        height: 42px;
        margin-bottom: 0.65rem;
    }

    .chapter-header-banner {
        margin-top: 0;
    }
}

.content-area.view-transition-forward {
    animation: navSlideInForward 0.32s ease;
}

.content-area.view-transition-back {
    animation: navSlideInBack 0.32s ease;
}

@keyframes navSlideInForward {
    0% {
        opacity: 0.5;
        transform: translateX(22px);
    }

    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes navSlideInBack {
    0% {
        opacity: 0.5;
        transform: translateX(-22px);
    }

    100% {
        opacity: 1;
        transform: translateX(0);
    }
}
