/* ============================================================
   EduFeArn — UI matching the product spec PDFs
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800;900&display=swap');

:root {
    --purple: #7B3FA0;
    --purple-dark: #5a2d78;
    --purple-mid: #9b5fc0;
    --purple-light: #d4b8e8;
    --purple-pale: #f0e8f8;
    --green: #5CB85C;
    --green-dark: #449d44;
    --sidebar-bg: #7B3FA0;
    --topbar-bg: #7B3FA0;
    --body-bg: #f5f0fa;
    --white: #ffffff;
    --text: #333;
    --text-light: #666;
    --text-muted: #999;
    --border: #e0d0ef;
    --shadow: 0 2px 8px rgba(123,63,160,0.12);
    --radius: 8px;
    --sidebar-w: 160px;
    --right-w: 210px;
}

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

html, body {
    font-family: 'Nunito', 'Segoe UI', Arial, sans-serif;
    font-size: 14px;
    background: var(--body-bg);
    color: var(--text);
    height: 100%;
}

/* TOP BAR */
.top-bar {
    background: var(--topbar-bg);
    height: 62px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 18px 0 0;
    position: sticky;
    top: 0;
    z-index: 200;
    overflow: visible;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.top-bar-logo {
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: var(--purple-dark);
    height: 100%;
    width: var(--sidebar-w);
    padding: 0 14px;
    flex-shrink: 0;
}

.logo-text {
    font-size: 1.4rem;
    font-weight: 900;
    color: white;
    letter-spacing: 0.5px;
    line-height: 1;
}

    .logo-text .logo-a {
        color: #7bcc40;
    }

.logo-sub {
    font-size: 0.52rem;
    color: rgba(255,255,255,0.65);
    letter-spacing: 1.4px;
    text-transform: uppercase;
    margin-top: 3px;
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 12px;
    color: white;
    font-size: 0.9rem;
}

.top-bar-greeting {
    font-weight: 700;
}

.top-bar-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #c8a8e0;
    border: 3px solid white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 800;
    color: var(--purple-dark);
    position: relative;
    cursor: pointer;
}

    .top-bar-avatar .notif-dot {
        position: absolute;
        top: -2px;
        right: -2px;
        width: 12px;
        height: 12px;
        border-radius: 50%;
        background: #e74c3c;
        border: 2px solid white;
    }

.offline-pill {
    background: rgba(255,255,255,0.18);
    color: white;
    font-size: 0.7rem;
    padding: 3px 10px;
    border-radius: 20px;
    border: 1px solid rgba(255,255,255,0.35);
    font-style: italic;
}

/* SHELL */
.app-shell {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.layout-body {
    display: flex;
    flex: 1;
    min-height: 0;
}

/* SIDEBAR */
.sidebar {
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 62px);
    flex-shrink: 0;
    position: sticky;
    top: 62px;
    align-self: flex-start;
}

.sidebar-user {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 18px 10px 14px;
    position: relative;
}

.sidebar-gear {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 1rem;
    color: rgba(255,255,255,0.55);
    cursor: pointer;
}

.sidebar-avatar-circle {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #bfa0d8;
    border: 3px solid rgba(255,255,255,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--purple-dark);
}

.sidebar-user-name {
    font-size: 0.72rem;
    color: white;
    margin-top: 7px;
    text-align: center;
    font-weight: 700;
}

.sidebar-divider {
    height: 1px;
    background: rgba(255,255,255,0.15);
    margin: 0 10px 4px;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 14px 6px;
    color: rgba(255,255,255,0.72);
    text-decoration: none;
    cursor: pointer;
    border-left: 3px solid transparent;
    transition: all 0.18s;
    font-size: 0.76rem;
    text-align: center;
}

    .nav-item:hover {
        background: rgba(255,255,255,0.12);
        color: white;
    }

    .nav-item.active {
        background: rgba(255,255,255,0.2);
        color: white;
        border-left-color: #7bcc40;
    }

.nav-icon {
    font-size: 2.2rem;
    line-height: 1;
}

.nav-label {
    line-height: 1.2;
    margin-top: 3px;
    font-weight: 600;
    font-size: 0.78rem;
}

.sidebar-logout {
    margin-top: auto;
    padding: 12px 14px;
    font-size: 0.72rem;
    color: rgba(255,255,255,0.5);
    cursor: pointer;
    text-align: left;
    border-top: 1px solid rgba(255,255,255,0.12);
}

    .sidebar-logout:hover {
        color: white;
    }

/* MAIN CONTENT */
.main-content {
    flex: 1;
    background: white;
    overflow-y: auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.content-inner {
    padding: 18px;
}

.page-header-bar {
    background: var(--purple-pale);
    border-bottom: 2px solid var(--border);
    padding: 11px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}

    .page-header-bar h2 {
        font-size: 1rem;
        font-weight: 800;
        color: var(--purple);
    }

/* RIGHT PANEL */
.right-panel {
    width: var(--right-w);
    background: #faf8fd;
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 62px);
    flex-shrink: 0;
    position: sticky;
    top: 62px;
    align-self: flex-start;
    overflow-y: auto;
}

