/* ==========================================================================
   Asesmen Sikap Kebangsaan — fondasi desain (token, tipografi, komponen dasar)
   Palet: biru dongker seragam SMP, merah-putih, kertas buku tulis.
   Huruf: Plus Jakarta Sans (Tokotype, Indonesia) — lisensi SIL OFL 1.1.
   ========================================================================== */

@font-face {
  font-family: "Plus Jakarta Sans";
  src: url("../fonts/plus-jakarta-sans-latin.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308,
    U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Plus Jakarta Sans";
  src: url("../fonts/plus-jakarta-sans-latin-ext.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329,
    U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --navy-950: #0F1838;
  --navy-900: #142049;
  --navy-800: #1B2A5C;
  --navy-700: #24387A;
  --navy-600: #2F4A9A;
  --navy-200: #C9D3EE;
  --navy-100: #E4E9F7;
  --navy-50: #F1F4FB;
  --red-700: #B71E33;
  --red-600: #D7263D;
  --red-100: #FBD9DE;
  --red-50: #FDEEF0;
  --ink: #18213D;
  --ink-2: #3A4466;
  --muted: #5D6888;
  --line: #DCE2EF;
  --line-strong: #C2CBE0;
  --paper: #F5F7FC;
  --surface: #FFFFFF;
  --rule: #DCE5F6;
  --sun: #F4B63E;
  --sun-50: #FFF6E1;
  --green-700: #17744A;
  --green-50: #E7F5EE;
  --amber-700: #8F5200;
  --amber-600: #B96B00;
  --amber-50: #FFF4DF;
  --opt-sts: #E04F5F;
  --opt-ts: #EE8A35;
  --opt-s: #2AA866;
  --opt-ss: #2F6FDE;
  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 20px;
  --shadow-1: 0 1px 2px rgba(20, 32, 73, 0.06), 0 2px 10px rgba(20, 32, 73, 0.05);
  --shadow-2: 0 10px 30px rgba(20, 32, 73, 0.12);
  --focus-ring: 0 0 0 3px #fff, 0 0 0 6px var(--opt-ss);
  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  color-scheme: light;
}

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

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

body {
  margin: 0;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "ss01" 0;
  overflow-x: hidden;
}

img,
svg {
  display: block;
  max-width: 100%;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  line-height: 1.2;
  color: var(--navy-900);
  letter-spacing: -0.01em;
}

p {
  margin: 0;
}

a {
  color: var(--navy-600);
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}
[tabindex="-1"]:focus,
[tabindex="-1"]:focus-visible {
  outline: none;
  box-shadow: none;
}

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

[hidden] {
  display: none !important;
}

.icon {
  flex: none;
}

/* ------------------------------------------------------------------ tombol */
.btn {
  --btn-bg: var(--surface);
  --btn-fg: var(--navy-800);
  --btn-border: var(--line-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 48px;
  padding: 0.7rem 1.15rem;
  border: 1.5px solid var(--btn-border);
  border-radius: 12px;
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-weight: 700;
  font-size: 1rem;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.btn:hover {
  --btn-border: var(--navy-600);
}
.btn:active {
  transform: translateY(1px);
}
.btn[disabled],
.btn[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}
.btn-primary {
  --btn-bg: var(--navy-800);
  --btn-fg: #fff;
  --btn-border: var(--navy-800);
}
.btn-primary:hover {
  --btn-bg: var(--navy-700);
  --btn-border: var(--navy-700);
}
.btn-danger {
  --btn-bg: var(--red-600);
  --btn-fg: #fff;
  --btn-border: var(--red-600);
}
.btn-danger:hover {
  --btn-bg: var(--red-700);
  --btn-border: var(--red-700);
}
.btn-ghost {
  --btn-bg: transparent;
  --btn-border: transparent;
}
.btn-ghost:hover {
  --btn-bg: var(--navy-50);
  --btn-border: transparent;
}
.btn-lg {
  min-height: 56px;
  padding: 0.9rem 1.5rem;
  font-size: 1.0625rem;
  border-radius: 14px;
}
.btn-sm {
  min-height: 36px;
  padding: 0.4rem 0.75rem;
  font-size: 0.875rem;
  border-radius: 10px;
}
.btn-block {
  width: 100%;
}

/* ------------------------------------------------------------------ formulir */
.field {
  display: grid;
  gap: 0.4rem;
}
.field > label,
.field-label {
  font-weight: 700;
  font-size: 0.9375rem;
  color: var(--ink);
}
.field-hint {
  font-size: 0.8125rem;
  color: var(--muted);
  line-height: 1.45;
}
.field-error {
  font-size: 0.8125rem;
  color: var(--red-700);
  font-weight: 600;
}
.optional-tag {
  font-weight: 500;
  color: var(--muted);
  font-size: 0.8125rem;
}
.input,
.select,
.textarea {
  width: 100%;
  min-height: 50px;
  padding: 0.7rem 0.9rem;
  border: 1.5px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface);
  font-size: 1rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.textarea {
  min-height: 110px;
  resize: vertical;
  line-height: 1.5;
}
.select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 2.6rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231B2A5C' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.85rem center;
  background-size: 18px;
}
.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--navy-700);
  box-shadow: 0 0 0 3px var(--navy-100);
}
.input[aria-invalid="true"],
.select[aria-invalid="true"] {
  border-color: var(--red-600);
}
.input-code {
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
}

/* pilihan berbentuk chip (radio) */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.chip {
  position: relative;
}
.chip input {
  position: absolute;
  opacity: 0;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
}
.chip span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 52px;
  min-height: 46px;
  padding: 0.55rem 1rem;
  border: 1.5px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface);
  font-weight: 700;
  color: var(--ink-2);
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
.chip input:checked + span {
  background: var(--navy-800);
  border-color: var(--navy-800);
  color: #fff;
}
.chip input:focus-visible + span {
  box-shadow: var(--focus-ring);
}
.chip:hover span {
  border-color: var(--navy-600);
}

