/* Antrian Skrining — UPTD Puskesmas Separi III */

@font-face {
  font-family: "Plus Jakarta Sans";
  src: url("fonts/plus-jakarta-sans.woff2") format("woff2");
  font-weight: 300 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Fraunces";
  src: url("fonts/fraunces.woff2") format("woff2");
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --cream: #f7f2e7;
  --cream-2: #efe7d6;
  --white: #fffdf8;
  --ink: #10241d;
  --forest: #0b3b2c;
  --forest-deep: #08271e;
  --green: #176a4f;
  --green-soft: #2f8668;
  --mint: #d7ebdd;
  --mint-2: #e9f2e9;
  --amber: #e8a45c;
  --amber-soft: #f6e3cb;
  --coral: #cf5b47;
  --muted: #5d6b63;
  --line: rgba(16, 36, 29, 0.14);
  --line-strong: rgba(16, 36, 29, 0.25);
  --font-sans: "Plus Jakarta Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-serif: "Fraunces", Georgia, "Times New Roman", serif;
  --radius: 24px;
  --shadow: 0 18px 40px -24px rgba(8, 39, 30, 0.45);
}

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

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--ink);
  background:
    radial-gradient(1100px 520px at 12% -10%, var(--mint-2), transparent 60%),
    radial-gradient(900px 480px at 105% 8%, var(--amber-soft), transparent 55%),
    var(--cream);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

[hidden] { display: none !important; }

button { font: inherit; color: inherit; }

