/* =================================================================
   Bayhaqy Kids — Shared theme + shell
   Kid-friendly bilingual learning platform (K-9)
   Red-black-white palette matches the rest of bayhaqy.my.id
   ================================================================= */

:root {
  /* Brand palette — matches portfolio + apps */
  --red-700:    #B91C1C;
  --red-800:    #991B1B;
  --red-900:    #7F1D1D;
  --red-50:     #FEF2F2;
  --red-100:    #FEE2E2;

  /* Subject colors — each subject has its own accent */
  --math:       #2563EB;   /* blue */
  --math-soft:  #DBEAFE;
  --language:   #DB2777;   /* pink */
  --lang-soft:  #FCE7F3;
  --science:    #059669;   /* green */
  --sci-soft:   #D1FAE5;
  --tech:       #7C3AED;   /* purple */
  --tech-soft:  #EDE9FE;
  --history:    #D97706;   /* amber */
  --hist-soft:  #FEF3C7;
  --games:      #B91C1C;   /* red */
  --games-soft: #FEE2E2;

  /* Neutrals */
  --ink:        #111111;
  --ink-soft:   #1F2937;
  --ink-mute:   #6B7280;
  --ink-faint:  #9CA3AF;
  --line:       #E5E7EB;
  --line-soft:  #F3F4F6;
  --paper:      #FFFFFF;
  --paper-alt:  #FAFAFA;
  --paper-warm: #FFF8F0;  /* warm off-white for kids */

  /* Typography */
  --font-display: 'Baloo 2', 'Nunito', 'Inter', system-ui, sans-serif;
  --font-body:    'Nunito', 'Inter', system-ui, sans-serif;

  /* Radii — kid-friendly large radii */
  --radius-sm: 8px;
  --radius:    14px;
  --radius-lg: 22px;
  --radius-xl: 32px;

  /* Shadows */
  --shadow-sm: 0 2px 6px rgba(15,23,42,0.06);
  --shadow:    0 6px 20px rgba(15,23,42,0.08);
  --shadow-lg: 0 14px 36px rgba(15,23,42,0.12);

  /* Layout */
  --container: 1180px;

  /* Type scale */
  --fs-xs: 0.78rem;
  --fs-sm: 0.9rem;
  --fs-md: 1rem;
  --fs-lg: 1.15rem;
  --fs-xl: 1.4rem;
  --fs-2xl: 1.85rem;
  --fs-3xl: 2.6rem;
  --fs-4xl: 3.4rem;

  --ease: cubic-bezier(.2,.7,.3,1);
}

[data-theme="dark"] {
  --ink:        #F1F5F9;
  --ink-soft:   #CBD5E1;
  --ink-mute:   #94A3B8;
  --ink-faint:  #64748B;
  --line:       #334155;
  --line-soft:  #1E293B;
  --paper:      #0F172A;
  --paper-alt:  #1E293B;
  --paper-warm: #1A2333;
  --red-50:     rgba(185, 28, 28, 0.18);
  --red-100:    rgba(185, 28, 28, 0.25);
  --math-soft:  rgba(37, 99, 235, 0.18);
  --lang-soft:  rgba(219, 39, 119, 0.18);
  --sci-soft:   rgba(5, 150, 105, 0.18);
  --tech-soft:  rgba(124, 58, 237, 0.18);
  --hist-soft:  rgba(217, 119, 6, 0.18);
  --games-soft: rgba(185, 28, 28, 0.18);
  --shadow-sm: 0 2px 6px rgba(0,0,0,0.3);
  --shadow:    0 6px 20px rgba(0,0,0,0.35);
  --shadow-lg: 0 14px 36px rgba(0,0,0,0.45);
}

/* ============== Reset ============== */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-body);
  font-size: var(--fs-md);
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  padding-top: 64px; /* header height */
}
img { max-width: 100%; height: auto; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--red-700); text-decoration: none; transition: color .2s var(--ease); }
a:hover { color: var(--red-900); }

::selection { background: var(--red-700); color: #fff; }

/* ============== Header ============== */
.kids-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: 64px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  transition: box-shadow .2s var(--ease), background .2s var(--ease);
}
.kids-header.scrolled { box-shadow: var(--shadow-sm); }
.kids-header-inner {
  max-width: var(--container);
  height: 100%;
  margin: 0 auto;
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.kids-brand {
  display: flex; align-items: center; gap: 0.6rem;
  text-decoration: none;
  color: var(--ink);
}
.kids-brand-logo {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, var(--red-700), var(--red-900));
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 800; font-family: var(--font-display);
  font-size: 1.3rem;
  box-shadow: var(--shadow-sm);
}
.kids-brand-name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}
.kids-brand-name .accent { color: var(--red-700); }

