/* ===== Kiosk / Mesin Tiket (layar sentuh) ===== */
.kiosk-page {
  --u: min(1vh, 0.75vw);
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  background: linear-gradient(160deg, #e9f7f5 0%, var(--slate-100) 50%, #e7eef8 100%);
}
.kiosk { height: 100vh; display: grid; grid-template-rows: auto 1fr auto; }

.kiosk-header {
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  padding: calc(var(--u) * 2) calc(var(--u) * 3);
  color: #fff;
  background: linear-gradient(100deg, var(--navy-800), var(--teal-700));
}
.kiosk-header .brand { display: flex; align-items: center; gap: calc(var(--u) * 2); min-width: 0; }
.kiosk-header img {
  height: calc(var(--u) * 10); width: auto; flex: none; object-fit: contain;
  filter: drop-shadow(0 calc(var(--u) * .3) calc(var(--u) * .8) rgba(0, 0, 0, .3));
}
.kiosk-header h1 { margin: 0; font-size: calc(var(--u) * 4.4); font-weight: 800; line-height: 1.1; }
.kiosk-header p { margin: 4px 0 0; font-size: calc(var(--u) * 1.8); opacity: .9; max-width: 70ch; }
.kiosk-clock { text-align: right; flex: none; }
.kiosk-clock span { display: block; font-size: calc(var(--u) * 5); font-weight: 800; line-height: 1; }
.kiosk-clock small { font-size: calc(var(--u) * 2); font-weight: 600; opacity: .9; }

.kiosk-main {
  display: flex; flex-direction: column; justify-content: center; gap: calc(var(--u) * 3);
  padding: calc(var(--u) * 3) calc(var(--u) * 4);
  min-height: 0;
}
.kiosk-title {
  margin: 0; text-align: center; color: var(--navy-800);
  font-size: calc(var(--u) * 4); font-weight: 800;
}
.kiosk-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: calc(var(--u) * 4); min-height: 0; }

.loket-a { --c: var(--loket-a); --c-dark: var(--loket-a-dark); --glow: 20, 184, 166; }
.loket-b { --c: var(--loket-b); --c-dark: var(--loket-b-dark); --glow: 37, 112, 200; }

.kiosk-btn {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: calc(var(--u) * .8);
  min-height: calc(var(--u) * 52);
  padding: calc(var(--u) * 3);
  border: 0; border-radius: calc(var(--u) * 3.5);
  color: #fff; cursor: pointer;
  background: linear-gradient(150deg, var(--c) 0%, var(--c-dark) 100%);
  box-shadow: 0 calc(var(--u) * 2) calc(var(--u) * 5) -1vh rgba(var(--glow), .7), inset 0 -0.8vh 0 rgba(0, 0, 0, .15);
  transition: transform .12s ease, box-shadow .12s ease, filter .12s;
  overflow: hidden;
}
.kiosk-btn::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(circle at 30% 10%, rgba(255, 255, 255, .25), transparent 55%);
  pointer-events: none;
}
.kiosk-btn:active, .kiosk-btn.pressed { transform: scale(.97); filter: brightness(.95); }
.kiosk-btn:focus-visible { outline: 6px solid var(--amber-400); outline-offset: 4px; }
.kiosk-btn[disabled] { filter: grayscale(.4) brightness(.9); cursor: wait; }
.kb-top { font-size: calc(var(--u) * 2.6); font-weight: 700; letter-spacing: .14em; text-transform: uppercase; opacity: .9; }
.kb-letter {
  display: grid; place-items: center;
  width: calc(var(--u) * 20); height: calc(var(--u) * 20); border-radius: 50%;
  background: rgba(255, 255, 255, .16); border: calc(var(--u) * .6) solid rgba(255, 255, 255, .55);
  font-size: calc(var(--u) * 13); font-weight: 800; line-height: 1;
}
.kb-title { font-size: calc(var(--u) * 6); font-weight: 800; letter-spacing: .06em; line-height: 1.1; }
.kb-desc { font-size: calc(var(--u) * 2.8); font-weight: 600; opacity: .95; }
.kb-info {
  display: flex; gap: calc(var(--u) * 3); margin-top: calc(var(--u) * 1);
  padding: calc(var(--u) * .9) calc(var(--u) * 2.4); border-radius: 999px;
  background: rgba(0, 0, 0, .18); font-size: calc(var(--u) * 2.2); font-weight: 600;
}
.kb-info strong { font-weight: 800; }

