/*
   家具展示間預約系統 - 前台樣式
   v2.9.22：外觀改成大卡片、進度條，顏色用 CSS 變數
   只改樣式，class 名稱與 JS 行為不變
*/

:root {
  --fb-ink:     #222222;
  --fb-ink-2:   #3a3532;
  --fb-muted:   #6b645c;
  --fb-line:    #e2ddd6;
  --fb-paper:   #f8f6f3;
  --fb-bg:      #ffffff;
  --fb-accent:  #ab4222;
  --fb-accent-d:#8f3519;
  --fb-soft:    #f6e8e2;
  --fb-danger:  #b3261e;
  --fb-ok:      #1d6b3c;
  --fb-font:    Inter,"Noto Sans TC","PingFang TC","Microsoft JhengHei",system-ui,sans-serif;
  /* 舊變數名稱保留（其他地方可能有用到） */
  --ivory: var(--fb-paper); --ivory-2: var(--fb-paper); --ivory-3: var(--fb-line);
  --charcoal: var(--fb-ink); --charcoal-2: var(--fb-ink-2); --warm-gray: var(--fb-muted);
  --accent: var(--fb-accent); --accent-l: var(--fb-soft); --danger: var(--fb-danger); --success: var(--fb-ok);
  --border: var(--fb-line); --radius: 10px; --radius-lg: 12px;
  --shadow: 0 2px 20px rgba(26,20,10,.08); --transition: all .18s ease;
}

.fb-wrap {
  font-family: var(--fb-font);
  font-size: 15px;
  line-height: 1.6;
  max-width: 640px;
  margin: 40px auto;
  padding: 0 20px 80px;
  color: var(--fb-ink);
  position: relative;
  font-variant-numeric: tabular-nums;
}
.fb-wrap *, .fb-wrap *::before, .fb-wrap *::after { box-sizing: border-box; }
.fb-wrap button { font-family: inherit; }

/* 進度條（原本的 1-2-3 圓點改成三段進度條） */
.fb-stepper {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 32px;
}
.fb-step-line { display: none; }
.fb-step {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}
.fb-step::before {
  content: "";
  height: 4px;
  border-radius: 2px;
  background: var(--fb-line);
  transition: var(--transition);
}
.fb-step-num {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}
.fb-step-lbl {
  font-size: 13px;
  color: var(--fb-muted);
  white-space: nowrap;
  transition: var(--transition);
}
.fb-step.active::before, .fb-step.done::before { background: var(--fb-accent); }
.fb-step.active .fb-step-lbl { color: var(--fb-accent); font-weight: 700; }
.fb-step.done   .fb-step-lbl { color: var(--fb-ink-2); }

/* Panel */
.fb-panel { display: none; animation: fbFade .3s ease; }
.fb-panel.active { display: block; }
@keyframes fbFade {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}
.fb-panel-title {
  font-family: var(--fb-font);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: .02em;
  margin: 0 0 6px;
  color: var(--fb-ink);
  line-height: 1.35;
}
.fb-panel-sub {
  font-size: 15px;
  color: var(--fb-muted);
  margin: 0 0 22px;
}

