/* =========================================================================
   Kids Computer Academy — Design Tokens
   Palette:   #EAF6FF (sky bg) #7C5CFC (primary/purple) #FFC93C (sunny yellow)
              #2ED9A6 (mint/success) #FF6B6B (coral/danger) #2B2250 (ink text)
   Type:      'Baloo Bhaijaan 2' (display, rounded, Arabic) / 'Tajawal' (body)
   Signature: the winding "learning path" that connects lesson nodes
   ========================================================================= */

:root {
    --bg-sky:      #EAF6FF;
    --purple:      #7C5CFC;
    --purple-dark: #5C3DE0;
    --yellow:      #FFC93C;
    --mint:        #2ED9A6;
    --coral:       #FF6B6B;
    --ink:         #2B2250;
    --white:       #FFFFFF;
    --gray:        #8B87A6;
    --radius-lg:   28px;
    --radius-md:   18px;
    --radius-sm:   12px;
    --shadow-soft: 0 10px 30px rgba(92, 61, 224, 0.12);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: 'Tajawal', 'Segoe UI', sans-serif;
    background: var(--bg-sky);
    color: var(--ink);
    direction: rtl;
    line-height: 1.6;
}

h1, h2, h3, h4, .display {
    font-family: 'Baloo Bhaijaan 2', 'Tajawal', sans-serif;
    font-weight: 700;
    margin: 0 0 .5em;
}

a { color: inherit; text-decoration: none; }

img { max-width: 100%; display: block; }

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ---------- Top bar (student) ---------- */
.topbar {
    background: var(--white);
    box-shadow: 0 2px 12px rgba(43, 34, 80, 0.06);
    position: sticky;
    top: 0;
    z-index: 20;
}
.topbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    max-width: 1100px;
    margin: 0 auto;
}
.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: 'Baloo Bhaijaan 2', sans-serif;
    font-size: 1.4rem;
    color: var(--purple-dark);
}
.brand .emoji { font-size: 1.8rem; }

.stat-pills { display: flex; gap: 10px; flex-wrap: wrap; }
.pill {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-sky);
    border-radius: 999px;
    padding: 8px 14px;
    font-weight: 700;
    font-size: .95rem;
}
.pill.xp   { color: var(--purple-dark); }
.pill.coin { color: #B8860B; background: #FFF6DC; }
.pill.level{ color: #0E8F6F; background: #E3FBF4; }

.nav-links { display: flex; gap: 18px; align-items: center; }
.nav-links a { font-weight: 700; color: var(--ink); }
.nav-links a:hover { color: var(--purple); }
.btn-logout {
    background: var(--coral);
    color: var(--white) !important;
    padding: 8px 16px;
    border-radius: 999px;
    font-weight: 700;
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-block;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-weight: 700;
    font-size: 1rem;
    padding: 12px 26px;
    border-radius: 999px;
    transition: transform .15s ease, box-shadow .15s ease;
}
.btn:hover { transform: translateY(-2px); }
.btn-primary { background: var(--purple); color: var(--white); box-shadow: var(--shadow-soft); }
.btn-primary:hover { background: var(--purple-dark); }
.btn-success { background: var(--mint); color: var(--white); }
.btn-warning { background: var(--yellow); color: var(--ink); }
.btn-outline { background: transparent; border: 2px solid var(--purple); color: var(--purple); }
.btn-block { display: block; width: 100%; text-align: center; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

/* ---------- Cards ---------- */
.card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    padding: 24px;
}

.grid {
    display: grid;
    gap: 20px;
}
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

/* ---------- Auth pages ---------- */
.auth-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px;
    background: linear-gradient(160deg, var(--bg-sky) 0%, #DDEBFF 100%);
}
.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    padding: 36px;
    text-align: center;
}
.auth-card .emoji-hero { font-size: 3rem; margin-bottom: 6px; }
.field { text-align: right; margin-bottom: 16px; }
.field label { display: block; font-weight: 700; margin-bottom: 6px; font-size: .9rem; }
.field input {
    width: 100%;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    border: 2px solid #E4E1F5;
    font-family: inherit;
    font-size: 1rem;
}
.field input:focus { outline: none; border-color: var(--purple); }
.alert {
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    margin-bottom: 16px;
    font-weight: 700;
    font-size: .92rem;
}
.alert-error   { background: #FFE9E9; color: #C43D3D; }
.alert-success { background: #E3FBF4; color: #0E8F6F; }

/* ---------- Progress bars ---------- */
.progress-bar {
    background: #EDEBFB;
    border-radius: 999px;
    height: 14px;
    overflow: hidden;
}
.progress-bar > span {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, var(--purple), var(--mint));
    border-radius: 999px;
    transition: width .4s ease;
}

/* ---------- Learning path (signature element) ---------- */
.learning-path {
    position: relative;
    padding: 20px 0;
}
.path-node {
    display: flex;
    align-items: center;
    gap: 16px;
    position: relative;
    padding: 14px 18px;
    margin-bottom: 6px;
    border-radius: var(--radius-md);
    background: var(--white);
    box-shadow: 0 4px 14px rgba(43,34,80,.06);
}
.path-node::before {
    content: '';
    position: absolute;
    right: 33px;
    top: -6px;
    width: 3px;
    height: 12px;
    background: #D8D3F5;
}
.path-node:first-child::before { display: none; }
.node-icon {
    width: 46px; height: 46px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
    color: var(--white);
}
.node-icon.done   { background: var(--mint); }
.node-icon.active { background: var(--purple); }
.node-icon.locked { background: #C9C6DE; }
.path-node.locked { opacity: .6; }
.node-title { font-weight: 700; }
.node-sub { font-size: .85rem; color: var(--gray); }

/* ---------- Category / Stage cards ---------- */
.stage-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    padding: 22px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.badge-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: .8rem;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 999px;
    width: fit-content;
}
.badge-status.locked { background: #F1F0F7; color: var(--gray); }
.badge-status.open    { background: #E3FBF4; color: #0E8F6F; }
.badge-status.done    { background: #FFF6DC; color: #B8860B; }

/* ---------- Quiz ---------- */
.quiz-question { margin-bottom: 26px; }
.quiz-options { display: grid; gap: 10px; margin-top: 10px; }
.quiz-option {
    display: block;
    background: var(--bg-sky);
    border: 2px solid transparent;
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    cursor: pointer;
    font-weight: 700;
}
.quiz-option:hover { border-color: var(--purple); }
.quiz-option input { margin-left: 10px; }

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
    .topbar-inner { flex-direction: column; gap: 10px; align-items: stretch; }
    .stat-pills { justify-content: center; }
    .nav-links { justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

:focus-visible {
    outline: 3px solid var(--purple);
    outline-offset: 2px;
}
