/* =====================================================
   COURSE HEADER COMPONENT
===================================================== */

.course-header {
    position: relative;

    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;

    padding: 24px 28px;
    margin: 18px 0;

    border-radius: 22px;

    cursor: pointer;
    overflow: hidden;

    background:
        linear-gradient(
            145deg,
            rgba(255,255,255,0.96),
            rgba(248,250,255,0.92)
        );

    border: 1px solid rgba(255,255,255,0.35);

    box-shadow:
        0 10px 28px rgba(15, 23, 42, 0.06),
        0 2px 10px rgba(15, 23, 42, 0.04);

    backdrop-filter: blur(12px);

    transition:
        transform 0.35s ease,
        box-shadow 0.35s ease,
        border-color 0.35s ease;
}

/* Decorative top gradient line */
.course-header::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;

    width: 100%;
    height: 4px;

    background:
        linear-gradient(
            90deg,
            #2563eb,
            #7c3aed,
            #06b6d4
        );
}

/* Hover overlay */
.course-header::after {
    content: "";
    position: absolute;
    inset: 0;

    background:
        linear-gradient(
            90deg,
            rgba(37, 99, 235, 0.05),
            rgba(124, 58, 237, 0.04)
        );

    opacity: 0;
    transition: opacity 0.35s ease;
}

.course-header:hover::after {
    opacity: 1;
}

/* Hover animation */
.course-header:hover {
    transform: translateY(-4px);

    border-color: rgba(124, 58, 237, 0.22);

    box-shadow:
        0 18px 42px rgba(15, 23, 42, 0.12),
        0 6px 18px rgba(15, 23, 42, 0.08);
}

/* =====================================================
   COURSE INFO
===================================================== */

.course-info {
    position: relative;
    z-index: 2;
    flex: 1;
}

.course-info h2 {
    margin: 0 0 10px;

    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: 0.2px;

    color: #0f172a;
}

.course-info p {
    margin: 0;

    font-size: 0.96rem;
    line-height: 1.7;

    color: #64748b;

    max-width: 900px;
}

/* =====================================================
   ARROW BUTTON
===================================================== */

.course-arrow {
    position: relative;
    z-index: 2;

    min-width: 46px;
    height: 46px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 50%;

    font-size: 0.9rem;
    font-weight: bold;

    color: #2563eb;

    background:
        linear-gradient(
            145deg,
            rgba(37, 99, 235, 0.10),
            rgba(124, 58, 237, 0.10)
        );

    transition:
        transform 0.35s ease,
        background 0.35s ease,
        box-shadow 0.35s ease;
}

/* Arrow hover */
.course-header:hover .course-arrow {
    transform: scale(1.08);

    box-shadow:
        0 8px 20px rgba(37, 99, 235, 0.16);
}

/* =====================================================
   ACTIVE STATE
   Add .active using JS when expanded
===================================================== */

.course-header.active {
    border-color: rgba(37, 99, 235, 0.22);

    box-shadow:
        0 20px 48px rgba(37, 99, 235, 0.12),
        0 8px 22px rgba(15, 23, 42, 0.08);
}

.course-header.active .course-arrow {
    transform: rotate(180deg);

    background:
        linear-gradient(
            145deg,
            rgba(37, 99, 235, 0.18),
            rgba(124, 58, 237, 0.18)
        );
}

/* =====================================================
   OPTIONAL GLASS/DARK MODE SUPPORT
===================================================== */

.dark .course-header {
    background:
        linear-gradient(
            145deg,
            rgba(15, 23, 42, 0.92),
            rgba(30, 41, 59, 0.92)
        );

    border: 1px solid rgba(255,255,255,0.05);
}

.dark .course-info h2 {
    color: #f8fafc;
}

.dark .course-info p {
    color: #cbd5e1;
}

/* =====================================================
   MOBILE RESPONSIVENESS
===================================================== */