.coming-up-widget {
    border-bottom: 1px solid var(--border);
    padding: 12px 14px;
}

.coming-up-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 7px;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--purple);
}

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

.coming-up-empty {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-style: italic;
}

.coming-up-item {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 5px 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.75rem;
    color: var(--text);
}

.cdot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--purple);
    flex-shrink: 0;
}

.course-btns {
    display: flex;
    gap: 8px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
}

.course-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 4px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: white;
    font-size: 0.65rem;
    color: var(--text-light);
    cursor: pointer;
    font-weight: 600;
    transition: all 0.15s;
}

    .course-btn:hover {
        background: var(--purple-pale);
        border-color: var(--purple);
        color: var(--purple);
    }

.course-btn-icon {
    font-size: 1.4rem;
}

.view-results-link {
    padding: 10px 14px;
    font-size: 0.75rem;
    color: var(--purple);
    cursor: pointer;
    font-weight: 700;
    border-bottom: 1px solid var(--border);
}

    .view-results-link:hover {
        text-decoration: underline;
    }

.mascot-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    padding: 10px 14px;
}

.right-brand {
    text-align: center;
}

.right-brand-name {
    font-size: 1.15rem;
    font-weight: 900;
    color: var(--purple);
}

    .right-brand-name .rba {
        color: var(--green);
    }

.right-brand-sub {
    font-size: 0.52rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 2px;
}

.fab-group {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    padding: 10px 10px 14px;
    gap: 8px;
}

.fab {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    transition: transform 0.15s, box-shadow 0.15s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

    .fab:hover {
        transform: scale(1.12);
    }

.fab-green {
    background: var(--green);
    color: white;
}

.fab-gold {
    background: #f0ad4e;
    color: white;
}

.fab-purple {
    background: var(--purple);
    color: white;
}

/* LOGIN */
.login-bg {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--purple-dark) 0%, var(--purple) 55%, var(--purple-mid) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
    overflow: hidden;
}

    .login-bg::before {
        content: '';
        position: absolute;
        width: 420px;
        height: 420px;
        border-radius: 50%;
        background: rgba(255,255,255,0.05);
        bottom: -120px;
        right: -100px;
    }

    .login-bg::after {
        content: '';
        position: absolute;
        width: 260px;
        height: 260px;
        border-radius: 50%;
        background: rgba(255,255,255,0.04);
        top: -70px;
        left: -70px;
    }

.login-card {
    background: white;
    border-radius: 16px;
    padding: 40px 36px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    position: relative;
    z-index: 1;
}

.login-logo {
    text-align: center;
    font-size: 2.4rem;
    font-weight: 900;
    color: var(--purple);
    margin-bottom: 4px;
}

.login-tagline {
    text-align: center;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--text-muted);
    margin-bottom: 28px;
}

/* FILTER + ACTION BARS */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    padding: 10px 18px;
    border-bottom: 1px solid var(--border);
    background: white;
}

.filter-search-wrap {
    display: flex;
    gap: 0;
    flex: 1;
    min-width: 160px;
}

    .filter-search-wrap input {
        flex: 1;
        border-radius: 4px 0 0 4px;
        padding: 7px 10px;
        border: 1.5px solid var(--border);
        font-size: 0.82rem;
        font-family: inherit;
        border-right: none;
    }

        .filter-search-wrap input:focus {
            outline: none;
            border-color: var(--purple);
        }

.search-btn {
    padding: 7px 13px;
    border-radius: 0 4px 4px 0;
    background: var(--purple);
    color: white;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
}

.filter-select {
    padding: 7px 10px;
    border: 1.5px solid var(--border);
    border-radius: 4px;
    font-size: 0.8rem;
    background: white;
    font-family: inherit;
}

.action-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 18px;
    border-bottom: 1px solid var(--border);
    background: var(--purple-pale);
}

.action-row-btn {
    font-size: 0.75rem;
    color: var(--purple-dark);
    cursor: pointer;
    padding: 4px 10px;
    border-radius: 4px;
    font-weight: 700;
    border: 1px solid var(--border);
    background: white;
    transition: all 0.15s;
}

    .action-row-btn:hover {
        background: var(--purple);
        color: white;
        border-color: var(--purple);
    }

