/* ============================================================
   設計語彙：旅行文件本
   紙色底 + 墨綠印記 + 鏽紅印章色，襯線標題／等寬時刻
   ============================================================ */

:root {
  --paper: #FBF9F3;
  --paper-alt: #F3EEE0;
  --ink: #1F2A38;
  --ink-soft: #5B6472;
  --ink-faint: #9AA0A8;
  --line: #D9CFB8;
  --accent: #2E5F58;       /* 墨綠：主色，像護照燙金 */
  --accent-soft: #E4ECE9;
  --stamp: #A6452E;        /* 鏽紅：像入境章 */
  --stamp-soft: #F3E3DD;
  --white: #FFFFFF;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(31, 42, 56, 0.06);
  --shadow-lift: 0 8px 24px rgba(31, 42, 56, 0.12);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Microsoft JhengHei', sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

/* 底紋：淡淡的紙質網格，像文件底紋 */
body {
  background-image:
    radial-gradient(circle at 1px 1px, rgba(31,42,56,0.035) 1px, transparent 0);
  background-size: 22px 22px;
}

h1, h2, h3, .display {
  font-family: 'Fraunces', Georgia, serif;
  letter-spacing: -0.01em;
}

.mono {
  font-family: 'Inter', sans-serif;
}

/* ---------------- 載入畫面 ---------------- */
.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--paper);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
}
.loading-image {
  width: min(220px, 70vw);
  height: 220px;
  border-radius: 16px;
  object-fit: cover;
}
.loading-emoji { font-size: 48px; }
.loading-text { font-size: 13px; color: var(--ink-soft); letter-spacing: 0.04em; }

/* ---------------- App 外框 ---------------- */
.app {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-bottom: 78px;
}

.app-header {
  padding: 22px 20px 16px;
  text-align: center;
  border-bottom: 1px dashed var(--line);
  background: var(--paper);
  position: sticky;
  top: 0;
  z-index: 10;
}
.header-emoji { font-size: 26px; margin-bottom: 4px; }
.header-image {
  display: block;
  margin: 0 auto 10px;
  width: 100%;
  max-width: 280px;
  height: 220px;
  border-radius: 14px;
  object-fit: cover;
  object-position: center center;
}
.header-title { font-size: 21px; font-weight: 600; margin: 0; color: var(--ink); }
.header-title-en { font-size: 11px; font-weight: 500; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink); margin-top: 2px; }
.header-meta { font-size: 12px; color: var(--ink-soft); margin-top: 6px; font-family: 'Inter', sans-serif; letter-spacing: 0.01em; }

.header-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin-top: 8px;
}
.header-chip {
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 20px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 500;
  white-space: nowrap;
}

.panels { flex: 1; padding: 18px 16px 8px; }
.panel { display: none; animation: fadeIn 0.25s ease; }
.panel.active { display: block; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ---------------- 分頁列（登機證票根風格） ---------------- */
.tabbar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 20;
  max-width: 560px;
  margin: 0 auto;
  display: flex;
  background: var(--ink);
  border-top: 1px solid rgba(255,255,255,0.08);
}
.tab-btn {
  flex: 1;
  background: none;
  border: none;
  color: rgba(246,241,230,0.55);
  padding: 12px 4px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  cursor: pointer;
  position: relative;
}
.tab-btn .tab-icon { font-size: 19px; }
.tab-btn.active { color: var(--paper); }
.tab-btn.active::before {
  content: "";
  position: absolute;
  top: 0; left: 50%;
  transform: translateX(-50%);
  width: 28px; height: 2px;
  background: var(--stamp);
  border-radius: 2px;
}

/* ---------------- 通用卡片 ---------------- */
.card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0 0 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ---------------- 總覽：基本資訊 ---------------- */
.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 16px;
}
.info-item { }
.info-label { font-size: 11px; color: var(--ink-faint); margin-bottom: 2px; }
.info-value { font-size: 14px; font-weight: 500; }
.info-item.full { grid-column: 1 / -1; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.chip {
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 20px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 500;
  white-space: nowrap;
}
.chip.stamp { background: var(--stamp-soft); color: var(--stamp); }

/* ---------------- 總覽：預算 ---------------- */
.budget-total {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 12px;
}
.budget-total-label { font-size: 12px; color: var(--ink-soft); }
.budget-total-amount { font-family: 'Inter', sans-serif; font-size: 24px; font-weight: 600; color: var(--accent); }
.budget-note { font-size: 11px; color: var(--ink-faint); margin-bottom: 12px; }

.budget-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-top: 1px dashed var(--line);
}
.budget-row:first-of-type { border-top: none; }
.budget-icon { font-size: 17px; width: 24px; text-align: center; }
.budget-label { flex: 1; font-size: 13px; }
.budget-note-inline { font-size: 11px; color: var(--ink-faint); display: block; }
.budget-amount { font-family: 'Inter', sans-serif; font-size: 13px; font-weight: 600; color: var(--ink); white-space: nowrap; }

