/* =========================================================
   即時可訂 — 餐廳訂位 · 顧客前端樣式
   主題全部走 CSS 變數，換客戶只需改 :root 一處
   行動優先 RWD、暖色可信任調、手機 sticky 底部主行動鈕
   （沿用方案B style.css 的 CSS 變數主題作法）
   ========================================================= */

:root {
  /* —— 品牌主題（華承軒 麵館 · 朱紅系；每個客戶在此換色） —— */
  --bg: #f7f1e7;          /* 暖奶油 */
  --card: #fdfaf4;        /* 紙白 */
  --ink: #1c1714;         /* 墨黑 */
  --muted: #4a3f37;       /* 次要 */
  --brand: #c0392b;       /* 朱紅 */
  --brand-ink: #9c2a1d;   /* 朱紅深 */
  --accent: #b8893b;      /* 火腿金：可訂、成功 */
  --line: #e7dcc8;        /* 暖邊 */
  --radius: 16px;
  --shadow: 0 6px 20px rgba(60, 40, 25, 0.08), 0 1px 3px rgba(60, 40, 25, 0.05);
  --shadow-lg: 0 -8px 28px rgba(60, 40, 25, 0.12);

  /* —— 衍生 —— */
  --radius-sm: 10px;
  --radius-pill: 999px;
  --brand-soft: color-mix(in srgb, var(--brand) 10%, transparent);
  --accent-soft: color-mix(in srgb, var(--accent) 12%, transparent);
  --maxw: 720px;
  --bar-h: 78px;

  --font: "Noto Sans TC", -apple-system, BlinkMacSystemFont, "Segoe UI",
          "PingFang TC", "Microsoft JhengHei", "Helvetica Neue", Arial, sans-serif;
  /* 標題楷體（華承軒）：LXGW WenKai TC */
  --font-display: "LXGW WenKai TC", "Noto Sans TC", "PingFang TC",
          "Microsoft JhengHei", serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  /* 預留底部 sticky 主行動鈕空間 */
  padding-bottom: calc(var(--bar-h) + env(safe-area-inset-bottom, 0px));
}

h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
.brand-name, .hero-title, .step-title, .success h2, .foot-name {
  font-family: var(--font-display);
}
p { margin: 0; }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }

.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: 18px;
}

/* =========================================================
   頂部品牌列
   ========================================================= */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 60px;
}
.brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.brand-mark {
  flex: none;
  width: 40px; height: 40px;
  border-radius: 12px;
  display: grid; place-items: center;
  background: linear-gradient(150deg, var(--brand), var(--brand-ink));
  color: #fff;
  box-shadow: var(--shadow);
}
.brand-text { min-width: 0; }
.brand-name {
  font-size: 17px;
  font-weight: 900;
  letter-spacing: .2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.brand-tag { font-size: 12px; color: var(--muted); }

.header-phone {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  color: var(--brand-ink);
  background: var(--brand-soft);
  font-weight: 700;
  font-size: 13px;
  padding: 8px 13px;
  border-radius: var(--radius-pill);
  transition: background .18s ease;
}
.header-phone:active { background: color-mix(in srgb, var(--brand) 20%, transparent); }

/* =========================================================
   主視覺
   ========================================================= */
.hero {
  background:
    radial-gradient(120% 90% at 100% 0%, var(--brand-soft), transparent 55%),
    radial-gradient(90% 80% at 0% 100%, var(--accent-soft), transparent 60%);
  border-bottom: 1px solid var(--line);
}
.hero-inner { padding-block: 30px 34px; }
.hero-kicker {
  display: inline-block;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--brand-ink);
  background: var(--card);
  border: 1px solid var(--line);
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.hero-title {
  font-size: clamp(26px, 7vw, 38px);
  font-weight: 900;
  letter-spacing: -.5px;
}
.hero-sub {
  margin-top: 12px;
  max-width: 32em;
  color: var(--muted);
  font-size: 15px;
}
.hero-meta {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.hero-meta .pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--line);
  padding: 6px 12px;
  border-radius: var(--radius-pill);
}
.hero-meta .pill svg { color: var(--brand); flex: none; }

