/* ============================================
   Urdu Lessons — Custom Styles
   ============================================ */

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

body {
    background: #0a0a12;
    overflow-x: hidden;
}

/* ---- Glassy Navbar ---- */
.navbar-glass {
    background: rgba(15, 15, 26, 0.72);
    backdrop-filter: blur(20px) saturate(1.6);
    -webkit-backdrop-filter: blur(20px) saturate(1.6);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.nav-link {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.65);
    text-decoration: none;
    border-radius: 0.75rem;
    transition: all 0.2s ease;
}

.nav-link:hover,
.nav-link.active {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
}

.nav-link.active {
    color: #58CC02;
}

.nav-link-btn {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: #fff;
    background: #58CC02;
    text-decoration: none;
    border-radius: 0.75rem;
    transition: all 0.2s ease;
}

.nav-link-btn:hover {
    background: #4CAF00;
    transform: translateY(-1px);
}

.mobile-nav-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    font-size: 0.9375rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.75);
    text-decoration: none;
    border-radius: 0.75rem;
    transition: all 0.2s ease;
}

.mobile-nav-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.06);
}

/* ---- Hamburger ---- */
.hamburger-lines {
    display: flex;
    flex-direction: column;
    gap: 5px;
    width: 20px;
}

.hamburger-lines span {
    display: block;
    height: 2px;
    background: #fff;
    border-radius: 2px;
    transition: all 0.3s ease;
    transform-origin: center;
}

.hamburger-active .hamburger-lines span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.hamburger-active .hamburger-lines span:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}

.hamburger-active .hamburger-lines span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* ---- Mobile Menu ---- */
.mobile-menu-hidden {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease;
}

.mobile-menu-visible {
    max-height: 400px;
}

/* ---- Navbar hide/show ---- */
#navbar {
    transform: translateY(0);
}

#navbar.navbar-hidden {
    transform: translateY(-100%);
}

/* ---- Scroll to Top ---- */
#scroll-top.visible {
    opacity: 1;
    pointer-events: auto;
}

/* ---- Cards ---- */
.card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 1rem;
    padding: 1.5rem;
    transition: all 0.25s ease;
}

.card:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

.card-locked {
    opacity: 0.5;
    pointer-events: none;
    position: relative;
}

.card-locked::after {
    content: '🔒';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2rem;
    filter: grayscale(0.5);
}

/* ---- Stat Cards ---- */
.stat-card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01));
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 1rem;
    padding: 1.5rem;
}

/* ---- Form Styles ---- */
.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.75rem;
    color: #fff;
    font-size: 0.9375rem;
    transition: all 0.2s ease;
    outline: none;
}

.form-input:focus {
    border-color: #58CC02;
    box-shadow: 0 0 0 3px rgba(88, 204, 2, 0.15);
    background: rgba(255, 255, 255, 0.07);
}

.form-input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.form-label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    background: #58CC02;
    color: #fff;
    font-weight: 600;
    font-size: 0.9375rem;
    border: none;
    border-radius: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-primary:hover {
    background: #4CAF00;
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(88, 204, 2, 0.3);
}

.btn-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    font-weight: 500;
    font-size: 0.8125rem;
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.25);
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
    border-radius: 0.5rem;
}

.btn-outline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    background: transparent;
    color: rgba(255, 255, 255, 0.65);
    font-weight: 500;
    font-size: 0.8125rem;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-outline:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.25);
}

/* ---- Language Toggle Switches ---- */
.toggle-bar {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 1rem;
    flex-wrap: wrap;
}

.toggle-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.toggle-label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.6);
    user-select: none;
    cursor: pointer;
}

.toggle-switch {
    position: relative;
    width: 44px;
    height: 24px;
    cursor: pointer;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 999px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: #fff;
    border-radius: 50%;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.toggle-switch input:checked + .toggle-slider {
    background: #58CC02;
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(20px);
}

/* ---- Speaker Button ---- */
.speaker-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: rgba(88, 204, 2, 0.15);
    border: 1px solid rgba(88, 204, 2, 0.25);
    border-radius: 0.75rem;
    color: #58CC02;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.speaker-btn:hover {
    background: rgba(88, 204, 2, 0.25);
    transform: scale(1.05);
}

.speaker-btn.playing {
    animation: pulse-speaker 1s infinite;
}

@keyframes pulse-speaker {
    0%, 100% { box-shadow: 0 0 0 0 rgba(88, 204, 2, 0.3); }
    50% { box-shadow: 0 0 0 8px rgba(88, 204, 2, 0); }
}

.speaker-btn-sm {
    width: 32px;
    height: 32px;
    border-radius: 0.5rem;
    font-size: 0.875rem;
}

/* ---- Lesson Word Cards ---- */
.word-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 1rem;
    padding: 1.25rem;
    cursor: pointer;
    transition: all 0.25s ease;
    position: relative;
    overflow: visible;
}

.word-card:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.12);
}

.word-card:active {
    transform: scale(0.98);
}

.word-urdu {
    font-family: 'Noto Nastaliq Urdu', serif;
    font-size: 1.75rem;
    line-height: 2.5;
    color: #fff;
    direction: rtl;
    text-align: right;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    margin-bottom: 0.5rem;
}

.word-roman {
    font-size: 1rem;
    color: #58CC02;
    font-weight: 500;
    padding: 0.25rem 0;
    transition: all 0.3s ease;
}

.word-english {
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.5);
    font-weight: 400;
    padding: 0.25rem 0;
    transition: all 0.3s ease;
}

.word-hidden {
    opacity: 0;
    max-height: 0;
    padding: 0;
    overflow: hidden;
    margin: 0;
}

.word-visible {
    opacity: 1;
    max-height: 60px;
}

/* ---- Tap-on-Word Popup ---- */
.word-tappable {
    display: inline-block;
    cursor: pointer;
    position: relative;
    padding: 0.125rem 0.25rem;
    border-radius: 0.375rem;
    transition: all 0.2s ease;
    font-family: 'Noto Nastaliq Urdu', serif;
}