/* DATA TABLE */
.data-table-wrap {
    overflow-x: auto;
}

    .data-table-wrap table {
        width: 100%;
        border-collapse: collapse;
        font-size: 0.8rem;
    }

        .data-table-wrap table th {
            background: var(--purple-pale);
            color: var(--purple-dark);
            font-weight: 800;
            font-size: 0.7rem;
            text-transform: uppercase;
            padding: 10px 14px;
            text-align: left;
            letter-spacing: 0.5px;
            border-bottom: 2px solid var(--border);
            white-space: nowrap;
        }

        .data-table-wrap table td {
            padding: 10px 14px;
            border-bottom: 1px solid #f5f0fa;
            vertical-align: middle;
        }

        .data-table-wrap table tbody tr:hover {
            background: var(--purple-pale);
        }

        .data-table-wrap table tbody tr:last-child td {
            border-bottom: none;
        }

.tr-active {
    background: var(--purple-pale) !important;
}

/* STAT BOXES */
.stat-boxes {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
}

.stat-box {
    background: white;
    border: 2px solid var(--purple-light);
    border-radius: 10px;
    padding: 14px 12px;
    text-align: center;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 900;
    color: var(--purple);
    line-height: 1;
}

.stat-label {
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    color: var(--text-muted);
    margin-top: 4px;
    font-weight: 700;
}

.big-stat-box {
    background: var(--green);
    color: white;
    border-radius: var(--radius);
    padding: 16px 12px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

    .big-stat-box:hover {
        transform: translateY(-2px);
        box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    }

    .big-stat-box.purple-box {
        background: var(--purple);
    }

.big-stat-value {
    font-size: 2.2rem;
    font-weight: 900;
    line-height: 1;
}

.big-stat-label {
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    opacity: 0.9;
    margin-top: 4px;
    font-weight: 700;
}

/* SCORE CIRCLE */
.score-circle {
    width: 76px;
    height: 76px;
    border-radius: 50%;
    border: 8px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--purple);
}

    .score-circle.high {
        border-color: var(--green);
        color: var(--green-dark);
    }

    .score-circle.mid {
        border-color: #f0ad4e;
        color: #c07000;
    }

    .score-circle.low {
        border-color: #e74c3c;
        color: #c0392b;
    }

/* TOPIC GRID */
.topic-grid {
    display: grid;
    grid-template-columns: repeat(3,1fr);
    gap: 6px;
}

.topic-tile {
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 10px 8px;
    text-align: center;
    cursor: pointer;
    transition: all 0.15s;
    background: white;
}

    .topic-tile:hover, .topic-tile.active {
        border-color: var(--purple);
        background: var(--purple-pale);
    }

    .topic-tile .t-name {
        font-size: 0.7rem;
        font-weight: 700;
        color: var(--text);
        line-height: 1.3;
    }

    .topic-tile .t-score {
        font-size: 0.65rem;
        color: var(--text-muted);
        margin-top: 3px;
    }

    .topic-tile.high-score {
        border-color: var(--green);
        background: #f0fbe8;
    }

    .topic-tile.mid-score {
        border-color: #f0ad4e;
        background: #fffbf0;
    }

    .topic-tile.low-score {
        border-color: #e74c3c;
        background: #fdf5f5;
    }

/* TEST CARDS */
.test-card {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 14px;
    background: white;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: box-shadow 0.2s;
}

    .test-card:hover {
        box-shadow: 0 3px 14px rgba(123,63,160,0.14);
    }

.test-card-info {
    flex: 1;
}

.test-card-name {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text);
}

.test-card-meta {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 3px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* ASSESSMENT CARD */
.assessment-card {
    background: var(--purple-pale);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

    .assessment-card:hover {
        transform: translateY(-2px);
        box-shadow: 0 4px 18px rgba(123,63,160,0.2);
        border-color: var(--purple);
    }

.assessment-card-icon {
    font-size: 2rem;
    margin-bottom: 6px;
}

.assessment-card-name {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--purple-dark);
    line-height: 1.3;
}

.assessment-card-meta {
    font-size: 0.68rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* CURRICULUM TREE */
.unit-row, .curriculum-unit-row {
    background: var(--purple-light);
    color: var(--purple-dark);
    padding: 9px 14px;
    border-radius: 5px;
    font-weight: 800;
    font-size: 0.82rem;
    cursor: pointer;
    margin-bottom: 3px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.curriculum-subtopic-pills {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    padding: 6px 12px 10px 24px;
}

.subtopic-pill {
    padding: 3px 11px;
    border-radius: 20px;
    font-size: 0.72rem;
    cursor: pointer;
    border: 1px solid var(--border);
    background: white;
    color: var(--text);
    transition: all 0.15s;
}

    .subtopic-pill:hover, .subtopic-pill.active {
        background: var(--purple);
        color: white;
        border-color: var(--purple);
    }

/* SPLIT LAYOUT */
.split-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    min-height: 300px;
}

.split-left {
    padding: 0;
    border-right: 1px solid var(--border);
    overflow-y: auto;
}

.split-right {
    padding: 14px;
    overflow-y: auto;
    max-height: 70vh;
}

.questions-panel-title {
    font-size: 0.82rem;
    font-weight: 800;
    color: var(--purple);
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.question-preview-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    font-size: 0.75rem;
    border-bottom: 1px solid #f5f0fb;
}

.q-id {
    color: var(--text-muted);
    min-width: 34px;
    font-weight: 700;
}

.q-type {
    color: var(--text);
    flex: 1;
}

.q-date {
    color: var(--text-muted);
    font-size: 0.68rem;
}

.close-panel-btn {
    display: block;
    margin-top: 14px;
    padding: 7px 18px;
    background: #8e6faa;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 0.78rem;
    cursor: pointer;
    font-weight: 700;
}

/* PAGINATION */
.pagination {
    display: flex;
    justify-content: center;
    gap: 4px;
    padding: 12px;
}

.page-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: white;
    font-size: 0.75rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text);
    transition: all 0.15s;
}

    .page-btn.active, .page-btn:hover {
        background: var(--purple);
        color: white;
        border-color: var(--purple);
    }