.kids-nav {
  display: flex; align-items: center; gap: 0.25rem;
  margin-left: auto;
}
.kids-nav a {
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: var(--fs-sm);
  color: var(--ink-soft);
  transition: background .15s, color .15s;
}
.kids-nav a:hover { background: var(--line-soft); color: var(--ink); }
.kids-nav .lang-toggle {
  background: var(--red-50);
  color: var(--red-700);
  font-weight: 700;
  padding: 0.4rem 0.7rem;
  border-radius: var(--radius-sm);
  font-size: var(--fs-xs);
  cursor: pointer;
  border: 1px solid transparent;
  margin-left: 0.5rem;
}
.kids-nav .lang-toggle:hover { background: var(--red-100); }

.theme-toggle {
  background: none; border: 1px solid var(--line);
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--ink-soft);
  transition: background .15s;
}
.theme-toggle:hover { background: var(--line-soft); }
.theme-toggle svg { width: 18px; height: 18px; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
[data-theme="light"] .theme-toggle .icon-sun { display: none; }

.menu-toggle {
  display: none;
  background: none; border: 1px solid var(--line);
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.menu-toggle span {
  display: block; width: 16px; height: 2px;
  background: var(--ink); margin: 3px auto;
  transition: transform .2s, opacity .2s;
}

@media (max-width: 760px) {
  .menu-toggle { display: block; }
  .kids-nav {
    position: fixed; top: 64px; left: 0; right: 0;
    background: var(--paper);
    border-bottom: 1px solid var(--line);
    flex-direction: column;
    align-items: stretch;
    padding: 0.5rem 1rem 1rem;
    gap: 0.25rem;
    transform: translateY(-120%);
    transition: transform .25s var(--ease);
    box-shadow: var(--shadow);
  }
  .kids-nav.open { transform: translateY(0); }
  .kids-nav a { padding: 0.7rem 0.85rem; }
}

/* ============== Footer ============== */
.kids-footer {
  background: var(--paper-alt);
  border-top: 1px solid var(--line);
  padding: 2rem 1.25rem;
  margin-top: 3rem;
}
.kids-footer-inner {
  max-width: var(--container);
  margin: 0 auto;
  display: flex; flex-wrap: wrap; gap: 1rem;
  align-items: center; justify-content: space-between;
  font-size: var(--fs-sm);
  color: var(--ink-mute);
}
.kids-footer a { color: var(--ink-soft); }
.kids-footer .brand-mini {
  display: flex; align-items: center; gap: 0.5rem;
  text-decoration: none;
  color: var(--ink);
}
.kids-footer .brand-mini .logo {
  width: 28px; height: 28px;
  background: linear-gradient(135deg, var(--red-700), var(--red-900));
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 800; font-size: 0.85rem;
  font-family: var(--font-display);
}
.kids-footer .footer-links {
  display: flex; gap: 1rem; flex-wrap: wrap;
}

/* ============== Page hero ============== */
.kids-hero {
  padding: 2.5rem 1.25rem 1.5rem;
  max-width: var(--container);
  margin: 0 auto;
}
.kids-hero .eyebrow {
  display: inline-flex; align-items: center; gap: 0.4rem;
  background: var(--red-50);
  color: var(--red-700);
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
}
.kids-hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, var(--fs-3xl));
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: var(--ink);
  margin-bottom: 0.75rem;
}
.kids-hero h1 .accent { color: var(--red-700); }
.kids-hero p {
  font-size: var(--fs-lg);
  color: var(--ink-soft);
  max-width: 640px;
}