.app {
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

/* ---------- Topbar ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: clamp(14px, 2.6vw, 28px) clamp(18px, 4vw, 52px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand__mark {
  flex: none;
  display: grid;
  place-items: center;
  width: clamp(44px, 5vw, 56px);
  aspect-ratio: 1;
  border-radius: 16px;
  background: var(--forest);
  color: var(--cream);
  box-shadow: 0 8px 18px -10px rgba(8, 39, 30, 0.7);
}
.brand__mark svg { width: 60%; height: 60%; }

.brand__text { min-width: 0; }

.brand__eyebrow {
  margin: 0 0 2px;
  font-size: clamp(0.62rem, 0.9vw, 0.72rem);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--green);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand__title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: clamp(1.25rem, 2vw, 1.65rem);
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.01em;
}

.clock { text-align: right; flex: none; }

.clock__time {
  display: block;
  font-size: clamp(1.35rem, 2.4vw, 1.9rem);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.clock__date {
  margin: 4px 0 0;
  font-size: clamp(0.7rem, 1vw, 0.82rem);
  color: var(--muted);
  white-space: nowrap;
}

/* ---------- Board ---------- */

.board {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: clamp(10px, 2vw, 26px) clamp(18px, 4vw, 52px) clamp(18px, 3vw, 34px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: clamp(18px, 3vw, 34px);
}

.board__intro {
  text-align: center;
  max-width: 900px;
  margin: 0 auto;
}

.board__question {
  margin: 0;
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: clamp(1.7rem, 4.4vw, 3.3rem);
  line-height: 1.08;
  letter-spacing: -0.015em;
  text-wrap: balance;
}
.board__question span { color: var(--green); }

.board__hint {
  margin: clamp(8px, 1.4vw, 14px) 0 0;
  color: var(--muted);
  font-size: clamp(0.85rem, 1.35vw, 1.05rem);
}

.choices {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(14px, 2.4vw, 26px);
}

.choice {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-height: clamp(190px, 27vh, 300px);
  padding: clamp(20px, 2.6vw, 32px);
  border: 1px solid transparent;
  border-radius: calc(var(--radius) + 6px);
  text-align: left;
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.choice--jkn {
  background: var(--forest);
  color: var(--cream);
  box-shadow: 0 24px 44px -28px rgba(8, 39, 30, 0.85);
}
.choice--non {
  background: var(--white);
  color: var(--ink);
  border-color: rgba(232, 164, 92, 0.55);
  box-shadow: var(--shadow);
}

.choice:hover { transform: translateY(-3px); }
.choice--jkn:hover { background: var(--forest-deep); }
.choice--non:hover { background: #fff9ee; border-color: var(--amber); }
.choice:active { transform: translateY(0) scale(0.992); }

.choice:focus-visible {
  outline: 3px solid var(--amber);
  outline-offset: 4px;
}

.choice__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin-bottom: auto;
}

.choice__tag {
  font-size: clamp(0.62rem, 0.95vw, 0.72rem);
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  padding: 6px 11px;
  border-radius: 999px;
}
.choice--jkn .choice__tag { background: rgba(247, 242, 231, 0.14); color: var(--mint); }
.choice--non .choice__tag { background: var(--amber-soft); color: #6b4413; }

.choice__key {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  font-size: 0.82rem;
  font-weight: 700;
  border: 1px solid currentColor;
  opacity: 0.45;
}

.choice__label {
  font-family: var(--font-serif);
  font-size: clamp(2.4rem, 5.4vw, 4rem);
  font-weight: 600;
  line-height: 0.95;
  letter-spacing: -0.02em;
  margin-top: clamp(14px, 2.4vw, 26px);
}

.choice__sub {
  font-size: clamp(0.9rem, 1.5vw, 1.15rem);
  font-weight: 600;
  opacity: 0.82;
  line-height: 1.25;
}

.choice__foot {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: clamp(14px, 2.4vw, 24px);
  font-size: clamp(0.75rem, 1.1vw, 0.9rem);
  font-weight: 600;
  opacity: 0.75;
}
.choice__foot svg { width: 17px; height: 17px; flex: none; }

/* ---------- Footer ---------- */

.footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px clamp(18px, 4vw, 52px);
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: clamp(0.68rem, 0.95vw, 0.78rem);
}

.footer__note { margin: 0; }
.footer__right { display: flex; align-items: center; gap: 16px; }

.offline {
  margin: 0;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--amber-soft);
  color: #6b4413;
  font-weight: 700;
}

.linkbtn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 4px;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: inherit;
  font-weight: 600;
  cursor: pointer;
  border-radius: 6px;
}
.linkbtn:hover { color: var(--forest); }
.linkbtn:focus-visible { outline: 2px solid var(--green); outline-offset: 3px; }
.linkbtn svg { width: 15px; height: 15px; }

/* ---------- Ticket view ---------- */

.ticketview {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(8, 39, 30, 0.55);
  backdrop-filter: blur(7px);
  animation: fade-in 160ms ease;
}

.ticketview__card {
  position: relative;
  width: min(540px, 100%);
  padding: clamp(26px, 4vw, 40px) clamp(22px, 4vw, 38px) clamp(24px, 3vw, 34px);
  border-radius: 26px;
  background: var(--white);
  box-shadow: 0 40px 80px -30px rgba(0, 0, 0, 0.55);
  text-align: center;
  animation: rise 220ms cubic-bezier(0.19, 1, 0.22, 1);
}

.ticketview__kicker {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--green);
}

.ticketview__number {
  margin: 6px 0 4px;
  font-size: clamp(4rem, 13vw, 7rem);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--forest);
}

.ticketview__lane {
  display: inline-block;
  margin: 4px 0 0;
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--mint);
  color: var(--forest);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.ticketview__time {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}

.ticketview__note {
  margin: 18px auto 0;
  max-width: 32ch;
  font-family: var(--font-serif);
  font-size: clamp(1rem, 2vw, 1.2rem);
  line-height: 1.35;
}

.ticketview__status {
  margin: 14px 0 0;
  min-height: 1.2em;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--green);
}

.ticketview__actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}
.ticketview__actions .btn { flex: 1; }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 12px 20px;
  border-radius: 14px;
  border: 1px solid transparent;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, transform 120ms ease;
}
.btn:active { transform: scale(0.985); }
.btn:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }

.btn--solid { background: var(--forest); color: var(--cream); }
.btn--solid:hover { background: var(--forest-deep); }

.btn--ghost { background: transparent; color: var(--forest); border-color: var(--line-strong); }
.btn--ghost:hover { background: var(--mint-2); }

