/* ═══════════════════════════════════════════════════════════════════════════
   kids.css — Global styles for the Grade 5 Scholarship Platform
   Design: bright, playful, safe for 9-11 year olds
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Google Fonts are loaded in base.html ── */

:root {
  --color-primary:   #7C3AED;   /* Purple — buttons, headers */
  --color-accent:    #F59E0B;   /* Amber/gold — stars, rewards */
  --color-success:   #10B981;   /* Teal — correct answers, streaks */
  --color-danger:    #EF4444;   /* Coral red — timer only, never for wrong answers */
  --color-bg-start:  #f0f4ff;
  --color-bg-end:    #fff8f0;
  --color-card:      #ffffff;
  --color-text:      #1e1b4b;
  --radius-card:     16px;
  --radius-btn:      12px;
  --shadow-card:     0 4px 20px rgba(124, 58, 237, 0.10);
}

/* ── Global reset & base ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: 'Nunito', 'Noto Sans Sinhala', sans-serif;
  background: linear-gradient(135deg, var(--color-bg-start) 0%, var(--color-bg-end) 100%);
  min-height: 100vh;
  color: var(--color-text);
  font-size: 1rem;
}

/* Sinhala text always uses Noto Sans Sinhala */
:lang(si), .sinhala, [data-lang="si"] {
  font-family: 'Noto Sans Sinhala', sans-serif;
}

