/* ============================================================
   Padha World — Design System (shared)
   Brand: purple orbit + graduation cap · Baloo 2 display + Inter body
   ============================================================ */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../assets/fonts/inter-latin-400-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../assets/fonts/inter-latin-500-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../assets/fonts/inter-latin-600-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../assets/fonts/inter-latin-700-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Baloo 2";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../assets/fonts/baloo-2-latin-600-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Baloo 2";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../assets/fonts/baloo-2-latin-700-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Baloo 2";
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url("../assets/fonts/baloo-2-latin-800-normal.woff2") format("woff2");
}

:root {
  --purple-50: #f5f0ff;
  --purple-100: #ede4ff;
  --purple-200: #dcccfc;
  --purple-300: #c4a8f8;
  --purple-400: #a875f0;
  --purple-500: #8b3dff;
  --purple-600: #7c3aed;
  --purple-700: #6d28d9;
  --purple-800: #5b21b6;
  --purple-900: #3b1470;

  --blue-400: #4f9cf9;
  --blue-500: #2f7cf6;
  --blue-600: #1c63d8;

  --ink-900: #1e1030;
  --ink-700: #38284f;
  --ink-500: #6f6885;
  --ink-300: #a9a3bd;

  --bg-page: #f6f5fc;
  --bg-card: #ffffff;
  --border: #ece9f7;
  --border-strong: #ddd8ef;

  --success: #16a34a;
  --success-bg: #e9f9ee;
  --danger: #dc2626;
  --danger-bg: #fdeeee;
  --warning: #d97706;
  --warning-bg: #fef6e0;

  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-pill: 999px;

  --shadow-sm: 0 1px 2px rgba(30, 16, 48, 0.05), 0 2px 8px rgba(30, 16, 48, 0.05);
  --shadow-md: 0 4px 12px rgba(59, 20, 112, 0.08), 0 12px 40px rgba(59, 20, 112, 0.08);
  --shadow-lg: 0 20px 60px rgba(59, 20, 112, 0.22);
  --shadow-glow: 0 0 0 4px rgba(139, 61, 255, 0.18);

  --font-display: "Baloo 2", "Inter", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, sans-serif;

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink-900);
  background: var(--bg-page);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; }
button { font-family: inherit; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0);
  white-space: nowrap; border: 0;
}

:focus-visible {
  outline: 3px solid rgba(139, 61, 255, 0.55);
  outline-offset: 2px;
  border-radius: 6px;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: none;
  cursor: pointer;
  font-weight: 600;
  font-size: 15px;
  border-radius: var(--radius-pill);
  padding: 13px 22px;
  transition: transform 0.18s var(--ease-out), box-shadow 0.18s var(--ease-out),
              background 0.18s var(--ease-out), opacity 0.18s;
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
}
.btn:active { transform: translateY(1px) scale(0.99); }
.btn:disabled { opacity: 0.65; cursor: not-allowed; }

.btn-primary {
  background: linear-gradient(135deg, #8b3dff 0%, #6d28d9 100%);
  color: #fff;
  box-shadow: 0 6px 18px rgba(124, 58, 237, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 10px 26px rgba(124, 58, 237, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.btn-ghost {
  background: transparent;
  color: var(--purple-700);
  border: 1.5px solid var(--border-strong);
  background: #fff;
}
.btn-ghost:hover:not(:disabled) { border-color: var(--purple-400); color: var(--purple-800); }

.btn-block { width: 100%; }
.btn .btn-label { display: inline-flex; align-items: center; gap: 10px; }

/* Button loading state */
.btn-loading { pointer-events: none; }
.spinner {
  width: 18px; height: 18px;
  border: 2.2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
  flex: 0 0 auto;
}
.btn-ghost .spinner, .spinner.spinner-dark {
  border-color: rgba(109, 40, 217, 0.25);
  border-top-color: var(--purple-700);
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Inputs ---------- */
.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-700);
  margin-bottom: 6px;
}
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap .input-icon {
  position: absolute;
  left: 14px;
  color: var(--ink-300);
  pointer-events: none;
  display: flex;
}
.input {
  width: 100%;
  font: inherit;
  font-size: 15px;
  color: var(--ink-900);
  background: #fff;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}
.input-wrap .input { padding-left: 44px; }
.input-wrap .input.has-trailing { padding-right: 48px; }
.input::placeholder { color: var(--ink-300); }
.input:focus {
  border-color: var(--purple-500);
  box-shadow: var(--shadow-glow);
}
.input[aria-invalid="true"] { border-color: var(--danger); }
.field-error {
  display: none;
  font-size: 12.5px;
  color: var(--danger);
  margin-top: 5px;
  font-weight: 500;
}
.field-error.visible { display: block; }

.icon-btn {
  position: absolute;
  right: 6px;
  border: none;
  background: transparent;
  padding: 8px;
  border-radius: 10px;
  cursor: pointer;
  color: var(--ink-500);
  display: flex;
  transition: background 0.15s, color 0.15s;
}
.icon-btn:hover { background: var(--purple-50); color: var(--purple-700); }

/* ---------- Alert / error box ---------- */
.alert {
  display: none;
  gap: 10px;
  align-items: flex-start;
  font-size: 13.5px;
  line-height: 1.45;
  border-radius: var(--radius-md);
  padding: 11px 13px;
  margin-bottom: 14px;
}
.alert.visible { display: flex; }
.alert-error { background: var(--danger-bg); color: #991b1b; border: 1px solid #f5c2c2; }
.alert-success { background: var(--success-bg); color: #14532d; border: 1px solid #bfe8cd; }
.alert-info { background: var(--purple-50); color: var(--purple-800); border: 1px solid var(--purple-200); }
.alert svg { flex: 0 0 auto; margin-top: 1px; }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(20, 8, 40, 0.55);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 80;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s var(--ease-out);
}
.modal-backdrop.open { opacity: 1; pointer-events: auto; }
.modal {
  background: #fff;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  width: min(560px, 100%);
  max-height: calc(100vh - 40px);
  max-height: calc(100dvh - 40px);
  overflow: auto;
  transform: translateY(16px) scale(0.97);
  transition: transform 0.25s var(--ease-out);
}
.modal-backdrop.open .modal { transform: translateY(0) scale(1); }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px 0;
}
.modal-body { padding: 14px 22px 22px; }
.modal-close {
  border: none; background: var(--purple-50); color: var(--purple-800);
  width: 38px; height: 38px; border-radius: 12px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
}
.modal-close:hover { background: var(--purple-100); }

/* ---------- Toast ---------- */
.toast-wrap {
  position: fixed;
  bottom: 26px; left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: flex; flex-direction: column; gap: 10px;
  width: min(440px, calc(100vw - 32px));
}
.toast {
  background: #241733;
  color: #f3efff;
  font-size: 14px;
  line-height: 1.45;
  padding: 12px 16px;
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  display: flex; gap: 10px; align-items: flex-start;
  animation: toast-in 0.28s var(--ease-out);
}
@keyframes toast-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- Logo bits ---------- */
.wordmark {
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: 0.2px;
  line-height: 1;
}
.wordmark .world { color: var(--purple-500); }

/* ---------- Skip link ---------- */
.skip-link {
  position: absolute; left: 16px; top: -60px;
  background: #1e1030; color: #fff; padding: 12px 18px;
  border-radius: 12px; z-index: 200; font-weight: 600; text-decoration: none;
  transition: top 0.2s;
}
.skip-link:focus { top: 14px; color: #fff; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
