/* ============================================================
   艾維斯旅行所 ELVIS TRAVEL LAB — 品牌樣式系統
   ============================================================ */

:root {
  /* 品牌色彩系統（規格書 §5） */
  --color-primary: #F47C62;      /* 夕陽珊瑚橘 */
  --color-primary-dark: #E36347;
  --color-primary-soft: #FDE6E0;
  --color-secondary: #55B9D8;    /* 天空藍 */
  --color-secondary-soft: #E3F4F9;
  --color-nature: #6FA77A;       /* 森林綠 */
  --color-nature-soft: #E7F2E9;
  --color-accent: #F3C969;       /* 陽光金 */
  --color-accent-soft: #FCF2DA;
  --color-bg: #FFF9F3;           /* 暖米白 */
  --color-surface: #FFFFFF;
  --color-text: #263746;         /* 深藍灰 */
  --color-text-secondary: #71808C;
  --color-border: #EFE3D8;

  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-pill: 999px;

  --shadow-sm: 0 2px 8px rgba(38, 55, 70, 0.06);
  --shadow-md: 0 8px 24px rgba(38, 55, 70, 0.10);
  --shadow-lg: 0 16px 40px rgba(38, 55, 70, 0.14);

  --font-display: "Noto Serif TC", "Georgia", serif;
  --font-body: "Noto Sans TC", -apple-system, BlinkMacSystemFont, "PingFang TC", "Microsoft JhengHei", sans-serif;

  --max-width: 960px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  scroll-behavior: smooth;
}

body {
  font-size: 16px;
  line-height: 1.6;
  padding-bottom: 72px; /* space for mobile sticky CTA */
}

img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }
a { color: inherit; text-decoration: none; }

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255, 249, 243, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--color-border);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-mark-link {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.brand-mark-img {
  width: 46px;
  height: 46px;
  object-fit: contain;
  flex-shrink: 0;
  display: block;
}

.brand-text-link {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.brand-text-zh {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
  line-height: 1.2;
  color: var(--color-text);
}

.brand-text-en {
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--color-text-secondary);
  text-transform: uppercase;
}

.nav-desktop {
  display: none;
  gap: 28px;
  align-items: center;
  font-size: 14px;
  font-weight: 500;
}

.nav-desktop a {
  color: var(--color-text-secondary);
  transition: color 0.15s ease;
}
.nav-desktop a:hover,
.nav-desktop a.active { color: var(--color-primary); }

.nav-menu-btn {
  display: flex;
  background: none;
  border: none;
  padding: 8px;
  color: var(--color-text);
}

@media (min-width: 768px) {
  .nav-desktop { display: flex; }
  .nav-menu-btn { display: none; }
}

/* ---------- Hero ---------- */
.hero {
  padding: 40px 0 26px;
  text-align: left;
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--color-primary-soft);
  color: var(--color-primary-dark);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  margin-bottom: 18px;
  letter-spacing: 0.02em;
}

.hero h1 {
  font-family: var(--font-display);
  font-size: 26px;
  line-height: 1.35;
  font-weight: 700;
  margin: 0 0 10px;
  color: var(--color-text);
}

.hero h1 .accent { color: var(--color-primary); }

.hero p.sub {
  font-size: 15px;
  color: var(--color-text-secondary);
  margin: 0;
}

@media (min-width: 768px) {
  .hero { padding: 56px 0 32px; }
  .hero h1 { font-size: 34px; }
  .hero p.sub { font-size: 16px; }
}

/* ---------- Cards (generic) ---------- */
.card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
  padding: 20px;
}

/* ---------- Form ---------- */
.form-card {
  margin-top: 8px;
}

.field-group {
  margin-bottom: 20px;
}

.field-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--color-text);
}

.field-label .required-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--color-primary);
  display: inline-block;
}

.text-input {
  width: 100%;
  padding: 13px 16px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--color-border);
  background: var(--color-bg);
  font-size: 15px;
  color: var(--color-text);
  transition: border-color 0.15s ease, background 0.15s ease;
}
.text-input:focus {
  outline: none;
  border-color: var(--color-primary);
  background: #fff;
}

.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  padding: 10px 16px;
  border-radius: var(--radius-pill);
  border: 1.5px solid var(--color-border);
  background: var(--color-surface);
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text-secondary);
  transition: all 0.15s ease;
  white-space: nowrap;
}

