/* ============================================================
   JENNIFERTRAVELS — 統一設計系統 style.css
   涵蓋：根目錄首頁 / 0315_nantou / 0220_hokkaido
   ============================================================ */

/* --- Google Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+TC:wght@400;700&family=Noto+Sans+TC:wght@300;400;500;700;900&family=Noto+Sans+JP:wght@400;700&display=swap');

/* --- 設計 Token (CSS 變數) --- */
:root {
  --ink:           #1c1917;   /* 主文字 stone-900 */
  --paper:         #faf8f4;   /* 背景米白 */
  --warm:          #f5f0e8;   /* 次要暖背景 */
  --accent:        #c2410c;   /* 主強調橘紅 */
  --accent-mid:    #ea580c;   /* 中強調 */
  --accent-light:  #fff7ed;   /* 淡橘背景 */
  --accent-border: #fed7aa;   /* 橘色邊框 */
  --muted:         #78716c;   /* 次要文字 stone-500 */
  --border:        #e7e2d9;   /* 通用邊框 */
  --card-bg:       #ffffff;
}

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; }

/* --- Base --- */
body {
  background-color: var(--paper);
  font-family: 'Noto Sans TC', sans-serif;
  color: var(--ink);
  padding-bottom: 60px;
}

/* Paper texture overlay */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)' opacity='0.025'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
}

.serif { font-family: 'Noto Serif TC', serif; }

/* ============================================================
   HEADER（共用）
   ============================================================ */

/* ── Banner header — 暖沙褐色，比內容深一階 ── */
header,
.site-header,
.header-bg {
  background: #e8e0d3;
  color: var(--ink);
  position: relative;
  overflow: hidden;
  border-bottom: 2px solid #d4c9b8;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

/* 所有 header 內的文字顏色 */
header h1, header h2,
.site-header h1, .site-header h2,
.header-bg h1, .header-bg h2 {
  color: var(--ink);
}

header p, header span, header a:not(.back-btn),
.site-header p, .site-header span,
.header-bg p, .header-bg span {
  color: var(--muted);
}

/* 飛機裝飾水印 */
header::after,
.site-header::after,
.header-bg::after {
  content: '✈';
  position: absolute;
  right: -10px;
  bottom: -20px;
  font-size: 120px;
  opacity: 0.12;
  line-height: 1;
  pointer-events: none;
  color: var(--accent-border);
}

/* 返回按鈕 */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s;
  padding: 4px 0;
}
.back-btn:hover { color: var(--accent); }

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   根目錄首頁 — TRIP CARD LIST
   ============================================================ */

.trip-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: box-shadow 0.2s, transform 0.2s, border-color 0.2s;
  position: relative;
  overflow: hidden;
  display: block;
  text-decoration: none;
  opacity: 0;
  animation: fadeUp 0.4s ease forwards;
}
.trip-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: var(--accent-border);
  transition: background 0.2s;
}
.trip-card:hover {
  box-shadow: 0 8px 24px rgba(0,0,0,0.08);
  transform: translateY(-2px);
  border-color: #fda87a;
}
.trip-card:hover::before        { background: var(--accent); }
.trip-card:hover .card-title    { color: var(--accent); }
.trip-card:hover .arrow-icon    { transform: translateX(4px); color: var(--accent); }

.arrow-icon {
  transition: transform 0.2s, color 0.2s;
  color: #d6cfc6;
}

/* Tag badge */
.trip-tag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 2px 7px;
  border-radius: 99px;
  border: 1px solid var(--border);
  color: var(--muted);
  background: var(--warm);
}

/* Year divider */
.year-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.15em;
  color: var(--muted);
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 10px;
}
.year-label::before,
.year-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 64px 24px;
  color: var(--muted);
}

/* ============================================================
   南投 0315 — STICKY HEADER + TABS
   ============================================================ */

.sticky-top {
  position: sticky;
  top: 0;
  z-index: 20;
}