/* 商品類別：大卡片 */
.fb-cat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 28px;
}
.fb-cat-btn {
  min-height: 60px;
  padding: 12px 10px;
  border: 2px solid var(--fb-line);
  border-radius: 12px;
  background: var(--fb-bg);
  color: var(--fb-ink);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  line-height: 1.3;
}
.fb-cat-btn:hover { border-color: #cfc6ba; background: var(--fb-paper); }
.fb-cat-btn.selected {
  border-color: var(--fb-accent);
  background: var(--fb-soft);
  color: var(--fb-accent);
}
.fb-cat-btn:focus-visible, .fb-spec-opt:focus-visible, .fb-slot-btn:focus-visible, .fb-btn:focus-visible {
  outline: 3px solid var(--fb-accent); outline-offset: 2px;
}

/* 規格選擇 */
.fb-specs-wrap { margin-bottom: 24px; }
.fb-spec-block {
  padding: 18px 18px 6px;
  margin-bottom: 12px;
  border: 1px solid var(--fb-line);
  border-radius: 12px;
  background: var(--fb-paper);
  animation: fbFade .25s ease;
}
.fb-spec-block:last-child { border-bottom: 1px solid var(--fb-line); }
.fb-spec-cat-name {
  font-size: 16px;
  color: var(--fb-ink);
  font-weight: 700;
  margin-bottom: 12px;
}
.fb-spec-group { margin-bottom: 14px; }
.fb-spec-label {
  font-size: 14px;
  color: var(--fb-muted);
  margin-bottom: 8px;
}
.fb-spec-options { display: flex; flex-wrap: wrap; gap: 8px; }
.fb-spec-opt {
  min-height: 42px;
  padding: 8px 16px;
  border: 1px solid var(--fb-line);
  border-radius: 99px;
  background: var(--fb-bg);
  color: var(--fb-ink);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}
.fb-spec-opt:hover    { border-color: #cfc6ba; }
.fb-spec-opt.selected { background: var(--fb-soft); color: var(--fb-accent); border-color: var(--fb-accent); box-shadow: 0 0 0 1px var(--fb-accent); }

/* 額外欄位 */
.fb-extra-fields { padding: 4px 0 8px; }

/* 日期時間 */
.fb-datetime-grid {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 28px;
  margin-bottom: 28px;
  align-items: start;
}

/* 表單欄位 */
.fb-field { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; }
.fb-field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.fb-label {
  font-size: 15px;
  font-weight: 700;
  color: var(--fb-ink);
}
.fb-opt { font-weight: 400; color: var(--fb-muted); font-size: 13px; }
.fb-req { color: var(--fb-accent); }
.fb-hint { font-size: 13px; color: var(--fb-muted); margin: 0; }
.fb-hint-center { color: var(--fb-muted); font-size: 15px; text-align: center; padding: 18px 0; margin: 0; grid-column: 1/-1; }

.fb-input {
  border: 1px solid var(--fb-line);
  border-radius: 10px;
  padding: 12px 14px;
  font-family: var(--fb-font);
  font-size: 16px;
  min-height: 50px;
  color: var(--fb-ink);
  background: var(--fb-bg);
  width: 100%;
  transition: var(--transition);
  -webkit-appearance: none;
}
.fb-input::placeholder { color: #a9a198; }
.fb-input:focus {
  outline: none;
  border-color: var(--fb-accent);
  box-shadow: 0 0 0 3px var(--fb-soft);
}
textarea.fb-input { resize: vertical; min-height: 80px; line-height: 1.6; }

.fb-input-prefix {
  display: flex;
  align-items: center;
  border: 1px solid var(--fb-line);
  border-radius: 10px;
  overflow: hidden;
  background: var(--fb-bg);
  transition: var(--transition);
}
.fb-input-prefix:focus-within { border-color: var(--fb-accent); box-shadow: 0 0 0 3px var(--fb-soft); }
.fb-input-prefix > span {
  padding: 0 12px;
  font-size: 14px;
  color: var(--fb-muted);
  background: var(--fb-paper);
  border-right: 1px solid var(--fb-line);
  white-space: nowrap;
  align-self: stretch;
  display: flex; align-items: center;
}
.fb-input-prefix .fb-input { border: none; box-shadow: none; border-radius: 0; }
.fb-input-prefix .fb-input:focus { box-shadow: none; }

/* 時段按鈕 */
.fb-slot-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.fb-slot-btn {
  min-height: 50px;
  padding: 8px 6px;
  border: 2px solid var(--fb-line);
  border-radius: 10px;
  background: var(--fb-bg);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  color: var(--fb-ink);
}
.fb-slot-btn:hover:not(:disabled) { border-color: #cfc6ba; background: var(--fb-paper); }
.fb-slot-btn.selected { background: var(--fb-soft) !important; color: var(--fb-accent) !important; border-color: var(--fb-accent) !important; }
.fb-turnstile { margin: 20px 0 0; min-height: 65px; }
.fb-slot-btn.full small { display: block; font-size: 11px; text-decoration: none; }
.fb-slot-btn.full {
  background: var(--fb-paper);
  color: #a9a198;
  border-color: var(--fb-line);
  cursor: not-allowed;
  text-decoration: line-through;
  font-weight: 400;
  font-size: 14px;
}
.fb-slot-capacity { font-size: 12px; color: var(--fb-muted); margin-left: 3px; font-weight: 400; }

/* 表單格線 */
.fb-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }
.fb-field-full { grid-column: 1/-1; }

/* 預約摘要 */
.fb-summary {
  background: var(--fb-paper);
  border: 1px solid var(--fb-line);
  border-radius: 12px;
  padding: 18px 20px;
  margin-bottom: 18px;
}
.fb-summary-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--fb-ink);
  margin-bottom: 10px;
}
.fb-summary-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-size: 15px;
  padding: 8px 0;
  border-bottom: 1px solid var(--fb-line);
}
.fb-summary-row:last-child { border-bottom: none; }
.fb-summary-key { color: var(--fb-muted); white-space: nowrap; }
.fb-summary-val { color: var(--fb-ink); font-weight: 600; text-align: right; }

