/* Station (kiosk) screens. Loaded after app.css. */

.kiosk {
  --brand: #e1251b;
  --brand-dark: #b3170f;
  --brand-edge: #8f120b;
  --ink: #1b1b1f;
  --soft: #6d6d78;
  --frame: 640px;
  font-family: "Kanit", "Leelawadee UI", Tahoma, sans-serif;
  background: #fff;
  color: var(--ink);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------- header ---------- */
.kiosk-bar {
  position: relative;
  z-index: 2;
  background: #000;
  color: #fff;
  text-align: center;
  padding: 14px 16px 12px;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}
.kiosk-bar::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -4px;
  height: 4px;
  background: linear-gradient(90deg, #e1251b, #f39200, #ffc800, #3aaa35, #2b9fd9, #7d3c98, #e85d9a);
}
.kiosk-title { font-size: 22px; font-weight: 500; letter-spacing: .3px; }
.kiosk-subtitle { font-size: 11px; font-weight: 300; letter-spacing: 7px; opacity: .8; margin-top: 2px; }
.kiosk > .banner { position: relative; z-index: 2; margin: 18px 24px 0; }

/* ---------- canvas ---------- */
.kiosk-main { position: relative; flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.kiosk-deco { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
.deco { position: absolute; }
.deco svg, .deco img { display: block; width: 100%; height: auto; }
.deco.twinkle { animation: twinkle 3.2s ease-in-out infinite; }
.deco.d2 { animation-delay: 1.1s; }
.deco.d3 { animation-delay: 2.2s; }

.kiosk-view {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 26px;
  padding: 36px 20px 52px;
}
.kiosk-view:not([hidden]) { animation: view-in .3s ease both; }

/* ---------- logo ---------- */
.kiosk-logo img { display: block; max-width: min(480px, 80vw); max-height: min(230px, 28vh); }
.kiosk-logo.small img { max-width: min(320px, 60vw); max-height: min(120px, 15vh); }
.kiosk-logo-text { font-size: 36px; font-weight: 600; text-align: center; }
.kiosk-logo.small .kiosk-logo-text { font-size: 26px; }

/* ---------- home ---------- */
.home-actions { display: flex; flex-direction: column; align-items: center; gap: 30px; }

.kiosk-btn {
  font: inherit;
  font-size: 19px;
  font-weight: 500;
  color: #fff;
  cursor: pointer;
  border: 0;
  border-radius: 12px;
  padding: 10px 34px;
  min-width: 150px;
  background: linear-gradient(180deg, #f0473c 0%, var(--brand) 45%, var(--brand-dark) 100%);
  box-shadow: 0 4px 0 var(--brand-edge), 0 10px 20px rgba(225, 37, 27, .22);
  transition: transform .08s, box-shadow .08s, filter .15s;
}
.kiosk-btn:hover { filter: brightness(1.05); }
.kiosk-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--brand-edge), 0 4px 10px rgba(225, 37, 27, .22); }
.kiosk-btn:disabled { opacity: .55; cursor: wait; }
.kiosk-btn.big { width: 340px; font-size: 30px; padding: 14px 0; border-radius: 14px; }

.kiosk-pro {
  font: inherit;
  color: #fff;
  cursor: pointer;
  border: 0;
  width: 164px;
  height: 164px;
  border-radius: 36px;
  background: linear-gradient(150deg, #f4524a 0%, var(--brand) 50%, var(--brand-dark) 100%);
  box-shadow: 0 5px 0 var(--brand-edge), 0 16px 30px rgba(225, 37, 27, .3);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: transform .08s, box-shadow .08s, filter .15s;
}
.kiosk-pro span { font-size: 28px; font-weight: 500; margin-bottom: -2px; }
.kiosk-pro b { font-size: 58px; font-weight: 700; letter-spacing: 1px; }
.kiosk-pro:hover { filter: brightness(1.05); }
.kiosk-pro:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--brand-edge), 0 8px 16px rgba(225, 37, 27, .3); }

/* ---------- cards & forms ---------- */
.kiosk-card {
  width: min(var(--frame), 100%);
  background: rgba(255, 255, 255, .97);
  border-radius: 22px;
  padding: 30px 36px;
  box-shadow: 0 14px 44px rgba(20, 20, 30, .1), 0 0 0 1px rgba(0, 0, 0, .04);
}

.kiosk-form { display: flex; flex-direction: column; gap: 16px; }
.kiosk-field { display: grid; grid-template-columns: 150px 1fr; align-items: center; gap: 16px; }
.kiosk-field > span { font-size: 18px; font-weight: 500; text-align: right; }
.kiosk-form input {
  font: inherit;
  font-size: 20px;
  padding: 11px 16px;
  border: 1.5px solid #cfcfd6;
  border-radius: 12px;
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
.kiosk-form input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px rgba(225, 37, 27, .12); }
.kiosk-form input::placeholder { color: #b4b4bc; }
.kiosk-form input.upper { text-transform: uppercase; }
.kiosk-datetime { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.kiosk-datetime label { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.kiosk-datetime input { width: 100%; font-size: 17px; padding: 9px 12px; }
.kiosk-datetime small { font-size: 14px; color: var(--soft); }

.kiosk-error {
  margin: 4px 0 0;
  padding: 11px 16px;
  border-radius: 12px;
  background: #fdecea;
  color: #c4170e;
  font-weight: 500;
  text-align: center;
}

.kiosk-actions { display: flex; justify-content: center; gap: 12px; }
.kiosk-actions.spread { width: min(var(--frame), 100%); justify-content: space-between; }

/* ---------- confirmation ---------- */
.kiosk-heading { margin: 0 0 18px; color: var(--brand); font-size: 28px; font-weight: 600; text-align: center; }
.kiosk-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid #e4e4ea;
  border-radius: 14px;
  overflow: hidden;
  font-size: 19px;
}
.kiosk-table th, .kiosk-table td { padding: 12px 20px; text-align: left; border-bottom: 1px solid #ececf1; }
.kiosk-table tr:last-child th, .kiosk-table tr:last-child td { border-bottom: 0; }
.kiosk-table th { width: 44%; background: #faf6f6; color: #55555f; font-weight: 500; font-size: 17px; }
.kiosk-table td { font-weight: 500; word-break: break-all; }
.confirm-card .kiosk-error { margin-top: 16px; }

/* ---------- status cards ---------- */
.kiosk-state {
  width: min(440px, 90vw);
  min-height: 270px;
  border-radius: 24px;
  padding: 30px 28px;
  color: #fff;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: 0 18px 44px rgba(0, 0, 0, .18);
  animation: pop .35s cubic-bezier(.2, 1.4, .4, 1) both;
}
.state-icon svg { display: block; width: 88px; height: 88px; margin-bottom: 6px; }
.kiosk-state-title { font-size: 34px; font-weight: 600; letter-spacing: 1.5px; line-height: 1.2; }
.kiosk-state-detail { font-size: 18px; font-weight: 400; opacity: .92; }
.kiosk-state-no { font-size: 22px; font-weight: 600; margin-top: 4px; }
.kiosk-state-detail:empty, .kiosk-state-no:empty { display: none; }

.kiosk-state.process { background: linear-gradient(160deg, #ef3b30, var(--brand-dark)); }
.kiosk-state.process .spin { transform-origin: 24px 24px; animation: spin 1.6s linear infinite; }
.kiosk-state.done { background: linear-gradient(160deg, #4cc35a, #34a843); color: #10260f; }
.kiosk-state.error { background: #fff; color: var(--ink); border: 3px solid var(--brand); }
.kiosk-state.error .state-icon, .kiosk-state.error .kiosk-state-title { color: var(--brand); }
.kiosk-state.warn { background: #fff; color: var(--ink); border: 3px solid #e29a00; }
.kiosk-state.warn .state-icon, .kiosk-state.warn .kiosk-state-title { color: #c98500; }
.kiosk-state.error .kiosk-state-title, .kiosk-state.warn .kiosk-state-title { font-size: 28px; letter-spacing: 0; }
.kiosk-state.error .kiosk-state-no, .kiosk-state.warn .kiosk-state-no { font-size: 16px; font-weight: 400; color: var(--soft); }

.kiosk-home {
  font: inherit;
  font-size: 18px;
  font-weight: 500;
  color: #fff;
  cursor: pointer;
  border: 0;
  border-radius: 999px;
  padding: 9px 32px;
  margin-top: 12px;
  background: #1b1b1f;
  box-shadow: 0 6px 14px rgba(0, 0, 0, .22);
}
.kiosk-home:active { transform: translateY(2px); }

/* ---------- slip scanner ---------- */
.scan-panel { width: min(var(--frame), 100%); min-height: 360px; display: flex; align-items: center; justify-content: center; }
.scan-panel .kiosk-state { width: 100%; min-height: 360px; }
.scan-panel:not(.idle) .scan-idle { display: none; }
.scan-idle {
  position: relative;
  width: 100%;
  height: 360px;
  border-radius: 24px;
  overflow: hidden;
  background: radial-gradient(circle at 50% 38%, #2c2c33 0%, #0e0e12 72%);
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 18px 44px rgba(0, 0, 0, .25);
}
.corner { position: absolute; width: 48px; height: 48px; border: 4px solid #fff; }
.corner.tl { top: 26px; left: 26px; border-right: 0; border-bottom: 0; border-top-left-radius: 12px; }
.corner.tr { top: 26px; right: 26px; border-left: 0; border-bottom: 0; border-top-right-radius: 12px; }
.corner.bl { bottom: 26px; left: 26px; border-right: 0; border-top: 0; border-bottom-left-radius: 12px; }
.corner.br { bottom: 26px; right: 26px; border-left: 0; border-top: 0; border-bottom-right-radius: 12px; }
.scan-line {
  position: absolute;
  left: 50px; right: 50px; top: 44px;
  height: 3px;
  border-radius: 3px;
  background: linear-gradient(90deg, transparent, #ff4a3d, transparent);
  box-shadow: 0 0 16px #ff4a3d;
  animation: scan-line 2.4s ease-in-out infinite alternate;
}
.scan-icon { width: 76px; height: 76px; opacity: .92; }
.scan-title { font-size: 30px; font-weight: 500; letter-spacing: 2px; }
.scan-hint { font-size: 17px; font-weight: 300; opacity: .75; }
.scan-manual { width: min(var(--frame), 100%); display: flex; gap: 12px; align-items: stretch; }
.scan-manual input {
  flex: 1;
  min-width: 0;
  font-family: Consolas, "Courier New", monospace;
  font-size: 15px;
  padding: 12px 16px;
  border: 1.5px solid #cfcfd6;
  border-radius: 12px;
  background: rgba(255, 255, 255, .97);
  transition: border-color .15s, box-shadow .15s;
}
.scan-manual input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px rgba(225, 37, 27, .12); }
.scan-manual input::placeholder { font-family: "Kanit", "Leelawadee UI", Tahoma, sans-serif; color: #a8a8b2; }
.scan-manual .kiosk-btn { flex: none; padding-top: 0; padding-bottom: 0; }

.kiosk .focus-hint {
  width: min(var(--frame), 100%);
  margin: 0;
  padding: 10px 14px;
  border-radius: 12px;
  background: #fff6e0;
  color: #9a6400;
  font-weight: 500;
  text-align: center;
}

/* ---------- staff bar ---------- */
.staff-bar {
  position: relative;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
  padding: 8px 16px;
  border-top: 1px solid var(--line);
  background: #fafafa;
  font-family: "Sarabun", "Leelawadee UI", Tahoma, sans-serif;
  font-size: 14px;
}
.staff-bar .pill { font-size: 13px; padding: 4px 10px; }

/* ---------- motion ---------- */
@keyframes view-in { from { opacity: 0; transform: translateY(8px); } }
@keyframes pop { from { opacity: 0; transform: scale(.92); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes twinkle { 50% { transform: scale(.65) rotate(20deg); opacity: .55; } }
@keyframes scan-line { to { top: calc(100% - 47px); } }

@media (prefers-reduced-motion: reduce) {
  .kiosk *, .kiosk *::before, .kiosk *::after { animation: none !important; transition: none !important; }
}

/* ---------- small screens ---------- */
@media (max-width: 860px) {
  .kiosk-deco { opacity: .45; }
}
@media (max-width: 600px) {
  .kiosk-deco { display: none; }
  .kiosk-card { padding: 22px 18px; }
  .kiosk-field { grid-template-columns: 1fr; gap: 6px; }
  .kiosk-field > span { text-align: left; }
  .kiosk-btn.big { width: 100%; }
  .scan-idle, .scan-panel, .scan-panel .kiosk-state { height: auto; min-height: 300px; }
}
