/* ============================================================
   EscolaKids — Design System
   Temas: azul (padrão), rosa, espaco
   Fontes: por faixa etária (3-6, 7-10, 11-14, 15-17)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Baloo+2:wght@400;500;700&family=Nunito:wght@400;500;700&family=Poppins:wght@400;500;600&family=Inter:wght@400;500;600&display=swap');

/* ── Tokens base ── */
:root {
    /* Tema Céu Azul (padrão) */
    --ek-bg:           #F5F7FF;
    --ek-surface:      #FFFFFF;
    --ek-accent:       #3B82F6;
    --ek-accent2:      #FBBF24;
    --ek-accent-light: #DBEAFE;
    --ek-accent2-light:#FEF3C7;
    --ek-text:         #1E293B;
    --ek-text-muted:   #64748B;
    --ek-border:       #E2E8F0;
    --ek-btn:          #3B82F6;
    --ek-btn-text:     #FFFFFF;
    --ek-badge-bg:     #EFF6FF;
    --ek-badge-text:   #1D4ED8;
    --ek-star:         #FBBF24;
    --ek-progress:     #3B82F6;
    --ek-success:      #16A34A;
    --ek-warning:      #D97706;
    --ek-danger:       #DC2626;

    /* Fontes — padrão 7-10 anos */
    --ek-font:         'Nunito', sans-serif;
    --ek-font-size:    15px;
    --ek-font-h1:      22px;
    --ek-font-h2:      18px;
    --ek-font-h3:      15px;
    --ek-line-height:  1.65;

    /* Layout */
    --ek-radius-sm:    8px;
    --ek-radius-md:    12px;
    --ek-radius-lg:    16px;
    --ek-radius-full:  9999px;
    --ek-shadow:       0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --ek-shadow-md:    0 4px 6px rgba(0,0,0,0.05), 0 2px 4px rgba(0,0,0,0.04);

    /* Transições */
    --ek-transition:   all 0.2s ease;
}

/* ── Tema Rosa — Jardim Encantado ── */
[data-theme="rosa"] {
    --ek-bg:           #FDF4F9;
    --ek-surface:      #FFF7FC;
    --ek-accent:       #EC4899;
    --ek-accent2:      #A855F7;
    --ek-accent-light: #FCE7F3;
    --ek-accent2-light:#F3E8FF;
    --ek-text:         #3B1239;
    --ek-text-muted:   #9D6B8E;
    --ek-border:       #F9D0E9;
    --ek-btn:          #EC4899;
    --ek-btn-text:     #FFFFFF;
    --ek-badge-bg:     #FDF2F8;
    --ek-badge-text:   #9D174D;
    --ek-star:         #F472B6;
    --ek-progress:     #EC4899;
}

/* ── Tema Espaço Sideral ── */
[data-theme="espaco"] {
    --ek-bg:           #0F1629;
    --ek-surface:      #1A2540;
    --ek-accent:       #38BDF8;
    --ek-accent2:      #FB923C;
    --ek-accent-light: #162033;
    --ek-accent2-light:#1E2D4A;
    --ek-text:         #E2F4FF;
    --ek-text-muted:   #94BDD4;
    --ek-border:       #2D3F5F;
    --ek-btn:          #38BDF8;
    --ek-btn-text:     #0A1628;
    --ek-badge-bg:     #1E3A52;
    --ek-badge-text:   #7DD3FC;
    --ek-star:         #FBBF24;
    --ek-progress:     #38BDF8;
}

/* ── Fontes por faixa etária ── */
[data-age="3-6"] {
    --ek-font:      'Baloo 2', sans-serif;
    --ek-font-size: 17px;
    --ek-font-h1:   26px;
    --ek-font-h2:   21px;
    --ek-font-h3:   18px;
    --ek-line-height: 1.8;
}

[data-age="7-10"] {
    --ek-font:      'Nunito', sans-serif;
    --ek-font-size: 15px;
    --ek-font-h1:   22px;
    --ek-font-h2:   18px;
    --ek-font-h3:   15px;
    --ek-line-height: 1.65;
}

[data-age="11-14"] {
    --ek-font:      'Poppins', sans-serif;
    --ek-font-size: 14px;
    --ek-font-h1:   20px;
    --ek-font-h2:   17px;
    --ek-font-h3:   14px;
    --ek-line-height: 1.6;
}

[data-age="15-17"] {
    --ek-font:      'Inter', sans-serif;
    --ek-font-size: 14px;
    --ek-font-h1:   20px;
    --ek-font-h2:   16px;
    --ek-font-h3:   14px;
    --ek-line-height: 1.55;
}

/* ── Reset e base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: var(--ek-font);
    font-size: var(--ek-font-size);
    line-height: var(--ek-line-height);
    color: var(--ek-text);
    background-color: var(--ek-bg);
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.3s ease, color 0.3s ease;
}

h1 { font-size: var(--ek-font-h1); font-weight: 700; }
h2 { font-size: var(--ek-font-h2); font-weight: 700; }
h3 { font-size: var(--ek-font-h3); font-weight: 600; }

a { color: var(--ek-accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout ── */
.ek-container {
    max-width: 1140px;
    margin: 0 auto;
    padding: 0 1.25rem;
}