/* ── Navbar ──────────────────────────────────────────────────────────────── */
.navbar-kids {
  background: linear-gradient(90deg, var(--color-primary) 0%, #9333ea 100%);
  box-shadow: 0 2px 12px rgba(124, 58, 237, 0.3);
  padding: 0.75rem 1.5rem;
}
.navbar-kids .navbar-brand {
  font-size: 1.4rem;
  font-weight: 800;
  color: #fff !important;
  letter-spacing: -0.5px;
}
.navbar-kids .nav-link {
  color: rgba(255,255,255,0.9) !important;
  font-weight: 600;
  border-radius: 8px;
  padding: 0.4rem 0.8rem !important;
  transition: background 0.2s;
}
.navbar-kids .nav-link:hover,
.navbar-kids .nav-link.active { background: rgba(255,255,255,0.18); color: #fff !important; }

.lang-badge {
  background: var(--color-accent);
  color: #fff;
  font-weight: 700;
  border-radius: 20px;
  padding: 0.25rem 0.7rem;
  font-size: 0.8rem;
  cursor: pointer;
  border: none;
  transition: transform 0.15s;
}
.lang-badge:hover { transform: scale(1.08); }

/* ── Cards ───────────────────────────────────────────────────────────────── */
.card-kids {
  background: var(--color-card);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  border: none;
  overflow: hidden;
}
.card-kids .card-header {
  background: linear-gradient(90deg, var(--color-primary), #9333ea);
  color: #fff;
  font-weight: 700;
  font-size: 1.1rem;
  border-radius: var(--radius-card) var(--radius-card) 0 0;
  padding: 1rem 1.25rem;
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn-kids-primary {
  background: linear-gradient(135deg, var(--color-primary), #9333ea);
  color: #fff;
  font-weight: 700;
  font-size: 1.05rem;
  min-height: 48px;
  border-radius: var(--radius-btn);
  border: none;
  transition: transform 0.15s, box-shadow 0.15s;
  box-shadow: 0 4px 14px rgba(124, 58, 237, 0.35);
}
.btn-kids-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(124, 58, 237, 0.45);
  color: #fff;
}
.btn-kids-accent {
  background: linear-gradient(135deg, var(--color-accent), #f97316);
  color: #fff;
  font-weight: 700;
  min-height: 48px;
  border-radius: var(--radius-btn);
  border: none;
  transition: transform 0.15s;
}
.btn-kids-accent:hover { transform: translateY(-2px); color: #fff; }

/* ── Answer option buttons ───────────────────────────────────────────────── */
.answer-option {
  display: block;
  width: 100%;
  text-align: left;
  background: #f8f7ff;
  border: 2.5px solid #e0d9ff;
  border-radius: var(--radius-btn);
  padding: 0.85rem 1.2rem;
  min-height: 48px;
  margin-bottom: 0.75rem;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--color-text);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, transform 0.15s;
}
.answer-option:hover {
  border-color: var(--color-primary);
  background: #ede9fe;
  transform: translateX(4px);
}
.answer-option.selected  { border-color: var(--color-primary); background: #ede9fe; }
.answer-option.correct   { border-color: var(--color-success); background: #d1fae5; color: #065f46; }
.answer-option.incorrect { border-color: #f87171; background: #fee2e2; }

/* Image-based answer options — three cards in a row */
.answer-options-image-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 0.75rem;
}
.answer-option-image {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: calc(33.33% - 0.5rem);
  min-width: 90px;
  max-width: 180px;
  padding: 0.6rem 0.5rem;
  text-align: center;
}
.answer-option-image img {
  max-width: 100%;
  max-height: 100px;
  object-fit: contain;
}
@media (max-width: 480px) {
  .answer-option-image { width: calc(33.33% - 0.4rem); min-width: 80px; }
  .answer-option-image img { max-height: 72px; }
}

/* ── Timer bar ───────────────────────────────────────────────────────────── */
.timer-bar-wrap {
  height: 14px;
  background: #e5e7eb;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 1rem;
}
.timer-bar {
  height: 100%;
  border-radius: 10px;
  background: var(--color-success);
  transition: width 1s linear, background 1s;
}
.timer-bar.amber { background: var(--color-accent); }
.timer-bar.red   { background: var(--color-danger); }

.timer-text {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--color-primary);
}
.timer-text.danger { color: var(--color-danger); }

/* ── Reward / Gem badges ─────────────────────────────────────────────────── */
.stat-badge {
  background: #fff;
  border-radius: 14px;
  padding: 0.6rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 2px 10px rgba(0,0,0,0.08);
  font-weight: 700;
  font-size: 1.1rem;
}
.stat-badge .emoji { font-size: 1.4rem; }

/* ── Star burst animation ────────────────────────────────────────────────── */
.star-float {
  position: fixed;
  pointer-events: none;
  font-size: 2rem;
  font-weight: 900;
  color: var(--color-accent);
  z-index: 9999;
  animation: floatUp 1.2s ease-out forwards;
}
@keyframes floatUp {
  0%   { opacity: 1; transform: translateY(0) scale(1); }
  80%  { opacity: 0.9; }
  100% { opacity: 0; transform: translateY(-120px) scale(1.4); }
}

/* ── Shake animation (wrong answer) ─────────────────────────────────────── */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-8px); }
  40%       { transform: translateX(8px); }
  60%       { transform: translateX(-6px); }
  80%       { transform: translateX(6px); }
}
.shake { animation: shake 0.5s ease; }

/* ── Combo banner ────────────────────────────────────────────────────────── */
.combo-banner {
  position: fixed;
  top: 70px;
  left: 50%;
  transform: translateX(-50%) scale(0);
  background: linear-gradient(135deg, var(--color-success), #059669);
  color: #fff;
  font-size: 1.3rem;
  font-weight: 800;
  padding: 0.7rem 1.5rem;
  border-radius: 50px;
  z-index: 9998;
  max-width: 90vw;
  text-align: center;
  box-shadow: 0 4px 20px rgba(16, 185, 129, 0.5);
  animation: comboPop 2s ease forwards;
}
@keyframes comboPop {
  0%   { transform: translateX(-50%) scale(0); opacity: 0; }
  20%  { transform: translateX(-50%) scale(1.1); opacity: 1; }
  70%  { transform: translateX(-50%) scale(1); opacity: 1; }
  100% { transform: translateX(-50%) scale(0.8); opacity: 0; }
}

/* ── Trophy / cup on result page ─────────────────────────────────────────── */
.trophy-wrap {
  animation: trophyBounce 0.8s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
  display: inline-block;
}
@keyframes trophyBounce {
  0%   { transform: scale(0) rotate(-10deg); opacity: 0; }
  60%  { transform: scale(1.15) rotate(3deg); opacity: 1; }
  80%  { transform: scale(0.95) rotate(-2deg); }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}

/* ── Confetti (pure CSS, no library) ────────────────────────────────────── */
.confetti-piece {
  position: fixed;
  width: 10px;
  height: 18px;
  top: -20px;
  border-radius: 3px;
  opacity: 0;
  animation: confettiFall var(--dur, 3s) var(--delay, 0s) ease-in forwards;
  z-index: 9997;
}
@keyframes confettiFall {
  0%   { top: -20px; opacity: 1; transform: rotate(var(--rot0, 0deg)) translateX(0); }
  100% { top: 110vh;  opacity: 0.3; transform: rotate(var(--rot1, 360deg)) translateX(var(--dx, 40px)); }
}

/* ── Forms ───────────────────────────────────────────────────────────────── */
.form-control, .form-select {
  border-radius: 10px;
  border: 2px solid #e0d9ff;
  font-size: 1rem;
  padding: 0.65rem 1rem;
  transition: border-color 0.2s;
}
.form-control:focus, .form-select:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
}

/* ── Leaderboard ─────────────────────────────────────────────────────────── */
.leaderboard-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 1rem;
  border-radius: 10px;
  margin-bottom: 0.4rem;
  font-weight: 600;
  background: #f8f7ff;
}
.leaderboard-row.rank-1 { background: #fef9c3; }
.leaderboard-row.rank-2 { background: #f1f5f9; }
.leaderboard-row.rank-3 { background: #fff7ed; }
.leaderboard-rank { font-size: 1.2rem; min-width: 2rem; }
.leaderboard-gems { margin-left: auto; color: var(--color-accent); font-weight: 700; }

/* ── Landing hero ────────────────────────────────────────────────────────── */
.hero-section {
  min-height: unset;
  padding: 2rem 0 1.5rem;
  display: flex;
  align-items: center;
  text-align: center;
}
.hero-title {
  font-size: clamp(2rem, 6vw, 3.5rem);
  font-weight: 800;
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.2;
}
.hero-subtitle { font-size: clamp(1rem, 3vw, 1.2rem); color: #6b7280; font-weight: 500; }

/* ── Progress bar ────────────────────────────────────────────────────────── */
.progress-kids {
  height: 16px;
  border-radius: 10px;
  background: #e5e7eb;
  overflow: hidden;
}
.progress-kids-bar {
  height: 100%;
  border-radius: 10px;
  background: linear-gradient(90deg, var(--color-primary), var(--color-accent));
  transition: width 0.5s ease;
}

/* ── Role selection cards ────────────────────────────────────────────────── */
.role-card {
  border: 3px solid #e0d9ff;
  border-radius: var(--radius-card);
  padding: 1.5rem;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.15s, box-shadow 0.15s;
  text-align: center;
  background: #fff;
}
.role-card:hover, .role-card.active {
  border-color: var(--color-primary);
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(124, 58, 237, 0.2);
}
.role-card .role-icon { font-size: 3rem; margin-bottom: 0.5rem; }
.role-card .role-label { font-weight: 700; font-size: 1.1rem; }

/* ── Messages / alerts ───────────────────────────────────────────────────── */
.alert-kids {
  border-radius: 12px;
  border: none;
  font-weight: 600;
  padding: 0.85rem 1.25rem;
}

/* ── Mobile tweaks ───────────────────────────────────────────────────────── */
@media (max-width: 576px) {
  .hero-title { font-size: 2rem; }
  .answer-option { font-size: 0.95rem; padding: 0.85rem 1rem; min-height: 48px; }
  .stat-badge { font-size: 0.95rem; }
  .card-kids { padding: 1rem !important; }
  .navbar-kids .container { padding-left: 0.75rem; padding-right: 0.75rem; }
}

@media (max-width: 400px) {
  .hero-title { font-size: 1.7rem; }
  .answer-option { font-size: 0.9rem; }
  .combo-banner { font-size: 1.1rem; padding: 0.6rem 1rem; }
  .btn-kids-primary, .btn-kids-accent { font-size: 0.95rem; padding: 0.6rem 1rem; }
}

/* ── Social login buttons ────────────────────────────────────────────────── */
.btn-social {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1rem;
  min-height: 48px;
  border-radius: var(--radius-btn);
  font-weight: 600;
  font-size: 0.95rem;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: opacity .15s, transform .1s;
}
.btn-social:hover  { opacity: .88; transform: translateY(-1px); text-decoration: none; }
.btn-google        { background: #fff; color: #3c4043; border: 2px solid #dadce0; }
.btn-google:hover  { color: #3c4043; }
.btn-facebook      { background: #1877F2; color: #fff; }
.btn-facebook:hover{ color: #fff; }

.divider-or {
  display: flex;
  align-items: center;
  gap: .75rem;
  color: #9ca3af;
  font-size: .85rem;
}
.divider-or::before,
.divider-or::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #e5e7eb;
}
