/* ===========================================================
   NobodyEats / FoodDada — mockup 主題層
   正式版這層會疊在 Bootstrap 5.3 之上，只靠 CSS 變數換皮膚
   =========================================================== */

:root {
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.06), 0 2px 8px rgba(0,0,0,.05);
  --shadow: 0 2px 6px rgba(0,0,0,.07), 0 12px 28px rgba(0,0,0,.08);
  --ink: #10100f;
  --ink-2: #545452;
  --ink-3: #8e8e8b;
  --line: #e8e8e4;
  --bg: #ffffff;
  --bg-2: #f6f6f3;
  --font: "Noto Sans TC", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang TC", "Microsoft JhengHei", sans-serif;
}

/* ---------- 皮膚 A：NobodyEats（預設） ---------- */
:root[data-theme="nobodyeats"] {
  --brand: #05a357;
  --brand-dark: #047a41;
  --brand-soft: #e7f6ee;
  --on-brand: #ffffff;
  --accent: #10100f;
  --header-bg: #ffffff;
  --header-ink: #10100f;
  --radius: 10px;
  --radius-lg: 14px;
  --btn-radius: 999px;
  --card-radius: 10px;
  --font-title-weight: 800;
  --letter: -0.01em;
}

/* ---------- 皮膚 B：FoodDada ---------- */
:root[data-theme="fooddada"] {
  --brand: #e6386f;
  --brand-dark: #c72659;
  --brand-soft: #fdeaf1;
  --on-brand: #ffffff;
  --accent: #2b2b3c;
  --header-bg: #e6386f;
  --header-ink: #ffffff;
  --ink: #2b2b3c;
  --ink-2: #6b6b7b;
  --ink-3: #9a9aa8;
  --bg-2: #f7f6f9;
  --radius: 14px;
  --radius-lg: 22px;
  --btn-radius: 10px;
  --card-radius: 16px;
  --font-title-weight: 700;
  --letter: 0;
}