.kiosk-footer {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: calc(var(--u) * 1.6) calc(var(--u) * 3);
  background: #fff; border-top: 1px solid var(--slate-200);
  font-size: calc(var(--u) * 2.2); font-weight: 600; color: var(--slate-600);
}
.kiosk-footer-right { display: inline-flex; align-items: center; gap: calc(var(--u) * 2); flex: none; }

/* Tombol layar penuh (hanya tampil saat belum layar penuh) */
.fs-btn {
  display: inline-flex; align-items: center; gap: .5em;
  padding: .55em 1.1em; border: 0; border-radius: 999px;
  font-size: max(14px, calc(var(--u) * 2)); font-weight: 700; color: #fff; cursor: pointer;
  background: var(--navy-700);
  transition: background-color .15s ease, transform .1s ease;
}
.fs-btn:hover { background: var(--navy-800); }
.fs-btn:active { transform: scale(.97); }
.fs-btn:focus-visible { outline: 3px solid var(--amber-400); outline-offset: 2px; }
.fs-btn svg { width: 1.3em; height: 1.3em; flex: none; }
.fs-btn.attention { background: var(--teal-600); animation: fs-pulse 2s ease-in-out infinite; }
@keyframes fs-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(20, 184, 166, .55); }
  50%      { box-shadow: 0 0 0 10px rgba(20, 184, 166, 0); }
}

/* Logo: indikator tekan lama (menu petugas) */
#kioskLogo { transition: transform .3s ease, filter .3s ease; -webkit-user-drag: none; }
#kioskLogo.pressing { transform: scale(.88); filter: brightness(.8) drop-shadow(0 0 calc(var(--u) * 1) rgba(251, 191, 36, .9)); transition-duration: 3s; }

/* Layar mulai kiosk */
.kiosk-start {
  position: fixed; inset: 0; z-index: 80;
  display: grid; place-items: center; padding: 24px;
  background: linear-gradient(135deg, rgba(11, 45, 87, .97), rgba(15, 118, 110, .97));
  cursor: pointer;
}
.kiosk-start-card {
  width: min(640px, 100%); max-height: calc(100dvh - 48px); overflow: auto;
  background: #fff; border-radius: 24px; padding: 32px; text-align: center;
  box-shadow: var(--shadow); cursor: default;
}
.ks-logo { height: 110px; width: auto; object-fit: contain; margin: 0 auto 12px; }
.kiosk-start-card h2 { margin: 0; font-size: 28px; font-weight: 800; color: var(--navy-800); }
.kiosk-start-card > p { margin: 4px 0 22px; color: var(--slate-500); font-weight: 600; }
.ks-btn { width: 100%; font-size: 22px; padding: 20px 24px; border-radius: 16px; }
.ks-btn svg { width: 28px; height: 28px; }
.ks-check {
  display: flex; align-items: center; gap: 10px; justify-content: center;
  margin: 18px 0 10px; font-weight: 600; color: var(--slate-700); cursor: pointer;
}
.ks-check input { width: 22px; height: 22px; accent-color: var(--teal-600); flex: none; }
.kiosk-start-card .ks-hint { margin: 0; font-size: 13px; color: var(--slate-500); line-height: 1.5; }