.warning-box {
  margin-top: 12px;
  padding: 10px 12px;
  background: var(--stamp-soft);
  color: var(--stamp);
  font-size: 12px;
  border-radius: 10px;
  line-height: 1.5;
}

/* ---------------- 總覽：機票（登機證卡片） ---------------- */
.flight-card {
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 10px;
  position: relative;
}
.flight-leg-tag {
  position: absolute;
  top: -9px; left: 12px;
  background: var(--accent);
  color: var(--paper);
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 8px;
  letter-spacing: 0.03em;
}
.flight-route { font-size: 13px; font-weight: 600; margin: 6px 0 8px; }
.flight-time-row { display: flex; align-items: center; gap: 10px; }
.flight-point { flex: 1; text-align: center; }
.flight-time { font-family: 'Inter', sans-serif; font-size: 17px; font-weight: 600; }
.flight-place { font-size: 11px; color: var(--ink-soft); margin-top: 2px; }
.flight-arrow { color: var(--ink-faint); font-size: 14px; }
.flight-cabin { font-size: 10px; color: var(--ink-faint); text-align: right; margin-top: 6px; }

/* ---------------- 總覽：基地總覽 ---------------- */
.base-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-top: 1px dashed var(--line);
}
.base-row:first-of-type { border-top: none; }
.base-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }
.base-name { font-weight: 600; font-size: 13px; flex: 1; }
.base-nights { font-size: 11px; color: var(--stamp); font-weight: 600; }
.base-dates { font-size: 11px; color: var(--ink-soft); display: block; }

.route-map-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 12px;
  padding: 10px;
  border-radius: 10px;
  background: var(--accent);
  color: var(--paper);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
}

/* ---------------- 總覽：住宿 ---------------- */
.stay-row {
  padding: 10px 0;
  border-top: 1px dashed var(--line);
}
.stay-row:first-of-type { border-top: none; }
.stay-base { font-size: 10px; color: var(--accent); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.stay-name { font-size: 14px; font-weight: 600; margin: 2px 0 6px; }
.stay-links { display: flex; gap: 12px; }
.stay-links a { font-size: 12px; color: var(--ink-soft); text-decoration: none; border-bottom: 1px solid var(--line); }

/* ---------------- 行程：日期切換（票根） ---------------- */
.day-switcher {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 2px 14px;
  scrollbar-width: none;
}
.day-switcher::-webkit-scrollbar { display: none; }

.day-stub {
  flex-shrink: 0;
  min-width: 58px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 4px 7px;
  text-align: center;
  cursor: pointer;
  position: relative;
}
.day-stub .stub-num { font-family: 'Inter', sans-serif; font-size: 10px; color: var(--ink-faint); }
.day-stub .stub-date { font-size: 13px; font-weight: 600; margin-top: 2px; }
.day-stub.active {
  background: var(--ink);
  border-color: var(--ink);
}
.day-stub.active .stub-num { color: var(--stamp); }
.day-stub.active .stub-date { color: var(--paper); }
/* 票根打洞感 */
.day-stub::before, .day-stub::after {
  content: "";
  position: absolute;
  width: 8px; height: 8px;
  background: var(--paper);
  border-radius: 50%;
  bottom: -4px;
}
.day-stub::before { left: -4px; }
.day-stub::after { right: -4px; }

.day-content { position: relative; }
.day-swipe-hint { text-align: center; font-size: 11px; color: var(--ink-faint); margin-top: 14px; }

.day-header { margin-bottom: 12px; }
.day-base-line { font-size: 11px; color: var(--accent); font-weight: 600; margin-bottom: 4px; }
.day-title-row { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.day-title { font-size: 18px; font-weight: 600; margin: 0; }
.day-date-mono { font-family: 'Inter', sans-serif; font-size: 12px; color: var(--ink-soft); }
.day-map-link {
  display: inline-block;
  margin-top: 8px;
  font-size: 12px;
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid var(--accent-soft);
}

.notes-box {
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
  border-radius: 0 10px 10px 0;
  padding: 10px 14px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--ink);
  margin-bottom: 16px;
}
.notes-box-label { font-size: 11px; color: var(--accent); font-weight: 600; margin-bottom: 3px; display: block; }

.schedule-list { position: relative; padding-left: 4px; }
.schedule-item {
  display: flex;
  gap: 12px;
  padding-bottom: 14px;
  position: relative;
}
.schedule-item::before {
  content: "";
  position: absolute;
  left: 63px;
  top: 16px;
  bottom: -4px;
  width: 1px;
  background: var(--line);
}
.schedule-item:last-child::before { display: none; }
.schedule-time {
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  width: 42px;
  flex-shrink: 0;
  padding-top: 1px;
}
.schedule-marker {
  width: 20px;
  flex-shrink: 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 5px;
}
.schedule-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--stamp);
}
.schedule-icon {
  font-size: 14px;
  line-height: 1;
  margin-top: -3px;
}
.schedule-text { font-size: 13.5px; line-height: 1.5; flex: 1; }