/* 個資告知 */
.fb-privacy {
  font-size: 13px;
  color: var(--fb-muted);
  margin-bottom: 22px;
  line-height: 1.7;
  padding: 12px 14px;
  background: var(--fb-paper);
  border-left: 3px solid var(--fb-accent);
  border-radius: 4px 10px 10px 4px;
}

/* 按鈕 */
.fb-btn-row { display: flex; gap: 10px; align-items: center; }
.fb-btn {
  min-height: 52px;
  padding: 0 26px;
  border: none;
  border-radius: 12px;
  font-family: var(--fb-font);
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  display: inline-flex; align-items: center; justify-content: center;
}
.fb-btn-primary { background: var(--fb-accent); color: #fff !important; flex: 1; }
.fb-btn-primary:hover:not(:disabled) { background: var(--fb-accent-d); color: #fff !important; }
.fb-btn-primary:active, .fb-btn-primary:focus { background: var(--fb-accent-d); color: #fff !important; }
.fb-btn-primary:disabled { background: var(--fb-accent); opacity: .35; cursor: not-allowed; }
.fb-btn-ghost {
  background: transparent;
  color: var(--fb-ink-2);
  border: 1px solid var(--fb-line);
  font-weight: 500;
  font-size: 16px;
  padding: 0 18px;
}
.fb-btn-ghost:hover { border-color: #cfc6ba; background: var(--fb-paper); }

/* 成功畫面 */
.fb-success { text-align: center; padding: 40px 8px; }
.fb-check {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: var(--fb-accent);
  color: #fff;
  font-size: 30px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 20px;
  animation: fbPop .4s cubic-bezier(.18,.89,.32,1.28);
}
@keyframes fbPop { from { transform: scale(.3); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.fb-success h3 {
  font-family: var(--fb-font);
  font-size: 26px;
  font-weight: 700;
  margin: 0 0 12px;
  color: var(--fb-ink);
}
.fb-success p { color: var(--fb-muted); font-size: 15px; line-height: 1.7; margin-bottom: 28px; }

/* Loading */
.fb-loading {
  position: absolute; inset: 0;
  background: rgba(255,255,255,.8);
  display: none; /* 預設隱藏，JS 呼叫 showLoading(true) 才顯示 */
  align-items: center; justify-content: center;
  border-radius: 12px;
  z-index: 99;
  backdrop-filter: blur(2px);
}
.fb-spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--fb-line);
  border-top-color: var(--fb-accent);
  border-radius: 50%;
  animation: fbSpin .7s linear infinite;
}
@keyframes fbSpin { to { transform: rotate(360deg); } }

/* 響應式 */
@media (max-width: 560px) {
  .fb-wrap { padding: 0 16px 60px; margin: 20px auto; }
  .fb-panel-title { font-size: 22px; }
  .fb-cat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fb-datetime-grid { grid-template-columns: 1fr; gap: 6px; }
  .fb-form-grid { grid-template-columns: 1fr; }
  .fb-field-row { grid-template-columns: 1fr; }
  .fb-step-lbl { font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .fb-panel, .fb-spec-block, .fb-check { animation: none; }
}

/* Email 自動補全下拉 */
.fb-email-dropdown {
  display: none;
  position: absolute;
  left: 0; right: 0;
  background: #fff;
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  box-shadow: 0 4px 16px rgba(26,26,26,.10);
  z-index: 99;
  overflow: hidden;
}
.fb-email-option {
  padding: 10px 14px;
  font-size: 15px;
  color: var(--charcoal-2);
  cursor: pointer;
  transition: background .15s;
  border-bottom: 1px solid var(--ivory-2);
}
.fb-email-option:last-child { border-bottom: none; }
.fb-email-option:hover,
.fb-email-option.active {
  background: var(--ivory-2);
  color: var(--charcoal);
}

/* Email 欄位加上 relative 定位讓下拉正確對齊 */
#fb-email {
  position: relative;
}
.fb-field:has(#fb-email) {
  position: relative;
}

/* 預約成功自訂訊息 */
.fb-success-custom {
  margin: 16px auto 24px;
  max-width: 400px;
  font-size: 14px;
  color: var(--charcoal-2);
  line-height: 1.8;
  text-align: left;
}
.fb-success-custom img {
  max-width: 100%;
  border-radius: var(--radius-lg);
  margin: 12px 0;
}
.fb-success-custom p { margin: 0 0 10px; }
.fb-success-custom strong { color: var(--charcoal); }

/* 預約成功資訊區塊 */
.fb-success-booking-info {
  margin: 0 auto 24px;
  max-width: 360px;
  text-align: left;
}
.fb-success-booking-info p {
  font-size: 15px;
  margin-bottom: 14px;
  color: var(--charcoal);
}
.fb-success-booking-info table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.fb-success-booking-info td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--ivory-3);
}
.fb-success-booking-info td:first-child {
  color: var(--warm-gray);
  width: 90px;
  font-weight: 500;
}
.fb-success-booking-info td:last-child {
  color: var(--charcoal);
  font-weight: 600;
}

/* 姓名並排欄位 */
.fb-field-row {
  display: flex;
  gap: 12px;
}
.fb-field-row > div {
  flex: 1;
}

/* 迎賓區塊 */
.fb-welcome {
  margin-bottom: 28px;
  text-align: center;
}
.fb-welcome-img img {
  width: 100%;
  max-height: 280px;
  object-fit: cover;
  border-radius: var(--radius-lg, 12px);
  margin-bottom: 16px;
}
.fb-welcome-text {
  font-size: 14px;
  color: var(--charcoal-2, #4a4540);
  line-height: 1.8;
}
.fb-welcome-text p { margin: 0 0 8px; }

/* 防機器人欄位（真人看不到） */
.fb-hp {
  position: absolute !important;
  left: -10000px !important;
  width: 1px; height: 1px;
  overflow: hidden;
}

/* 沙發選購小幫手建議單 */
.fb-advisor{margin:0 0 24px;padding:16px 18px;border:1px solid var(--fb-line);border-left:3px solid var(--fb-accent);border-radius:4px 12px 12px 4px;background:var(--fb-paper);font-size:15px;line-height:1.7}
.fb-advisor[hidden]{display:none}
.fb-advisor-title{font-weight:700;margin-bottom:4px}
.fb-advisor-title span{font-weight:700;color:var(--fb-accent);margin-left:6px;letter-spacing:.04em}
.fb-advisor ul{margin:0 0 6px;padding-left:18px}
.fb-advisor p{margin:0;color:#666;font-size:13px}
.fb-home-countdown{margin:16px 0 0;font-size:15px;color:#6b645c;text-align:center}
.fb-home-countdown a{color:#ab4222;font-weight:700}

/* 手機：預算、姓名欄位上下排，避免輸入框太窄 */
@media (max-width: 560px) {
  .fb-field-row { flex-direction: column; gap: 0; }
}

/* 稱呼：姓＋先生／小姐（v2.9.22） */
.fb-name-row { display: flex; gap: 10px; align-items: stretch; }
.fb-name-row .fb-input { flex: 1; min-width: 0; }
.fb-title { display: flex; gap: 8px; }
.fb-title-btn {
  min-height: 50px; min-width: 76px; padding: 0 14px;
  border: 2px solid var(--fb-line); border-radius: 10px; background: var(--fb-bg);
  color: var(--fb-ink); font-size: 16px; font-weight: 600; cursor: pointer; transition: var(--transition);
}
.fb-title-btn:hover { border-color: #cfc6ba; }
.fb-title-btn[aria-checked="true"] { border-color: var(--fb-accent); background: var(--fb-soft); color: var(--fb-accent); }
.fb-title-btn:focus-visible { outline: 3px solid var(--fb-accent); outline-offset: 2px; }
.fb-panel-sub + .fb-datetime-grid { margin-top: 4px; }

/* 稱謂三個選項：手機上排到姓氏下方 */
.fb-title .fb-title-btn[data-v="名字"] { min-width: 112px; }
@media (max-width: 560px) {
  .fb-name-row { flex-wrap: wrap; }
  .fb-name-row .fb-input { flex-basis: 100%; }
  .fb-title { width: 100%; }
  .fb-title .fb-title-btn { flex: 1; min-width: 0; padding: 0 8px; }
}

/* 最初從哪裡知道我們（v2.9.27） */
.fb-heard { display: flex; flex-wrap: wrap; gap: 8px; }
.fb-heard-btn {
  min-height: 44px; padding: 0 14px;
  border: 2px solid var(--fb-line); border-radius: 999px; background: var(--fb-bg);
  color: var(--fb-ink); font-size: 15px; font-weight: 600; cursor: pointer; transition: var(--transition);
}
.fb-heard-btn:hover { border-color: #cfc6ba; }
.fb-heard-btn[aria-checked="true"] { border-color: var(--fb-accent); background: var(--fb-soft); color: var(--fb-accent); }
.fb-heard-btn:focus-visible { outline: 3px solid var(--fb-accent); outline-offset: 2px; }
.fb-heard-note { margin-top: 10px; max-width: 360px; }
.fb-heard-note[hidden] { display: none; }
.fb-privacy a { color: var(--fb-accent); }
.fb-mail-fix { margin-top: 6px; color: var(--fb-text, #1c1c1c); }
.fb-mail-fix[hidden] { display: none; }
.fb-mail-fix-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--fb-accent); text-decoration: underline; cursor: pointer; }
