/* S Book Meja — halaman tempahan. Ikut "S Book Meja – Draf UI". */
:root {
  --accent: #0E7A5A;
  --accent-dark: #0B5E46;
  --accent-soft: #E7F5EF;
  --bg: #F5F6F8;
  --card: #FFFFFF;
  --ink: #15171C;
  --muted: #5A6070;
  --line: #E3E5EA;
  --field: #D5D8DF;
  --chip: #F0F1F4;
  --warn: #B45309;
  --warn-soft: #FEF3E2;
  --bad: #B42318;
  --bad-dark: #9B1C12;
  --bad-soft: #FDECEA;
  --info: #1D4ED8;
  --info-soft: #EAF0FB;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
a:hover { color: var(--accent-dark); }

.app {
  max-width: 480px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  background: var(--bg);
  display: flex;
  flex-direction: column;
}

/* ---------- Header ---------- */
.header {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.header.compact { flex-direction: row; align-items: center; gap: 12px; }
.header .brand { display: flex; gap: 14px; align-items: center; }
.header.compact .brand { gap: 12px; flex: 1; min-width: 0; }
.logo {
  width: 56px; height: 56px; border-radius: 16px; flex-shrink: 0;
  background: var(--accent); color: #fff; font-weight: 800; font-size: 20px;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.logo img { width: 100%; height: 100%; object-fit: cover; }
.header.compact .logo { width: 40px; height: 40px; border-radius: 12px; font-size: 15px; }
.header h1 { margin: 0; font-size: 20px; font-weight: 800; }
.header.compact h1 { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.header .info { margin: 4px 0 0; font-size: 13px; color: var(--muted); line-height: 1.45; }

.lang {
  align-self: flex-end; display: flex; background: var(--chip);
  border-radius: 999px; padding: 3px; flex-shrink: 0;
}
.lang button {
  height: 32px; min-width: 44px; padding: 0 12px; border: 0; border-radius: 999px;
  background: transparent; color: var(--muted); font-size: 12px; font-weight: 700;
}
.lang button[aria-pressed="true"] { background: var(--ink); color: #fff; font-weight: 800; }

/* ---------- Borang ---------- */
.main { padding: 20px; display: flex; flex-direction: column; gap: 22px; flex-grow: 1; }
.main h2 { margin: 0; font-size: 22px; font-weight: 800; }
.section { display: flex; flex-direction: column; gap: 10px; }
.label { font-size: 14px; font-weight: 700; }

.dates { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; }
.date {
  height: 68px; border-radius: 10px; padding: 6px 0;
  border: 1px solid var(--field); background: var(--card); color: var(--ink);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.date .d { font-size: 11px; font-weight: 600; }
.date .n { font-size: 16px; font-weight: 800; }
.date .x { font-size: 9px; font-weight: 600; min-height: 11px; }
.date[aria-pressed="true"] { border: 2px solid var(--accent); background: var(--accent); color: #fff; }
.date:disabled { border: 1px dashed var(--field); background: var(--chip); color: #8A8F9C; cursor: not-allowed; }

.slots { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.slot {
  height: 46px; border-radius: 12px; font-size: 14px; font-weight: 700;
  border: 1px solid var(--field); background: var(--card); color: var(--ink);
}
.slot[aria-pressed="true"] { border: 2px solid var(--accent); background: var(--accent); color: #fff; }
.empty { margin: 0; font-size: 14px; color: var(--muted); background: var(--card); border: 1px dashed var(--field); border-radius: 12px; padding: 14px; text-align: center; }

.pax {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px;
}
.pax .ctrl { display: flex; align-items: center; gap: 14px; }
.pax button {
  width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--field);
  background: var(--card); font-size: 22px; line-height: 1;
}
.pax button:disabled { opacity: .4; cursor: not-allowed; }
.pax output { font-size: 20px; font-weight: 800; min-width: 24px; text-align: center; }

.fields { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 700; }
.field .opt { font-weight: 500; color: var(--muted); font-size: 13px; }
.field input, .field textarea {
  border: 1px solid var(--field); border-radius: 12px; padding: 0 14px;
  font-weight: 500; font-size: 16px; background: var(--card); width: 100%;
}
.field input { height: 48px; }
.field textarea { padding: 12px 14px; resize: none; }
.field input::placeholder, .field textarea::placeholder { color: #8A8F9C; }
.field input:focus, .field textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.field[data-error] input, .field[data-error] textarea { border-color: var(--bad); }
.err { font-size: 12px; font-weight: 600; color: var(--bad); }

.submit { display: flex; flex-direction: column; gap: 10px; }
.btn {
  display: flex; align-items: center; justify-content: center; width: 100%;
  height: 56px; border-radius: 14px; border: 0; background: var(--accent); color: #fff;
  font-size: 17px; font-weight: 800; text-decoration: none;
}
.btn:hover { color: #fff; background: var(--accent-dark); }
.btn:disabled { opacity: .6; cursor: progress; }
.btn.ghost { height: 50px; border: 1px solid var(--field); background: var(--card); color: var(--ink); font-size: 14px; font-weight: 700; }
.btn.ghost:hover { background: var(--chip); color: var(--ink); }
.note { margin: 0; font-size: 13px; color: var(--muted); text-align: center; line-height: 1.5; }
.alert { margin: 0; font-size: 14px; font-weight: 600; color: var(--bad-dark); background: var(--bad-soft); border-radius: 12px; padding: 12px 14px; line-height: 1.45; }

.footer { padding: 16px 20px 20px; border-top: 1px solid var(--line); text-align: center; font-size: 12px; color: var(--muted); }

/* ---------- Skrin keputusan ---------- */
.result { padding: 36px 20px 24px; align-items: center; gap: 20px; }
.result .text { display: flex; flex-direction: column; gap: 8px; text-align: center; }
.result h2 { font-size: 23px; line-height: 1.3; }
.result .text p { margin: 0; font-size: 14px; color: var(--muted); line-height: 1.55; }
.result .text strong { color: var(--ink); }
.icon {
  width: 88px; height: 88px; border-radius: 999px;
  display: flex; align-items: center; justify-content: center;
}
.icon.ok { background: var(--accent-soft); color: var(--accent); }
.icon.bad { background: var(--bad-soft); color: var(--bad); }
.icon.info { background: var(--info-soft); color: var(--info); }
.ok-title { color: var(--accent-dark); }
.bad-title { color: var(--bad-dark); }

.ring { position: relative; width: 168px; height: 168px; }
.ring svg { display: block; }
.ring circle.track { stroke: var(--line); }
.ring circle.bar { stroke: var(--warn); transition: stroke-dashoffset 1s linear; }
.ring .t { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.ring .t b { font-size: 36px; font-weight: 800; letter-spacing: -.5px; font-variant-numeric: tabular-nums; }
.ring .t span { font-size: 12px; font-weight: 600; color: var(--muted); }

.code {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  background: var(--card); border: 2px dashed var(--accent); border-radius: 16px; padding: 14px 28px;
}
.code span { font-size: 12px; font-weight: 700; color: var(--muted); }
.code b { font-size: 30px; font-weight: 800; letter-spacing: 3px; }

.card {
  width: 100%; background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  padding: 16px; display: flex; flex-direction: column; gap: 12px;
}
.row { display: flex; justify-content: space-between; gap: 16px; font-size: 14px; }
.row span { color: var(--muted); flex-shrink: 0; }
.row b { font-weight: 700; text-align: right; overflow-wrap: anywhere; }
.hr { height: 1px; background: var(--line); }
.badge { font-size: 13px; font-weight: 700; color: var(--warn); background: var(--warn-soft); padding: 3px 10px; border-radius: 999px; }
.reason .k { font-size: 12px; font-weight: 700; color: var(--muted); }
.reason .v { font-size: 17px; font-weight: 800; }
.reason .s { font-size: 13px; color: var(--muted); }
.actions { width: 100%; display: flex; flex-direction: column; gap: 10px; margin-top: auto; }
.actions.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.small { margin: 0; font-size: 12px; color: var(--muted); text-align: center; line-height: 1.5; }

/* ---------- Muat / ralat ---------- */
.loading, .blank { flex-grow: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 40px 24px; text-align: center; }
.blank h2 { margin: 0; font-size: 20px; }
.blank p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.5; }
.spinner { width: 36px; height: 36px; border-radius: 999px; border: 4px solid var(--line); border-top-color: var(--accent); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .spinner { animation-duration: 3s; }
  .ring circle.bar { transition: none; }
}
@media (max-width: 340px) {
  .dates { gap: 3px; }
  .date .d { font-size: 10px; }
  .slots { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.notice { margin: 0; font-size: 14px; font-weight: 600; color: var(--warn); background: var(--warn-soft); border-radius: 12px; padding: 12px 14px; line-height: 1.45; }
