/* ViaMath — gaya kustom di luar Tailwind CDN.
   Design tokens & komponen mengikuti §13 Blueprint (playful-profesional, anak 10–11 th). */

:root {
  /* Palet (terkontrol) */
  --indigo: #5B8DEF;
  --purple: #A78BFA;
  --mint:   #6EE7B7;
  --yellow: #FCD34D;
  --peach:  #FDBA74;
  --bg:     #F8FAFC;
  --ink:    #1E293B;
  --ink-soft:#475569;
  --ok:     #10B981;
  --no:     #FB7185; /* rose lembut, bukan merah menyala */

  --radius: 1.5rem;
  --shadow-soft: 0 8px 30px rgba(91,141,239,0.12);
  --shadow-card: 0 4px 16px rgba(15,23,42,0.06);
}

* { font-family: 'Nunito', system-ui, sans-serif; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--ink); font-size: 16px; }

/* ---- Skala font ramah anak SD (≥16px teks baca utama; §13.2 Blueprint) ----
   Override kelas teks Tailwind dari satu titik. Di-scope ke body agar menang atas
   utilitas Tailwind CDN. line-height dijaga agar tetap lega & terbaca. */
body .text-\[10px\] { font-size: 12px !important; }
body .text-\[11px\] { font-size: 12.5px !important; }
body .text-xs  { font-size: 13.5px !important; line-height: 1.45; }
body .text-sm  { font-size: 16px   !important; line-height: 1.55; }  /* teks baca utama: 14→16 */
body .text-base{ font-size: 17px   !important; }
body .text-lg  { font-size: 19px   !important; }
body .text-xl  { font-size: 22px   !important; }
body .text-2xl { font-size: 27px   !important; }
body .text-3xl { font-size: 32px   !important; }

/* Catatan: ukuran kontrol (tombol/input/nav/chip) diatur langsung di deklarasi
   masing-masing komponen di bawah, agar tidak ada bentrok spesifisitas. */

/* ---- Komponen dasar ---- */
.vm-card {
  background: #fff;
  border: 1px solid #EEF2F7;
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
}
.vm-glass {
  background: rgba(255,255,255,0.78);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.4);
}

/* Tombol — target sentuh ≥44px */
.vm-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 44px; padding: 0 1.25rem;
  border-radius: 1rem; font-weight: 800; font-size: 1rem;
  cursor: pointer; border: none; transition: transform .15s, box-shadow .15s, filter .15s;
  user-select: none;
}
.vm-btn:active { transform: translateY(1px) scale(.99); }
.vm-btn-primary {
  background: linear-gradient(135deg, var(--indigo), var(--purple));
  color: #fff; box-shadow: var(--shadow-soft);
}
.vm-btn-primary:hover { filter: brightness(1.05); }
.vm-btn-ghost { background: #fff; color: var(--ink-soft); border: 2px solid #E2E8F0; }
.vm-btn-ghost:hover { border-color: var(--indigo); color: var(--indigo); }
.vm-btn:disabled { opacity: .5; cursor: not-allowed; }

/* Input */
.vm-input, .vm-textarea, .vm-select {
  width: 100%; padding: .75rem 1rem; font-size: 1.0625rem; font-weight: 600;
  border: 2px solid #E2E8F0; border-radius: 1rem; background: #fff; color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
.vm-input:focus, .vm-textarea:focus, .vm-select:focus {
  outline: none; border-color: var(--indigo); box-shadow: 0 0 0 4px rgba(91,141,239,.15);
}
.vm-textarea { resize: vertical; min-height: 5rem; }

/* Chip / badge */
.vm-chip {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .25rem .75rem; border-radius: 999px; font-size: .8rem; font-weight: 800;
}

/* Pecahan tertulis (a/b vertikal) */
.vm-frac { display: inline-flex; flex-direction: column; align-items: center; line-height: 1; font-weight: 900; }
.vm-frac .bar { width: 1.4em; height: 2px; background: currentColor; margin: .15em 0; }

/* ---- Layout sidebar ---- */
#vm-sidebar {
  width: 250px; flex-shrink: 0; min-height: 100%;
  background: rgba(255,255,255,0.9); backdrop-filter: blur(12px);
  border-right: 1px solid rgba(91,141,239,0.12);
  transition: transform .3s ease;
}
#vm-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 40; }
#vm-overlay.open { display: block; }
@media (max-width: 860px) {
  #vm-sidebar { position: fixed; inset: 0 auto 0 0; z-index: 50; transform: translateX(-100%); }
  #vm-sidebar.open { transform: translateX(0); }
}

.nav-item {
  display: flex; align-items: center; gap: .75rem;
  width: 100%; padding: .7rem 1rem; border-radius: 1rem;
  font-weight: 700; font-size: .95rem; color: var(--ink-soft); text-align: left;
  background: transparent; border: none; cursor: pointer; transition: background .15s, color .15s;
}
.nav-item:hover { background: #F1F5F9; }
.nav-item.active { background: linear-gradient(135deg, var(--indigo), var(--purple)); color: #fff; box-shadow: var(--shadow-soft); }
.nav-item.locked { opacity: .45; cursor: not-allowed; }
.nav-item i[class*="ph-"] { font-size: 22px; }

/* Ukuran ikon Phosphor default (bisa di-override inline via font-size) */
i[class*="ph-"] { font-size: 1.15em; vertical-align: -0.15em; }
.vm-btn i[class*="ph-"] { font-size: 1.2em; }

/* ---- Animasi (hormati reduced-motion) ---- */
@keyframes fadeUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes floaty { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes pop { 0% { transform: scale(.8); } 60% { transform: scale(1.08); } 100% { transform: scale(1); } }
@keyframes shake { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-5px)} 75%{transform:translateX(5px)} }
.fade-up { animation: fadeUp .45s ease both; }
.floaty  { animation: floaty 3s ease-in-out infinite; }
.pop     { animation: pop .4s ease both; }
.shake   { animation: shake .4s ease both; }

@media (prefers-reduced-motion: reduce) {
  .fade-up, .floaty, .pop, .shake { animation: none !important; }
  * { scroll-behavior: auto !important; }
}

/* ---- Toast ---- */
#vm-toast-wrap { position: fixed; left: 50%; bottom: 1.5rem; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: .5rem; align-items: center; pointer-events: none; }
.vm-toast { background: var(--ink); color: #fff; padding: .7rem 1.1rem; border-radius: 1rem; font-weight: 700; font-size: .9rem; box-shadow: var(--shadow-soft); animation: fadeUp .3s ease both; max-width: 90vw; }
.vm-toast.ok { background: var(--ok); }
.vm-toast.no { background: var(--no); }

/* Helpers */
.hidden { display: none !important; }
.vm-scroll-x { overflow-x: auto; scrollbar-width: thin; }