/* BUTTONS */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 8px 16px;
    border-radius: 5px;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    border: none;
    transition: all 0.15s;
    text-decoration: none;
    white-space: nowrap;
    font-family: inherit;
}

.btn-purple {
    background: var(--purple);
    color: white;
}

    .btn-purple:hover {
        background: var(--purple-dark);
    }

.btn-green {
    background: var(--green);
    color: white;
}

    .btn-green:hover {
        background: var(--green-dark);
    }

.btn-outline {
    background: white;
    color: var(--purple);
    border: 1.5px solid var(--purple);
}

    .btn-outline:hover {
        background: var(--purple-pale);
    }

.btn-grey {
    background: #e8dff5;
    color: var(--purple-dark);
    border: 1px solid var(--border);
}

    .btn-grey:hover {
        background: var(--purple-light);
    }

.btn-danger {
    background: #e74c3c;
    color: white;
}

    .btn-danger:hover {
        background: #c0392b;
    }

.btn-sm {
    padding: 6px 12px;
    font-size: 0.75rem;
}

.btn-xs {
    padding: 4px 9px;
    font-size: 0.7rem;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* BADGES */
.badge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 20px;
    font-size: 0.68rem;
    font-weight: 700;
}

.badge-purple {
    background: var(--purple-pale);
    color: var(--purple);
}

.badge-green {
    background: #d4edda;
    color: #276a27;
}

.badge-red {
    background: #fde8e8;
    color: #c0392b;
}

.badge-orange {
    background: #fff3cd;
    color: #856404;
}

.badge-grey {
    background: #f0ece8;
    color: #666;
}

/* FORMS */
.form-group {
    margin-bottom: 14px;
}

.form-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-light);
    margin-bottom: 5px;
}

.form-control {
    width: 100%;
    padding: 8px 11px;
    border: 1.5px solid var(--border);
    border-radius: 5px;
    font-size: 0.82rem;
    background: white;
    font-family: inherit;
    color: var(--text);
    transition: border-color 0.15s;
}

    .form-control:focus {
        outline: none;
        border-color: var(--purple);
        box-shadow: 0 0 0 3px rgba(123,63,160,0.1);
    }

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 13px;
}

/* MODALS */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(80,40,120,0.48);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 500;
}

.modal-box {
    background: white;
    border-radius: 12px;
    padding: 26px;
    width: 92%;
    max-width: 520px;
    box-shadow: 0 12px 50px rgba(0,0,0,0.25);
    max-height: 90vh;
    overflow-y: auto;
}

.modal-title {
    font-size: 1rem;
    font-weight: 800;
    color: var(--purple);
    margin-bottom: 18px;
    border-bottom: 2px solid var(--purple-pale);
    padding-bottom: 11px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 18px;
    padding-top: 13px;
    border-top: 1px solid var(--border);
}

/* ALERTS */
.alert {
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 0.8rem;
    margin-bottom: 14px;
    font-weight: 600;
}

.alert-danger {
    background: #fde8e8;
    color: #c0392b;
    border: 1px solid #f5c6c6;
}

.alert-success {
    background: #d4edda;
    color: #276a27;
    border: 1px solid #c3e6cb;
}

.alert-info {
    background: #ddeeff;
    color: #1a5276;
    border: 1px solid #bee5f5;
}