@media (max-width: 768px) {

    .course-header {
        padding: 20px;
        border-radius: 18px;
        gap: 16px;
    }

    .course-info h2 {
        font-size: 1.15rem;
    }

    .course-info p {
        font-size: 0.9rem;
        line-height: 1.6;
    }

    .course-arrow {
        min-width: 40px;
        height: 40px;
        font-size: 0.8rem;
    }
}
/* =====================================================
    1. GLOBAL DESIGN SYSTEM & THEMES
===================================================== */
:root {
    --bg: #f8fafc;
    --card-bg: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --primary: #3a7afe;
    --primary-soft: rgba(58, 122, 254, 0.1);
    --header-bg: #ffffff;
    --header-shadow: 0 2px 10px rgba(0,0,0,0.1);
    --nav-text: #1e293b;
    --radius: 12px;
    --shadow: 0 4px 6px rgba(0,0,0,0.05);
    --transition: all 0.3s ease;
}

body.dark-mode {
    --bg: #0f172a;
    --card-bg: #1e293b;
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --border: #334155;
    --primary: #60a5fa;
    --primary-soft: rgba(96,165,250,0.1);
    --header-bg: #1e293b;
    --header-shadow: 0 4px 20px rgba(0,0,0,0.4);
    --nav-text: #f1f5f9;
}

body {
    font-family: 'Inter', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    margin: 0;
    line-height: 1.6;
    transition: background 0.3s ease;
}

/* =====================================================
    2. HEADER, TOGGLE & PROFILE
===================================================== */
.header-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 5%;
    background: var(--header-bg);
    box-shadow: var(--header-shadow);
    position: sticky;
    top: 0;
    z-index: 1100;
}

.header-left, .header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.branding b { color: var(--primary); text-transform: uppercase; }
.branding small { color: var(--nav-text); opacity: 0.8; }

/* THEME SWITCH (Inside Header) */
.theme-switch {
    position: relative;
    width: 54px;
    height: 28px;
}

.theme-switch input { display: none; }

.slider {
    position: absolute;
    inset: 0;
    border-radius: 34px;
    background: #cbd5e1;
    cursor: pointer;
    transition: 0.3s;
}

.slider:before {
    content: "";
    position: absolute;
    width: 20px;
    height: 20px;
    left: 4px; top: 4px;
    background: white;
    border-radius: 50%;
    transition: 0.3s;
}

input:checked + .slider { background: var(--primary); }
input:checked + .slider:before { transform: translateX(26px); }

/* PROFILE DROPDOWN */
.header-profile { position: relative; }
.header-profile img {
    width: 40px; height: 40px;
    border-radius: 50%;
    border: 2px solid var(--primary);
    cursor: pointer;
}

.profile-dropdown {
    position: absolute;
    top: 55px;
    right: 0;
    width: 200px;
    background: var(--card-bg);
    border-radius: 8px;
    box-shadow: var(--shadow);
    display: none;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--border);
}

.profile-dropdown.open { display: flex; }
.profile-dropdown a {
    padding: 12px;
    text-decoration: none;
    color: var(--text);
    font-size: 0.9rem;
}

.profile-dropdown a:hover {
    background: var(--primary);
    color: #fff;
}

/* =====================================================
    3. MAIN LAYOUT & INTRO
===================================================== */
main {
    max-width: 900px;
    margin: 60px auto;
    padding: 0 20px;
}

#intro-section {
    background: var(--card-bg);
    padding: 40px;
    border-radius: var(--radius);
    border-left: 6px solid var(--primary);
    box-shadow: var(--shadow);
    margin-bottom: 30px;
}

/* =====================================================
    4. PROGRESS DASHBOARD
===================================================== */
.progress-section { margin: 30px 0; }

.progress-card {
    background: var(--card-bg);
    padding: 25px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.progress-bar-container {
    background: var(--primary-soft);
    height: 20px;
    border-radius: var(--radius);
    overflow: hidden;
    margin: 15px 0;
}

.progress-bar-fill {
    height: 100%;
    background: var(--primary);
    text-align: center;
    color: white;
    font-weight: 600;
    font-size: 0.85rem;
    line-height: 20px;
    transition: width 0.4s ease;
}

.certificate-btn {
    display: inline-block;
    padding: 10px 20px;
    background: var(--primary);
    color: #fff;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: background 0.3s ease;
    margin-top: 10px;
}

/* =====================================================
    5. THE MODULE SYSTEM (CLEANED & SCROLLABLE)
===================================================== */
.module-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    margin: 30px 0;
    border: 1px solid var(--border);
    overflow: hidden;
    position: relative;
}

