/* ============================================================
   Trip Template — 深色主題共用樣式
   所有 personal/ 下的旅遊網站共用。顏色以 CSS 變數集中管理，
   個別旅程的主色 (--accent) 由 trip-template.js 依 TRIP_DATA 設定。
   ============================================================ */

:root {
  --bg: #0A0F1E;
  --surface: #111827;
  --surface-2: #1a2234;
  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.16);
  --ink: #e2e8f0;
  --ink-2: #94a3b8;
  --ink-3: #64748b;
  --accent: #f43f5e;          /* 由 JS 覆寫 */
  --accent-soft: rgba(244, 63, 94, 0.15);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: 'Noto Sans TC', 'Inter', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

img { max-width: 100%; }

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: #2a3650; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #3b4a6b; }

.container { max-width: min(1500px, 94vw); margin: 0 auto; padding: 0 20px; }

/* ---------- 導覽列 ---------- */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
  background: rgba(10, 15, 30, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.nav-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; letter-spacing: 0.03em; }
.nav-brand i { color: var(--accent); font-size: 20px; }
.nav-links { display: flex; gap: 2px; font-size: 13.5px; font-weight: 500; overflow-x: auto; scrollbar-width: none; }
.nav-links::-webkit-scrollbar { display: none; }
.nav-links a {
  color: var(--ink-2); text-decoration: none; padding: 6px 9px; border-radius: 8px;
  transition: color 0.15s, background 0.15s; white-space: nowrap;
}
.nav-links a:hover { color: var(--ink); background: rgba(255, 255, 255, 0.06); }
.nav-back { color: var(--ink-3); text-decoration: none; font-size: 13px; white-space: nowrap; margin-left: 14px; }
.nav-back:hover { color: var(--ink); }
.nav-burger { display: none; background: none; border: none; color: var(--ink-2); font-size: 20px; cursor: pointer; padding: 8px; }
.nav-mobile { display: none; border-top: 1px solid var(--border); background: #0d1326; }
.nav-mobile a { display: block; padding: 12px 20px; font-size: 14px; color: var(--ink-2); text-decoration: none; }
.nav-mobile a:hover { background: rgba(255, 255, 255, 0.05); color: var(--ink); }
.nav-mobile.open { display: block; }

/* ---------- Hero ---------- */
.hero {
  padding: 120px 20px 64px;
  background:
    linear-gradient(rgba(255,255,255,0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px),
    linear-gradient(135deg, #0c2a3a 0%, #1a1f3a 45%, #0A0F1E 100%);
  background-size: 40px 40px, 40px 40px, cover;
  text-align: center;
}
.hero-badge {
  display: inline-block; padding: 5px 14px; margin-bottom: 18px;
  font-size: 11.5px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--accent); background: var(--accent-soft);
  border: 1px solid var(--border-strong); border-radius: 999px;
}
.hero h1 { font-size: clamp(30px, 5vw, 52px); font-weight: 900; margin: 0 0 12px; letter-spacing: -0.01em; line-height: 1.15; }
.hero-sub { font-size: 17px; color: var(--ink-2); margin: 0 0 26px; font-weight: 300; }
.hero-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; font-size: 13.5px; color: var(--ink-2); }
.hero-chips span {
  display: inline-flex; align-items: center; gap: 7px; padding: 6px 14px;
  background: rgba(255, 255, 255, 0.05); border: 1px solid var(--border); border-radius: 999px;
}

/* ---------- 階段橫幅（計劃倒數 / 旅途中今天） ---------- */
.phase-banner {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin: 28px auto 0; padding: 14px 18px; max-width: min(1460px, 90vw);
  background: var(--accent-soft); border: 1px solid var(--border-strong);
  border-radius: 14px; font-size: 14.5px; font-weight: 600;
}
.phase-banner .cta {
  margin-left: auto; padding: 7px 16px; border-radius: 10px; font-size: 13.5px;
  background: var(--accent); color: #fff; text-decoration: none; font-weight: 700;
}

/* ---------- 旅程統計 ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin: 40px auto 8px; }
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  padding: 18px 20px;
}
.stat .num { font-size: 30px; font-weight: 800; letter-spacing: -0.02em; color: var(--ink); line-height: 1.2; }
.stat .num small { font-size: 15px; font-weight: 600; color: var(--ink-2); margin-left: 3px; }
.stat .lbl { font-size: 12.5px; color: var(--ink-3); margin-top: 3px; font-weight: 600; letter-spacing: 0.03em; }

/* ---------- 區段標題 ---------- */
.section { margin: 72px auto; scroll-margin-top: 76px; }
.section-head h2 { font-size: clamp(24px, 3.4vw, 32px); font-weight: 800; margin: 0 0 8px; }
.section-head p { color: var(--ink-2); margin: 0 0 24px; font-size: 15px; }
.section-head.center { text-align: center; }
.section-head.center p { max-width: 620px; margin-left: auto; margin-right: auto; }

/* ---------- 足跡回放 ---------- */
.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.tab {
  padding: 8px 16px; border-radius: 10px; font-size: 13.5px; font-weight: 600; cursor: pointer;
  background: var(--surface); color: var(--ink-2); border: 1px solid var(--border);
  transition: all 0.15s; font-family: inherit;
}
.tab:hover { border-color: var(--border-strong); color: var(--ink); }
.tab.active { background: var(--accent); border-color: var(--accent); color: #fff; }

.map-box {
  width: 100%; height: 440px; border-radius: 18px; border: 1px solid var(--border);
  position: relative; z-index: 0; overflow: hidden; background: var(--surface);
}
.map-box.tall { height: 480px; }

.visits { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 10px; margin-top: 14px; }
.visit {
  display: flex; align-items: flex-start; gap: 12px; padding: 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  cursor: pointer; transition: border-color 0.15s, transform 0.15s;
}
.visit:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.visit img { width: 76px; height: 76px; border-radius: 10px; object-fit: cover; flex-shrink: 0; }
.visit .n {
  width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0; margin-top: 2px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 12px; font-weight: 800;
}
.visit .t { font-size: 14px; font-weight: 700; }
.visit .s { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.visit .c { font-size: 12px; color: var(--ink-2); font-style: italic; margin-top: 4px; }
.legend-row { display: flex; flex-wrap: wrap; gap: 10px; }
.legend-item {
  display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px; font-size: 13px; font-weight: 600;
  color: var(--ink-2); background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
}
.legend-item .bar { width: 26px; height: 4px; border-radius: 2px; }
.legend-item .dot { width: 10px; height: 10px; border-radius: 50%; }

/* ---------- 每日時間軸 ---------- */
.day-head { display: flex; align-items: center; gap: 16px; margin-bottom: 10px; }
.day-badge {
  width: 54px; height: 54px; flex-shrink: 0; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 21px; color: #fff;
  box-shadow: 0 6px 18px -6px rgba(0, 0, 0, 0.6);
}
.day-head h2 { font-size: clamp(20px, 3vw, 27px); font-weight: 800; margin: 0; }
.day-head .route { color: var(--ink-2); font-size: 14px; margin-top: 2px; }
.day-head .today-chip {
  padding: 3px 12px; border-radius: 999px; font-size: 12px; font-weight: 800;
  background: var(--accent); color: #fff; margin-left: 6px; vertical-align: middle;
}
.day-actions { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; margin: 4px 0 26px 70px; font-size: 13px; }
.day-actions .replay-link { color: var(--accent); text-decoration: none; font-weight: 700; cursor: pointer; }
.day-actions .replay-link:hover { text-decoration: underline; }
.day-memo {
  margin: 0 0 26px 70px; padding: 10px 16px; font-size: 13.5px; color: #fbbf24;
  background: rgba(217, 119, 6, 0.10); border: 1px solid rgba(217, 119, 6, 0.25);
  border-radius: 12px;
}
.weather-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; font-size: 12.5px; font-weight: 600;
  color: var(--ink-2); background: var(--surface); border: 1px solid var(--border); border-radius: 999px;
}

.tl { position: relative; }
.tl::before {
  content: ''; position: absolute; top: 0; bottom: 0; left: 50%; width: 2px;
  background: linear-gradient(to bottom, transparent, #2a3650 8%, #2a3650 92%, transparent);
  transform: translateX(-50%);
}
.tl-item { position: relative; width: 50%; padding-bottom: 22px; }
.tl-item.left  { margin-right: auto; padding-right: 36px; text-align: right; }
.tl-item.right { margin-left: auto;  padding-left: 36px; }
.tl-item .dot {
  position: absolute; top: 22px; width: 13px; height: 13px; border-radius: 50%;
  border: 3px solid var(--bg); z-index: 2;
}
.tl-item.left .dot  { right: -7.5px; }
.tl-item.right .dot { left: -7.5px; }

.ev {
  display: inline-block; width: 100%; text-align: left;
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  padding: 18px 20px; transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.ev:hover { transform: translateY(-2px); border-color: var(--border-strong); box-shadow: 0 14px 34px -14px rgba(0, 0, 0, 0.7); }
.ev.hotel { border-left: 3px solid; }
.ev-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.tl-item.left .ev-top { flex-direction: row-reverse; }
.ev-time { font-size: 13px; font-weight: 700; color: var(--ink-3); white-space: nowrap; }
.ev-time.hl { color: var(--accent); }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 11px;
  border-radius: 999px; font-size: 11.5px; font-weight: 700; white-space: nowrap;
}
.ev h3 { font-size: 16.5px; font-weight: 800; margin: 0 0 6px; }
.ev .desc { font-size: 13.5px; color: var(--ink-2); margin: 0 0 10px; }
.ev-photo { width: 100%; max-height: 190px; object-fit: cover; border-radius: 12px; margin: 2px 0 10px; cursor: zoom-in; }
.ev-memo {
  font-size: 12.5px; color: #fbbf24; font-style: italic; margin: 0 0 10px;
  padding-left: 10px; border-left: 2px solid rgba(217, 119, 6, 0.5);
}
.tl-item.left .ev-memo { border-left: none; border-right: 2px solid rgba(217, 119, 6, 0.5); padding-left: 0; padding-right: 10px; }
.ev-links { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; }
.tl-item.left .ev-links { justify-content: flex-end; }
.ev-links a, .ev-links button {
  color: var(--accent); text-decoration: none; font-weight: 600; display: inline-flex; align-items: center; gap: 6px;
  background: none; border: none; padding: 0; font-size: 13px; cursor: pointer; font-family: inherit;
}
.ev-links a:hover, .ev-links button:hover { text-decoration: underline; }
.ev-links .sub { color: var(--ink-3); }
.tl-item.left .ev { text-align: right; }
.tl-item.left .ev h3, .tl-item.left .ev .desc { text-align: right; }

.day-panel.today .ev { border-color: rgba(255, 255, 255, 0.12); }
.day-panel[hidden] { display: none; }
.day-tabs { margin-bottom: 28px; }
.day-photo {
  width: 100%; max-height: 360px; object-fit: cover; cursor: zoom-in;
  border-radius: 18px; border: 1px solid var(--border); margin-bottom: 24px;
}

/* ---------- 行程總覽表 ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); }
.ov-table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 560px; }
.ov-table th {
  text-align: left; padding: 13px 18px; font-size: 12px; font-weight: 700;
  letter-spacing: 0.06em; color: var(--ink-3); border-bottom: 1px solid var(--border);
}
.ov-table td { padding: 13px 18px; border-bottom: 1px solid var(--border); color: var(--ink-2); }
.ov-table tr:last-child td { border-bottom: none; }
.ov-table td:first-child { white-space: nowrap; font-weight: 700; color: var(--ink); }
.ov-table td:nth-child(3), .ov-table td:nth-child(4) { white-space: nowrap; }

/* ---------- 主題地圖（景點 / 購物 / 美食） ---------- */
.groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; margin-top: 26px; }
.group-card { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; overflow: hidden; }
.group-head { padding: 16px 20px; border-bottom: 1px solid var(--border); }
.group-head h3 { margin: 0; font-size: 16.5px; font-weight: 800; display: flex; align-items: center; gap: 9px; }
.group-head .sub { font-size: 12.5px; color: var(--ink-2); margin-top: 3px; }
.group-body { padding: 8px 8px; }
.group-item {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 11px 12px; border-radius: 12px; text-decoration: none;
  transition: background 0.15s;
}
.group-item:hover { background: rgba(255, 255, 255, 0.05); }
.group-item .gi-name { font-size: 14px; font-weight: 700; }
.group-item .gi-desc { font-size: 12.5px; color: var(--ink-2); margin-top: 2px; }
.group-item .gi-arrow { color: var(--ink-3); font-size: 12px; margin-top: 5px; flex-shrink: 0; }
.group-item:hover .gi-arrow { color: var(--accent); }

/* ---------- 準備清單 / 實用資訊 / 訂票 / 提醒 ---------- */
.ck-item {
  display: flex; align-items: flex-start; gap: 12px; padding: 10px 12px;
  border-radius: 12px; cursor: pointer; font-size: 14px; color: var(--ink-2);
  transition: background 0.15s;
}
.ck-item:hover { background: rgba(255, 255, 255, 0.05); }
.ck-item input {
  appearance: none; width: 18px; height: 18px; margin: 2px 0 0; flex-shrink: 0;
  border: 2px solid var(--ink-3); border-radius: 6px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background 0.15s, border-color 0.15s;
}
.ck-item input:checked { background: var(--accent); border-color: var(--accent); }
.ck-item input:checked::after { content: '✓'; color: #fff; font-size: 12px; font-weight: 800; line-height: 1; }
.ck-item input:checked + span { color: var(--ink-3); text-decoration: line-through; }

.info-row {
  display: flex; justify-content: space-between; gap: 16px;
  padding: 10px 12px; font-size: 13.5px; border-radius: 10px;
}
.info-row:hover { background: rgba(255, 255, 255, 0.04); }
.info-label { color: var(--ink-3); font-weight: 600; white-space: nowrap; }
.info-value { color: var(--ink); text-align: right; }
.info-value a { color: var(--accent); }

.reminder-list { display: flex; flex-direction: column; gap: 10px; }
.reminder-item {
  display: flex; align-items: flex-start; gap: 12px; padding: 13px 18px;
  font-size: 14px; color: #fbbf24; border-radius: 14px;
  background: rgba(217, 119, 6, 0.10); border: 1px solid rgba(217, 119, 6, 0.25);
}
.reminder-item i { margin-top: 3px; }

/* ---------- 頁尾 ---------- */
.footer {
  border-top: 1px solid var(--border); margin-top: 80px; padding: 36px 20px 44px;
  text-align: center; font-size: 13px; color: var(--ink-3);
}
.footer a { color: var(--ink-3); }

/* ---------- Lightbox ---------- */
.lb {
  display: none; position: fixed; inset: 0; z-index: 9999;
  background: rgba(2, 4, 12, 0.92); cursor: zoom-out;
  align-items: center; justify-content: center; flex-direction: column; gap: 14px;
}
.lb.open { display: flex; }
.lb img { max-height: 86vh; max-width: 92vw; border-radius: 14px; object-fit: contain; box-shadow: 0 12px 48px rgba(0, 0, 0, 0.7); }
.lb p { color: var(--ink); font-size: 14px; max-width: 80vw; text-align: center; margin: 0; }
.lb .x { position: absolute; top: 14px; right: 22px; color: #fff; font-size: 30px; line-height: 1; cursor: pointer; }
.lb .lb-arrow {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 1;
  color: #fff; font-size: 46px; line-height: 1; padding: 20px 14px;
  cursor: pointer; user-select: none; opacity: 0.7;
}
.lb .lb-arrow:hover { opacity: 1; }
.lb .lb-prev { left: 4px; }
.lb .lb-next { right: 4px; }

/* ---------- Leaflet 深色調整 ---------- */
.leaflet-container { z-index: 10; background: #0d1326; font-family: inherit; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--surface-2); color: var(--ink); box-shadow: 0 8px 24px rgba(0,0,0,0.5); }
.leaflet-popup-content { font-family: inherit; font-size: 13px; }
.leaflet-container a.leaflet-popup-close-button { color: var(--ink-3); }
.leaflet-control-attribution { background: rgba(10, 15, 30, 0.7) !important; color: var(--ink-3) !important; }
.leaflet-control-attribution a { color: var(--ink-2) !important; }
.leaflet-bar a { background: var(--surface-2); color: var(--ink); border-color: var(--border-strong); }
.leaflet-bar a:hover { background: #232d47; }

/* ---------- 響應式 ---------- */
@media (min-width: 1400px) {
  .map-box { height: 520px; }
  .map-box.tall { height: 580px; }
}

@media (max-width: 768px) {
  .nav-links, .nav-back { display: none; }
  .nav-burger { display: block; }

  .tl::before { left: 22px; transform: none; }
  .tl-item, .tl-item.left, .tl-item.right {
    width: 100%; margin: 0; padding: 0 0 18px 48px; text-align: left;
  }
  .tl-item.left .dot, .tl-item.right .dot { left: 16px; right: auto; }
  .tl-item.left .ev, .tl-item.left .ev h3, .tl-item.left .ev .desc { text-align: left; }
  .tl-item.left .ev-top { flex-direction: row; }
  .tl-item.left .ev-links { justify-content: flex-start; }
  .tl-item.left .ev-memo { border-right: none; border-left: 2px solid rgba(217, 119, 6, 0.5); padding-right: 0; padding-left: 10px; }

  .day-actions, .day-memo { margin-left: 0; }
  .map-box { height: 360px; }
  .hero { padding-top: 100px; }
}