.ek-page {
    min-height: 100vh;
    background: var(--ek-bg);
}

/* ── Navbar ── */
.ek-navbar {
    background: var(--ek-surface);
    border-bottom: 1px solid var(--ek-border);
    position: sticky;
    top: 0;
    z-index: 100;
    transition: var(--ek-transition);
}

.ek-navbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
    gap: 1rem;
}

.ek-logo {
    font-size: 20px;
    font-weight: 700;
    color: var(--ek-accent);
    font-family: var(--ek-font);
    letter-spacing: -0.3px;
}

.ek-nav-links {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    list-style: none;
}

.ek-nav-links a {
    font-size: 14px;
    font-weight: 500;
    color: var(--ek-text-muted);
    text-decoration: none;
    padding: 0.25rem 0;
    border-bottom: 2px solid transparent;
    transition: var(--ek-transition);
}

.ek-nav-links a:hover,
.ek-nav-links a.active {
    color: var(--ek-accent);
    border-bottom-color: var(--ek-accent);
}

.ek-navbar-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* ── Cards ── */
.ek-card {
    background: var(--ek-surface);
    border: 1px solid var(--ek-border);
    border-radius: var(--ek-radius-md);
    padding: 1.25rem;
    transition: var(--ek-transition);
}

.ek-card-hover:hover {
    box-shadow: var(--ek-shadow-md);
    transform: translateY(-1px);
}

/* ── Botões ── */
.ek-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-family: var(--ek-font);
    font-size: var(--ek-font-size);
    font-weight: 700;
    padding: 0.6rem 1.25rem;
    border-radius: var(--ek-radius-full);
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: var(--ek-transition);
    white-space: nowrap;
}

.ek-btn-primary {
    background: var(--ek-btn);
    color: var(--ek-btn-text);
}

.ek-btn-primary:hover {
    opacity: 0.88;
    text-decoration: none;
    color: var(--ek-btn-text);
}

.ek-btn-outline {
    background: transparent;
    color: var(--ek-accent);
    border: 2px solid var(--ek-accent);
}

.ek-btn-outline:hover {
    background: var(--ek-accent-light);
    text-decoration: none;
}

.ek-btn-ghost {
    background: transparent;
    color: var(--ek-text-muted);
    border: 1px solid var(--ek-border);
}

.ek-btn-ghost:hover {
    background: var(--ek-accent-light);
    color: var(--ek-accent);
    border-color: var(--ek-accent);
    text-decoration: none;
}

.ek-btn-sm {
    font-size: 13px;
    padding: 0.4rem 0.9rem;
}

.ek-btn-lg {
    font-size: calc(var(--ek-font-size) + 2px);
    padding: 0.8rem 1.75rem;
}

.ek-btn-block { width: 100%; }

/* ── Inputs ── */
.ek-input {
    width: 100%;
    font-family: var(--ek-font);
    font-size: var(--ek-font-size);
    color: var(--ek-text);
    background: var(--ek-surface);
    border: 1.5px solid var(--ek-border);
    border-radius: var(--ek-radius-sm);
    padding: 0.6rem 0.9rem;
    outline: none;
    transition: var(--ek-transition);
}

.ek-input:focus {
    border-color: var(--ek-accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--ek-accent) 15%, transparent);
}

.ek-input::placeholder { color: var(--ek-text-muted); }

.ek-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--ek-text-muted);
    margin-bottom: 0.35rem;
}

.ek-form-group { margin-bottom: 1rem; }

/* ── Badges / pills ── */
.ek-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 700;
    padding: 0.2rem 0.6rem;
    border-radius: var(--ek-radius-full);
    background: var(--ek-badge-bg);
    color: var(--ek-badge-text);
}