.word-tappable:hover {
    background: rgba(88, 204, 2, 0.1);
}

.word-tappable.has-active-popup {
    z-index: 50;
}

/* Roman Urdu words are tappable too, for learners who skip the script */
.roman-tappable {
    display: inline-block;
    cursor: pointer;
    position: relative;
    direction: ltr;
    padding: 0.0625rem 0.25rem;
    border-radius: 0.375rem;
    border-bottom: 1px dotted rgba(88, 204, 2, 0.45);
    transition: all 0.2s ease;
}

.roman-tappable:hover {
    background: rgba(88, 204, 2, 0.12);
    border-bottom-color: rgba(88, 204, 2, 0.9);
}

.roman-tappable.has-active-popup {
    z-index: 50;
}

.word-popup {
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) scale(0.9);
    background: rgba(18, 18, 32, 0.96);
    backdrop-filter: blur(18px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 0.875rem;
    padding: 0.875rem 1.125rem;
    min-width: 170px;
    max-width: 260px;
    opacity: 0;
    pointer-events: none;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 100;
    box-shadow: 0 10px 36px rgba(0, 0, 0, 0.6);
    text-align: center;
}

.word-popup.active {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(-50%) scale(1);
}

.popup-header-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}

.popup-speak-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 0.5rem;
    background: rgba(88, 204, 2, 0.15);
    border: 1px solid rgba(88, 204, 2, 0.3);
    color: #58CC02;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.popup-speak-btn:hover {
    background: rgba(88, 204, 2, 0.3);
    transform: scale(1.08);
}

.word-popup .popup-urdu {
    font-family: 'Noto Nastaliq Urdu', serif;
    font-size: 1.5rem;
    color: #fff;
    direction: rtl;
    line-height: 1.8;
}

.word-popup .popup-roman {
    font-size: 0.9375rem;
    color: #58CC02;
    font-weight: 600;
    margin-bottom: 0.25rem;
    letter-spacing: 0.02em;
    direction: ltr;
}

.word-popup .popup-english {
    font-size: 0.8125rem;
    color: rgba(255, 255, 255, 0.75);
    margin-top: 0.25rem;
    line-height: 1.35;
    padding-top: 0.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    direction: ltr;
}

/* ---- Sentence Section ---- */
.sentence-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 1rem;
    padding: 1.25rem;
    transition: all 0.25s ease;
}

.sentence-urdu {
    font-family: 'Noto Nastaliq Urdu', serif;
    font-size: 1.5rem;
    line-height: 2.5;
    color: #fff;
    direction: rtl;
    text-align: right;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    margin-bottom: 0.5rem;
}

.sentence-roman {
    font-size: 0.9375rem;
    color: #58CC02;
    font-weight: 500;
    padding: 0.25rem 0;
    transition: all 0.3s ease;
}

.sentence-english {
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.5);
    padding: 0.25rem 0;
    transition: all 0.3s ease;
}

/* ---- Lesson Card (in list) ---- */
.lesson-list-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 1rem;
    padding: 1rem 1.25rem;
    text-decoration: none;
    transition: all 0.25s ease;
}

.lesson-list-card:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(88, 204, 2, 0.2);
    transform: translateY(-2px);
}

.lesson-list-card.locked {
    opacity: 0.45;
    cursor: not-allowed;
}

.lesson-list-card.locked:hover {
    transform: none;
    border-color: rgba(255, 255, 255, 0.06);
}

.lesson-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.75rem;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.lesson-icon.unlocked {
    background: rgba(88, 204, 2, 0.15);
    color: #58CC02;
}

.lesson-icon.locked-icon {
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.3);
}

/* ---- Toast ---- */
.toast-msg {
    padding: 0.75rem 1.25rem;
    border-radius: 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.toast-success {
    background: rgba(88, 204, 2, 0.15);
    border: 1px solid rgba(88, 204, 2, 0.3);
    color: #86efac;
}

.toast-error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

/* ---- Auth Forms ---- */
.auth-container {
    max-width: 420px;
    margin: 2rem auto;
}

.auth-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 1.5rem;
    padding: 2.5rem;
}

/* ---- Admin Tables ---- */
.admin-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.admin-table th {
    text-align: left;
    padding: 0.75rem 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(255, 255, 255, 0.4);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.admin-table td {
    padding: 0.875rem 1rem;
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.8);
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    vertical-align: middle;
}

.admin-table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

/* ---- Status Badges ---- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    font-size: 0.6875rem;
    font-weight: 600;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.badge-pending {
    background: rgba(251, 191, 36, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(251, 191, 36, 0.2);
}

.badge-approved {
    background: rgba(88, 204, 2, 0.15);
    color: #86efac;
    border: 1px solid rgba(88, 204, 2, 0.2);
}

.badge-rejected {
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.badge-banned {
    background: rgba(139, 92, 246, 0.15);
    color: #c4b5fd;
    border: 1px solid rgba(139, 92, 246, 0.2);
}

/* ---- Alert Messages ---- */
.alert {
    padding: 1rem 1.25rem;
    border-radius: 0.75rem;
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.alert-success {
    background: rgba(88, 204, 2, 0.1);
    border: 1px solid rgba(88, 204, 2, 0.2);
    color: #86efac;
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}

.alert-info {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.2);
    color: #93c5fd;
}

.alert-warning {
    background: rgba(251, 191, 36, 0.1);
    border: 1px solid rgba(251, 191, 36, 0.2);
    color: #fde68a;
}

/* MCQ post-answer explanation (Lessons 9+ store these in question JSON) */
.mcq-explanation {
    margin-top: 1.25rem;
    padding: 0.875rem 1rem;
    border-radius: 0.75rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 0.9375rem;
    line-height: 1.55;
    color: rgba(255, 255, 255, 0.75);
    animation: mcqExplanationIn 0.25s ease-out;
}

.mcq-explanation-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.45);
    margin-bottom: 0.35rem;
}