.chip:active { transform: scale(0.97); }

.chip.selected {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
  box-shadow: var(--shadow-sm);
}

.chip.style-chip.selected {
  background: var(--color-nature);
  border-color: var(--color-nature);
}

.budget-input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}
.budget-input-wrap span { color: var(--color-text-secondary); font-size: 14px; }

/* Advanced (collapsible) */
.advanced-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: none;
  border: none;
  padding: 14px 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--color-secondary);
  border-top: 1px solid var(--color-border);
  margin-top: 8px;
}
.advanced-toggle .chevron { transition: transform 0.2s ease; }
.advanced-toggle.open .chevron { transform: rotate(180deg); }

.advanced-panel {
  display: none;
  padding-top: 4px;
}
.advanced-panel.open { display: block; }

.mini-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--color-border);
  font-size: 14px;
}
.mini-row:last-child { border-bottom: none; }

.toggle-switch {
  position: relative;
  width: 46px;
  height: 26px;
  border-radius: var(--radius-pill);
  background: var(--color-border);
  border: none;
  transition: background 0.2s ease;
  flex-shrink: 0;
}
.toggle-switch::after {
  content: "";
  position: absolute;
  top: 3px; left: 3px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease;
}
.toggle-switch.on { background: var(--color-primary); }
.toggle-switch.on::after { transform: translateX(20px); }

.stepper {
  display: flex;
  align-items: center;
  gap: 12px;
}
.stepper button {
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 1.5px solid var(--color-border);
  background: #fff;
  font-size: 16px;
  line-height: 1;
  color: var(--color-primary);
}
.stepper .val { min-width: 20px; text-align: center; font-weight: 600; }

/* ---------- CTA ---------- */
.cta-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 16px 24px;
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
  color: #fff;
  border: none;
  border-radius: var(--radius-pill);
  font-size: 16px;
  font-weight: 700;
  box-shadow: 0 8px 20px rgba(244, 124, 98, 0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.cta-primary:active { transform: scale(0.98); }
.cta-primary:disabled { opacity: 0.6; box-shadow: none; }

.cta-secondary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px 24px;
  background: var(--color-surface);
  color: var(--color-text);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-pill);
  font-size: 15px;
  font-weight: 600;
}

.cta-optimize {
  background: var(--color-secondary-soft);
  color: #1a7893;
  border: 1.5px solid var(--color-secondary);
}

/* ---------- Loading ---------- */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255, 249, 243, 0.97);
  backdrop-filter: blur(6px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 24px;
}
.loading-overlay.show { display: flex; }

.loading-spinner {
  width: 56px; height: 56px;
  border-radius: 50%;
  border: 4px solid var(--color-primary-soft);
  border-top-color: var(--color-primary);
  animation: spin 0.9s linear infinite;
  margin-bottom: 24px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-steps {
  list-style: none;
  padding: 0;
  margin: 0;
  width: 100%;
  max-width: 280px;
}
.loading-steps li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  font-size: 14px;
  color: var(--color-text-secondary);
  opacity: 0.4;
  transition: opacity 0.3s ease, color 0.3s ease;
}
.loading-steps li.active {
  opacity: 1;
  color: var(--color-text);
  font-weight: 600;
}
.loading-steps li.done { opacity: 0.7; color: var(--color-nature); }
.loading-steps li .dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--color-border);
  flex-shrink: 0;
}
.loading-steps li.active .dot { background: var(--color-primary); }
.loading-steps li.done .dot { background: var(--color-nature); }

/* ---------- Section titles ---------- */
.section-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  margin: 32px 0 14px;
}

/* ---------- Trip result header ---------- */
.trip-header { margin-bottom: 20px; }
.trip-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 12px;
}
.trip-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.meta-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-secondary);
}

.ai-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--color-accent-soft);
  color: #8a6c1f;
  font-size: 12px;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  margin-bottom: 10px;
}

.ai-disclaimer {
  font-size: 12px;
  color: var(--color-text-secondary);
  background: var(--color-surface);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-top: 16px;
  line-height: 1.6;
}

/* ---------- Day tabs ---------- */
.day-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 0 12px;
  margin-bottom: 8px;
  scrollbar-width: none;
}
.day-tabs::-webkit-scrollbar { display: none; }