.module-header {
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.module-meta { display: flex; align-items: center; gap: 10px; }

/* Fixed Scrollable Attribute */
.module-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--bg);
}

.module-card.active .module-body {
    max-height: 80vh; 
    overflow-y: auto;
    border-top: 1px solid var(--border);
    box-shadow: inset 0 10px 10px -10px rgba(0,0,0,0.1);
}

/* Scrollbar Styling */
.module-body::-webkit-scrollbar { width: 8px; }
.module-body::-webkit-scrollbar-track { background: var(--primary-soft); }
.module-body::-webkit-scrollbar-thumb { 
    background: var(--primary); 
    border-radius: 5px; 
}

.module-content { padding: 30px 25px 80px 25px; }

/* Arrow Rotation */
.arrow { transition: 0.3s; }
.module-card.active .arrow { transform: rotate(180deg); }

/* =====================================================
    6. TABLES, QUIZ & POPUPS
===================================================== */
table { 
    width: 100%; 
    border-collapse: collapse; 
    margin-top: 20px; 
    
    /* MODIFIED: Mobile scroll fix */
    display: block; 
    overflow-x: auto; 
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    white-space: nowrap; /* Keeps table data on one line to enable scrolling */
}

/* Added a scrollbar style specifically for tables so users know they can scroll */
table::-webkit-scrollbar {
    height: 8px;
}
table::-webkit-scrollbar-track {
    background: var(--border);
    border-radius: 4px;
}
table::-webkit-scrollbar-thumb {
    background: var(--primary-soft);
    border-radius: 4px;
}
table::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

th { background: var(--primary); color: white; padding: 12px; text-align: left; }
td { padding: 12px; border-bottom: 1px solid var(--border); }

.quiz-container {
    margin-top: 50px;
    padding: 30px;
    background: var(--primary-soft);
    border-radius: var(--radius);
}

.options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 15px;
}

.option-label {
    padding: 12px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
}

.option-label:hover { border-color: var(--primary); }

/* This targets the button inside your quiz form specifically */
.quiz-form button[type="submit"] {
    width: 100%;
    padding: 16px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: var(--transition);
    margin-top: 25px;
    box-shadow: 0 4px 12px rgba(58, 122, 254, 0.2);
    display: block;
}

/* Hover State */
.quiz-form button[type="submit"]:hover {
    background: #2563eb;
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(58, 122, 254, 0.4);
}

/* Active/Click State */
.quiz-form button[type="submit"]:active {
    transform: translateY(0);
}

/* Loading/Disabled State (Matches your JS logic) */
.quiz-form button[type="submit"]:disabled {
    background: var(--text-muted);
    cursor: not-allowed;
    transform: none;
    opacity: 0.7;
    box-shadow: none;
}

.quiz-popup {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.6);
    display: flex; justify-content: center; align-items: center;
    opacity: 0; pointer-events: none;
    transition: 0.3s; z-index: 1200;
}

.quiz-popup.show { opacity: 1; pointer-events: auto; }

/* =====================================================
    7. FLOATING ELEMENTS & STATES
===================================================== */
/* Top Progress Line */
.progress-container {
    position: fixed; top: 0; width: 100%;
    height: 4px; z-index: 1150;
}
.progress-bar { height: 100%; width: 0%; background: var(--primary); }

/* Bottom Theme Toggle */
.theme-toggle {
    position: fixed; bottom: 20px; right: 20px;
    width: 50px; height: 50px;
    border-radius: 50%;
    background: var(--card-bg);
    border: 1px solid var(--border);
    cursor: pointer;
    box-shadow: var(--shadow);
    z-index: 1000;
}

