/* ============================================
   dargo-theme.css — Student-facing pages
   "Clean Academy" design for kids
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800;900&family=Assistant:wght@400;700;800&display=swap');

/* ============ CSS VARIABLES ============ */
:root {
    /* Brand Colors (from Dargo logo) */
    --blue-dark: #2563C0;
    --blue-mid: #4DB6E8;
    --blue-light: #D6EEFA;
    --orange: #E8642A;
    --orange-light: #FDE8DC;
    --gold: #F5B830;
    --gold-dark: #D99B1A;
    --gold-light: #FEF3D0;

    /* Neutrals */
    --bg: #F0F4FA;
    /* cool off-white page background */
    --surface: #FFFFFF;
    /* cards, panels */
    --surface-2: #F7F9FC;
    /* subtle inner backgrounds */
    --border: #E2E8F2;
    /* card borders */
    --ink: #1E2A3B;
    /* primary text */
    --ink-muted: #6B7A8D;
    /* secondary text */
    --locked: #C8D0DC;
    /* locked lesson color */
    --locked-dark: #A0AABA;

    /* Sizing */
    --radius-sm: 10px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-full: 9999px;
    --shadow-sm: 0 2px 8px rgba(30, 42, 59, 0.08);
    --shadow-md: 0 4px 16px rgba(30, 42, 59, 0.12);
    --shadow-lg: 0 8px 32px rgba(30, 42, 59, 0.14);

    /* Typography */
    --font: 'Nunito', 'Assistant', sans-serif;
}

/* ============ RESET & BASE ============ */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    height: 100%;
}

body {
    font-family: var(--font);
    background-color: var(--bg);
    color: var(--ink);
    min-height: 100%;
    -webkit-font-smoothing: antialiased;
    opacity: 0;
    transition: opacity 0.25s ease;
}

body.loaded {
    opacity: 1;
}

a {
    text-decoration: none;
    color: inherit;
}

/* ============ TOP NAVBAR ============ */
.top-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: var(--surface);
    border-bottom: 2px solid var(--border);
    height: 64px;
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 16px;
}

.top-nav .nav-logo img {
    height: 36px;
    display: block;
}

.top-nav .nav-logo-text {
    font-size: 1.5rem;
    font-weight: 900;
    color: var(--blue-dark);
    letter-spacing: -0.5px;
}

.top-nav .nav-spacer {
    flex: 1;
}

/* Nav links */
.top-nav .nav-links {
    display: flex;
    align-items: center;
    gap: 4px;
}

.top-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 8px 16px;
    border-radius: var(--radius-full);
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--ink-muted);
    transition: background 0.15s, color 0.15s;
}

.top-nav .nav-link:hover {
    background: var(--bg);
    color: var(--ink);
}

.top-nav .nav-link.active {
    background: var(--blue-light);
    color: var(--blue-dark);
}

.top-nav .nav-link .nav-icon {
    font-size: 1.1rem;
}

/* Stats chips */
.top-nav .nav-stats {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 8px;
}

.stat-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--surface-2);
    border: 2px solid var(--border);
    border-radius: var(--radius-full);
    padding: 5px 14px;
    font-weight: 800;
    font-size: 0.95rem;
}

.stat-chip .chip-icon {
    font-size: 1.1rem;
}

.stat-chip.streak .chip-icon {
    color: var(--orange);
}

.stat-chip.gems .chip-icon {
    color: var(--blue-mid);
}

.stat-chip .chip-val {
    color: var(--ink);
}

/* Avatar */
.nav-avatar {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-full);
    background: var(--blue-dark);
    color: white;
    font-weight: 800;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    margin-left: 4px;
    flex-shrink: 0;
    border: 2px solid var(--blue-mid);
}

/* Page wrapper — accounts for fixed nav */
.page-wrap {
    padding-top: 80px;
    padding-bottom: 40px;
    min-height: 100vh;
}

.container {
    max-width: 760px;
    margin: 0 auto;
    padding: 0 24px;
}

.container.wide {
    max-width: 980px;
}

/* ============ BACK LINK ============ */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    color: var(--blue-dark);
    font-size: 0.95rem;
    margin-bottom: 24px;
    padding: 8px 0;
    transition: opacity 0.15s;
}

.back-link:hover {
    opacity: 0.7;
}

/* ============ PAGE HEADER ============ */
.page-header {
    margin-bottom: 28px;
}

.page-header h1 {
    font-size: 1.8rem;
    font-weight: 900;
    color: var(--ink);
    line-height: 1.2;
}

.page-header .subtitle {
    font-size: 1rem;
    color: var(--ink-muted);
    margin-top: 4px;
    font-weight: 600;
}

/* ============ SECTION LABEL ============ */
.section-label {
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: var(--ink-muted);
    margin-bottom: 14px;
}