.day-tab {
  flex-shrink: 0;
  padding: 10px 18px;
  border-radius: var(--radius-pill);
  border: 1.5px solid var(--color-border);
  background: var(--color-surface);
  font-size: 14px;
  font-weight: 700;
  color: var(--color-text-secondary);
}
.day-tab.active {
  background: var(--color-text);
  border-color: var(--color-text);
  color: #fff;
}

/* ---------- Day card ---------- */
.day-panel { display: none; }
.day-panel.active { display: block; }

.day-card-header {
  margin-bottom: 16px;
}
.day-card-header .day-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--color-primary);
  letter-spacing: 0.08em;
}
.day-card-header h3 {
  font-family: var(--font-display);
  font-size: 19px;
  margin: 4px 0 0;
}
.day-route {
  font-size: 13px;
  color: var(--color-text-secondary);
  margin-top: 4px;
}

/* timeline */
.timeline {
  position: relative;
  padding-left: 26px;
}
.timeline::before {
  content: "";
  position: absolute;
  left: 9px; top: 6px; bottom: 6px;
  width: 2px;
  background: var(--color-border);
}

.timeline-item {
  position: relative;
  margin-bottom: 18px;
}
.timeline-item::before {
  content: "";
  position: absolute;
  left: -26px; top: 4px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--color-primary);
  border: 2px solid var(--color-bg);
}
.timeline-item.type-transport::before { background: var(--color-secondary); }
.timeline-item.type-meal::before { background: var(--color-accent); }
.timeline-item.type-hotel::before { background: var(--color-text-secondary); }
.timeline-item.type-nature::before { background: var(--color-nature); }

.timeline-time {
  font-size: 13px;
  font-weight: 700;
  color: var(--color-text-secondary);
  margin-bottom: 3px;
}

.spot-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-top: 6px;
}

.spot-card-top {
  display: flex;
  gap: 12px;
}

/* ---------- 拖曳把手（§39, V3.1） ---------- */
.drag-handle {
  flex-shrink: 0;
  width: 28px; height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--color-text-secondary);
  background: none;
  border: none;
  cursor: grab;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}
.drag-handle:active { cursor: grabbing; color: var(--color-primary-dark); }

.timeline-item.dragging {
  position: relative;
  z-index: 50;
}
.timeline-item.dragging .spot-card {
  box-shadow: var(--shadow-lg);
  border-color: var(--color-primary);
  opacity: 0.96;
}

.spot-thumb {
  width: 64px; height: 64px;
  border-radius: var(--radius-sm);
  background: var(--color-primary-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  flex-shrink: 0;
}

.spot-info { flex: 1; min-width: 0; }
.spot-name { font-weight: 700; font-size: 15px; margin: 0 0 2px; }
.spot-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 4px 0 6px;
}
.spot-tag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: var(--color-nature-soft);
  color: #3f6b48;
  font-weight: 600;
}
.spot-tag.duration { background: var(--color-secondary-soft); color: #1a7893; }
.spot-reason {
  font-size: 13px;
  color: var(--color-text-secondary);
  margin: 4px 0 0;
  line-height: 1.5;
}
.spot-next-transport {
  font-size: 12px;
  color: var(--color-secondary);
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.spot-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}
.spot-actions button {
  flex: 1;
  padding: 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-secondary);
}
.spot-actions button.danger { color: #C0503A; }
.spot-actions button.swap { color: var(--color-secondary); }
/* V11 待辦#5：地圖連結是 <a> 不是 <button>，樣式需與 .spot-actions button
   對齊（flex/padding/邊框/字級皆相同），但另外用 class 命名避免和既有
   query selector 混淆；連結置中並移除底線，視覺上與其他按鈕一致。 */
.spot-actions .map-link-btn {
  flex: 1;
  padding: 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  font-size: 12px;
  font-weight: 600;
  color: var(--color-secondary);
  text-align: center;
  text-decoration: none;
  display: inline-block;
}

.event-simple {
  font-size: 14px;
  padding: 10px 14px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text);
}

/* ---------- gap notice ---------- */
.gap-notice {
  background: var(--color-accent-soft);
  border-radius: var(--radius-md);
  padding: 14px;
  margin: 10px 0;
  font-size: 13px;
}
.gap-notice p { margin: 0 0 10px; font-weight: 600; }
.gap-options { display: flex; flex-direction: column; gap: 8px; }
.gap-options button {
  text-align: left;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: #fff;
  font-size: 13px;
}