.ek-badge-success { background: #DCFCE7; color: #15803D; }
.ek-badge-warning { background: #FEF3C7; color: #92400E; }
.ek-badge-danger  { background: #FEE2E2; color: #991B1B; }

/* ── Avatar ── */
.ek-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--ek-radius-full);
    background: var(--ek-accent);
    color: var(--ek-btn-text);
    font-weight: 700;
    flex-shrink: 0;
}

.ek-avatar-sm  { width: 32px; height: 32px; font-size: 13px; }
.ek-avatar-md  { width: 44px; height: 44px; font-size: 16px; }
.ek-avatar-lg  { width: 60px; height: 60px; font-size: 22px; }

/* ── XP / Progress bar ── */
.ek-progress {
    height: 10px;
    background: var(--ek-border);
    border-radius: var(--ek-radius-full);
    overflow: hidden;
}

.ek-progress-fill {
    height: 100%;
    border-radius: var(--ek-radius-full);
    background: var(--ek-progress);
    transition: width 0.5s ease;
}

/* ── Streak dots ── */
.ek-streak {
    display: flex;
    gap: 6px;
    align-items: center;
}

.ek-streak-dot {
    width: 24px;
    height: 24px;
    border-radius: var(--ek-radius-full);
    background: var(--ek-star);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    color: white;
}

.ek-streak-dot.empty {
    background: var(--ek-border);
    color: var(--ek-text-muted);
}

/* ── Exercício — opções de resposta ── */
.ek-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.ek-option {
    background: var(--ek-accent-light);
    border: 2px solid var(--ek-border);
    border-radius: var(--ek-radius-md);
    padding: 0.65rem 1rem;
    font-family: var(--ek-font);
    font-size: var(--ek-font-size);
    font-weight: 600;
    color: var(--ek-text);
    cursor: pointer;
    text-align: center;
    transition: var(--ek-transition);
    outline: none;
}

.ek-option:hover:not(:disabled) {
    border-color: var(--ek-accent);
    color: var(--ek-accent);
    background: var(--ek-accent-light);
}

.ek-option.selected {
    border-color: var(--ek-accent);
    background: var(--ek-accent-light);
    color: var(--ek-accent);
}

.ek-option.correct {
    border-color: #16A34A;
    background: #DCFCE7;
    color: #15803D;
}

.ek-option.wrong {
    border-color: #DC2626;
    background: #FEE2E2;
    color: #991B1B;
}

.ek-option:disabled { cursor: not-allowed; opacity: 0.7; }

/* ── Stat cards ── */
.ek-stat-card {
    background: var(--ek-surface);
    border: 1px solid var(--ek-border);
    border-radius: var(--ek-radius-md);
    padding: 0.9rem;
    text-align: center;
}

.ek-stat-num {
    font-size: 24px;
    font-weight: 700;
    color: var(--ek-accent);
    line-height: 1.2;
}

.ek-stat-label {
    font-size: 11px;
    color: var(--ek-text-muted);
    margin-top: 2px;
    font-weight: 500;
}

/* ── Alerta / Flash messages ── */
.ek-alert {
    padding: 0.75rem 1rem;
    border-radius: var(--ek-radius-sm);
    font-size: 14px;
    margin-bottom: 1rem;
    font-weight: 500;
}

.ek-alert-success { background: #DCFCE7; color: #15803D; border-left: 4px solid #16A34A; }
.ek-alert-warning { background: #FEF3C7; color: #92400E; border-left: 4px solid #D97706; }
.ek-alert-danger  { background: #FEE2E2; color: #991B1B; border-left: 4px solid #DC2626; }
.ek-alert-info    { background: var(--ek-badge-bg); color: var(--ek-badge-text); border-left: 4px solid var(--ek-accent); }

/* ── Grid helpers ── */
.ek-grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 1rem; }
.ek-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 1rem; }
.ek-grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 1rem; }

@media (max-width: 768px) {
    .ek-grid-3, .ek-grid-4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 480px) {
    .ek-grid-2, .ek-grid-3, .ek-grid-4 { grid-template-columns: 1fr; }
    .ek-options { grid-template-columns: 1fr; }
}

/* ── Seletor de tema (painel da criança) ── */
.ek-theme-picker {
    display: flex;
    gap: 10px;
    align-items: center;
}

.ek-theme-option {
    width: 28px;
    height: 28px;
    border-radius: var(--ek-radius-full);
    border: 3px solid transparent;
    cursor: pointer;
    transition: var(--ek-transition);
    outline: none;
}

.ek-theme-option.active,
.ek-theme-option:hover {
    border-color: var(--ek-text);
    transform: scale(1.1);
}

.ek-theme-azul   { background: #3B82F6; }
.ek-theme-rosa   { background: #EC4899; }
.ek-theme-espaco { background: #0F1629; border: 3px solid #38BDF8; }

/* ── Decorações por tema ── */
.ek-deco {
    font-size: 11px;
    letter-spacing: 6px;
    opacity: 0.35;
    color: var(--ek-accent);
    user-select: none;
}

/* ── Tema neutro — painel do pai ── */
.pai-panel {
    --ek-font: 'Inter', system-ui, sans-serif;
    --ek-font-size: 14px;
    --ek-bg: #F8FAFC;
    --ek-surface: #FFFFFF;
    --ek-accent: #3B82F6;
    --ek-text: #0F172A;
    --ek-text-muted: #64748B;
    --ek-border: #E2E8F0;
    font-family: var(--ek-font);
}

/* ── Utilities ── */
.text-accent  { color: var(--ek-accent); }
.text-muted   { color: var(--ek-text-muted); }
.text-success { color: var(--ek-success); }
.text-warning { color: var(--ek-warning); }
.text-danger  { color: var(--ek-danger); }
.bg-accent    { background: var(--ek-accent); }
.bg-surface   { background: var(--ek-surface); }

.fw-400 { font-weight: 400; }
.fw-500 { font-weight: 500; }
.fw-700 { font-weight: 700; }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.flex         { display: flex; }
.flex-center  { display: flex; align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-wrap    { flex-wrap: wrap; }
.gap-1        { gap: 0.5rem; }
.gap-2        { gap: 1rem; }

.rounded-full { border-radius: var(--ek-radius-full); }
.w-full       { width: 100%; }
.hidden       { display: none; }