/* ============ WORLD CARDS (horizontal) ============ */
.worlds-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
}

.world-card {
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-md);
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
    text-decoration: none;
    color: inherit;
    overflow: hidden;
}

.world-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--blue-mid);
}

.world-card:active {
    transform: translateY(0);
    box-shadow: var(--shadow-md);
}

.world-thumb,
.world-thumb-placeholder {
    width: 100%;
    height: 180px;
    border-radius: 0;
    object-fit: cover;
    flex-shrink: 0;
    background: var(--blue-light);
}

.world-thumb-placeholder {
    background: linear-gradient(135deg, var(--blue-mid), var(--blue-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
}

.world-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px 32px 32px;
    text-align: center;
}

.world-info {
    width: 100%;
}

.world-info h3 {
    font-size: 1.5rem;
    font-weight: 900;
    color: var(--ink);
    margin-bottom: 6px;
}

.world-info .world-sub {
    font-size: 1rem;
    color: var(--ink-muted);
    font-weight: 700;
    margin-bottom: 24px;
}

/* Progress bar inside the hero card */
.world-card .progress-bar {
    width: 100%;
    height: 12px;
    background: var(--border);
    border-radius: var(--radius-full);
    margin-bottom: 32px;
    overflow: hidden;
}

.world-card .progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--gold), var(--orange));
    border-radius: var(--radius-full);
    transition: width 0.4s ease;
    width: 0%;
}

.world-action {
    display: inline-block;
    width: 100%;
    background: var(--blue-dark);
    color: white;
    font-weight: 900;
    font-size: 1.1rem;
    letter-spacing: 0.5px;
    padding: 16px 24px;
    border-radius: var(--radius-md);
    text-transform: uppercase;
    transition: background 0.15s, transform 0.1s, box-shadow 0.1s;
    box-shadow: 0 4px 0 #1a4a99;
}

.world-card:hover .world-action {
    background: var(--blue-mid);
    box-shadow: 0 4px 0 #288bc5;
}

.world-card:active .world-action {
    transform: translateY(4px);
    box-shadow: none;
}

/* ============ UNIT BANNER ============ */
.unit-banner {
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 22px 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 28px;
    box-shadow: var(--shadow-sm);
    border-left: 6px solid var(--blue-dark);
}

.unit-banner-icon {
    font-size: 2.2rem;
    flex-shrink: 0;
}

.unit-banner-text h2 {
    font-size: 1.3rem;
    font-weight: 900;
    color: var(--ink);
}

.unit-banner-text p {
    font-size: 0.9rem;
    color: var(--ink-muted);
    font-weight: 600;
    margin-top: 2px;
}

/* ============ LESSON LIST ============ */
.lessons-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.lesson-row {
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
    text-decoration: none;
    color: inherit;
}

.lesson-row.locked {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

/* Admin-locked: same appearance but pointer-events kept on so toast click fires */
.lesson-row.admin-locked {
    opacity: 0.6;
    cursor: not-allowed;
}

.lesson-row.current {
    border-color: var(--blue-mid);
    box-shadow: 0 0 0 3px var(--blue-light);
}

.lesson-row.completed {
    border-color: var(--gold);
}

.lesson-row:not(.locked):hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* Status Badge (circle on left) */
.lesson-badge {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
    font-weight: 800;
}

.lesson-badge.state-completed {
    background: var(--gold-light);
    color: var(--gold-dark);
    border: 2.5px solid var(--gold);
}

.lesson-badge.state-current {
    background: var(--blue-dark);
    color: white;
    box-shadow: 0 0 0 4px var(--blue-light);
    animation: pulse-blue 2.5s infinite;
}

.lesson-badge.state-locked {
    background: var(--surface-2);
    color: var(--locked);
    border: 2.5px solid var(--locked);
}

@keyframes pulse-blue {
    0% {
        box-shadow: 0 0 0 4px var(--blue-light);
    }

    50% {
        box-shadow: 0 0 0 8px rgba(77, 182, 232, 0.2);
    }

    100% {
        box-shadow: 0 0 0 4px var(--blue-light);
    }
}

.lesson-info {
    flex: 1;
    min-width: 0;
}

.lesson-info h4 {
    font-size: 1rem;
    font-weight: 800;
    color: var(--ink);
}

.lesson-info .lesson-type {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--ink-muted);
    margin-top: 2px;
}

.lesson-row-arrow {
    font-size: 1.2rem;
    color: var(--ink-muted);
    flex-shrink: 0;
}

.lesson-row.current .lesson-row-arrow {
    color: var(--blue-dark);
}

.lesson-row.completed .lesson-row-arrow {
    color: var(--gold-dark);
}