/* Day tab bar */
.tabs-bar {
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  display: flex;
}
.tab-btn {
  flex: 1;
  padding: 14px 8px;
  text-align: center;
  cursor: pointer;
  border: none;
  background: none;
  border-bottom: 3px solid transparent;
  color: var(--muted);
  transition: all 0.15s;
  font-family: 'Noto Sans TC', sans-serif;
}
.tab-btn:hover { background: #fafaf9; color: var(--ink); }
.tab-btn.active {
  border-bottom-color: var(--accent);
  color: var(--accent);
}
.tab-date    { font-size: 15px; font-weight: 700; font-family: 'Noto Sans TC', sans-serif; }
.tab-summary { font-size: 11px; margin-top: 2px; line-height: 1.4; color: inherit; font-family: 'Noto Sans TC', sans-serif; }

/* Day summary strip */
.day-summary {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.03em;
  text-align: center;
  padding: 10px 16px 18px;
}

/* ============================================================
   南投 0315 — TIMELINE
   ============================================================ */

.timeline-wrap {
  max-width: 680px;
  margin: 0 auto;
  padding: 28px 16px 0;
}
.timeline {
  position: relative;
}
.timeline::before {
  content: '';
  position: absolute;
  left: 16px;          /* 線在 x=16px */
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(to bottom, var(--accent-border), var(--border) 80%, transparent);
}

/* Event item：padding-left 把內容推到 dot 右邊 */
.event-item {
  position: relative;
  margin-bottom: 20px;
  padding-left: 52px;  /* dot(32) + gap(20) */
  opacity: 0;
  animation: fadeUp 0.35s ease forwards;
}

/* Timeline dot (南投)
   left:0, width:32px → center = 0+16 = 16px = 線的位置 ✓
   position:absolute 相對於 .event-item */
.event-dot {
  position: absolute;
  left: 0;
  top: 14px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 3px solid var(--paper);
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
  color: white;
  z-index: 2;
}


/* Timeline dot (北海道用) — flex item，由 timeline-col 置中 */
.timeline-dot {
  position: relative;   /* 覆蓋 event-dot 的 absolute */
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 3px solid var(--paper);
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
  color: white;
  z-index: 10;
  flex-shrink: 0;
}

/* Event card */
.event-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 18px 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
  transition: box-shadow 0.2s;
}
.event-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.08); }

.event-header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
}
.event-time {
  background: var(--paper);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 3px 8px;
  border-radius: 6px;
  white-space: nowrap;
  margin-top: 2px;
}
.event-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.4;
}
.event-notes {
  font-size: 13.5px;
  color: #57534e;
  line-height: 1.75;
  white-space: pre-line;
  margin-top: 4px;
}

/* Info block（地址 / 時間 / 導航） */
.info-block {
  margin-top: 14px;
  background: #fafaf9;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.info-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
}
.info-row svg { flex-shrink: 0; margin-top: 1px; }
.info-link {
  color: var(--accent);
  cursor: pointer;
  text-decoration: none;
}
.info-link:hover { text-decoration: underline; color: var(--accent-mid); }
.info-muted { color: var(--muted); }

/* Options block */
.options-block {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.option-card {
  background: #fafaf9;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
}
.option-name  { font-size: 13px; font-weight: 700; margin-bottom: 5px; }
.option-meta  { display: flex; align-items: center; gap: 5px; font-size: 12px; margin-bottom: 2px; }

/* Alert block */
.alert-block {
  margin-top: 12px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 10px;
  padding: 10px 14px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
  color: #92400e;
  white-space: pre-line;
  line-height: 1.65;
}
.alert-block svg { flex-shrink: 0; margin-top: 1px; }

/* ============================================================
   北海道 0220 — TAB / TIMELINE / MODAL
   ============================================================ */

/* accent 色 */
.accent-color { color: var(--accent) !important; }

/* header-bg (北海道用，套用 header 樣式即可) */
/* .header-bg — merged into header block above */

/* Main tab bar */
.tab-item {
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  font-weight: 500;
  transition: all 0.18s;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  border-radius: 0;
  font-size: 0.875rem;
  font-family: 'Noto Sans TC', sans-serif;
  color: var(--muted);
  background: none;
  border: none;
}
.main-tab:hover {
  color: var(--ink);
  background-color: var(--warm);
}
.main-tab.active {
  border-bottom: 3px solid var(--accent);
  color: var(--accent);
  font-weight: 700;
  background-color: transparent;
}
.day-tab { color: var(--muted); }
.day-tab:hover {
  color: var(--ink);
  background-color: var(--warm);
}
.day-tab.active {
  border-bottom: 3px solid var(--accent);
  color: var(--accent);
  font-weight: 700;
  background-color: transparent;
}

/* Content area */
.content-area {
  animation: fadeIn 0.4s ease-in-out;
  min-height: 500px;
}

/* Modals */
#location-modal,
#hotel-edit-modal,
#expense-modal,
#itinerary-modal {
  transition: opacity 0.2s ease-in-out;
}
#location-modal.hidden,
#hotel-edit-modal.hidden,
#expense-modal.hidden,
#itinerary-modal.hidden   { opacity: 0; pointer-events: none; }
#location-modal:not(.hidden),
#hotel-edit-modal:not(.hidden),
#expense-modal:not(.hidden),
#itinerary-modal:not(.hidden) { opacity: 1; pointer-events: auto; }