.alert-warn {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

/* SPINNER */
.spinner {
    display: flex;
    justify-content: center;
    padding: 40px;
}

.spin-ring {
    width: 38px;
    height: 38px;
    border: 4px solid var(--border);
    border-top-color: var(--purple);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* PROGRESS */
.prog-wrap {
    background: var(--border);
    border-radius: 10px;
    height: 8px;
    overflow: hidden;
}

.prog-fill {
    height: 100%;
    border-radius: 10px;
    transition: width 0.4s;
}

.prog-purple {
    background: var(--purple);
}

.prog-green {
    background: var(--green);
}

.prog-orange {
    background: #f0ad4e;
}

.prog-red {
    background: #e74c3c;
}

/* TEST SCREEN */
.test-wrap {
    max-width: 700px;
    width: 100%;
    margin: 0 auto;
    padding: 32px 24px;
}

.test-question-card {
    background: white;
    border-radius: 10px;
    box-shadow: var(--shadow);
    padding: 24px;
    border-top: 4px solid var(--purple);
    margin-bottom: 18px;
}

.q-text {
    font-size: 0.98rem;
    font-weight: 600;
    line-height: 1.7;
    margin-bottom: 18px;
}

.option-btn {
    display: block;
    width: 100%;
    padding: 10px 14px;
    margin-bottom: 8px;
    border: 1.5px solid var(--border);
    border-radius: 6px;
    text-align: left;
    background: white;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
}

    .option-btn:hover {
        border-color: var(--purple);
        background: var(--purple-pale);
    }

    .option-btn.selected {
        border-color: var(--purple);
        background: var(--purple-pale);
        font-weight: 700;
    }

    .option-btn.correct {
        border-color: var(--green);
        background: #d4edda;
        color: #276a27;
    }

    .option-btn.incorrect {
        border-color: #e74c3c;
        background: #fde8e8;
        color: #c0392b;
    }

.q-nav-dots {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    justify-content: center;
    margin: 14px 0;
}

.q-dot {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid var(--border);
    background: white;
    font-size: 0.68rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text);
    transition: all 0.15s;
    font-family: inherit;
}

    .q-dot.answered {
        background: var(--green);
        border-color: var(--green);
        color: white;
    }

    .q-dot.current {
        background: var(--purple);
        border-color: var(--purple);
        color: white;
    }

/* LEARNER WIDGETS */
.home-widget {
    background: white;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px;
    margin-bottom: 10px;
}

.home-widget-title {
    font-size: 0.7rem;
    font-weight: 800;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    margin-bottom: 7px;
}

.home-score-big {
    font-size: 2.2rem;
    font-weight: 900;
    color: var(--purple);
    line-height: 1;
}

.tip-box {
    background: #f0fbe8;
    border: 1px solid #c3e6cb;
    border-radius: 8px;
    padding: 12px 14px;
    font-size: 0.8rem;
    color: #276a27;
    line-height: 1.6;
}

/* CARD */
.card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}

.card-title {
    font-size: 0.9rem;
    font-weight: 800;
    color: var(--purple);
}

.card-body {
    padding: 14px 16px;
}

/* RESPONSIVE */
@media (max-width: 1050px) {
    .right-panel {
        display: none;
    }
}