@keyframes mcqExplanationIn {
    from {
        opacity: 0;
        transform: translateY(4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .word-urdu {
        font-size: 1.5rem;
    }

    .word-card {
        padding: 1rem;
    }

    .toggle-bar {
        gap: 0.75rem;
        padding: 0.625rem 0.75rem;
    }

    .admin-table-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .auth-card {
        padding: 1.5rem;
        border-radius: 1rem;
    }

    .word-popup {
        min-width: 140px;
        padding: 0.75rem;
    }

    .sentence-urdu {
        font-size: 1.25rem;
    }
}

/* ---- Lesson Prose (grammar notes, tables, callouts) ---- */
.lesson-prose h2,
.lesson-prose h3 {
    font-size: 1.0625rem;
    font-weight: 700;
    color: #fff;
    margin: 1.25rem 0 0.5rem;
}

.lesson-prose p {
    margin-bottom: 0.75rem;
}

.lesson-prose strong {
    color: #fff;
    font-weight: 600;
}

.lesson-prose blockquote {
    border-left: 3px solid #58CC02;
    background: rgba(88, 204, 2, 0.07);
    border-radius: 0 0.75rem 0.75rem 0;
    padding: 0.875rem 1rem;
    margin: 1rem 0;
}

.lesson-prose ul {
    list-style: disc;
    padding-left: 1.25rem;
    margin-bottom: 0.75rem;
}

.lesson-prose li {
    margin-bottom: 0.375rem;
}

/*
 * Inside prose the words stay `inline` so the browser's own bidi ordering
 * applies to them. As inline-block each word becomes an atomic box ordered by
 * the parent's direction, which prints Urdu phrases backwards in LTR text and
 * in table cells.
 */
.lesson-prose .word-tappable {
    display: inline;
    padding: 0 0.1875rem;
    font-size: 1.05em;
}

/* Keeps a phrase together as one right-to-left unit inside LTR prose. */
.lesson-prose .urdu-run {
    direction: rtl;
    unicode-bidi: isolate;
}

.lesson-prose [dir="rtl"] {
    text-align: right;
}

.lesson-prose table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    font-size: 0.875rem;
}

/* Wrapper added by lesson.js so word popups are not clipped on desktop */
.lesson-prose .table-scroll {
    margin: 1rem 0;
}

@media (max-width: 640px) {
    .lesson-prose .table-scroll {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

.lesson-prose thead th {
    text-align: left;
    white-space: nowrap;
    padding: 0.625rem 0.875rem;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #58CC02;
    background: rgba(88, 204, 2, 0.08);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.lesson-prose tbody td {
    padding: 0.625rem 0.875rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.8);
    vertical-align: middle;
}

.lesson-prose tbody tr:hover td {
    background: rgba(255, 255, 255, 0.03);
}

html.light .lesson-prose h2,
html.light .lesson-prose h3,
html.light .lesson-prose strong {
    color: #1f2937;
}

html.light .lesson-prose {
    color: #334155 !important;
}

html.light .lesson-prose thead th {
    color: #3d8c00;
    background: rgba(88, 204, 2, 0.1);
    border-bottom-color: rgba(0, 0, 0, 0.08);
}

html.light .lesson-prose tbody td {
    color: rgba(0, 0, 0, 0.72);
    border-bottom-color: rgba(0, 0, 0, 0.06);
}

html.light .lesson-prose tbody tr:hover td {
    background: rgba(0, 0, 0, 0.02);
}

html.light .roman-tappable:hover {
    background: rgba(88, 204, 2, 0.1);
}

/* ---- Lesson Topics (collapsible) ---- */
.topic-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 1rem;
    transition: border-color 0.25s ease;
}

.topic-card.is-open {
    border-color: rgba(88, 204, 2, 0.35);
}

.topic-header {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.875rem 1rem;
    background: transparent;
    border: none;
    border-radius: 1rem;
    color: inherit;
    text-align: left;
    cursor: pointer;
    transition: background 0.2s ease;
}

.topic-header:hover {
    background: rgba(255, 255, 255, 0.03);
}

.topic-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    font-size: 1.125rem;
}

.topic-card.is-done .topic-icon {
    background: rgba(88, 204, 2, 0.14);
}

.topic-heading {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.topic-title {
    font-size: 0.9375rem;
    font-weight: 600;
    line-height: 1.35;
    color: #fff;
}

.topic-meta {
    font-size: 0.6875rem;
    color: rgba(255, 255, 255, 0.4);
}

.topic-status-done,
.topic-status-pending {
    flex-shrink: 0;
    padding: 0.25rem 0.5rem;
    border-radius: 999px;
    font-size: 0.625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.topic-status-done {
    display: none;
    color: #58CC02;
    background: rgba(88, 204, 2, 0.14);
}

.topic-status-pending {
    display: inline-block;
    color: rgba(255, 255, 255, 0.4);
    background: rgba(255, 255, 255, 0.06);
}

.topic-card.is-done .topic-status-done {
    display: inline-block;
}

.topic-card.is-done .topic-status-pending {
    display: none;
}

.topic-chevron {
    flex-shrink: 0;
    color: rgba(255, 255, 255, 0.35);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.topic-card.is-open .topic-chevron {
    transform: rotate(90deg);
    color: #58CC02;
}

.topic-panel {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Set once the opening animation has finished so word popups are not clipped */
.topic-panel.is-expanded {
    overflow: visible;
}

.topic-panel-inner {
    padding: 0.25rem 1rem 1.25rem;
}

.topic-panel-inner .section-heading {
    margin-top: 1.25rem;
}

@media (max-width: 480px) {
    .topic-header {
        gap: 0.625rem;
        padding: 0.75rem;
    }

    .topic-panel-inner {
        padding: 0.25rem 0.75rem 1rem;
    }
}

html.light .topic-card {
    background: #fff;
    border-color: rgba(0, 0, 0, 0.08);
}

html.light .topic-header:hover {
    background: rgba(0, 0, 0, 0.02);
}

html.light .topic-icon {
    background: rgba(0, 0, 0, 0.04);
}

html.light .topic-title {
    color: #1a1a2e;
}

html.light .topic-meta {
    color: rgba(0, 0, 0, 0.45);
}

html.light .topic-status-pending {
    color: rgba(0, 0, 0, 0.45);
    background: rgba(0, 0, 0, 0.05);
}

html.light .topic-status-done {
    color: #3d8c00;
}

html.light .topic-chevron {
    color: rgba(0, 0, 0, 0.3);
}

/* ---- Section Heading ---- */
.section-heading {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.section-heading-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(88, 204, 2, 0.1);
    border-radius: 0.625rem;
    font-size: 1rem;
}

.section-heading-text {
    font-size: 1rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.8);
}

/* ---- Empty State ---- */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: rgba(255, 255, 255, 0.3);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* ---- JSON Editor ---- */
.json-editor {
    width: 100%;
    min-height: 400px;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.75rem;
    color: #86efac;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.8125rem;
    line-height: 1.6;
    resize: vertical;
    outline: none;
    tab-size: 2;
}

.json-editor:focus {
    border-color: #58CC02;
    box-shadow: 0 0 0 3px rgba(88, 204, 2, 0.1);
}

/* ============================================
   Collapsible Exercise Panels
   ============================================ */
.lesson-card-wrapper {
    position: relative;
}

.lesson-card-wrapper .lesson-list-card {
    position: relative;
    z-index: 2;
}

/* Toggle button (chevron) */
.exercise-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 0.625rem;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: all 0.25s ease;
    flex-shrink: 0;
}

.exercise-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.exercise-toggle-btn.open {
    background: rgba(88, 204, 2, 0.15);
    color: #58CC02;
}

.exercise-chevron {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.exercise-toggle-btn.open .exercise-chevron {
    transform: rotate(90deg);
}

/* Collapsible panel */
.exercises-panel {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.exercises-panel.open {
    max-height: 1000px;
}

.exercises-panel-inner {
    padding: 0.5rem 0.75rem 0.75rem;
    margin: -4px 8px 0;
    background: rgba(255, 255, 255, 0.015);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-top: none;
    border-radius: 0 0 1rem 1rem;
}

/* Exercise items */
.exercise-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.75rem;
    border-radius: 0.625rem;
    transition: background 0.2s ease;
}

.exercise-item:hover {
    background: rgba(255, 255, 255, 0.03);
}

.exercise-item + .exercise-item {
    border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.exercise-item-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
    background: rgba(255, 255, 255, 0.05);
    font-size: 0.875rem;
    flex-shrink: 0;
}

.exercise-item-icon.completed {
    background: rgba(88, 204, 2, 0.1);
}

.exercise-item-title {
    font-size: 0.8125rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.8);
}

.exercise-item-type {
    font-size: 0.6875rem;
    color: rgba(255, 255, 255, 0.35);
    text-transform: capitalize;
}

.exercise-score {
    font-size: 0.75rem;
    font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
}

.score-good {
    color: #86efac;
    background: rgba(88, 204, 2, 0.1);
}

.score-ok {
    color: #fbbf24;
    background: rgba(251, 191, 36, 0.1);
}

.score-bad {
    color: #fca5a5;
    background: rgba(239, 68, 68, 0.1);
}

.exercise-not-done {
    font-size: 0.6875rem;
    color: rgba(255, 255, 255, 0.25);
    font-style: italic;
}

/* Light mode overrides for exercises */
html.light .exercise-toggle-btn {
    background: rgba(0, 0, 0, 0.04);
    color: rgba(0, 0, 0, 0.4);
}

html.light .exercise-toggle-btn:hover {
    background: rgba(0, 0, 0, 0.08);
    color: #1a1a2e;
}

html.light .exercise-toggle-btn.open {
    background: rgba(88, 204, 2, 0.1);
    color: #3d8c00;
}

html.light .exercises-panel-inner {
    background: rgba(0, 0, 0, 0.015);
    border-color: rgba(0, 0, 0, 0.06);
}

html.light .exercise-item:hover {
    background: rgba(0, 0, 0, 0.02);
}

html.light .exercise-item + .exercise-item {
    border-top-color: rgba(0, 0, 0, 0.05);
}

html.light .exercise-item-icon {
    background: rgba(0, 0, 0, 0.04);
}

html.light .exercise-item-icon.completed {
    background: rgba(88, 204, 2, 0.08);
}

html.light .exercise-item-title {
    color: rgba(0, 0, 0, 0.75);
}

html.light .exercise-item-type {
    color: rgba(0, 0, 0, 0.35);
}

html.light .score-good {
    color: #326e00;
    background: rgba(88, 204, 2, 0.08);
}

html.light .score-ok {
    color: #92400e;
    background: rgba(251, 191, 36, 0.08);
}

html.light .score-bad {
    color: #b91c1c;
    background: rgba(239, 68, 68, 0.06);
}

html.light .exercise-not-done {
    color: rgba(0, 0, 0, 0.25);
}

/* ============================================
   Matching Game
   ============================================ */
.match-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}
.match-col {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.match-item {
    background: rgba(255, 255, 255, 0.03);
    border: 2px solid rgba(255, 255, 255, 0.1);
    padding: 1rem;
    border-radius: 0.75rem;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s ease;
    user-select: none;
    font-size: 1rem;
}
.match-item.urdu {
    font-size: 1.25rem;
    font-weight: 500;
}
.match-item .match-roman {
    font-size: 0.8125rem;
    font-weight: 500;
    color: #58CC02;
    margin-top: 0.375rem;
    line-height: 1.4;
}
html.light .match-item .match-roman {
    color: #3d8c00;
}
.match-item:hover {
    background: rgba(255, 255, 255, 0.08);
}
.match-item.selected {
    background: rgba(59, 130, 246, 0.2);
    border-color: #3b82f6;
    transform: scale(1.02);
}
.match-item.matched {
    background: rgba(88, 204, 2, 0.15);
    border-color: #58CC02;
    color: #58CC02;
    opacity: 0.6;
    pointer-events: none;
    transform: scale(0.98);
}
.match-item.error {
    background: rgba(239, 68, 68, 0.2);
    border-color: #ef4444;
    animation: shake 0.4s ease-in-out;
}
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

html.light .match-item {
    background: #fff;
    border-color: rgba(0, 0, 0, 0.1);
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}
html.light .match-item:hover {
    background: #f8fafc;
}
html.light .match-item.selected {
    background: #eff6ff;
    border-color: #3b82f6;
}
html.light .match-item.matched {
    background: #f0fdf4;
    border-color: #58CC02;
    color: #3d8c00;
}
html.light .match-item.error {
    background: #fef2f2;
    border-color: #ef4444;
}

/* ============================================
   Sentence Builder Game
   ============================================ */
.builder-target {
    font-size: 1.125rem;
    font-weight: 500;
    color: #fff;
    margin-bottom: 1rem;
}
.builder-zone {
    min-height: 4.5rem;
    border: 2px dashed rgba(255, 255, 255, 0.2);
    border-radius: 0.75rem;
    padding: 0.75rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    background: rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    direction: rtl; /* Right to left for Urdu */
}
.builder-zone.correct {
    border-color: #58CC02;
    background: rgba(88, 204, 2, 0.1);
}
.builder-zone.error {
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
    animation: shake 0.4s ease-in-out;
}
.builder-bank {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    min-height: 4rem;
    padding: 1rem 0;
    direction: ltr;
}
.builder-chip {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    cursor: pointer;
    user-select: none;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}
.builder-chip .chip-roman {
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.7);
}
.builder-chip .chip-urdu {
    font-size: 1.25rem;
    font-family: var(--font-urdu);
}
.builder-chip:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}
.builder-chip.in-zone {
    background: rgba(59, 130, 246, 0.2);
    border-color: rgba(59, 130, 246, 0.5);
}
.builder-question {
    display: none; /* Only show active question */
}
.builder-question.active {
    display: block;
    animation: fadeIn 0.4s ease;
}

html.light .builder-target { color: #1f2937; }
html.light .builder-zone { border-color: rgba(0, 0, 0, 0.15); background: rgba(0, 0, 0, 0.02); }
html.light .builder-zone.correct { border-color: #58CC02; background: #f0fdf4; }
html.light .builder-zone.error { border-color: #ef4444; background: #fef2f2; }
html.light .builder-chip { background: #fff; border-color: rgba(0, 0, 0, 0.1); box-shadow: 0 1px 3px rgba(0,0,0,0.05); }
html.light .builder-chip .chip-roman { color: #64748b; }
html.light .builder-chip:hover { background: #f8fafc; }
html.light .builder-chip.in-zone { background: #eff6ff; border-color: #3b82f6; }

/* ============================================
   Alphabet Grid
   ============================================ */
.alphabet-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
    direction: rtl; /* Right to left for Urdu alphabet */
}
.alphabet-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.75rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1rem 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    position: relative; /* For word-popup */
}
.alphabet-card:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.2);
}
.alphabet-urdu {
    font-size: 2.5rem;
    font-family: var(--font-urdu);
    line-height: 1.2;
    color: #fff;
    margin-bottom: 0.25rem;
}
.alphabet-roman {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
    text-align: center;
    margin-top: 0.75rem; /* Proper spacing between Urdu and Roman */
}

html.light .alphabet-card { background: #fff; border-color: rgba(0, 0, 0, 0.1); box-shadow: 0 2px 4px rgba(0,0,0,0.05); }
html.light .alphabet-card:hover { background: #f8fafc; border-color: rgba(0, 0, 0, 0.2); }
html.light .alphabet-urdu { color: #1f2937; }
html.light .alphabet-roman { color: #64748b; }

/* ============================================
   Theme Toggle Button
   ============================================ */
.theme-toggle-btn {
    padding: 0.5rem !important;
    border-radius: 0.75rem;
    cursor: pointer;
    background: none;
    border: none;
}

.theme-toggle-btn-mobile {
    cursor: pointer;
    background: none;
    border: none;
    text-align: left;
    width: 100%;
}

/* Dark mode (default): show sun icon, hide moon */
.theme-icon-sun { display: block; }
.theme-icon-moon { display: none; }
.theme-label-dark { display: inline; }
.theme-label-light { display: none; }

/* Light mode: show moon icon, hide sun */
html.light .theme-icon-sun { display: none; }
html.light .theme-icon-moon { display: block; }
html.light .theme-label-dark { display: none; }
html.light .theme-label-light { display: inline; }

/* ============================================
   LIGHT MODE — html.light overrides
   ============================================ */
html.light body {
    background: #f5f5f7;
    color: #1a1a2e;
}

/* ---- Navbar ---- */
html.light .navbar-glass {
    background: rgba(245, 245, 247, 0.78);
    backdrop-filter: blur(20px) saturate(1.8);
    -webkit-backdrop-filter: blur(20px) saturate(1.8);
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

html.light .nav-link {
    color: rgba(0, 0, 0, 0.55);
}

html.light .nav-link:hover,
html.light .nav-link.active {
    color: #1a1a2e;
    background: rgba(0, 0, 0, 0.05);
}

html.light .nav-link.active {
    color: #3d8c00;
}

html.light .mobile-nav-link {
    color: rgba(0, 0, 0, 0.6);
}

html.light .mobile-nav-link:hover {
    color: #1a1a2e;
    background: rgba(0, 0, 0, 0.04);
}

html.light .hamburger-lines span {
    background: #1a1a2e;
}

/* ---- Cards ---- */
html.light .card {
    background: #fff;
    border-color: rgba(0, 0, 0, 0.08);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

html.light .card:hover {
    background: #fff;
    border-color: rgba(0, 0, 0, 0.12);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

html.light .stat-card {
    background: #fff;
    border-color: rgba(0, 0, 0, 0.08);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

/* ---- Auth ---- */
html.light .auth-card {
    background: #fff;
    border-color: rgba(0, 0, 0, 0.08);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

/* ---- Forms ---- */
html.light .form-input {
    background: #f9fafb;
    border-color: rgba(0, 0, 0, 0.12);
    color: #1a1a2e;
}

html.light .form-input:focus {
    background: #fff;
    border-color: #58CC02;
    box-shadow: 0 0 0 3px rgba(88, 204, 2, 0.12);
}

html.light .form-input::placeholder {
    color: rgba(0, 0, 0, 0.3);
}

html.light .form-label {
    color: rgba(0, 0, 0, 0.5);
}

/* ---- Toggle Bar ---- */
html.light .toggle-bar {
    background: #fff;
    border-color: rgba(0, 0, 0, 0.08);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

html.light .toggle-label {
    color: rgba(0, 0, 0, 0.55);
}

html.light .toggle-slider {
    background: rgba(0, 0, 0, 0.12);
}

/* ---- Word/Sentence Cards ---- */
html.light .word-card {
    background: #fff;
    border-color: rgba(0, 0, 0, 0.08);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

html.light .word-card:hover {
    background: #fff;
    border-color: rgba(0, 0, 0, 0.12);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

html.light .word-urdu {
    color: #1a1a2e;
    border-bottom-color: rgba(0, 0, 0, 0.06);
}

html.light .word-roman {
    color: #3d8c00;
}

html.light .word-english {
    color: rgba(0, 0, 0, 0.45);
}

html.light .sentence-card {
    background: #fff;
    border-color: rgba(0, 0, 0, 0.08);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

html.light .sentence-urdu {
    color: #1a1a2e;
    border-bottom-color: rgba(0, 0, 0, 0.06);
}

html.light .sentence-roman {
    color: #3d8c00;
}

html.light .sentence-english {
    color: rgba(0, 0, 0, 0.45);
}

/* ---- Tap-on-Word Popup ---- */
html.light .word-tappable:hover {
    background: rgba(88, 204, 2, 0.08);
}

html.light .word-popup {
    background: #ffffff;
    border-color: rgba(0, 0, 0, 0.12);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
}

html.light .word-popup .popup-urdu {
    color: #0f172a;
}

html.light .word-popup .popup-roman {
    color: #16a34a;
}

html.light .word-popup .popup-english {
    color: #475569;
    border-top-color: rgba(0, 0, 0, 0.08);
}

html.light .popup-speak-btn {
    background: #dcfce7;
    border-color: #86efac;
    color: #15803d;
}

/* ---- Speaker Button ---- */
html.light .speaker-btn {
    background: rgba(88, 204, 2, 0.1);
    border-color: rgba(88, 204, 2, 0.2);
    color: #3d8c00;
}

html.light .speaker-btn:hover {
    background: rgba(88, 204, 2, 0.18);
}

/* ---- Lesson List Card ---- */
html.light .lesson-list-card {
    background: #fff;
    border-color: rgba(0, 0, 0, 0.08);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    color: #1a1a2e;
}

html.light .lesson-list-card:hover {
    background: #fff;
    border-color: rgba(88, 204, 2, 0.3);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

html.light .lesson-icon.locked-icon {
    background: rgba(0, 0, 0, 0.04);
    color: rgba(0, 0, 0, 0.25);
}

/* ---- Admin Table ---- */
html.light .admin-table th {
    color: rgba(0, 0, 0, 0.4);
    border-bottom-color: rgba(0, 0, 0, 0.08);
}

html.light .admin-table td {
    color: rgba(0, 0, 0, 0.7);
    border-bottom-color: rgba(0, 0, 0, 0.05);
}

html.light .admin-table tr:hover td {
    background: rgba(0, 0, 0, 0.02);
}

/* ---- Scroll-to-Top ---- */
html.light #scroll-top {
    box-shadow: 0 4px 16px rgba(88, 204, 2, 0.2);
}

/* ---- Alerts (light) ---- */
html.light .alert-success {
    background: rgba(88, 204, 2, 0.08);
    border-color: rgba(88, 204, 2, 0.2);
    color: #326e00;
}

html.light .alert-error {
    background: rgba(239, 68, 68, 0.06);
    border-color: rgba(239, 68, 68, 0.15);
    color: #b91c1c;
}

html.light .alert-info {
    background: rgba(59, 130, 246, 0.06);
    border-color: rgba(59, 130, 246, 0.15);
    color: #1d4ed8;
}

html.light .mcq-explanation {
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.08);
    color: #374151;
}

html.light .mcq-explanation-label {
    color: #6b7280;
}

html.light .alert-warning {
    background: rgba(251, 191, 36, 0.08);
    border-color: rgba(251, 191, 36, 0.2);
    color: #92400e;
}

/* ---- Badges (light) ---- */
html.light .badge-approved {
    background: rgba(88, 204, 2, 0.1);
    color: #326e00;
    border-color: rgba(88, 204, 2, 0.2);
}

html.light .badge-pending {
    background: rgba(251, 191, 36, 0.1);
    color: #92400e;
    border-color: rgba(251, 191, 36, 0.2);
}

html.light .badge-rejected {
    background: rgba(239, 68, 68, 0.08);
    color: #b91c1c;
    border-color: rgba(239, 68, 68, 0.15);
}

html.light .badge-banned {
    background: rgba(139, 92, 246, 0.08);
    color: #5b21b6;
    border-color: rgba(139, 92, 246, 0.15);
}

/* ---- Toast (light) ---- */
html.light .toast-success {
    background: rgba(88, 204, 2, 0.1);
    border-color: rgba(88, 204, 2, 0.25);
    color: #326e00;
}

html.light .toast-error {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.2);
    color: #b91c1c;
}

/* ---- Section Headings (light) ---- */
html.light .section-heading {
    border-bottom-color: rgba(0, 0, 0, 0.06);
}

html.light .section-heading-text {
    color: rgba(0, 0, 0, 0.7);
}

/* ---- Empty State (light) ---- */
html.light .empty-state {
    color: rgba(0, 0, 0, 0.35);
}

/* ---- JSON Editor (light) ---- */
html.light .json-editor {
    background: #f9fafb;
    border-color: rgba(0, 0, 0, 0.1);
    color: #326e00;
}

html.light .json-editor:focus {
    background: #fff;
    border-color: #58CC02;
}

/* ---- Misc text overrides ---- */
html.light .text-white { color: #1a1a2e !important; }
html.light .text-gray-400 { color: rgba(0, 0, 0, 0.5) !important; }
html.light .text-gray-500 { color: rgba(0, 0, 0, 0.45) !important; }
html.light .text-gray-600 { color: rgba(0, 0, 0, 0.4) !important; }

/* ---- Progress Bar (light) ---- */
html.light .bg-white\/5 {
    background: rgba(0, 0, 0, 0.06);
}

/* ---- Dividers (light) ---- */
html.light .bg-white\/10,
html.light .border-white\/5 {
    border-color: rgba(0, 0, 0, 0.06) !important;
}

/* ---- Mobile menu (light) ---- */
html.light .mobile-menu-visible .navbar-glass {
    border-top-color: rgba(0, 0, 0, 0.06);
}

/* ---- Btn outline (light) ---- */
html.light .btn-outline {
    color: rgba(0, 0, 0, 0.55);
    border-color: rgba(0, 0, 0, 0.12);
}

html.light .btn-outline:hover {
    background: rgba(0, 0, 0, 0.04);
    color: #1a1a2e;
    border-color: rgba(0, 0, 0, 0.2);
}

/* ---- Smooth transition for all theme changes ---- */
html.light body,
html.light .navbar-glass,
html.light .card,
html.light .stat-card,
html.light .auth-card,
html.light .word-card,
html.light .sentence-card,
html.light .toggle-bar,
html.light .lesson-list-card,
html.light .lesson-hero-card,
html.light .sequence-step,
html.light .lesson-completion-card,
html.light .activity-card {
    transition: background 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

/* ============================================
   MODERN LESSON HERO & HEADER
   ============================================ */
.lesson-hero-card {
    background: linear-gradient(135deg, rgba(88, 204, 2, 0.08) 0%, rgba(255, 255, 255, 0.02) 100%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 1.25rem;
    padding: 1.75rem;
    position: relative;
    overflow: hidden;
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
}

.lesson-hero-card::before {
    content: '';
    position: absolute;
    top: -50px;
    right: -50px;
    width: 150px;
    height: 150px;
    background: radial-gradient(circle, rgba(88, 204, 2, 0.15) 0%, rgba(88, 204, 2, 0) 70%);
    pointer-events: none;
}

.lesson-meta-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.35rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(8px);
}

.lesson-objective-box {
    background: rgba(255, 255, 255, 0.03);
    border-left: 3px solid #58CC02;
    border-radius: 0 0.75rem 0.75rem 0;
    padding: 0.75rem 1rem;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.875rem;
    line-height: 1.5;
}

html.light .lesson-hero-card {
    background: linear-gradient(135deg, #ffffff 0%, #f0fdf4 100%);
    border-color: rgba(0, 0, 0, 0.08);
    box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.05);
}

html.light .lesson-meta-chip {
    background: #ffffff;
    border-color: rgba(0, 0, 0, 0.08);
    color: #334155;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

html.light .lesson-objective-box {
    background: #f8fafc;
    border-left-color: #3d8c00;
    color: #475569;
}

/* ============================================
   LEARNING SEQUENCE STEPPER (Learn → Practise → Speak → Review)
   ============================================ */
.learning-sequence-bar {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.sequence-step {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 1rem;
    padding: 0.875rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    transition: all 0.25s ease;
    cursor: pointer;
    position: relative;
}

.sequence-step:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

.sequence-step.active {
    background: rgba(88, 204, 2, 0.1);
    border-color: #58CC02;
    box-shadow: 0 0 15px rgba(88, 204, 2, 0.15);
}

.sequence-step.completed {
    border-color: rgba(88, 204, 2, 0.4);
}

.sequence-step-icon {
    width: 36px;
    height: 36px;
    border-radius: 0.625rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
    background: rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.sequence-step.active .sequence-step-icon {
    background: #58CC02;
    color: #fff;
    box-shadow: 0 2px 8px rgba(88, 204, 2, 0.4);
}

.sequence-step.completed .sequence-step-icon {
    background: rgba(88, 204, 2, 0.2);
    color: #58CC02;
}

.sequence-step-info {
    flex: 1;
    min-width: 0;
}

.sequence-step-num {
    font-size: 0.625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: rgba(255, 255, 255, 0.4);
    display: block;
}

.sequence-step.active .sequence-step-num {
    color: #58CC02;
}

.sequence-step-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

.sequence-step-desc {
    font-size: 0.6875rem;
    color: rgba(255, 255, 255, 0.45);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

html.light .sequence-step {
    background: #ffffff;
    border-color: rgba(0, 0, 0, 0.08);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

html.light .sequence-step:hover {
    background: #f8fafc;
    border-color: rgba(0, 0, 0, 0.15);
}

html.light .sequence-step.active {
    background: #f0fdf4;
    border-color: #3d8c00;
    box-shadow: 0 2px 10px rgba(88, 204, 2, 0.15);
}

html.light .sequence-step-icon {
    background: #f1f5f9;
}

html.light .sequence-step-num {
    color: #94a3b8;
}

html.light .sequence-step.active .sequence-step-num {
    color: #3d8c00;
}

html.light .sequence-step-title {
    color: #0f172a;
}

html.light .sequence-step-desc {
    color: #64748b;
}

@media (max-width: 768px) {
    .learning-sequence-bar {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }
    .sequence-step {
        padding: 0.625rem 0.75rem;
    }
    .sequence-step-icon {
        width: 30px;
        height: 30px;
        font-size: 0.9375rem;
    }
    .sequence-step-desc {
        display: none;
    }
}

/* ============================================
   PURPOSE BADGES FOR EXERCISE TYPES
   ============================================ */
.purpose-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3125rem;
    padding: 0.25rem 0.625rem;
    border-radius: 9999px;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: none;
    line-height: 1.2;
}

.purpose-badge-syntax {
    background: rgba(129, 140, 248, 0.12);
    color: #a5b4fc;
    border: 1px solid rgba(129, 140, 248, 0.25);
}

.purpose-badge-speaking {
    background: rgba(251, 146, 60, 0.12);
    color: #fdba74;
    border: 1px solid rgba(251, 146, 60, 0.25);
}

.purpose-badge-vocab {
    background: rgba(88, 204, 2, 0.12);
    color: #86efac;
    border: 1px solid rgba(88, 204, 2, 0.25);
}

.purpose-badge-quiz {
    background: rgba(56, 189, 248, 0.12);
    color: #7dd3fc;
    border: 1px solid rgba(56, 189, 248, 0.25);
}

.purpose-badge-script {
    background: rgba(244, 114, 182, 0.12);
    color: #f472b6;
    border: 1px solid rgba(244, 114, 182, 0.25);
}

.purpose-badge-general {
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

html.light .purpose-badge-syntax {
    background: #ede9fe;
    color: #6366f1;
    border-color: #c7d2fe;
}

html.light .purpose-badge-speaking {
    background: #ffedd5;
    color: #ea580c;
    border-color: #fed7aa;
}

html.light .purpose-badge-vocab {
    background: #dcfce7;
    color: #16a34a;
    border-color: #bbf7d0;
}

html.light .purpose-badge-quiz {
    background: #e0f2fe;
    color: #0284c7;
    border-color: #bae6fd;
}

html.light .purpose-badge-script {
    background: #fce7f3;
    color: #db2777;
    border-color: #fbcfe8;
}

html.light .purpose-badge-general {
    background: #f1f5f9;
    color: #475569;
    border-color: #e2e8f0;
}

/* ============================================
   ACTIVITY CARDS (Practise & Speak inside lesson)
   ============================================ */
.activity-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 1rem;
    padding: 1.125rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    transition: all 0.25s ease;
    text-decoration: none;
}

.activity-card:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(88, 204, 2, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px -6px rgba(0, 0, 0, 0.3);
}

.activity-card-icon {
    width: 44px;
    height: 44px;
    border-radius: 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.activity-card.is-completed .activity-card-icon {
    background: rgba(88, 204, 2, 0.15);
    color: #58CC02;
}

html.light .activity-card {
    background: #ffffff;
    border-color: rgba(0, 0, 0, 0.08);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

html.light .activity-card:hover {
    background: #ffffff;
    border-color: rgba(88, 204, 2, 0.4);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06);
}

html.light .activity-card-icon {
    background: #f8fafc;
}

/* ============================================
   LESSON COMPLETION SUMMARY CARD
   ============================================ */
.lesson-completion-card {
    background: linear-gradient(135deg, rgba(88, 204, 2, 0.06) 0%, rgba(20, 20, 35, 0.7) 100%);
    border: 1px solid rgba(88, 204, 2, 0.25);
    border-radius: 1.25rem;
    padding: 1.75rem;
    position: relative;
    box-shadow: 0 12px 36px -8px rgba(0, 0, 0, 0.5);
}

.completion-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 0.875rem;
    margin: 1.25rem 0;
}

.completion-stat-tile {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 0.875rem;
    padding: 1rem;
    text-align: center;
}

.completion-stat-val {
    font-size: 1.375rem;
    font-weight: 700;
    color: #fff;
    font-family: 'JetBrains Mono', monospace;
}

.completion-stat-label {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 0.25rem;
}

.next-action-box {
    background: rgba(88, 204, 2, 0.1);
    border: 1px solid rgba(88, 204, 2, 0.25);
    border-radius: 1rem;
    padding: 1.125rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

html.light .lesson-completion-card {
    background: linear-gradient(135deg, #ffffff 0%, #f0fdf4 100%);
    border-color: rgba(88, 204, 2, 0.35);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.06);
}

html.light .completion-stat-tile {
    background: #ffffff;
    border-color: rgba(0, 0, 0, 0.08);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

html.light .completion-stat-val {
    color: #0f172a;
}

html.light .completion-stat-label {
    color: #64748b;
}

html.light .next-action-box {
    background: #f0fdf4;
    border-color: #86efac;
}

/* ---- Notes Drawer & Mistake Modal Light Mode ---- */
html.light #notes-drawer {
    background: #ffffff;
    border-color: rgba(0, 0, 0, 0.1);
}
html.light #notes-drawer .bg-gray-800 {
    background: #f8fafc;
}
html.light #notes-drawer .bg-gray-900 {
    background: #ffffff;
}
html.light #notes-drawer .border-white\/10 {
    border-color: rgba(0, 0, 0, 0.08);
}
html.light #notes-drawer .text-white {
    color: #0f172a;
}
html.light #notes-drawer .text-gray-400 {
    color: #64748b;
}
html.light #notes-drawer .hover\:text-white:hover {
    color: #0f172a;
}
html.light #notes-drawer .text-gray-500 {
    color: #64748b;
}

html.light #notes-list .bg-white\/5 {
    background: #f8fafc;
}
html.light #notes-list .border-white\/10 {
    border-color: rgba(0, 0, 0, 0.08);
}
html.light #notes-list .text-gray-300 {
    color: #1e293b;
}
html.light #notes-list .text-gray-200 {
    color: #334155;
}
html.light #notes-list .text-brand-400 {
    color: #3d8c00;
}
html.light #notes-list .bg-brand-500\/10 {
    background: #f0fdf4;
}
html.light #notes-list .border-brand-500\/20 {
    border-color: #86efac;
}

html.light #mistake-modal .bg-gray-900 {
    background: #ffffff;
    border-color: rgba(0, 0, 0, 0.1);
}
html.light #mistake-modal .text-white {
    color: #0f172a;
}
html.light #mistake-modal .text-gray-400 {
    color: #64748b;
}