/* ---------- Settings ---------- */

.settings {
  width: min(560px, calc(100vw - 32px));
  padding: 0;
  border: 0;
  border-radius: 24px;
  background: var(--white);
  color: var(--ink);
  box-shadow: 0 40px 80px -30px rgba(0, 0, 0, 0.5);
}
.settings::backdrop { background: rgba(8, 39, 30, 0.5); backdrop-filter: blur(4px); }

.settings__inner { padding: clamp(22px, 4vw, 30px); }

.settings__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.settings__head h2 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-weight: 600;
}
.settings__close {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 10px;
  background: var(--mint-2);
  color: var(--forest);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}
.settings__close:hover { background: var(--mint); }

.settings__group {
  margin: 22px 0 0;
  padding: 0;
  border: 0;
}
.settings__group legend {
  padding: 0;
  margin-bottom: 10px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--green);
}

.radio {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  margin-bottom: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
}
.radio:has(input:checked) { border-color: var(--green); background: var(--mint-2); }
.radio input { width: 18px; height: 18px; accent-color: var(--green); flex: none; }
.radio span { display: flex; flex-direction: column; }
.radio b { font-size: 0.92rem; }
.radio small { color: var(--muted); font-size: 0.76rem; }

.settings__note {
  margin: 18px 0 0;
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--muted);
}

.settings__actions {
  display: flex;
  gap: 10px;
  margin-top: 22px;
}
.settings__actions .btn { flex: 1; }

/* ---------- Receipt (print only) ---------- */

#print-root { display: none; }

.receipt {
  width: 100%;
  color: #000;
  background: #fff;
  font-family: var(--font-sans);
  text-align: center;
}

.receipt__clinic {
  margin: 0;
  font-size: 9pt;
  font-weight: 800;
  letter-spacing: 0.04em;
}
.receipt__sub {
  margin: 2pt 0 0;
  font-size: 7.5pt;
  font-weight: 600;
  letter-spacing: 0.18em;
}
.receipt__rule {
  margin: 4mm 0;
  border-top: 1px dashed #000;
}
.receipt__number {
  margin: 0;
  font-family: "DejaVu Sans Mono", "Courier New", monospace;
  font-size: 44pt;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.01em;
}
.receipt__lane {
  margin: 2mm 0 0;
  font-size: 10pt;
  font-weight: 800;
  letter-spacing: 0.08em;
}
.receipt__time {
  margin: 0;
  font-size: 8.5pt;
  font-variant-numeric: tabular-nums;
}
.receipt__note {
  margin: 4mm 0 0;
  font-size: 8.5pt;
  line-height: 1.45;
}

/* ---------- Animations ---------- */

@keyframes fade-in { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(0.98); } }

/* ---------- Responsive ---------- */

@media (max-width: 820px) {
  .topbar { gap: 12px; }
  .choices { grid-template-columns: 1fr; }
  .choice { min-height: 150px; }
  .choice__label { font-size: clamp(2rem, 9vw, 2.6rem); }
  .footer { flex-direction: column; align-items: flex-start; gap: 6px; }
  .footer__right { width: 100%; justify-content: space-between; }
}

@media (max-width: 480px) {
  .brand__eyebrow { display: none; }
  .clock__date { font-size: 0.64rem; }
  .board { padding-top: 4px; gap: 16px; }
  .board__hint { display: none; }
  .choice { min-height: 132px; padding: 18px; }
  .choice__foot { margin-top: 10px; }
  .ticketview__actions { flex-direction: column-reverse; }
}

@media (max-height: 620px) and (min-width: 821px) {
  .board__question { font-size: clamp(1.5rem, 3vw, 2.2rem); }
  .choice { min-height: 150px; }
  .choice__label { margin-top: 8px; }
}

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

/* ---------- Print ---------- */

@media print {
  html, body {
    width: auto;
    height: auto;
    background: #fff;
    overflow: visible;
  }
  body > * { display: none !important; }
  #print-root { display: block !important; }
  .receipt { width: 100%; }
}
