/* ==========================================================================
   Sistem Semakan Keputusan UASA 2026 - Premium Education Portal
   Navy / Royal blue / White / Gold
   ========================================================================== */

@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 400; font-display: swap; src: url('/fonts/poppins-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 500; font-display: swap; src: url('/fonts/poppins-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 600; font-display: swap; src: url('/fonts/poppins-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 700; font-display: swap; src: url('/fonts/poppins-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 800; font-display: swap; src: url('/fonts/poppins-latin-800-normal.woff2') format('woff2'); }

:root {
  --navy-950: #061235;
  --navy-900: #0B1E4F;
  --navy-800: #102A6B;
  --royal-700: #1747B8;
  --royal-600: #1F5BD8;
  --royal-500: #2F6FEB;
  --sky-100: #E8F0FE;
  --ink: #0F1E44;
  --ink-soft: #46557A;
  --line: #D5DDEE;
  --surface: #FFFFFF;
  --surface-soft: #F4F7FD;
  --gold-300: #F6DF92;
  --gold-500: #D4AF37;
  --gold-700: #A9801E;
  --gold-grad: linear-gradient(135deg, #F8E6A6 0%, #D4AF37 55%, #B08A26 100%);
  --royal-grad: linear-gradient(135deg, #2F6FEB 0%, #1747B8 55%, #0F2F86 100%);

  --grade-a: #15803D;
  --grade-b: #1D4ED8;
  --grade-c: #0E7490;
  --grade-d: #CA8A04;
  --grade-e: #EA580C;
  --grade-f: #DC2626;

  --radius-lg: 28px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --shadow-card: 0 30px 70px -28px rgba(6, 18, 53, .55), 0 12px 28px -18px rgba(6, 18, 53, .35);
  --font: 'Poppins', 'Segoe UI', system-ui, -apple-system, Roboto, 'Helvetica Neue', Arial, sans-serif;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--ink);
  background: linear-gradient(180deg, var(--navy-950) 0%, var(--navy-900) 22%, var(--royal-700) 58%, #DCE6FA 100%);
  background-color: var(--navy-900);
  overflow-x: hidden;
  line-height: 1.5;
}
img, svg { display: block; max-width: 100%; }
[hidden] { display: none !important; }
button, input, select { font: inherit; color: inherit; }

/* ---------- Backdrop ---------- */
.backdrop { position: absolute; inset: 0 0 auto 0; height: 760px; overflow: hidden; pointer-events: none; z-index: 0; }
.glow { position: absolute; border-radius: 50%; filter: blur(70px); opacity: .55; }
.glow-a { width: 520px; height: 520px; left: -160px; top: -140px; background: radial-gradient(circle, #2F6FEB 0%, transparent 70%); }
.glow-b { width: 560px; height: 560px; right: -180px; top: 40px; background: radial-gradient(circle, #3D86FF 0%, transparent 70%); opacity: .45; }
.deco { position: absolute; opacity: .9; }
.deco-left { width: min(40vw, 420px); left: max(-90px, -6vw); top: 170px; opacity: .4; }
.deco-right { width: min(42vw, 440px); right: max(-90px, -6vw); top: 130px; opacity: .45; }
.sweep { position: absolute; height: 3px; width: 70vw; background: linear-gradient(90deg, transparent, rgba(246, 223, 146, .85), transparent); transform: rotate(-24deg); filter: drop-shadow(0 0 6px rgba(246, 223, 146, .6)); }
.sweep-a { top: 70px; left: -32vw; }
.sweep-b { top: 520px; right: -36vw; transform: rotate(-16deg); opacity: .6; }

/* ---------- Hero ---------- */
.hero { position: relative; z-index: 1; text-align: center; color: #fff; padding: 34px 16px 0; }
.crest { display: flex; justify-content: center; margin-bottom: 6px; filter: drop-shadow(0 6px 14px rgba(0,0,0,.35)); }
.crest svg { width: 104px; height: auto; }
.title { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 10px; font-weight: 800; }
.eyebrow { font-size: clamp(.95rem, 3.7vw, 1.65rem); letter-spacing: .08em; text-transform: uppercase; font-weight: 700; text-shadow: 0 2px 10px rgba(0,0,0,.35); }
.title-plate {
  position: relative; display: inline-flex; gap: .28em; align-items: baseline;
  padding: .12em .55em .06em; border-radius: 22px;
  font-size: clamp(2.6rem, 13vw, 6rem); line-height: 1.05; max-width: 100%; letter-spacing: -.01em; font-style: italic;
  background: linear-gradient(180deg, rgba(10, 28, 78, .85), rgba(16, 42, 107, .75));
  border: 2px solid transparent;
  background-clip: padding-box;
  box-shadow: 0 18px 40px -18px rgba(0,0,0,.7), inset 0 1px 0 rgba(255,255,255,.12);
}
.title-plate::before {
  content: ''; position: absolute; inset: -2px; border-radius: 24px; padding: 2px;
  background: var(--gold-grad);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
}
.uasa { background: linear-gradient(180deg, #FFFFFF 30%, #C9D6F2 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.year { background: var(--gold-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.ribbon {
  display: inline-block; margin: 14px 0 0; padding: 7px 34px;
  background: var(--gold-grad); color: var(--navy-900);
  font-weight: 800; letter-spacing: .08em; text-transform: uppercase; font-size: clamp(.95rem, 3.8vw, 1.5rem);
  clip-path: polygon(4% 0, 100% 0, 96% 100%, 0 100%);
  box-shadow: 0 10px 24px -12px rgba(0,0,0,.6);
}
.kelas { margin: 12px 0 0; font-weight: 600; letter-spacing: .32em; text-transform: uppercase; font-size: clamp(.8rem, 3vw, 1.15rem); color: #EAF0FF; }

.teacher {
  display: inline-flex; align-items: center; gap: 14px; margin: 22px auto 0; padding: 8px 26px 8px 8px; max-width: 100%;
  border-radius: 999px; text-align: left;
  background: linear-gradient(135deg, rgba(255,255,255,.14), rgba(255,255,255,.04));
  border: 1.5px solid rgba(246, 223, 146, .75);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  box-shadow: 0 16px 34px -20px rgba(0,0,0,.8);
}
.teacher-icon {
  flex: none; display: grid; place-items: center; width: 60px; height: 60px; border-radius: 50%;
  color: var(--gold-300); background: var(--navy-900); border: 2px solid var(--gold-500);
}
.teacher-text { display: flex; flex-direction: column; }
.teacher-label { font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--gold-300); font-weight: 600; }
.teacher-name { font-size: clamp(.98rem, 3.6vw, 1.28rem); font-weight: 700; line-height: 1.3; }

/* ---------- Cards ---------- */
main { position: relative; z-index: 1; padding: 26px 16px 56px; }
.card {
  width: 100%; max-width: 820px; margin: 0 auto;
  background: rgba(255, 255, 255, .97);
  border: 1px solid rgba(255,255,255,.7);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 26px 18px 22px;
  animation: rise .6s cubic-bezier(.2,.8,.2,1) both;
}
@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .card { background: rgba(255,255,255,.92); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
}
.card-head { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 22px; }
.card-icon { flex: none; display: grid; place-items: center; width: 62px; height: 62px; border-radius: 18px; color: var(--royal-600); background: var(--sky-100); }
.card h2 { margin: 0; font-size: clamp(1.4rem, 5.4vw, 2.2rem); font-weight: 800; color: var(--navy-900); line-height: 1.2; }
.lead { margin: 6px 0 0; color: var(--ink-soft); font-size: clamp(.95rem, 3.4vw, 1.1rem); }
mark { background: linear-gradient(180deg, transparent 8%, #FCE9A6 8%, #FCE9A6 92%, transparent 92%); color: var(--navy-900); font-weight: 700; padding: 0 .25em; border-radius: 4px; }

/* ---------- Form ---------- */
.field { display: flex; gap: 14px; align-items: flex-end; margin-bottom: 18px; }
.field-icon { flex: none; display: grid; place-items: center; width: 54px; height: 54px; border-radius: 14px; background: var(--sky-100); color: var(--navy-800); }
.field-body { flex: 1; min-width: 0; }
label { display: block; font-weight: 700; margin-bottom: 6px; color: var(--navy-900); font-size: 1rem; }
.field-hint { margin: 6px 2px 0; font-size: .82rem; line-height: 1.35; color: #6B7899; }
.code-wrap { position: relative; }
.code-wrap input { padding-right: 56px; letter-spacing: .12em; }
.code-wrap input::placeholder { letter-spacing: normal; }
.code-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; display: grid; place-items: center; border: 0; border-radius: 10px; background: transparent; color: var(--navy-800); cursor: pointer; }
.code-toggle:hover { background: var(--sky-100); }
.code-toggle:focus-visible { outline: 3px solid var(--gold-500); outline-offset: 1px; }
.code-toggle .eye-closed { display: none; }
.code-toggle[aria-pressed="true"] .eye-open { display: none; }
.code-toggle[aria-pressed="true"] .eye-closed { display: block; }
.field:has(.field-hint) { align-items: flex-start; }
.field:has(.field-hint) .field-icon { margin-top: 30px; }
input[type="text"], input[type="password"], select {
  width: 100%; height: 56px; padding: 0 16px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--line); background: #fff; font-size: 16px; /* 16px prevents iOS zoom */
  transition: border-color .2s, box-shadow .2s;
}
input[type="text"]::placeholder, input[type="password"]::placeholder { color: #8A96B4; }
input[type="password"]:focus, input[type="text"]:focus, select:focus { outline: none; border-color: var(--royal-500); box-shadow: 0 0 0 4px rgba(47, 111, 235, .18); }
input[aria-invalid="true"], select[aria-invalid="true"] { border-color: var(--grade-f); }
.select-wrap { position: relative; }
.select-wrap::after { content: ''; position: absolute; right: 20px; top: 50%; width: 10px; height: 10px; border-right: 2.5px solid var(--navy-900); border-bottom: 2.5px solid var(--navy-900); transform: translateY(-70%) rotate(45deg); pointer-events: none; }
select { appearance: none; -webkit-appearance: none; padding-right: 48px; cursor: pointer; }
select:invalid { color: #5B6785; }
select option { color: var(--ink); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 52px; padding: 0 22px; border-radius: 14px; border: 0; cursor: pointer;
  font-weight: 700; letter-spacing: .02em; text-transform: uppercase; font-size: .98rem;
  transition: transform .18s ease, box-shadow .2s ease, filter .2s ease, background .2s;
  -webkit-tap-highlight-color: transparent;
}
.btn:focus-visible { outline: 3px solid var(--gold-500); outline-offset: 3px; }
.btn-primary { color: #fff; background: var(--royal-grad); box-shadow: 0 16px 30px -14px rgba(23, 71, 184, .9), inset 0 1px 0 rgba(255,255,255,.25); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 22px 36px -14px rgba(23, 71, 184, .95), inset 0 1px 0 rgba(255,255,255,.25); filter: brightness(1.06); }
.btn-primary:active { transform: translateY(0); }
.btn-lg { width: 100%; min-height: 64px; font-size: clamp(1.05rem, 4.4vw, 1.45rem); border-radius: 18px; margin-top: 8px; }
.btn-content, .btn-loading { display: inline-flex; align-items: center; gap: 12px; }
.btn-loading { display: none; }
.btn.is-loading { cursor: progress; filter: saturate(.85); }
.btn.is-loading .btn-content { display: none; }
.btn.is-loading .btn-loading { display: inline-flex; }
.spinner { width: 24px; height: 24px; border-radius: 50%; border: 3px solid rgba(255,255,255,.35); border-top-color: #fff; animation: spin .8s linear infinite; }
.btn-outline { background: #fff; color: var(--navy-900); border: 2px solid var(--navy-900); }
.btn-outline:hover { background: var(--navy-900); color: #fff; transform: translateY(-2px); }
.btn-gold { background: var(--gold-grad); color: var(--navy-900); box-shadow: 0 14px 26px -14px rgba(169, 128, 30, .9); }
.btn-gold:hover { transform: translateY(-2px); filter: brightness(1.05); }

.alert { margin: 4px 0 14px; padding: 14px 16px; border-radius: var(--radius-sm); font-weight: 500; background: #FEF2F2; color: #991B1B; border: 1px solid #FECACA; display: flex; gap: 10px; align-items: flex-start; }
.alert::before { content: '!'; flex: none; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: #DC2626; color: #fff; font-weight: 800; font-size: .85rem; }
.alert-info { background: #FFFBEB; color: #854D0E; border-color: #FDE68A; }
.alert-info::before { content: 'i'; background: #CA8A04; }

.note { display: flex; gap: 12px; align-items: flex-start; margin: 22px 0 0; padding: 14px 16px; border-radius: var(--radius-md); background: var(--surface-soft); color: var(--ink-soft); font-size: .95rem; }
.note svg { flex: none; color: var(--navy-800); }
.note strong { color: var(--royal-700); }

/* ---------- Result ---------- */
.result-head { text-align: center; margin-bottom: 18px; }
.result-kicker { margin: 0; color: var(--gold-700); font-weight: 700; letter-spacing: .24em; text-transform: uppercase; font-size: .8rem; }
.result-head h2 { text-transform: uppercase; letter-spacing: .02em; }
.result-head h2:focus { outline: none; }
.student { margin: 0 0 20px; display: grid; gap: 10px; padding: 16px 18px; border-radius: var(--radius-md); background: linear-gradient(135deg, var(--navy-900), var(--royal-700)); color: #fff; }
.student div { display: grid; grid-template-columns: 70px 1fr; gap: 10px; align-items: baseline; }
.student dt { color: var(--gold-300); font-weight: 600; font-size: .85rem; text-transform: uppercase; letter-spacing: .1em; }
.student dd { margin: 0; font-weight: 700; font-size: clamp(1rem, 3.8vw, 1.2rem); word-break: break-word; }

.subjects { display: grid; grid-template-columns: 1fr; gap: 16px; }
.subject {
  --grade: var(--grade-b);
  position: relative; overflow: hidden; border-radius: 22px; padding: 22px 20px 20px;
  background: #fff; border: 1.5px solid var(--line);
  box-shadow: 0 18px 34px -24px rgba(6, 18, 53, .5);
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 12px;
  animation: rise .55s cubic-bezier(.2,.8,.2,1) both;
}
.subject:nth-child(2) { animation-delay: .12s; }
.subject::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 6px; background: var(--grade); }
.subject[data-grade="A"] { --grade: var(--grade-a); }
.subject[data-grade="B"] { --grade: var(--grade-b); }
.subject[data-grade="C"] { --grade: var(--grade-c); }
.subject[data-grade="D"] { --grade: var(--grade-d); }
.subject[data-grade="E"] { --grade: var(--grade-e); }
.subject[data-grade="F"] { --grade: var(--grade-f); }
.subject-name { display: flex; align-items: center; gap: 10px; margin: 0 0 6px; font-weight: 800; font-size: 1.15rem; letter-spacing: .08em; text-transform: uppercase; color: var(--navy-900); }
.subject-name svg { color: var(--royal-600); }
.subject-percent { margin: 0; font-size: clamp(3.2rem, 16vw, 4.4rem); font-weight: 800; line-height: 1; color: var(--navy-900); letter-spacing: -.02em; }
.subject-percent small { font-size: .45em; font-weight: 700; margin-left: 2px; color: var(--ink-soft); }
.grade-pill { display: inline-flex; align-items: center; gap: 8px; margin-top: 12px; padding: 7px 16px; border-radius: 999px; background: var(--grade); color: #fff; font-weight: 800; letter-spacing: .08em; font-size: 1rem; }
.subject[data-grade="D"] .grade-pill { color: #3B2A00; }
.ring { width: 112px; height: 112px; position: relative; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 10; }
.ring .ring-track { stroke: #E7ECF7; }
.ring .ring-value { stroke: var(--grade); stroke-linecap: round; transition: stroke-dashoffset 1.1s cubic-bezier(.2,.8,.2,1); }
.ring-letter { position: absolute; inset: 0; display: grid; place-items: center; font-size: 2.6rem; font-weight: 800; color: var(--grade); }

.actions { display: grid; grid-template-columns: 1fr; gap: 12px; margin-top: 22px; }

/* ---------- Footer ---------- */
.site-footer { position: relative; z-index: 1; color: #fff; background: var(--navy-900); padding: 30px 16px 34px; border-top: 3px solid var(--gold-500); box-shadow: 0 -10px 30px -10px rgba(212, 175, 55, .45); }
.footer-inner { max-width: 820px; margin: 0 auto; display: flex; gap: 18px; align-items: center; justify-content: center; }
.footer-icon { flex: none; color: var(--gold-300); padding-right: 18px; border-right: 2px solid rgba(255,255,255,.35); }
.site-footer p { margin: 0; }
.footer-title { font-weight: 700; font-size: clamp(.98rem, 3.6vw, 1.2rem); }
.footer-sub { color: #D5DEF5; font-size: .92rem; }
.footer-copy { color: #9FB0D8; font-size: .82rem; margin-top: 4px !important; }

/* ---------- Slip (print only) ---------- */
.slip { display: none; }

/* ---------- Animations ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ---------- Larger screens ---------- */
@media (min-width: 640px) {
  .hero { padding-top: 44px; }
  .crest svg { width: 120px; }
  .card { padding: 36px 40px 30px; }
  .subjects { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
  .actions { grid-template-columns: 1fr 1fr; }
  .student { grid-template-columns: 1fr; padding: 18px 24px; }
}
@media (min-width: 1024px) {
  .backdrop { height: 820px; }
  .deco-left { top: 120px; opacity: .8; }
  .deco-right { top: 70px; opacity: .9; }
}
@media (max-width: 420px) {
  .field { gap: 10px; }
  .field-icon { width: 46px; height: 56px; }
  .card-icon { width: 52px; height: 52px; }
  .card-icon svg { width: 32px; height: 32px; }
  .ring { width: 92px; height: 92px; }
  .ring-letter { font-size: 2.1rem; }
  .teacher { padding-right: 18px; gap: 10px; }
  .teacher-icon { width: 50px; height: 50px; }
  .deco-left, .deco-right { opacity: .35; }
}

/* ==========================================================================
   PRINT: only the individual slip, A4
   ========================================================================== */
@page { size: A4 portrait; margin: 16mm; }
@media print {
  html, body { background: #fff !important; color: #000; }
  body > *:not(.slip) { display: none !important; }
  .slip { display: block !important; }
  .slip-sheet { font-family: var(--font); color: #0B1E4F; border: 2px solid #0B1E4F; border-radius: 10px; padding: 14mm 12mm 10mm; }
  .slip-header { display: flex; gap: 14px; align-items: center; padding-bottom: 8mm; border-bottom: 3px solid #D4AF37; }
  .slip-header img { width: 56px; height: 56px; }
  .slip-heading { flex: 1; }
  .slip-header .slip-logo { width: auto; height: auto; max-height: 24mm; max-width: 40mm; object-fit: contain; }
  .slip-ref { font-family: 'Consolas', 'Courier New', monospace; letter-spacing: .06em; }
  .slip-header p { margin: 0; }
  .slip-system { font-size: 10pt; letter-spacing: .14em; text-transform: uppercase; color: #46557A; }
  .slip-title { font-size: 20pt; font-weight: 800; }
  .slip-subtitle { font-size: 11pt; color: #1747B8; font-weight: 600; }
  .slip table { width: 100%; border-collapse: collapse; }
  .slip-info { margin: 8mm 0 6mm; font-size: 12pt; }
  .slip-info th { text-align: left; width: 28mm; padding: 2.5mm 0; color: #46557A; font-weight: 600; }
  .slip-info td { font-weight: 700; padding: 2.5mm 0; }
  .slip-results { font-size: 12pt; }
  .slip-results th, .slip-results td { border: 1px solid #9AA8C7; padding: 3.5mm 4mm; text-align: left; }
  .slip-results thead th { background: #0B1E4F !important; color: #fff !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .slip-results td:nth-child(3), .slip-results td:nth-child(4), .slip-results th:nth-child(3), .slip-results th:nth-child(4) { text-align: center; }
  .slip-results td:nth-child(3), .slip-results td:nth-child(4) { font-weight: 800; font-size: 14pt; }
  .slip-note { margin: 5mm 0 0; font-size: 10pt; color: #854D0E; }
  .slip-sign { display: flex; justify-content: space-between; align-items: flex-end; margin-top: 32mm; }
  .slip-sign p { margin: 0; }
  .slip-sign-line { width: 80mm; border-top: 1px solid #0B1E4F; margin-bottom: 2mm !important; }
  .slip-sign-name { font-weight: 700; font-size: 11pt; }
  .slip-sign-role { font-size: 10pt; color: #46557A; }
  .slip-date { font-size: 10pt; color: #46557A; }
  .slip-footer { margin: 10mm 0 0; padding-top: 4mm; border-top: 1px solid #D5DDEE; font-size: 8.5pt; color: #6B7899; text-align: center; }
}