/* ------------------------------------------------------------------ elemen umum */
.notice {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  padding: 0.9rem 1rem;
  border-radius: 12px;
  background: var(--navy-50);
  color: var(--ink-2);
  font-size: 0.9375rem;
  line-height: 1.5;
}
.notice .icon {
  margin-top: 2px;
  color: var(--navy-700);
}
.notice-warn {
  background: var(--amber-50);
  color: #5A3A05;
}
.notice-warn .icon {
  color: var(--amber-600);
}
.notice-danger {
  background: var(--red-50);
  color: #6B1220;
}
.notice-danger .icon {
  color: var(--red-600);
}
.notice-ok {
  background: var(--green-50);
  color: #0F4D31;
}
.notice-ok .icon {
  color: var(--green-700);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.6;
  background: var(--navy-100);
  color: var(--navy-800);
  white-space: nowrap;
}
.badge-pilot {
  background: var(--sun-50);
  color: #7A4D00;
  border: 1px solid #F3D48A;
}
.badge-research {
  background: var(--navy-800);
  color: #fff;
}
.badge-ok {
  background: var(--green-50);
  color: var(--green-700);
}
.badge-warn {
  background: var(--amber-50);
  color: var(--amber-700);
}
.badge-danger {
  background: var(--red-50);
  color: var(--red-700);
}
.badge-muted {
  background: #EEF0F5;
  color: var(--muted);
}

.flag-mark {
  display: inline-block;
  width: 22px;
  height: 15px;
  border-radius: 3px;
  background: linear-gradient(var(--red-600) 50%, #fff 50%);
  box-shadow: inset 0 0 0 1px rgba(20, 32, 73, 0.18);
  flex: none;
}

/* toast */
.toast-region {
  position: fixed;
  left: 50%;
  bottom: calc(96px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 80;
  display: grid;
  gap: 0.5rem;
  width: min(92vw, 440px);
  pointer-events: none;
}
.toast {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  padding: 0.8rem 1rem;
  border-radius: 12px;
  background: var(--navy-900);
  color: #fff;
  font-size: 0.9375rem;
  box-shadow: var(--shadow-2);
  pointer-events: auto;
  animation: toast-in 0.25s var(--ease);
}
.toast-error {
  background: #7A1424;
}
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

/* modal / bottom sheet */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(15, 24, 56, 0.45);
  animation: fade-in 0.2s ease;
}
.modal {
  width: min(100%, 520px);
  max-height: 88vh;
  overflow: auto;
  padding: 1.5rem 1.25rem calc(1.25rem + env(safe-area-inset-bottom));
  border-radius: 20px 20px 0 0;
  background: var(--surface);
  box-shadow: var(--shadow-2);
  animation: sheet-in 0.28s var(--ease);
}
.modal h2 {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
}
.modal-body {
  color: var(--ink-2);
}
.modal-actions {
  display: grid;
  gap: 0.6rem;
  margin-top: 1.25rem;
}
@media (min-width: 640px) {
  .modal-backdrop {
    align-items: center;
  }
  .modal {
    border-radius: 20px;
    padding: 1.75rem;
  }
  .modal-actions {
    grid-auto-flow: column;
    justify-content: end;
  }
}
@keyframes fade-in {
  from {
    opacity: 0;
  }
}
@keyframes sheet-in {
  from {
    transform: translateY(24px);
    opacity: 0;
  }
}

.spinner {
  width: 22px;
  height: 22px;
  border: 3px solid var(--navy-100);
  border-top-color: var(--navy-700);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@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;
  }
}