/* ---------- budget ---------- */
.budget-rows { margin: 10px 0; }
.budget-row {
  display: flex;
  justify-content: space-between;
  padding: 9px 0;
  border-bottom: 1px solid var(--color-border);
  font-size: 14px;
}
.budget-row:last-child { border-bottom: none; }
.budget-row .amt { font-weight: 700; }

.budget-total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding-top: 14px;
  margin-top: 4px;
  border-top: 2px solid var(--color-text);
}
.budget-total .label { font-weight: 700; }
.budget-total .amt { font-size: 20px; font-weight: 800; color: var(--color-primary); font-family: var(--font-display); }

.budget-status {
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}
.budget-status.ok { background: var(--color-nature-soft); color: #3f6b48; }
.budget-status.over { background: var(--color-primary-soft); color: #C0503A; }

/* ---------- empty state ---------- */
.empty-state {
  text-align: center;
  padding: 60px 24px;
}
.empty-state .icon { font-size: 48px; margin-bottom: 16px; }
.empty-state h2 {
  font-family: var(--font-display);
  font-size: 20px;
  margin: 0 0 8px;
}
.empty-state p {
  color: var(--color-text-secondary);
  font-size: 14px;
  margin: 0 0 24px;
}

/* ---------- error state ---------- */
.error-state {
  text-align: center;
  padding: 40px 24px;
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
}
.error-state .icon { font-size: 40px; margin-bottom: 12px; }
.error-state h3 { font-family: var(--font-display); margin: 0 0 8px; }
.error-state p { color: var(--color-text-secondary); font-size: 14px; margin: 0 0 20px; }
.error-actions { display: flex; flex-direction: column; gap: 10px; }

/* ---------- mobile sticky bar ---------- */
.sticky-cta {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 50;
  background: rgba(255, 249, 243, 0.96);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--color-border);
  padding: 10px 20px calc(10px + env(safe-area-inset-bottom));
}
@media (min-width: 768px) {
  .sticky-cta { display: none; }
  body { padding-bottom: 0; }
}

/* ---------- footer ---------- */
.site-footer {
  margin-top: 60px;
  padding: 20px 0 40px;
  border-top: 1px solid var(--color-border);
  text-align: center;
}
.footer-status-line {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
  font-size: 12px;
  color: var(--color-text-secondary);
}
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.status-dot.checking { background: var(--color-accent); }
.status-dot.online { background: var(--color-nature); }
.status-dot.offline { background: #C0503A; }

/* ---------- utility ---------- */
.hidden { display: none !important; }
.flex-row { display: flex; align-items: center; gap: 8px; }
.mt-16 { margin-top: 16px; }
.text-center { text-align: center; }

/* Mobile menu drawer */
.mobile-drawer {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: none;
}
.mobile-drawer.open { display: block; }
.mobile-drawer-backdrop {
  position: absolute; inset: 0;
  background: rgba(38, 55, 70, 0.4);
}
.mobile-drawer-panel {
  position: absolute;
  top: 0; right: 0;
  width: 78%;
  max-width: 300px;
  height: 100%;
  background: var(--color-bg);
  padding: 24px;
  box-shadow: var(--shadow-lg);
}
.mobile-drawer-panel a {
  display: block;
  padding: 14px 4px;
  font-size: 16px;
  font-weight: 600;
  border-bottom: 1px solid var(--color-border);
}

/* ---------- Print / PDF (規格書 §20) ---------- */
@media print {
  .site-header, .sticky-cta, .mobile-drawer, .loading-overlay,
  .spot-actions, .day-tabs, .gap-notice, .swap-options-panel,
  #reoptimizeBtn, #shareBtn, #pdfBtn, #recheckBtn, #undoOptimizeBtn,
  .pdf-cover, .drag-handle { display: none !important; }

  body { padding-bottom: 0; background: #fff; }
  .day-panel { display: block !important; page-break-inside: avoid; margin-bottom: 24px; }
  .card, .spot-card { box-shadow: none; border: 1px solid #ddd; }
  .container { max-width: 100%; }
  .ai-disclaimer { border: 1px solid #ccc; }
}

/* ============================================================
   V3 新增樣式
   ============================================================ */

/* ---------- 快速旅行範例（§29） ---------- */
.quick-examples { margin-top: 20px; }
.quick-examples-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-secondary);
  margin: 0 0 10px;
}
.quick-examples-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.quick-example-btn {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.quick-example-btn:hover { box-shadow: var(--shadow-sm); transform: translateY(-1px); }

/* ---------- 欄位補充說明 ---------- */
.field-hint {
  font-weight: 400;
  font-size: 12px;
  color: var(--color-text-secondary);
  margin-left: 6px;
}

/* ---------- 資料查證徽章（§6, §8） ---------- */
.source-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
}
.source-badge.verified { background: var(--color-nature-soft); color: #3f6b48; }
.source-badge.unverified { background: var(--color-accent-soft); color: #8a6c1f; }

/* ---------- 鎖定 / 已手動調整 徽章 ---------- */
.spot-flags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.flag-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  background: var(--color-secondary-soft);
  color: #1a7893;
}
.flag-badge.locked { background: var(--color-primary-soft); color: #C0503A; }

/* ---------- 景點卡片鎖定狀態 ---------- */
.spot-card.is-locked { border: 1.5px solid var(--color-primary); }

/* ---------- 住宿卡片 ---------- */
.accommodation-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--color-secondary-soft);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 14px;
  font-size: 13px;
}
.accommodation-card .icon { font-size: 20px; }
.accommodation-card .name { font-weight: 700; color: var(--color-text); }
.accommodation-card .area { color: var(--color-text-secondary); font-size: 12px; }

/* ---------- 品質檢查摘要（§33） ---------- */
.quality-check-card { margin-top: 10px; }
.quality-check-card ul { list-style: none; margin: 0; padding: 0; }
.quality-check-card li { font-size: 13px; padding: 4px 0; }
.quality-check-card li.pass { color: #3f6b48; }
.quality-check-card li.warn { color: #C0503A; }

/* ---------- 分享頁提示 ---------- */
.cloud-status-note {
  font-size: 12px;
  color: var(--color-text-secondary);
  margin-top: 8px;
}

/* ---------- PDF 封面頁（§28, V3.1） ---------- */
.pdf-cover { display: none; }
@media print {
  .pdf-cover {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    page-break-after: always;
    background: linear-gradient(155deg, var(--color-primary-soft) 0%, var(--color-secondary-soft) 100%);
  }
  .pdf-cover-inner {
    max-width: 620px;
    margin: 0 auto;
    padding: 48px;
    text-align: center;
  }
  .pdf-cover-brand {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--color-text-secondary);
    margin-bottom: 28px;
  }
  .pdf-cover-title {
    font-family: var(--font-display);
    font-size: 40px;
    font-weight: 900;
    color: var(--color-text);
    margin: 0 0 10px;
    line-height: 1.3;
  }
  .pdf-cover-destination {
    font-size: 17px;
    color: var(--color-primary-dark);
    font-weight: 700;
    margin: 0 0 24px;
  }
  .pdf-cover-meta {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px 18px;
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 20px;
  }
  .pdf-cover-budget {
    font-size: 14px;
    font-weight: 700;
    color: var(--color-text);
    margin: 0 0 20px;
  }
  .pdf-cover-summary {
    font-size: 13px;
    line-height: 1.8;
    color: var(--color-text-secondary);
    margin: 0 0 32px;
  }
  .pdf-cover-footer {
    font-family: var(--font-display);
    font-size: 14px;
    color: var(--color-text-secondary);
    border-top: 1px solid var(--color-border);
    padding-top: 18px;
  }
}

/* ---------- 手動調整 / 底部 Action Sheet（§38） ---------- */
.action-sheet-backdrop {
  position: fixed; inset: 0; background: rgba(38,55,70,0.4);
  z-index: 300; display: none;
}
.action-sheet-backdrop.open { display: block; }
.action-sheet {
  position: fixed; left: 0; right: 0; bottom: 0;
  background: var(--color-surface);
  border-radius: 20px 20px 0 0;
  padding: 10px 16px calc(16px + env(safe-area-inset-bottom));
  box-shadow: var(--shadow-lg);
  z-index: 301;
  transform: translateY(100%);
  transition: transform 0.2s ease;
}
.action-sheet.open { transform: translateY(0); }
.action-sheet .handle {
  width: 36px; height: 4px; background: var(--color-border);
  border-radius: 999px; margin: 6px auto 14px;
}
.action-sheet button {
  display: block; width: 100%; text-align: left;
  padding: 14px 8px; font-size: 15px; font-weight: 600;
  border-bottom: 1px solid var(--color-border);
  background: none; border-left: none; border-right: none; border-top: none;
  color: var(--color-text);
}
.action-sheet button:last-child { border-bottom: none; }
.action-sheet button.danger { color: var(--color-primary-dark); }

/* V11 待辦#4／#5：「查看」彈窗改版——原本只有名稱＋一句話就結束，
   現在補上分類／停留時間／來源徽章／營業資訊／地址／地圖預覽／導航與
   分享連結。這裡新增的 class 只作用在 .action-sheet-detail 內，不影響
   其他地方共用的 .action-sheet（例如「重新最佳化」模式選單）。 */
.action-sheet-detail { max-height: 86vh; overflow-y: auto; }
.as-detail-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 10px;
}
.as-detail-icon {
  font-size: 28px;
  line-height: 1;
  flex-shrink: 0;
}
.as-detail-title {
  font-weight: 700;
  font-size: 17px;
  margin: 0 0 6px;
  color: var(--color-text);
}
.as-detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.as-detail-text {
  font-size: 13px;
  color: var(--color-text);
  line-height: 1.6;
  margin: 0 0 8px;
}
.as-detail-text.as-detail-secondary { color: var(--color-text-secondary); }
.as-detail-hint {
  font-size: 12px;
  color: var(--color-text-secondary);
  margin: 8px 0 0;
  line-height: 1.5;
}
.as-map-wrap {
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--color-border);
  margin: 10px 0 10px;
}
.as-map-embed {
  width: 100%;
  height: 200px;
  border: none;
  display: block;
}
.as-map-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 6px;
}
.as-map-actions .as-map-link {
  flex: 1 1 30%;
  min-width: 100px;
  text-align: center;
  font-size: 12px;
  padding: 10px 6px;
  cursor: pointer;
}

/* ============================================================
   V5 新增樣式：一句話規劃旅行（§12-14）、行程健檢（§21-22）、
   最佳化模式選擇（§15）、住宿路線適合度（§23）
   ============================================================ */

.mt-8 { margin-top: 8px; }

.nl-card { margin-top: 20px; }
.nl-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 17px;
  color: var(--color-text);
  margin: 0 0 12px;
}
.nl-textarea {
  resize: vertical;
  min-height: 76px;
  line-height: 1.5;
  font-family: inherit;
}
.link-btn {
  background: none;
  border: none;
  color: var(--color-primary);
  font-size: 13px;
  font-weight: 600;
  padding: 6px 0;
  text-align: left;
  cursor: pointer;
}
.nl-back-row { margin: 0 0 12px; }