/* ============== Subject cards ============== */
.subjects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.25rem;
  max-width: var(--container);
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
}
.subject-card {
  display: block;
  background: var(--paper);
  border: 2px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  text-decoration: none;
  color: var(--ink);
  position: relative;
  overflow: hidden;
  transition: transform .2s var(--ease), box-shadow .2s var(--ease), border-color .2s;
}
.subject-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--accent);
}
.subject-card .icon {
  width: 64px; height: 64px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-soft);
  color: var(--accent);
  margin-bottom: 1rem;
}
.subject-card .icon svg { width: 36px; height: 36px; }
.subject-card h3 {
  font-family: var(--font-display);
  font-size: var(--fs-xl);
  font-weight: 800;
  margin-bottom: 0.4rem;
  color: var(--ink);
}
.subject-card p {
  color: var(--ink-soft);
  font-size: var(--fs-sm);
  margin-bottom: 0.85rem;
}
.subject-card .meta {
  display: flex; gap: 0.5rem; flex-wrap: wrap;
  font-size: var(--fs-xs);
  color: var(--ink-mute);
}
.subject-card .meta .pill {
  background: var(--accent-soft);
  color: var(--accent);
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-weight: 600;
}

.subject-card[data-subject="math"]     { --accent: var(--math);     --accent-soft: var(--math-soft); }
.subject-card[data-subject="language"]  { --accent: var(--language); --accent-soft: var(--lang-soft); }
.subject-card[data-subject="science"]   { --accent: var(--science);  --accent-soft: var(--sci-soft); }
.subject-card[data-subject="tech"]      { --accent: var(--tech);     --accent-soft: var(--tech-soft); }
.subject-card[data-subject="history"]   { --accent: var(--history);  --accent-soft: var(--hist-soft); }
.subject-card[data-subject="games"]     { --accent: var(--games);    --accent-soft: var(--games-soft); }

/* ============== Grade selector ============== */
.grade-selector {
  display: flex; gap: 0.5rem; flex-wrap: wrap;
  margin: 1rem 0 1.5rem;
}
.grade-btn {
  padding: 0.5rem 1rem;
  background: var(--paper);
  border: 2px solid var(--line);
  border-radius: 999px;
  font-weight: 700;
  font-size: var(--fs-sm);
  color: var(--ink-soft);
  cursor: pointer;
  transition: all .15s;
  font-family: var(--font-display);
}
.grade-btn:hover { border-color: var(--red-700); color: var(--ink); }
.grade-btn.active {
  background: var(--red-700);
  border-color: var(--red-700);
  color: #fff;
}

/* ============== Lesson list ============== */
.lesson-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}
.lesson-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.15rem 1.25rem;
  text-decoration: none;
  color: var(--ink);
  transition: transform .15s, box-shadow .15s, border-color .15s;
  position: relative;
  display: flex; flex-direction: column; gap: 0.4rem;
}
.lesson-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--accent);
}
.lesson-card .level {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 999px;
  font-size: var(--fs-xs);
  font-weight: 700;
  align-self: flex-start;
}
.lesson-card h4 {
  font-family: var(--font-display);
  font-size: var(--fs-lg);
  font-weight: 700;
  color: var(--ink);
}
.lesson-card .desc {
  font-size: var(--fs-sm);
  color: var(--ink-soft);
}
.lesson-card .type {
  font-size: var(--fs-xs);
  color: var(--ink-mute);
  margin-top: 0.4rem;
}

/* ============== App page (lesson container) ============== */
.app-main {
  max-width: var(--container);
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
}
.app-hero {
  margin-bottom: 1.5rem;
}
.app-eyebrow {
  display: inline-block;
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  margin-bottom: 0.5rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.app-title {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 4vw, var(--fs-2xl));
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin-bottom: 0.4rem;
}
.app-title .accent { color: var(--accent); }
.app-subtitle {
  color: var(--ink-soft);
  font-size: var(--fs-md);
  max-width: 640px;
}

/* ============== Card / Panel ============== */
.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-sm);
}
.card-title {
  font-family: var(--font-display);
  font-size: var(--fs-lg);
  font-weight: 700;
  margin-bottom: 0.75rem;
  display: flex; align-items: center; gap: 0.5rem;
  color: var(--ink);
}

/* ============== Form controls ============== */
.field {
  display: flex; flex-direction: column; gap: 0.4rem;
  margin-bottom: 0.85rem;
}
.field > span {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--ink-soft);
}
.field .hint {
  font-size: var(--fs-xs);
  color: var(--ink-mute);
  font-weight: 400;
}
input[type="text"], input[type="number"], input[type="search"],
input[type="url"], input[type="email"], textarea, select {
  width: 100%;
  padding: 0.7rem 0.9rem;
  border: 2px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper);
  color: var(--ink);
  font-size: var(--fs-md);
  font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
textarea { min-height: 100px; resize: vertical; }