* { box-sizing: border-box; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  letter-spacing: var(--letter);
  margin: 0;
  -webkit-font-smoothing: antialiased;
  /* 內容不足一頁時，footer 仍貼在視窗底部 */
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
h1,h2,h3,h4,h5 { font-weight: var(--font-title-weight); letter-spacing: var(--letter); }
a { color: var(--brand); text-decoration: none; }

/* ---------- 版面 ---------- */
/* 全站統一內容欄寬：720px 外框、實際內容 688px */
.ne-wrap { max-width: 720px; margin: 0 auto; padding: 0 16px; }
.ne-wrap-wide { max-width: 720px; margin: 0 auto; padding: 0 16px; }
.ne-section { padding: 20px 0; }
.muted { color: var(--ink-2); }
.tiny { font-size: 12px; color: var(--ink-3); }

/* ---------- Header ---------- */
.ne-header {
  position: sticky; top: 0; z-index: 40;
  background: var(--header-bg);
  color: var(--header-ink);
  border-bottom: 1px solid rgba(0,0,0,.06);
}
:root[data-theme="fooddada"] .ne-header { border-bottom-color: transparent; }
.ne-header-in {
  max-width: 720px; margin: 0 auto; padding: 12px 16px;
  display: flex; align-items: center; gap: 12px;
}
.ne-logo { font-weight: 900; font-size: 20px; letter-spacing: -.02em; color: var(--header-ink); display: flex; align-items: center; gap: 7px; }
.ne-logo .dot { color: var(--brand); }
:root[data-theme="fooddada"] .ne-logo .dot { color: #ffe08a; }
.ne-logo em { font-style: normal; }
.ne-header .addr { font-size: 13px; opacity: .85; display: flex; align-items: center; gap: 5px; }
.ne-spacer { flex: 1; }

/* 主題切換 */
.theme-switch { display: flex; gap: 0; border: 1px solid rgba(125,125,125,.35); border-radius: 999px; overflow: hidden; }
.theme-switch button {
  border: 0; background: transparent; color: inherit;
  font: inherit; font-size: 12px; font-weight: 700;
  padding: 5px 11px; cursor: pointer; opacity: .6;
}
.theme-switch button.on { background: var(--brand); color: var(--on-brand); opacity: 1; }
:root[data-theme="fooddada"] .theme-switch button.on { background: #fff; color: var(--brand); }

/* ---------- 按鈕 ---------- */
.btn-ne {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--brand); color: var(--on-brand);
  border: 0; border-radius: var(--btn-radius);
  padding: 14px 22px; font-weight: 700; font-size: 16px;
  cursor: pointer; width: 100%; transition: filter .15s;
  font-family: var(--font);
}
.btn-ne:hover { filter: brightness(.93); }
.btn-ne:disabled { background: var(--line); color: var(--ink-3); cursor: not-allowed; }
.btn-ghost {
  background: transparent; color: var(--ink); border: 1.5px solid var(--line);
  border-radius: var(--btn-radius); padding: 12px 18px; font-weight: 700;
  font-family: var(--font); cursor: pointer; width: 100%;
}
.btn-sm { padding: 8px 14px; font-size: 14px; width: auto; }

/* ---------- 表單 ---------- */
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 700; font-size: 14px; margin-bottom: 6px; }
.field .hint { font-size: 12px; color: var(--ink-3); margin-top: 5px; }
.inp, select.inp {
  width: 100%; padding: 13px 14px; font-size: 16px; font-family: var(--font);
  border: 1.5px solid var(--line); border-radius: var(--radius); background: #fff; color: var(--ink);
  outline: none;
}
.inp:focus { border-color: var(--brand); }
.inp:disabled { background: var(--bg-2); color: var(--ink-3); cursor: not-allowed; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ---------- 卡片 ---------- */
.card-ne {
  background: #fff; border: 1px solid var(--line);
  border-radius: var(--card-radius); overflow: hidden;
}
.thumb {
  display: flex; align-items: center; justify-content: center;
  font-size: 46px; line-height: 1;
}
.thumb-store { height: 132px; font-size: 60px; }
.thumb-item { width: 88px; height: 88px; border-radius: var(--radius); font-size: 38px; flex: 0 0 auto; }

/* 店家卡 */
.store-card { cursor: pointer; display: block; color: inherit; margin-bottom: 18px; }
.store-card:hover .thumb-store { filter: brightness(1.04); }
.store-card .body { padding: 12px 14px; }
.store-card h3 { margin: 0 0 4px; font-size: 17px; }
.store-meta { font-size: 13px; color: var(--ink-2); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.badge-ne {
  display: inline-block; background: var(--brand-soft); color: var(--brand-dark);
  font-size: 11px; font-weight: 800; padding: 3px 8px; border-radius: 999px;
}
.badge-dark { background: var(--accent); color: #fff; }

/* 品項列 */
.item-row {
  display: flex; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line);
  cursor: pointer; align-items: flex-start;
}
.item-row:hover { background: rgba(0,0,0,.015); }
.item-row .info { flex: 1; min-width: 0; }
.item-row h4 { margin: 0 0 4px; font-size: 15px; font-weight: 700; }
.item-row p { margin: 0 0 6px; font-size: 13px; color: var(--ink-2); line-height: 1.45; }
.price { font-weight: 700; font-size: 15px; }

/* 分類標籤列 */
.cat-bar { display: flex; gap: 8px; overflow-x: auto; padding: 12px 0; position: sticky; top: 57px; background: var(--bg); z-index: 30; }
.cat-bar::-webkit-scrollbar { display: none; }
.chip {
  white-space: nowrap; padding: 7px 14px; border-radius: 999px;
  border: 1.5px solid var(--line); font-size: 14px; font-weight: 600; cursor: pointer; background: #fff;
}
.chip.on { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ---------- Sticky 底欄 ---------- */
.sticky-bar {
  position: sticky; bottom: 0; background: rgba(255,255,255,.96);
  backdrop-filter: blur(8px); border-top: 1px solid var(--line);
  padding: 12px 0; z-index: 35;
}
/* 內距放在 .in，讓按鈕寬度與 .ne-wrap 的內容欄完全對齊（720 − 16×2 = 688） */
.sticky-bar .in { max-width: 720px; margin: 0 auto; padding: 0 16px; }

/* ---------- Modal（品項選項） ---------- */
.modal-ne { position: fixed; inset: 0; z-index: 90; display: none; }
.modal-ne.open { display: block; }
.modal-ne .backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.45); }
.modal-ne .panel {
  position: absolute; left: 50%; transform: translateX(-50%);
  bottom: 0; width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto;
  background: #fff; border-radius: var(--radius-lg) var(--radius-lg) 0 0; padding: 0;
}
/* panel 自己是捲動容器，底欄用 sticky 貼在它的底部
   （panel 有 transform，內部 position:fixed 會以 panel 為基準而失效） */
.modal-ne .panel > .sticky-bar { position: sticky; bottom: 0; margin-top: 8px; }
.opt-group { padding: 16px; border-top: 8px solid var(--bg-2); }
.opt-group h5 { margin: 0 0 2px; font-size: 15px; }
.opt-row { display: flex; align-items: center; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.opt-row input { width: 19px; height: 19px; accent-color: var(--brand); }
.opt-row .p { margin-left: auto; color: var(--ink-2); font-size: 14px; }
.req { font-size: 11px; font-weight: 800; color: #c0392b; }

/* 數量 */
.qty { display: flex; align-items: center; gap: 14px; }
.qty button {
  width: 34px; height: 34px; border-radius: 999px; border: 1.5px solid var(--line);
  background: #fff; font-size: 18px; cursor: pointer; line-height: 1;
}

/* ---------- 進度頁 ---------- */
/* 預計送達時間：分鐘數是這頁的主角，要一眼看到 */
.eta { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin: 4px 0 2px; }
.eta-label { font-size: 13px; color: var(--ink-3); }
.eta-num {
  font-size: 46px; line-height: 1.05; font-weight: 800; color: var(--brand);
  font-variant-numeric: tabular-nums; letter-spacing: -1px;
}
.eta-unit { font-size: 15px; font-weight: 700; color: var(--ink-2); }
.eta.is-soon .eta-num { font-size: 30px; }
.eta.is-soon .eta-label { display: none; }   /* 「預計 快到了」念起來很怪 */
.eta[hidden] { display: none; }

.stage-title { font-size: 26px; margin: 6px 0 4px; }
.progress-ne { display: flex; gap: 6px; margin: 18px 0 8px; }
.progress-ne i { flex: 1; height: 6px; border-radius: 99px; background: var(--line); }
.progress-ne i.done { background: var(--brand); }
.progress-ne i.now { background: linear-gradient(90deg, var(--brand) 50%, var(--line) 50%); }
.map {
  height: 230px; border-radius: var(--radius-lg); background: var(--bg-2);
  border: 1px solid var(--line); overflow: hidden; position: relative;
}
.courier-card { display: flex; gap: 12px; align-items: center; padding: 14px; }
.courier-av {
  width: 48px; height: 48px; border-radius: 999px; display: flex;
  align-items: center; justify-content: center; font-size: 24px; background: var(--brand-soft);
}
.chat { padding: 4px 0 0; }
.bubble {
  background: var(--bg-2); border-radius: 14px 14px 14px 4px;
  padding: 10px 13px; margin: 8px 0; font-size: 14px; max-width: 82%;
  animation: pop .3s ease;
}
.bubble .who { font-size: 11px; color: var(--ink-3); margin-bottom: 2px; }
@keyframes pop { from { opacity: 0; transform: translateY(6px); } }

/* ---------- 成就 ---------- */
.ach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.ach {
  border: 1px solid var(--line); border-radius: var(--card-radius);
  padding: 14px; text-align: center; background: #fff;
}
.ach.locked { opacity: .5; background: var(--bg-2); }
.ach .e { font-size: 30px; }
.ach h5 { font-size: 14px; margin: 8px 0 3px; }
.ach p { font-size: 12px; color: var(--ink-2); margin: 0; }

.toast-ach {
  position: fixed; right: 16px; bottom: 16px; z-index: 80;
  background: var(--accent); color: #fff; border-radius: var(--radius);
  padding: 12px 16px; display: flex; gap: 10px; align-items: center;
  box-shadow: var(--shadow); animation: pop .35s ease;
}

/* ---------- 收據 / 明細 ---------- */
.sum { font-size: 14px; }
.sum div { display: flex; justify-content: space-between; padding: 7px 0; }
.sum .total { font-weight: 800; font-size: 17px; border-top: 1px solid var(--line); margin-top: 6px; padding-top: 12px; }

/* ---------- Footer ---------- */
.ne-footer {
  margin-top: auto;              /* 永遠推到頁面最底 */
  padding: 26px 16px 34px; background: var(--bg-2);
  border-top: 1px solid var(--line);
  font-size: 12px; color: var(--ink-3); text-align: center; line-height: 1.7;
}
/* 有 sticky 底欄的頁面，底欄要壓在 footer 之上 */
.sticky-bar { order: 98; }
.ne-footer { order: 99; }

/* ---------- Mockup 專用導覽條 ---------- */
.mock-bar {
  background: #10100f; color: #fff; font-size: 12px; padding: 7px 14px;
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
}
.mock-bar a { color: #9ad; }
.mock-bar b { color: #ffd166; }