.nl-confirm {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px dashed var(--color-border);
}
.nl-confirm-title {
  font-weight: 700;
  font-size: 15px;
  margin: 0 0 10px;
  color: var(--color-text);
}
.nl-confirm-list {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
  color: var(--color-text-secondary);
}
.nl-confirm-key { font-weight: 600; color: var(--color-text); }
.nl-confirm-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.nl-confirm-actions .cta-primary,
.nl-confirm-actions .cta-secondary {
  flex: 1 1 auto;
}

/* ---------- 健檢卡（§21-22） ---------- */
.health-card { margin-top: 12px; }
.health-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--color-border);
  font-size: 14px;
}
.health-row:last-of-type { border-bottom: none; }
.health-stars { color: var(--color-accent, #E0A83E); letter-spacing: 1px; }
.health-overall {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1.5px solid var(--color-border);
  text-align: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  color: var(--color-primary);
}
.health-disclaimer {
  margin-top: 8px;
  font-size: 12px;
  color: var(--color-text-secondary);
  text-align: center;
}

/* ---------- 地理路線驗證（V6 待辦#2，真實 Google Maps Distance Matrix） ---------- */
.geo-check-card { margin-top: 12px; }
.geo-check-intro {
  font-size: 13.5px;
  color: var(--color-text-secondary);
  margin: 0 0 10px;
  line-height: 1.6;
}
.geo-check-summary {
  font-size: 13.5px;
  font-weight: 600;
  margin: 0 0 10px;
}
.geo-check-summary.pass { color: #3f6b48; }
.geo-check-summary.warn { color: #C0503A; }
.geo-check-subheading {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--color-text-secondary);
  margin: 14px 0 4px;
}
.geo-check-list { list-style: none; margin: 0; padding: 0; }
.geo-check-item {
  font-size: 13px;
  padding: 8px 0;
  border-bottom: 1px solid var(--color-border);
  line-height: 1.6;
}
.geo-check-item:last-of-type { border-bottom: none; }
.geo-check-item small { color: var(--color-text-secondary); }
.geo-check-item.underestimated { color: #C0503A; }
.geo-check-item.caution { color: #B8862E; }
.geo-check-item.unknown { color: var(--color-text-secondary); }
.geo-check-item.ok, .geo-check-item.overestimated { color: var(--color-text); }
.geo-check-disclaimer {
  margin-top: 10px;
  font-size: 11.5px;
  color: var(--color-text-secondary);
  text-align: center;
}

/* ---------- 最佳化模式選擇（§15） ---------- */
.optimize-mode-sheet .mode-option {
  display: block;
  width: 100%;
  text-align: left;
  padding: 14px 16px;
  margin-bottom: 8px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--color-border);
  background: var(--color-bg);
  font-size: 14px;
  color: var(--color-text);
  cursor: pointer;
}
.optimize-mode-sheet .mode-option strong { display: block; margin-bottom: 3px; font-size: 15px; }
.optimize-mode-sheet .mode-option span.desc { color: var(--color-text-secondary); font-size: 12.5px; }

/* ---------- 住宿路線適合度（§23） ---------- */
.accommodation-route-fit {
  margin-top: 6px;
  font-size: 12.5px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
}
.accommodation-route-fit.good { background: var(--color-nature-soft); color: #3f6b48; }
.accommodation-route-fit.fair { background: var(--color-accent-soft); color: #8a6c1f; }
.accommodation-route-fit.poor { background: #fde2e2; color: #a3403f; }

/* ---------- 交通時間軸（§5-6） ---------- */
.transport-next-line {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--color-text-secondary);
  margin-top: 6px;
}

/* ---------- 資料過期提醒（§37） ---------- */
.stale-data-notice {
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background: var(--color-accent-soft);
  color: #8a6c1f;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

/* ---------- §36：資料來源展開細節 ---------- */
.source-detail {
  margin-top: 8px;
  font-size: 12.5px;
  color: var(--color-text-secondary);
}
.source-detail summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--color-primary);
  list-style: none;
}
.source-detail summary::-webkit-details-marker { display: none; }
.source-detail summary::before { content: "▸ "; }
.source-detail[open] summary::before { content: "▾ "; }
.source-detail p { margin: 4px 0 0; }
.source-detail a { color: var(--color-primary); }
.source-detail .refresh-place-btn {
  margin-top: 8px;
  padding: 5px 12px;
  font-size: 11.5px;
}
/* V9 待辦#5：兩個查證按鈕（更新營業狀態／完整重新查證）並排顯示 */
.source-refresh-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.source-refresh-actions .refresh-place-btn {
  margin-top: 0;
}
.source-refresh-hint {
  margin-top: 6px !important;
  font-size: 11px;
  opacity: 0.8;
}

/* V10 待辦#5：「只清除特定欄位（進階）」巢狀展開區塊，讓使用者可以
   勾選 VOLATILE_PLACE_FIELDS 白名單內的任意子集合單獨清除快取，
   取代原本只有「清易過期欄位」／「整筆清除」二選一的限制。 */
.source-fields-detail {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed var(--color-border, #e0e0e0);
}
.source-fields-detail summary {
  cursor: pointer;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--color-text-secondary);
  list-style: none;
}
.source-fields-detail summary::-webkit-details-marker { display: none; }
.source-fields-detail summary::before { content: "▸ "; }
.source-fields-detail[open] summary::before { content: "▾ "; }
.source-fields-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin: 8px 0;
}
.field-checkbox {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  font-weight: 400;
  cursor: pointer;
}
.field-checkbox input[type="checkbox"] {
  margin: 0;
}
.refresh-fields-btn {
  margin-top: 2px;
  padding: 5px 12px;
  font-size: 11.5px;
}

/* ---------- V7 待辦#2：地理驗證自動觸發提示 ---------- */
.geo-check-summary.auto-note {
  color: var(--color-text-secondary);
  font-weight: 400;
}