/* =========================================================
   訂位流程容器
   ========================================================= */
.flow { padding-block: 22px 40px; }

.step-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 18px 20px;
  margin-bottom: 16px;
}
.step-head {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 14px;
}
.step-no {
  flex: none;
  width: 28px; height: 28px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 14px;
  font-weight: 900;
  background: var(--brand);
  color: #fff;
}
.step-title { font-size: 16.5px; font-weight: 900; }
.step-hint { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

/* 日期挑選 */
.field-date {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.date-input {
  width: 100%;
  font-family: inherit;
  font-size: 16px; /* 16px 防 iOS 縮放 */
  color: var(--ink);
  background: var(--bg);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 13px 14px;
  transition: border-color .16s ease, background .16s ease;
}
.date-input:focus { outline: none; border-color: var(--brand); background: var(--card); }
.date-weekday {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  min-height: 18px;
}
.date-weekday.is-closed { color: var(--brand-ink); }

/* =========================================================
   時段格
   ========================================================= */
.slot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 9px;
}
.slot {
  position: relative;
  border: 1.5px solid var(--line);
  background: var(--card);
  color: var(--ink);
  border-radius: var(--radius-sm);
  padding: 11px 6px 9px;
  font-family: inherit;
  text-align: center;
  transition: border-color .14s ease, background .14s ease, transform .1s ease, box-shadow .14s ease;
}
.slot:active { transform: scale(.97); }
.slot .slot-time {
  font-size: 16px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: .3px;
}
.slot .slot-left {
  display: block;
  margin-top: 3px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--accent);
}
.slot.is-selected {
  border-color: var(--brand);
  background: var(--brand-soft);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand) 30%, transparent);
}
.slot.is-selected .slot-time { color: var(--brand-ink); }
.slot.is-full {
  cursor: not-allowed;
  background: var(--bg);
  border-style: dashed;
  opacity: .72;
}
.slot.is-full .slot-time { color: var(--muted); }
.slot.is-full .slot-left { color: var(--muted); }

/* 人數 stepper */
.party-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.party-label { font-size: 14.5px; font-weight: 700; }
.party-label small { display: block; font-weight: 500; color: var(--muted); font-size: 12px; margin-top: 1px; }
.qty-stepper {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--brand-soft);
  border-radius: var(--radius-pill);
  padding: 4px;
}
.qty-btn {
  width: 38px; height: 38px;
  border: 0;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
  display: grid; place-items: center;
  transition: transform .1s ease, opacity .14s ease;
}
.qty-btn:active { transform: scale(.9); }
.qty-btn:disabled { opacity: .4; cursor: not-allowed; transform: none; }
.qty-num {
  min-width: 44px;
  text-align: center;
  font-weight: 900;
  font-size: 18px;
  color: var(--brand-ink);
  font-variant-numeric: tabular-nums;
}

/* =========================================================
   表單
   ========================================================= */
.field { margin-bottom: 14px; }
.field:last-child { margin-bottom: 0; }
.field label {
  display: block;
  font-size: 13.5px;
  font-weight: 700;
  margin-bottom: 6px;
}
.req { color: var(--brand); }
.field input,
.field textarea {
  width: 100%;
  font-family: inherit;
  font-size: 16px; /* 防 iOS 縮放 */
  color: var(--ink);
  background: var(--bg);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  transition: border-color .16s ease, background .16s ease;
}
.field input::placeholder,
.field textarea::placeholder { color: color-mix(in srgb, var(--muted) 75%, transparent); }
.field input:focus,
.field textarea:focus { outline: none; border-color: var(--brand); background: var(--card); }
.field textarea { resize: vertical; min-height: 58px; }

/* 訂位摘要列 */
.summary-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}
.summary-strip .chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  padding: 7px 12px;
  border-radius: var(--radius-pill);
}
.summary-strip .chip svg { color: var(--brand); flex: none; }
.summary-strip .chip.empty { color: var(--muted); font-weight: 500; }