/* Badges */
.badge-complete { background: #10b981; color: white; padding: 4px 10px; border-radius: 20px; font-size: 0.75rem; }
.badge-locked { background: #ef4444; color: white; padding: 4px 10px; border-radius: 20px; font-size: 0.75rem; }

/* Lock Overlays */
.lock-overlay {
    position: absolute; inset: 0;
    background: rgba(0,0,0,0.6);
    display: flex; justify-content: center; align-items: center;
    border-radius: 12px; z-index: 10;
}

.lock-message {
    background: white; padding: 15px 20px;
    border-radius: 10px; font-weight: 600; color: #111;
}

/* =====================================================
    8. RESPONSIVE
===================================================== */
@media (max-width: 768px) {
    .options-grid { grid-template-columns: 1fr; }
    main { margin: 20px auto; }
    .header-left small { display: none; }
}

/* Fix the visibility of the inner popup box */
.popup-content {
    background: var(--card-bg); /* Uses white in light mode, dark blue in dark mode */
    padding: 2rem;
    border-radius: var(--radius);
    border: 3px solid var(--primary);
    text-align: center;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 20px 40px rgba(0,0,0,0.4);
    color: var(--text);
    position: relative;
    z-index: 1201; /* Higher than the dim overlay */
}

/* Ensure the background overlay is dark enough to make the box pop */
.quiz-popup {
    background: rgba(0, 0, 0, 0.85); /* Darker overlay for better focus */
}

#popupTitle {
    margin-top: 0;
    font-size: 1.8rem;
}

#popupScore {
    font-size: 2.5rem;
    margin: 10px 0;
    font-weight: 800;
}

/* Success State for the Button */
.quiz-form button[type="submit"].btn-success {
    background-color: #10b981 !important; /* Emerald Green */
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.6);
    border-color: #059669;
    transform: scale(1.02);
    pointer-events: none; /* Prevents double-clicking after winning */
}
/* =====================================================
    9. HAMBURGER & MOBILE NAV
===================================================== */
.menu-toggle {
    display: none; /* Hidden on desktop */
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    z-index: 1200;
}

.menu-toggle .bar {
    width: 25px;
    height: 3px;
    background: var(--primary);
    border-radius: 2px;
    transition: var(--transition);
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 20px;
    margin: 0;
    padding: 0;
}

.nav-links a {
    text-decoration: none;
    color: var(--nav-text);
    font-weight: 600;
    font-size: 0.95rem;
    transition: var(--transition);
}

.nav-links a:hover { color: var(--primary); }

/* ... keep your existing design variables ... */

@media (max-width: 768px) {
    .menu-toggle { display: flex; z-index: 1201; }

    .nav-container {
        position: fixed;
        top: 0;
        left: -100%; /* Start hidden */
        width: 250px;
        height: 100vh;
        background: var(--card-bg);
        box-shadow: 10px 0 20px rgba(0,0,0,0.1);
        transition: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        padding-top: 80px;
        z-index: 1150;
        display: block; /* Ensure it's not display:none */
    }

    /* Matches the JavaScript .classList.toggle("active") */
    .nav-container.active { 
        left: 0; 
    }

    /* Hamburger to X Animation */
    .menu-toggle.active .bar:nth-child(1) { transform: translateY(8px) rotate(45deg); }
    .menu-toggle.active .bar:nth-child(2) { opacity: 0; }
    .menu-toggle.active .bar:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }
}

/* Ensure the Profile Dropdown stays visible when toggled */
.profile-dropdown.open {
    display: flex;
}

/* =====================================================
    10. FLOATING WHATSAPP BUTTON
===================================================== */
.whatsapp-float {
    position: fixed;
    width: 60px;
    height: 60px;
    bottom: 85px; /* Positioned above the theme toggle */
    right: 20px;
    background-color: #25d366;
    color: #FFF;
    border-radius: 50px;
    text-align: center;
    font-size: 30px;
    box-shadow: 2px 2px 10px rgba(0,0,0,0.2);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    animation: pulse-whatsapp 2s infinite;
}

.whatsapp-float:hover {
    background-color: #128c7e;
    transform: scale(1.1);
}

.whatsapp-icon {
    width: 35px;
    height: 35px;
    fill: white;
}

@keyframes pulse-whatsapp {
    0% { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.5); }
    70% { box-shadow: 0 0 0 15px rgba(37, 211, 102, 0); }
    100% { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0); }
}

/* Adjust for very small screens if needed */
@media (max-width: 768px) {
    .whatsapp-float {
        width: 50px;
        height: 50px;
        bottom: 80px;
    }
    .whatsapp-icon {
        width: 28px;
        height: 28px;
    }
}