@media (max-width: 750px) {
    .stat-boxes {
        grid-template-columns: repeat(2,1fr);
    }

    .split-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 650px) {
    .sidebar {
        width: 60px;
    }

    .nav-label, .sidebar-user-name, .logo-sub {
        display: none;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .topic-grid {
        grid-template-columns: repeat(2,1fr);
    }
}

/* ── Math Fraction Rendering (MathText component) ──────────────────────── */

/* Stacked fraction: numerator / denominator */
.mf {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    vertical-align: middle;
    margin: 0 1px;
    font-size: 0.88em;
    line-height: 1;
}

.mf-n {
    border-bottom: 1.5px solid currentColor;
    padding: 0 3px 1px;
    min-width: 14px;
    text-align: center;
}

.mf-d {
    padding: 1px 3px 0;
    min-width: 14px;
    text-align: center;
}

/* Math operator (+, −, ÷, ×, =) */
.mo {
    padding: 0 3px;
    vertical-align: middle;
    font-weight: 600;
    font-size: 0.95em;
}

/* Instruction line above the expression */
.math-instr {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    line-height: 1.5;
}

/* Expression display block */
.math-block {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    padding: 10px 18px;
    background: #faf7fe;
    border: 1px solid var(--border);
    border-radius: 8px;
    margin: 8px 0 4px;
    font-size: 1.2em;
    letter-spacing: 0.01em;
}

.math-expr {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 1px;
}

/* Inline rendering (options, answers) */
.math-inline {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    vertical-align: middle;
}

/* Option button with math content */
.option-btn .math-inline,
.option-btn .mf {
    font-size: 1em;
}

/* ── Fraction Input Widget ──────────────────────────────────────── */
.fi-wrap {
    margin-top: 14px;
}

.fi-layout {
    display: flex;
    align-items: center;
    gap: 18px;
    background: #faf7fd;
    border: 1.5px solid var(--border);
    border-radius: 12px;
    padding: 20px 24px;
    flex-wrap: wrap;
}

/* Whole-number column */
.fi-whole-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.fi-label {
    font-size: 0.62rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* "+" separator */
.fi-and {
    font-size: 1.3rem;
    color: var(--text-muted);
    font-weight: 300;
    line-height: 1;
    align-self: center;
}

/* Stacked fraction */
.fi-stacked {
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Shared input box style */
.fi-box {
    width: 80px;
    text-align: center;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--purple);
    padding: 8px 4px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    background: white;
    transition: border-color 0.15s, box-shadow 0.15s;
    -moz-appearance: textfield;
    appearance: textfield;
}

.fi-box::-webkit-outer-spin-button,
.fi-box::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.fi-box:focus {
    outline: none;
    border-color: var(--purple);
    box-shadow: 0 0 0 3px rgba(123, 63, 160, 0.12);
}

.fi-whole { width: 64px; font-size: 1.1rem; }

/* Fraction dividing line */
.fi-line {
    width: 100%;
    height: 2.5px;
    background: #444;
    border-radius: 2px;
    margin: 6px 0;
}

/* Live preview */
.fi-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding-left: 8px;
    border-left: 2px solid var(--border);
    margin-left: 4px;
}

.fi-preview-label {
    font-size: 0.62rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.fi-preview .math-inline {
    font-size: 1.1rem;
    color: var(--purple);
}

/* Hint text */
.fi-hint {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 7px;
    padding-left: 2px;
}

/* Toggle link */
.fi-toggle {
    display: inline-block;
    margin-top: 8px;
    background: none;
    border: none;
    color: var(--purple);
    font-size: 0.72rem;
    cursor: pointer;
    text-decoration: underline;
    padding: 0;
    opacity: 0.65;
}

.fi-toggle:hover { opacity: 1; }

/* ═══════════════════════════════════════════════════════════════════════════
   LANDING PAGE
   ═══════════════════════════════════════════════════════════════════════════ */

/* NAV */
.lp-nav {
    position: sticky;
    top: 0;
    z-index: 900;
    background: rgba(45,24,70,0.95);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    height: 64px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.lp-nav-logo {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.lp-logo-text {
    font-size: 1.55rem;
    font-weight: 900;
    color: white;
    line-height: 1;
    letter-spacing: 0.3px;
}

.lp-logo-a {
    color: #7bcc40;
}

.lp-logo-sub {
    font-size: 0.5rem;
    color: rgba(255,255,255,0.5);
    text-transform: uppercase;
    letter-spacing: 1.8px;
    margin-top: 3px;
}

.lp-nav-links {
    display: flex;
    align-items: center;
    gap: 10px;
}

.lp-nav-link {
    color: rgba(255,255,255,0.78);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 6px 14px;
    border-radius: 6px;
    transition: color 0.15s;
}

    .lp-nav-link:hover {
        color: white;
        background: rgba(255,255,255,0.08);
    }

.lp-btn-outline {
    background: transparent;
    color: white;
    border: 1.5px solid rgba(255,255,255,0.4);
    padding: 7px 18px;
    border-radius: 6px;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s;
}

    .lp-btn-outline:hover {
        border-color: white;
        background: rgba(255,255,255,0.08);
    }

.lp-btn-primary {
    background: #7bcc40;
    color: #1a0d2e;
    border: none;
    padding: 8px 20px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 800;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s;
}

    .lp-btn-primary:hover {
        background: #6ab832;
        transform: translateY(-1px);
    }

/* HERO */
.lp-hero {
    background: linear-gradient(160deg, #1a0d2e 0%, #2d1845 45%, #3d2260 100%);
    min-height: 92vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    padding: 60px 20px 80px;
}

.lp-hero-inner {
    position: relative;
    z-index: 2;
    text-align: center;
    max-width: 780px;
}

.lp-hero-badge {
    display: inline-block;
    background: rgba(123,204,64,0.15);
    border: 1px solid rgba(123,204,64,0.4);
    color: #7bcc40;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.8px;
    padding: 5px 16px;
    border-radius: 20px;
    margin-bottom: 28px;
    text-transform: uppercase;
}

.lp-hero-headline {
    font-size: clamp(2.4rem, 6vw, 4.2rem);
    font-weight: 900;
    color: white;
    line-height: 1.12;
    margin-bottom: 22px;
    letter-spacing: -0.5px;
}

.lp-hero-accent {
    color: #7bcc40;
}

.lp-hero-sub {
    font-size: clamp(0.9rem, 2vw, 1.08rem);
    color: rgba(255,255,255,0.72);
    line-height: 1.75;
    margin-bottom: 40px;
    max-width: 640px;
    margin-left: auto;
    margin-right: auto;
}

.lp-br { display: inline; }

.lp-hero-ctas {
    display: flex;
    gap: 14px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 52px;
}

.lp-cta-teacher {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: #7bcc40;
    color: #1a0d2e;
    border: none;
    padding: 14px 32px;
    border-radius: 10px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
    min-width: 180px;
}

    .lp-cta-teacher:hover {
        background: #6ab832;
        transform: translateY(-2px);
        box-shadow: 0 8px 24px rgba(123,204,64,0.35);
    }

.lp-cta-learner {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: transparent;
    color: white;
    border: 2px solid rgba(255,255,255,0.4);
    padding: 14px 32px;
    border-radius: 10px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
    min-width: 180px;
}

    .lp-cta-learner:hover {
        border-color: white;
        background: rgba(255,255,255,0.08);
        transform: translateY(-2px);
    }

.lp-cta-label {
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    opacity: 0.8;
    margin-bottom: 4px;
}

.lp-cta-action {
    font-size: 1rem;
    font-weight: 800;
}

.lp-hero-stats {
    display: flex;
    gap: 0;
    justify-content: center;
    align-items: center;
}

.lp-hero-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0 28px;
}

.lp-stat-num {
    font-size: 1.6rem;
    font-weight: 900;
    color: white;
    line-height: 1;
}

.lp-stat-lbl {
    font-size: 0.65rem;
    color: rgba(255,255,255,0.5);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-top: 4px;
    font-weight: 700;
}

.lp-stat-div {
    width: 1px;
    height: 36px;
    background: rgba(255,255,255,0.18);
}

/* Hero blobs */
.lp-blob {
    position: absolute;
    border-radius: 50%;
    background: rgba(123,63,160,0.18);
    filter: blur(60px);
    z-index: 1;
}

.lp-blob-1 {
    width: 500px;
    height: 500px;
    bottom: -150px;
    right: -100px;
}

.lp-blob-2 {
    width: 320px;
    height: 320px;
    top: -80px;
    left: -80px;
    background: rgba(123,204,64,0.08);
}

/* SUBJECTS */
.lp-subjects {
    background: var(--purple-dark);
    padding: 0;
}

.lp-subject-scroll {
    display: flex;
    gap: 0;
    overflow-x: auto;
    scrollbar-width: none;
}

    .lp-subject-scroll::-webkit-scrollbar { display: none; }

.lp-subject-card {
    flex: 1;
    min-width: 180px;
    padding: 28px 20px 24px;
    border-right: 1px solid rgba(255,255,255,0.08);
    cursor: pointer;
    transition: all 0.2s;
    border-bottom: 3px solid transparent;
}

    .lp-subject-card:hover {
        border-bottom-color: var(--purple);
        transform: translateY(-2px);
    }

    .lp-subject-card:last-child {
        border-right: none;
    }

.lp-subject-icon {
    font-size: 2rem;
    margin-bottom: 8px;
}

.lp-subject-name {
    font-size: 0.92rem;
    font-weight: 800;
    color: #1a0d2e;
    margin-bottom: 4px;
}

.lp-subject-count {
    font-size: 0.72rem;
    color: rgba(26,13,46,0.6);
    font-weight: 600;
}

/* SEARCH */
.lp-search-section {
    background: #2d1845;
    padding: 32px 20px;
    display: flex;
    justify-content: center;
}

.lp-search-bar {
    display: flex;
    align-items: center;
    gap: 14px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 50px;
    padding: 14px 20px;
    max-width: 620px;
    width: 100%;
    cursor: pointer;
    transition: all 0.2s;
}

    .lp-search-bar:hover {
        background: rgba(255,255,255,0.12);
        border-color: rgba(255,255,255,0.3);
    }

.lp-search-icon {
    font-size: 1.1rem;
    opacity: 0.6;
}

.lp-search-text {
    flex: 1;
    color: rgba(255,255,255,0.5);
    font-size: 0.9rem;
    font-weight: 600;
}

.lp-search-btn {
    background: #7B3FA0;
    color: white;
    border: none;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    font-size: 1.1rem;
    cursor: pointer;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
    transition: background 0.15s;
}

    .lp-search-btn:hover { background: var(--purple-dark); }

/* FEATURES */
.lp-features {
    background: #f5f0fa;
    padding: 80px 20px;
}

.lp-section-inner {
    max-width: 1100px;
    margin: 0 auto;
}

.lp-section-badge {
    display: inline-block;
    background: var(--purple-pale);
    color: var(--purple);
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 1.2px;
    padding: 4px 14px;
    border-radius: 20px;
    margin-bottom: 16px;
    text-transform: uppercase;
}

.lp-badge-green {
    background: rgba(123,204,64,0.2);
    color: #7bcc40;
}

.lp-section-title {
    font-size: clamp(1.6rem, 4vw, 2.4rem);
    font-weight: 900;
    color: var(--purple-dark);
    line-height: 1.25;
    margin-bottom: 12px;
}

.lp-section-sub {
    font-size: 0.95rem;
    color: var(--text-light);
    margin-bottom: 48px;
    max-width: 520px;
}

.lp-features-grid {
    display: grid;
    grid-template-columns: 1.4fr 1fr 1fr;
    grid-template-rows: auto auto;
    gap: 16px;
}

.lp-feature-card {
    background: white;
    border-radius: 14px;
    padding: 28px 24px;
    border: 1px solid var(--border);
    transition: all 0.2s;
}

    .lp-feature-card:hover {
        box-shadow: 0 6px 24px rgba(123,63,160,0.12);
        transform: translateY(-2px);
        border-color: var(--purple-light);
    }

    .lp-feature-card h3 {
        font-size: 1rem;
        font-weight: 800;
        color: var(--purple-dark);
        margin-bottom: 10px;
    }

    .lp-feature-card p {
        font-size: 0.82rem;
        color: var(--text-light);
        line-height: 1.65;
    }

.lp-feature-hero {
    grid-row: 1 / 3;
    background: linear-gradient(145deg, #2d1845, #4a2070);
    border-color: transparent;
    color: white;
}

    .lp-feature-hero h3 {
        color: white;
        font-size: 1.25rem;
    }

    .lp-feature-hero p {
        color: rgba(255,255,255,0.72);
    }

.lp-feature-icon-big {
    font-size: 3rem;
    margin-bottom: 18px;
}

.lp-feature-icon {
    font-size: 2rem;
    margin-bottom: 12px;
}

.lp-feature-list {
    list-style: none;
    margin-top: 16px;
    margin-bottom: 24px;
}

    .lp-feature-list li {
        font-size: 0.8rem;
        color: rgba(255,255,255,0.8);
        padding: 4px 0;
        font-weight: 600;
    }

.lp-btn-feature {
    background: #7bcc40;
    color: #1a0d2e;
    border: none;
    padding: 10px 22px;
    border-radius: 7px;
    font-size: 0.85rem;
    font-weight: 800;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s;
}

    .lp-btn-feature:hover {
        background: #6ab832;
        transform: translateY(-1px);
    }

/* HOW IT WORKS */
.lp-how {
    background: linear-gradient(160deg, #1a0d2e, #3d2260);
    padding: 80px 20px;
}

    .lp-how .lp-section-title { color: white; }

.lp-steps {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-top: 48px;
}

.lp-step {
    flex: 1;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 14px;
    padding: 28px 22px;
}

.lp-step-num {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #7bcc40;
    color: #1a0d2e;
    font-size: 1.2rem;
    font-weight: 900;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}

.lp-step-title {
    font-size: 1rem;
    font-weight: 800;
    color: white;
    margin-bottom: 10px;
}

.lp-step-desc {
    font-size: 0.82rem;
    color: rgba(255,255,255,0.6);
    line-height: 1.65;
}

.lp-step-arrow {
    font-size: 1.5rem;
    color: rgba(255,255,255,0.25);
    margin-top: 44px;
    flex-shrink: 0;
}

/* CTA BANNER */
.lp-cta-banner {
    background: var(--purple-pale);
    padding: 80px 20px;
}

.lp-cta-title {
    font-size: clamp(1.6rem, 4vw, 2.2rem);
    font-weight: 900;
    color: var(--purple-dark);
    margin-bottom: 12px;
}

.lp-cta-desc {
    color: var(--text-light);
    font-size: 0.95rem;
    margin-bottom: 32px;
}

/* FOOTER */
.lp-footer {
    background: #1a0d2e;
    padding: 36px 20px 24px;
}

.lp-footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.lp-footer-logo {
    font-size: 1.3rem;
    font-weight: 900;
    color: white;
}

.lp-footer-tagline {
    font-size: 0.6rem;
    color: rgba(255,255,255,0.4);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-top: 3px;
}

.lp-footer-links {
    display: flex;
    gap: 10px;
}

.lp-footer-link {
    color: rgba(255,255,255,0.5);
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 5px;
    cursor: pointer;
    transition: color 0.15s;
}

    .lp-footer-link:hover { color: white; }

.lp-footer-copy {
    border-top: 1px solid rgba(255,255,255,0.08);
    padding-top: 18px;
    font-size: 0.72rem;
    color: rgba(255,255,255,0.3);
    text-align: center;
}

/* Landing page responsive */
@media (max-width: 900px) {
    .lp-features-grid {
        grid-template-columns: 1fr 1fr;
    }

    .lp-feature-hero {
        grid-column: 1 / 3;
        grid-row: auto;
    }

    .lp-steps {
        flex-direction: column;
    }

    .lp-step-arrow {
        transform: rotate(90deg);
        margin: 0 auto;
        margin-top: 0;
    }
}

@media (max-width: 640px) {
    .lp-nav { padding: 0 16px; }
    .lp-nav-link { display: none; }
    .lp-features-grid { grid-template-columns: 1fr; }
    .lp-feature-hero { grid-column: auto; }
    .lp-hero-stats { gap: 0; }
    .lp-hero-stat { padding: 0 16px; }
    .lp-stat-num { font-size: 1.2rem; }
    .lp-br { display: none; }
    .lp-footer-inner { flex-direction: column; gap: 16px; text-align: center; }
}