/* "Start" pill on current lesson */
.lesson-start-pill {
    background: var(--blue-dark);
    color: white;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    padding: 5px 14px;
    border-radius: var(--radius-full);
    flex-shrink: 0;
}

/* ============ BADGES PAGE ============ */
.badges-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
}

.badge-card {
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px 16px;
    text-align: center;
    box-shadow: var(--shadow-sm);
    transition: transform 0.15s, box-shadow 0.15s;
}

.badge-card.earned {
    border-color: var(--gold);
    background: linear-gradient(160deg, #fffbf0 0%, #ffffff 100%);
}

.badge-card.earned:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.badge-card.locked-badge {
    opacity: 0.5;
    filter: grayscale(0.6);
}

.badge-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 12px;
    line-height: 1;
}

.badge-name {
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--ink);
    margin-bottom: 4px;
}

.badge-desc {
    font-size: 0.78rem;
    color: var(--ink-muted);
    font-weight: 600;
    line-height: 1.4;
}

.badge-earned-date {
    margin-top: 10px;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--gold-dark);
}

/* ============ REVIEW PAGE ============ */
.review-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.review-row {
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    text-decoration: none;
    color: inherit;
    transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}

.review-row:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--blue-mid);
}

.review-badge {
    width: 46px;
    height: 46px;
    border-radius: var(--radius-full);
    background: var(--orange-light);
    color: var(--orange);
    border: 2.5px solid var(--orange);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.review-info h4 {
    font-size: 1rem;
    font-weight: 800;
    color: var(--ink);
}

.review-info .review-world {
    font-size: 0.82rem;
    color: var(--ink-muted);
    font-weight: 600;
    margin-top: 2px;
}

/* ============ LOGIN PAGE ============ */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    /* Subtle centered glow */
    background-image: radial-gradient(ellipse 60% 50% at 50% 40%, rgba(77, 182, 232, 0.15) 0%, transparent 70%);
    padding: 24px;
}

.login-card {
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 40px 36px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
    text-align: center;
}

.login-logo {
    height: 56px;
    margin: 0 auto 24px;
    display: block;
}

.login-card h2 {
    font-size: 1.5rem;
    font-weight: 900;
    color: var(--ink);
    margin-bottom: 24px;
}

.input-group {
    margin-bottom: 18px;
    text-align: left;
}

.input-group label {
    display: block;
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--ink);
    margin-bottom: 7px;
}

.input-group input {
    width: 100%;
    padding: 13px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface-2);
    font-family: var(--font);
    font-size: 1rem;
    color: var(--ink);
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
    outline: none;
}

.input-group input:focus {
    border-color: var(--blue-dark);
    background: var(--surface);
    box-shadow: 0 0 0 3px var(--blue-light);
}

.btn-login {
    display: block;
    width: 100%;
    padding: 14px;
    background: var(--blue-dark);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-family: var(--font);
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s, box-shadow 0.1s;
    box-shadow: 0 4px 0 #1a4a99;
    margin-top: 8px;
}

.btn-login:hover {
    background: #1e52a8;
}

.btn-login:active {
    transform: translateY(3px);
    box-shadow: none;
}

.login-toggle {
    margin-top: 22px;
    font-size: 0.9rem;
    color: var(--ink-muted);
    font-weight: 600;
}

.login-toggle span {
    color: var(--blue-dark);
    font-weight: 800;
    cursor: pointer;
}

.login-toggle span:hover {
    text-decoration: underline;
}

.login-error {
    color: #D93025;
    font-weight: 700;
    font-size: 0.9rem;
    margin-bottom: 16px;
    display: none;
    background: #FDE8E6;
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    text-align: left;
}

/* ============ EMPTY STATE ============ */
.empty-state {
    text-align: center;
    padding: 60px 24px;
    color: var(--ink-muted);
}

.empty-state .empty-icon {
    font-size: 3rem;
    margin-bottom: 12px;
}

.empty-state h3 {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--ink);
}

.empty-state p {
    font-size: 0.95rem;
    margin-top: 6px;
}

/* ============ LOADING ============ */
.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 60px 24px;
    color: var(--ink-muted);
    font-weight: 700;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border);
    border-top-color: var(--blue-dark);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ============ RESPONSIVE ============ */
@media (max-width: 640px) {
    .top-nav {
        padding: 0 16px;
        gap: 8px;
    }

    .top-nav .nav-links {
        display: none;
    }

    .container {
        padding: 0 16px;
    }

    .page-wrap {
        padding-top: 72px;
    }

    .world-card {
        gap: 14px;
        padding: 14px 16px;
    }

    .world-thumb,
    .world-thumb-placeholder {
        width: 64px;
        height: 64px;
    }

    .world-action {
        display: none;
    }

    .badges-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .login-card {
        padding: 28px 20px;
    }
}