/* ============== Buttons ============== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.7rem 1.25rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--fs-md);
  cursor: pointer;
  border: 2px solid transparent;
  transition: all .15s var(--ease);
  text-decoration: none;
}
.btn-primary {
  background: var(--red-700);
  color: #fff;
  border-color: var(--red-700);
}
.btn-primary:hover { background: var(--red-800); border-color: var(--red-800); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-ghost {
  background: var(--paper);
  color: var(--ink);
  border-color: var(--line);
}
.btn-ghost:hover { background: var(--line-soft); border-color: var(--ink-faint); }
.btn-row { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* ============== Big buttons for kids ============== */
.btn-big {
  padding: 1rem 1.5rem;
  font-size: var(--fs-lg);
  border-radius: var(--radius);
  min-height: 56px;
}

/* ============== Layout helpers ============== */
.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 1.25rem;
}
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
@media (max-width: 760px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }
.text-c { text-align: center; }
.text-mute { color: var(--ink-mute); }
.text-red { color: var(--red-700); }
.text-sm { font-size: var(--fs-sm); }
.text-xs { font-size: var(--fs-xs); }
.text-mono { font-family: 'JetBrains Mono', 'SF Mono', Menlo, Consolas, monospace; }
.mt-1 { margin-top: 0.5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; }

/* ============== Toast ============== */
.toast {
  position: fixed; bottom: 1.5rem; left: 50%;
  transform: translateX(-50%) translateY(120%);
  background: var(--ink);
  color: var(--paper);
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: var(--fs-sm);
  box-shadow: var(--shadow-lg);
  z-index: 200;
  opacity: 0;
  transition: transform .25s var(--ease), opacity .25s var(--ease);
  pointer-events: none;
}
.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ============== Data table ============== */
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
}
table.data th, table.data td {
  padding: 0.5rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--line);
}
table.data th {
  font-weight: 700;
  color: var(--ink-soft);
  background: var(--paper-alt);
}
table.data td.k { color: var(--ink-mute); font-weight: 600; width: 35%; }
table.data td.v { color: var(--ink); font-family: 'JetBrains Mono', monospace; font-size: var(--fs-xs); }
table.data tr:last-child td { border-bottom: none; }

/* ============== Pill ============== */
.pill {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  background: var(--line-soft);
  color: var(--ink-soft);
  border-radius: 999px;
  font-size: var(--fs-xs);
  font-weight: 600;
  border: 1px solid var(--line);
}
.pill.green { background: var(--sci-soft); color: var(--science); border-color: transparent; }
.pill.muted { background: var(--paper-alt); color: var(--ink-mute); }

/* ============== Breadcrumbs ============== */
.breadcrumbs {
  display: flex; gap: 0.5rem; align-items: center;
  font-size: var(--fs-xs);
  color: var(--ink-mute);
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}
.breadcrumbs a { color: var(--ink-soft); }
.breadcrumbs .sep { opacity: 0.5; }

/* ============== Subject hero color ============== */
.subject-page { --accent: var(--red-700); --accent-soft: var(--red-50); }
.subject-page[data-subject="math"]     { --accent: var(--math);     --accent-soft: var(--math-soft); }
.subject-page[data-subject="language"] { --accent: var(--language); --accent-soft: var(--lang-soft); }
.subject-page[data-subject="science"]  { --accent: var(--science);  --accent-soft: var(--sci-soft); }
.subject-page[data-subject="tech"]     { --accent: var(--tech);     --accent-soft: var(--tech-soft); }
.subject-page[data-subject="history"]  { --accent: var(--history);  --accent-soft: var(--hist-soft); }

/* ============== Animations ============== */
@keyframes pop {
  0% { transform: scale(0.8); opacity: 0; }
  60% { transform: scale(1.05); }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}
@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
.animate-pop { animation: pop .3s var(--ease); }
.animate-shake { animation: shake .3s; }
.animate-bounce { animation: bounce .6s var(--ease); }

/* ============== Mobile tweaks ============== */
@media (max-width: 640px) {
  body { padding-top: 60px; font-size: var(--fs-sm); }
  .kids-header { height: 60px; }
  .kids-nav { top: 60px; }
  .kids-hero { padding: 1.5rem 1rem 1rem; }
  .subjects-grid { padding: 1rem; gap: 1rem; }
  .subject-card { padding: 1.25rem; }
  .card { padding: 1rem 1.1rem; }
  .btn { padding: 0.6rem 1rem; font-size: var(--fs-sm); }
  .btn-big { padding: 0.85rem 1.25rem; font-size: var(--fs-md); }
}