/* Modal konfirmasi */
.kiosk-modal {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center;
  background: rgba(7, 29, 58, .6); backdrop-filter: blur(4px);
  animation: km-fade .2s ease-out;
}
.kiosk-modal-card {
  width: min(92vw, calc(var(--u) * 80));
  background: #fff; border-radius: calc(var(--u) * 3); text-align: center;
  padding: calc(var(--u) * 4); border-top: calc(var(--u) * 1.4) solid var(--c);
  animation: km-pop .35s cubic-bezier(.2, 1.3, .4, 1);
}
.km-check {
  width: calc(var(--u) * 10); height: calc(var(--u) * 10); margin: 0 auto calc(var(--u) * 1.5);
  display: grid; place-items: center; border-radius: 50%;
  background: var(--c); color: #fff; font-size: calc(var(--u) * 6); font-weight: 800;
}
.kiosk-modal-card p { margin: 0; }
.km-caption { font-size: calc(var(--u) * 3); font-weight: 700; color: var(--slate-600); }
.km-number { font-size: calc(var(--u) * 17); font-weight: 800; color: var(--c-dark); line-height: 1.05; }
.km-dest { font-size: calc(var(--u) * 4); font-weight: 800; color: var(--c); }
.km-info { margin-top: calc(var(--u) * 1.5) !important; font-size: calc(var(--u) * 2.4); color: var(--slate-600); font-weight: 600; }
.km-countdown {
  margin-top: calc(var(--u) * 1.6) !important;
  font-size: calc(var(--u) * 2); font-weight: 700; color: var(--slate-500);
}
.km-countdown:empty { display: none; }
.print-warn {
  padding: .3em .8em; border-radius: 999px;
  background: #fef3c7; color: #92400e;
  font-size: calc(var(--u) * 1.7); font-weight: 700;
}
@keyframes km-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes km-pop { from { transform: scale(.8); opacity: 0; } to { transform: none; opacity: 1; } }

@media (orientation: portrait) {
  .kiosk-page { --u: min(1vh, 1.2vw); }
  .kiosk-buttons { grid-template-columns: 1fr; }
  .kiosk-btn { min-height: calc(var(--u) * 30); }
  .kb-letter { width: calc(var(--u) * 13); height: calc(var(--u) * 13); font-size: calc(var(--u) * 8); }
}

/* ===== Struk thermal ===== */
/* Di layar: dirender di luar viewport agar tingginya bisa diukur. */
.print-area { position: fixed; left: -10000px; top: 0; }
/* Struk ringkas hemat kertas (±40 mm untuk 58 mm, ±45 mm untuk 80 mm).
 * Tanpa logo/alamat/garis berlebih; semua hitam pekat karena printer thermal hanya 1 warna. */
.ticket {
  width: 48mm; /* area cetak efektif kertas 58 mm */
  padding: 1mm 0 2mm;
  font-family: Arial, "Helvetica Neue", sans-serif;
  color: #000; background: #fff; text-align: center; line-height: 1.2;
}
.ticket.paper-80 { width: 72mm; }
.t-name { font-size: 8.6pt; font-weight: 700; letter-spacing: 0; text-transform: uppercase; white-space: nowrap; }
.t-caption { font-size: 8pt; margin-top: 1.2mm; }
.t-number { font-size: 38pt; font-weight: 700; line-height: 1; margin: .6mm 0 .8mm; letter-spacing: -.01em; }
.t-loket { font-size: 11pt; font-weight: 700; }
.t-desc { font-size: 8pt; }
.t-line { border-top: 1px dashed #000; margin: 1.6mm 0 1.2mm; }
.t-meta { font-size: 7.5pt; }
.t-wa { margin-top: .6mm; font-weight: 700; }
.ticket.paper-80 .t-name { font-size: 12pt; }
.ticket.paper-80 .t-caption, .ticket.paper-80 .t-desc { font-size: 9.5pt; }
.ticket.paper-80 .t-number { font-size: 50pt; }
.ticket.paper-80 .t-loket { font-size: 13pt; }
.ticket.paper-80 .t-meta { font-size: 9pt; }

@media print {
  html, body { background: #fff !important; height: auto; overflow: visible; }
  body > *:not(.print-area) { display: none !important; }
  .print-area { position: static; left: auto; }
  .ticket { margin: 0 auto; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