.callout-box {
  border-radius: 0 10px 10px 0;
  padding: 10px 14px;
  font-size: 13px;
  line-height: 1.6;
  margin-bottom: 12px;
}
.callout-box .callout-label { font-size: 11px; font-weight: 600; margin-bottom: 4px; display: block; }
.callout-box ul { margin: 0; padding-left: 18px; }
.callout-box li { margin-bottom: 2px; }
.tip-box {
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
  color: var(--ink);
}
.tip-box .callout-label { color: var(--accent); }
.warning-box-day {
  background: var(--stamp-soft);
  border-left: 3px solid var(--stamp);
  color: var(--ink);
}
.warning-box-day .callout-label { color: var(--stamp); }

.links-box { margin-top: 18px; }
.link-row {
  display: flex;
  gap: 8px;
  align-items: baseline;
  padding: 7px 0;
  border-top: 1px dashed var(--line);
  font-size: 13px;
}
.link-row:first-of-type { border-top: none; }
.link-tag { font-size: 10px; color: var(--stamp); background: var(--stamp-soft); padding: 1px 7px; border-radius: 6px; flex-shrink: 0; }
.link-row a { color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--line); }

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--ink-faint);
  font-size: 13px;
}

/* ---------------- 打包 ---------------- */
.packing-progress-card {
  background: var(--ink);
  color: var(--paper);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
}
.packing-progress-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.packing-progress-label { font-size: 12px; color: rgba(246,241,230,0.6); }
.packing-progress-count { font-family: 'Inter', sans-serif; font-size: 16px; font-weight: 600; }
.progress-track { height: 6px; background: rgba(246,241,230,0.15); border-radius: 4px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--stamp); border-radius: 4px; transition: width 0.3s ease; }

.filter-chips { display: flex; gap: 7px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 6px; scrollbar-width: none; }
.filter-chips::-webkit-scrollbar { display: none; }
.filter-chip {
  flex-shrink: 0;
  font-size: 12px;
  padding: 6px 13px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: var(--white);
  color: var(--ink-soft);
  cursor: pointer;
  white-space: nowrap;
}
.filter-chip.active { background: var(--accent); border-color: var(--accent); color: var(--paper); }

.pack-group-title {
  font-size: 13px;
  font-weight: 600;
  margin: 18px 0 8px;
  color: var(--ink);
}
.pack-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 4px;
  border-top: 1px dashed var(--line);
  cursor: pointer;
}
.pack-item:first-of-type { border-top: none; }
.pack-check {
  width: 19px; height: 19px;
  border-radius: 5px;
  border: 1.5px solid var(--line);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: transparent;
}
.pack-item.checked .pack-check {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--paper);
}
.pack-item-name { font-size: 13.5px; flex: 1; }
.pack-item.checked .pack-item-name { color: var(--ink-faint); text-decoration: line-through; }
.pack-item-tags { display: flex; gap: 4px; }
.pack-item-tag { font-size: 9px; color: var(--ink-faint); background: var(--paper-alt); padding: 1px 6px; border-radius: 6px; }
.pack-reset {
  display: block;
  margin: 20px auto 4px;
  background: none;
  border: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 11px;
  padding: 6px 14px;
  border-radius: 20px;
  cursor: pointer;
}