/* Timeline (北海道版，用 class 而非 ::before) */
.timeline-col {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 40px;
  flex-shrink: 0;
}
.timeline-line-solid {
  position: absolute;
  top: 0; bottom: -3rem; left: 50%;
  width: 2px;
  transform: translateX(-50%);
  background: linear-gradient(to bottom, var(--accent-border), var(--border) 80%, transparent);
  z-index: 0;
}
.timeline-line-dashed {
  position: absolute;
  top: 0; bottom: -3rem; left: 50%;
  width: 0;
  transform: translateX(-50%);
  border-left: 2px dashed #d6d3d1;
  z-index: 0;
}
.first-item .timeline-line-solid,
.first-item .timeline-line-dashed { top: 1.5rem; }
.last-item .timeline-line-solid,
.last-item .timeline-line-dashed  { bottom: auto; height: 1.5rem; }

/* Form inputs */
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type=number] { -moz-appearance: textfield; }

/* Checklist */
.checklist-item { cursor: pointer; transition: all 0.2s; }
.checklist-item:hover { background-color: var(--accent-light); }
.checklist-checkbox { accent-color: var(--accent); width: 1.25rem; height: 1.25rem; }
.checked-text { text-decoration: line-through; color: #9ca3af; opacity: 0.7; }

/* Highlight clickable text */
.highlight-text-clickable {
  font-weight: 700;
  color: var(--accent);
  background-color: var(--accent-light);
  padding: 0 2px;
  border-radius: 2px;
  cursor: pointer;
  text-decoration: underline;
}

/* Hide scrollbar */
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

/* Day tab — 統一南投風格：日期大字 + 摘要小字 */
.day-tab {
  display: inline-flex !important;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 10px 14px !important;
  font-family: 'Noto Sans TC', sans-serif;
}
.day-tab .tab-date {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.3;
  color: inherit;
}
.day-tab .tab-summary {
  font-size: 10px;
  margin-top: 2px;
  line-height: 1.3;
  color: inherit;
  opacity: 0.75;
  max-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.day-tab.active .tab-summary { opacity: 1; }

/* Text clamp / expand */
.line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.line-clamp-none {
  display: block;
  -webkit-line-clamp: unset;
}
.expand-btn {
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  display: inline-block;
  margin-bottom: 0.75rem;
}
.expand-btn:hover { text-decoration: underline; color: var(--accent-mid); }

/* Section headings inside day-content */
.day-content h3.accent-color,
.day-content h3[class*="accent"] {
  color: var(--accent) !important;
  border-bottom-color: var(--accent-border) !important;
}

/* Checklist label hover (also used in script-generated HTML) */
.group:hover label,
.group:hover .group-hover\:text-orange-700 {
  color: var(--accent) !important;
}

/* ============================================================
   RWD — 手機版優化
   ============================================================ */

/* Tab bar — 手機字小一點，不擠 */
@media (max-width: 640px) {
  .tab-item {
    padding: 10px 10px;
    font-size: 0.8rem;
    gap: 3px;
  }

  .event-item {
    padding-left: 46px;
  }

  /* Timeline dot 在手機上稍小 */
  .event-dot {
    width: 28px;
    height: 28px;
    left: 2px;   /* 16 - 14(半徑) */
  }

  /* Event card 在手機上 padding 小一點 */
  .event-card {
    padding: 14px 14px 12px;
  }

  /* Trip card 手機版 padding */
  .trip-card .card-title {
    font-size: 0.95rem;
  }

  /* Modal 全螢幕感 */
  #location-modal > div,
  #hotel-edit-modal > div,
  #expense-modal > div,
  #itinerary-modal > div {
    max-height: 95vh;
    margin: 0.5rem;
  }

  /* Back btn 字小一點 */
  .back-btn {
    font-size: 12px;
  }

  /* Timeline line — 手機靠更左 */
  .timeline::before {
    left: 16px;
  }
  .timeline {
    padding-left: 0;
  }
}