.form-error {
  color: var(--brand-ink);
  background: var(--brand-soft);
  border: 1px solid color-mix(in srgb, var(--brand) 28%, var(--line));
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  padding: 10px 12px;
  margin-bottom: 12px;
  display: flex;
  gap: 9px;
  align-items: flex-start;
}
.form-error svg { flex: none; margin-top: 1px; }
.form-error[hidden] { display: none; }

/* =========================================================
   狀態（載入 / 公休 / 全額滿 / 錯誤）
   ========================================================= */
.state {
  text-align: center;
  padding: 36px 16px;
  color: var(--muted);
}
.state h3 { color: var(--ink); font-size: 16.5px; margin-bottom: 6px; }
.state p { font-size: 13.5px; }
.state-icon { color: var(--brand); opacity: .85; margin-bottom: 12px; }
.state.tone-quiet .state-icon { color: var(--muted); }
.state .btn { margin-top: 16px; }
.state[hidden] { display: none; }

.spinner {
  width: 32px; height: 32px;
  margin: 0 auto 14px;
  border: 3px solid var(--line);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* =========================================================
   通用按鈕
   ========================================================= */
.btn {
  border: 0;
  border-radius: var(--radius-pill);
  font-weight: 800;
  font-size: 16px;
  padding: 14px 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform .12s ease, opacity .16s ease, background .16s ease;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn-block { width: 100%; }
.btn-primary {
  background: var(--brand);
  color: #fff;
  box-shadow: 0 4px 14px color-mix(in srgb, var(--brand) 30%, transparent);
}
.btn-primary:active { background: var(--brand-ink); }
.btn-outline {
  background: transparent;
  color: var(--brand-ink);
  border: 1.5px solid var(--brand);
}

/* =========================================================
   手機 sticky 底部主行動鈕
   ========================================================= */
.action-bar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 50;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 0px));
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}
.action-bar[hidden] { display: none; }
.action-bar-inner {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  display: flex;
  align-items: center;
  gap: 14px;
}
.action-summary {
  flex: 1 1 auto;
  min-width: 0;
  line-height: 1.25;
}
.action-summary .a-main {
  font-size: 15px;
  font-weight: 900;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.action-summary .a-sub { font-size: 11.5px; color: var(--muted); }
.action-bar .btn { flex: none; }

/* =========================================================
   成功頁（取代流程，內嵌於主區）
   ========================================================= */
.success { text-align: center; padding: 30px 6px 20px; }
.success-icon {
  width: 80px; height: 80px;
  margin: 0 auto 16px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
}
.success h2 { font-size: 23px; font-weight: 900; }
.success-sub { color: var(--muted); margin-top: 7px; font-size: 14.5px; }
.success-card {
  text-align: left;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px;
  margin: 20px auto 12px;
  max-width: 460px;
}
.success-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
}
.success-row + .success-row { border-top: 1px dashed var(--line); }
.success-row .k { color: var(--muted); font-size: 14px; }
.success-row .v { font-size: 16px; font-weight: 800; text-align: right; }
.success-row.no .v {
  color: var(--brand-ink);
  letter-spacing: .8px;
  font-variant-numeric: tabular-nums;
  font-size: 18px;
}
.success-tip {
  color: var(--muted);
  font-size: 13px;
  max-width: 460px;
  margin: 4px auto 20px;
}
.success .btn { max-width: 460px; margin-inline: auto; }
.success[hidden] { display: none; }

/* =========================================================
   頁尾
   ========================================================= */
.site-footer {
  border-top: 1px solid var(--line);
  padding-block: 24px 28px;
  text-align: center;
  color: var(--muted);
}
.foot-name { font-weight: 900; color: var(--ink); font-size: 16px; }
.foot-info { font-size: 13px; margin-top: 6px; }
.foot-copy { font-size: 12px; margin-top: 12px; opacity: .7; }

/* =========================================================
   平板 / 桌機微調
   ========================================================= */
@media (min-width: 720px) {
  .hero-inner { padding-block: 44px 46px; }
  .slot-grid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); }
}

/* 尊重減少動態偏好 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    transition-duration: .001ms !important;
  }
}
