/* ==========================================================================
   Luxury Travel Planner Styles (行程路線規劃器專用樣式)
   和紙珍珠白與琥珀金風格 - 乾淨俐落、高對比、雙面板自適應
   ========================================================================== */

:root {
  --header-height: 58px;
  --sidebar-width: 480px;
  --cat-spot: #d97706;        /* 景點：暖琥珀金 */
  --cat-hotel: #4f46e5;       /* 宿所：雅緻靛藍 */
  --cat-restaurant: #dc2626;  /* 美饌：御所朱紅 */
  --cat-transport: #0284c7;   /* 交通：深空藍 */
}

html, body.planner-body {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background-color: var(--bg-main);
  font-family: var(--font-sans);
  color: var(--text-main);
}

/* ================= 頂部導覽列 ================= */
.planner-header {
  height: var(--header-height);
  background: #ffffff;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  position: relative;
  z-index: 1000;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.back-home-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--text-main);
  font-weight: 700;
  transition: all 0.2s;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-light);
}

.back-home-btn:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.back-home-btn .crest {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--gold-gradient);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 900;
  font-family: var(--font-serif);
}

.back-text {
  font-size: 0.88rem;
}

.header-divider {
  color: #d1d5db;
  font-size: 1rem;
}

.header-title {
  font-size: 1.08rem;
  font-weight: 700;
  font-family: var(--font-serif);
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.tag-free {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  background: #ecfdf5;
  color: #059669;
  border: 1px solid #a7f3d0;
  border-radius: var(--radius-full);
  font-family: var(--font-sans);
}

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

.save-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-right: 6px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #10b981;
  box-shadow: 0 0 6px #10b981;
}

.action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}

.btn-secondary {
  background: #ffffff;
  color: var(--text-sub);
  border-color: #d1d5db;
}

.btn-secondary:hover {
  background: #f8fafc;
  border-color: #9ca3af;
  color: var(--text-main);
}

.btn-gold {
  background: var(--gold-gradient);
  color: #ffffff;
  box-shadow: 0 2px 8px var(--gold-glow);
}

.btn-gold:hover {
  box-shadow: 0 4px 14px rgba(180, 138, 40, 0.35);
  transform: translateY(-1px);
}

.btn-danger-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid transparent;
}

.btn-danger-ghost:hover {
  background: #fef2f2;
  color: #dc2626;
  border-color: #fecaca;
}

/* ================= 手機版切換視圖 ================= */
.mobile-view-toggle {
  display: none;
  background: #ffffff;
  border-bottom: 1px solid var(--border-light);
  padding: 6px 12px;
  gap: 8px;
}

.toggle-tab {
  flex: 1;
  padding: 8px 12px;
  font-size: 0.88rem;
  font-weight: 600;
  background: #f1f5f9;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-sub);
  cursor: pointer;
}

.toggle-tab.active {
  background: #ffffff;
  color: var(--gold-dark);
  border-color: var(--gold-border);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

/* ================= 主工作區布局 ================= */
.planner-workspace {
  display: flex;
  height: calc(100vh - var(--header-height));
  width: 100%;
  position: relative;
}

/* 左側邊欄 */
.planner-sidebar {
  width: var(--sidebar-width);
  min-width: 380px;
  max-width: 520px;
  height: 100%;
  background: #ffffff;
  border-right: 1px solid var(--border-light);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px 18px 60px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: 2px 0 12px rgba(0, 0, 0, 0.03);
  z-index: 500;
}

/* 美化滾動軸 */
.planner-sidebar::-webkit-scrollbar {
  width: 6px;
}
.planner-sidebar::-webkit-scrollbar-track {
  background: #f8fafc;
}
.planner-sidebar::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}
.planner-sidebar::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* ================= 側邊欄頂部主頁籤 (行程 vs 收藏庫) ================= */
.sidebar-main-tabs {
  display: flex;
  background: #f1f5f9;
  padding: 4px;
  border-radius: var(--radius-md);
  gap: 6px;
  border: 1px solid #e2e8f0;
}

.s-main-tab {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 10px;
  font-size: 0.86rem;
  font-weight: 700;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-sub);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.s-main-tab:hover {
  color: var(--text-main);
}

.s-main-tab.active {
  background: #ffffff;
  color: var(--gold-dark);
  border-color: var(--gold-border);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.badge-count {
  background: #fef3c7;
  color: #92400e;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: var(--radius-full);
}

.s-main-tab.active .badge-count {
  background: var(--gold-gradient);
  color: #ffffff;
}

.sidebar-pane {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
}

/* ================= 行程排程視圖元件 ================= */
.trip-meta-box {
  background: var(--bg-washi);
  border: 1px solid #ebdcc5;
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.trip-title-input {
  width: 100%;
  border: none;
  background: transparent;
  font-family: var(--font-serif);
  font-size: 1.18rem;
  font-weight: 700;
  color: var(--text-main);
  outline: none;
  border-bottom: 1px dashed transparent;
  padding-bottom: 2px;
}

.trip-title-input:focus {
  border-bottom-color: var(--gold);
}

.trip-subtitle-input {
  width: 100%;
  border: none;
  background: transparent;
  font-size: 0.84rem;
  color: var(--text-muted);
  outline: none;
  border-bottom: 1px dashed transparent;
}

.trip-subtitle-input:focus {
  border-bottom-color: var(--gold);
  color: var(--text-sub);
}

/* 天數頁籤選擇器 */
.day-tabs-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 12px;
}

.day-tabs-scroll {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 2px 4px;
  scrollbar-width: none;
}
.day-tabs-scroll::-webkit-scrollbar {
  display: none;
}

.day-tab-btn {
  padding: 6px 14px;
  border-radius: var(--radius-full);
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-sub);
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s;
}

.day-tab-btn:hover {
  background: #e2e8f0;
  color: var(--text-main);
}

.day-tab-btn.active {
  background: var(--gold-gradient);
  color: #ffffff;
  border-color: transparent;
  box-shadow: 0 2px 8px var(--gold-glow);
}

.add-day-btn {
  padding: 6px 12px;
  border-radius: var(--radius-full);
  background: #ffffff;
  border: 1px dashed #d1d5db;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}

.add-day-btn:hover {
  border-color: var(--gold);
  color: var(--gold-dark);
  background: #fefce8;
}

/* 當天概況資訊卡片 */
.day-summary-card {
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

.day-summary-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.day-title-edit {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.day-badge {
  padding: 3px 8px;
  background: #fef3c7;
  color: var(--text-gold);
  font-weight: 700;
  font-size: 0.78rem;
  border-radius: 4px;
}

.day-title-input {
  flex: 1;
  font-size: 0.95rem;
  font-weight: 700;
  border: none;
  outline: none;
  color: var(--text-main);
  border-bottom: 1px solid transparent;
  padding: 2px 4px;
}

.day-title-input:focus {
  border-bottom-color: var(--gold);
}

.delete-day-btn {
  background: none;
  border: none;
  color: #9ca3af;
  font-size: 0.76rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
}

.delete-day-btn:hover {
  background: #fee2e2;
  color: #dc2626;
}

.day-stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.stat-pill {
  background: #f8fafc;
  border: 1px solid #f1f5f9;
  border-radius: var(--radius-sm);
  padding: 8px 6px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stat-icon {
  font-size: 0.95rem;
  margin-bottom: 2px;
}

.stat-val {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
}

.stat-label {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* 新增行程卡片表單 */
.add-spot-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.04);
}

.card-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 14px;
}

.btn-quick-from-lib {
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: var(--gold-dark);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.2s;
}

.btn-quick-from-lib:hover {
  background: var(--gold-gradient);
  color: #ffffff;
  border-color: transparent;
}

/* 類別選擇 Pill Chips */
.category-selector {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 14px;
}

.cat-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 4px;
  border-radius: var(--radius-sm);
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
}

.cat-chip input {
  display: none;
}

.cat-chip .cat-icon {
  font-size: 1.1rem;
  margin-bottom: 2px;
}

.cat-chip .cat-name {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-sub);
}

.cat-chip:hover {
  background: #f1f5f9;
}

.cat-chip.active[data-cat="spot"] {
  background: #fffbeb;
  border-color: #fde68a;
}
.cat-chip.active[data-cat="spot"] .cat-name { color: #b45309; }

.cat-chip.active[data-cat="hotel"] {
  background: #eef2ff;
  border-color: #c7d2fe;
}
.cat-chip.active[data-cat="hotel"] .cat-name { color: #4338ca; }

.cat-chip.active[data-cat="restaurant"] {
  background: #fef2f2;
  border-color: #fecaca;
}
.cat-chip.active[data-cat="restaurant"] .cat-name { color: #b91c1c; }

.cat-chip.active[data-cat="transport"] {
  background: #f0f9ff;
  border-color: #bae6fd;
}
.cat-chip.active[data-cat="transport"] .cat-name { color: #0369a1; }

/* 表單欄位 */
.form-group {
  margin-bottom: 12px;
}

.label-with-tool {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 5px;
}

.input-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-sub);
  display: block;
}

.tool-link-btn {
  background: none;
  border: none;
  font-size: 0.76rem;
  color: var(--gold-dark);
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}

.tool-link-btn:hover {
  text-decoration: underline;
}

.form-input {
  width: 100%;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid #d1d5db;
  background: #ffffff;
  font-size: 0.88rem;
  color: var(--text-main);
  outline: none;
  transition: all 0.2s;
}

.form-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(180, 138, 40, 0.15);
}

.form-input-sm {
  padding: 6px 10px;
  font-size: 0.82rem;
}

.input-action-wrap {
  display: flex;
  gap: 6px;
}

.btn-parse-loc {
  white-space: nowrap;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-sub);
  cursor: pointer;
}

.btn-parse-loc:hover {
  background: #e2e8f0;
  color: var(--text-main);
}

.parsed-coord-badge {
  margin-top: 5px;
  font-size: 0.76rem;
  color: #059669;
  background: #ecfdf5;
  padding: 3px 8px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* 移動方式選取 */
.transit-selector {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.transit-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 6px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  font-size: 0.8rem;
  color: var(--text-sub);
  cursor: pointer;
  transition: all 0.2s;
}

.transit-chip input {
  margin: 0;
}

.transit-chip.active {
  background: #fffbeb;
  border-color: #fde68a;
  color: #92400e;
  font-weight: 600;
}

.btn-submit-spot {
  width: 100%;
  padding: 10px;
  border-radius: var(--radius-sm);
  background: var(--gold-gradient);
  color: #ffffff;
  border: none;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  margin-top: 4px;
  box-shadow: 0 2px 8px var(--gold-glow);
  transition: all 0.2s;
}

.btn-submit-spot:hover {
  box-shadow: 0 4px 14px rgba(180, 138, 40, 0.35);
  transform: translateY(-1px);
}

/* 今日景點清單區塊 */
.spots-list-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.section-sub-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sub-title {
  font-size: 0.95rem;
  font-weight: 700;
  font-family: var(--font-serif);
  color: var(--text-main);
}

.sub-counter {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.empty-spots-state {
  text-align: center;
  padding: 36px 16px;
  background: #f8fafc;
  border-radius: var(--radius-md);
  border: 1px dashed #cbd5e1;
}

.empty-icon {
  font-size: 2rem;
  margin-bottom: 8px;
  opacity: 0.6;
}

.empty-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-sub);
  margin-bottom: 4px;
}

.empty-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* 景點項目卡片與連接器 */
.spot-item-card {
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
  transition: all 0.2s ease;
  position: relative;
}

.spot-item-card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.spot-card-top {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.spot-index-bubble {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  margin-top: 2px;
}

.cat-bubble-spot { background: var(--cat-spot); }
.cat-bubble-hotel { background: var(--cat-hotel); }
.cat-bubble-restaurant { background: var(--cat-restaurant); }
.cat-bubble-transport { background: var(--cat-transport); }

.spot-card-main {
  flex: 1;
  min-width: 0;
}

.spot-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.spot-cat-tag {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 3px;
}

.spot-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 4px;
  cursor: pointer;
}

.spot-name:hover {
  color: var(--gold-dark);
}

.spot-note {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin-bottom: 6px;
  word-break: break-all;
}

.spot-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.spot-btn {
  background: none;
  border: none;
  font-size: 0.76rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  text-decoration: none;
  transition: all 0.15s;
}

.spot-btn:hover {
  background: #f1f5f9;
  color: var(--text-main);
}

.spot-btn-star {
  color: var(--gold-dark);
  font-weight: 600;
}
.spot-btn-star:hover {
  background: #fffbeb;
}

.spot-btn-danger:hover {
  background: #fef2f2;
  color: #dc2626;
}

/* 兩景點之間的移動資訊指示器 (Leg Connector) */
.transit-leg-divider {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0 8px 22px;
  font-size: 0.76rem;
  color: var(--text-muted);
}

.transit-leg-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-weight: 600;
  color: #475569;
}

.transit-leg-pill.pill-car {
  background: #fffbeb;
  border-color: #fde68a;
  color: #92400e;
}

.transit-leg-pill.pill-train {
  background: #eef2ff;
  border-color: #c7d2fe;
  color: #4338ca;
}

/* ================= 視圖 2：景點與名宿收藏庫專用樣式 ================= */
.lib-header-box {
  background: var(--bg-washi);
  border: 1px solid #ebdcc5;
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.lib-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.lib-title-main {
  display: flex;
  align-items: center;
  gap: 8px;
}

.lib-icon {
  font-size: 1.2rem;
}

.lib-heading {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-main);
}

.lib-sub-text {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.lib-search-box {
  position: relative;
}

.lib-search-box .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #9ca3af;
  font-size: 0.85rem;
}

.lib-search-input {
  padding-left: 36px !important;
}

.lib-filters {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
}
.lib-filters::-webkit-scrollbar {
  display: none;
}

.lib-filter-pill {
  padding: 5px 12px;
  border-radius: var(--radius-full);
  background: #ffffff;
  border: 1px solid #d1d5db;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-sub);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}

.lib-filter-pill:hover {
  border-color: #9ca3af;
  color: var(--text-main);
}

.lib-filter-pill.active {
  background: var(--gold-gradient);
  color: #ffffff;
  border-color: transparent;
  box-shadow: 0 2px 6px var(--gold-glow);
}

/* 建立新收藏卡片表單 */
.add-poi-form-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.05);
}

/* 收藏卡片列表 */
.poi-library-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.poi-card {
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
  transition: all 0.2s ease;
  position: relative;
  border-left: 4px solid var(--cat-spot);
}

.poi-card.card-cat-hotel { border-left-color: var(--cat-hotel); }
.poi-card.card-cat-restaurant { border-left-color: var(--cat-restaurant); }
.poi-card.card-cat-spot { border-left-color: var(--cat-spot); }
.poi-card.card-cat-transport { border-left-color: var(--cat-transport); }

.poi-card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.07);
  transform: translateY(-1px);
}

.poi-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.poi-cat-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}
.poi-badge-hotel { background: #eef2ff; color: #4338ca; }
.poi-badge-restaurant { background: #fef2f2; color: #b91c1c; }
.poi-badge-spot { background: #fffbeb; color: #b45309; }
.poi-badge-transport { background: #f0f9ff; color: #0369a1; }

.poi-card-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 6px;
  cursor: pointer;
}

.poi-card-name:hover {
  color: var(--gold-dark);
}

.poi-card-note {
  font-size: 0.82rem;
  color: var(--text-sub);
  line-height: 1.45;
  margin-bottom: 10px;
  background: #f8fafc;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  word-break: break-all;
}

.poi-card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-top: 1px solid #f1f5f9;
  padding-top: 10px;
}

.btn-add-to-day {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  background: var(--gold-gradient);
  color: #ffffff;
  font-size: 0.84rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
  box-shadow: 0 2px 6px var(--gold-glow);
  transition: all 0.2s;
}

.btn-add-to-day:hover {
  box-shadow: 0 4px 12px rgba(180, 138, 40, 0.35);
  transform: translateY(-1px);
}

.poi-sub-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ================= 右側地圖畫布 ================= */
.planner-map-wrapper {
  flex: 1;
  height: 100%;
  position: relative;
  background: #e2e8f0;
}

.map-view {
  width: 100%;
  height: 100%;
}

/* 地圖浮動控制面板 */
.map-floating-panel {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 8px;
}

.map-filter-group {
  display: flex;
  background: #ffffff;
  padding: 3px;
  border-radius: var(--radius-full);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
  border: 1px solid var(--border-light);
}

.map-ctrl-btn {
  padding: 6px 14px;
  border-radius: var(--radius-full);
  background: transparent;
  border: none;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-sub);
  cursor: pointer;
  transition: all 0.2s;
}

.map-ctrl-btn:hover {
  color: var(--text-main);
}

.map-ctrl-btn.active {
  background: var(--gold-gradient);
  color: #ffffff;
  box-shadow: 0 2px 6px var(--gold-glow);
}

/* 地圖點選提示條 */
.map-pick-banner {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1001;
  background: #111827;
  color: #ffffff;
  padding: 8px 16px;
  border-radius: var(--radius-full);
  box-shadow: 0 6px 20px rgba(0,0,0,0.25);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  animation: pulseBanner 1.8s infinite;
}

@keyframes pulseBanner {
  0% { box-shadow: 0 0 0 0 rgba(180, 138, 40, 0.6); }
  70% { box-shadow: 0 0 0 10px rgba(180, 138, 40, 0); }
  100% { box-shadow: 0 0 0 0 rgba(180, 138, 40, 0); }
}

.btn-cancel-pick {
  background: #374151;
  color: #ffffff;
  border: none;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  cursor: pointer;
}

.btn-cancel-pick:hover {
  background: #4b5563;
}

/* 操作成功懸浮 Toast 提示 */
.floating-toast {
  position: absolute;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2000;
  background: #111827;
  color: #ffffff;
  padding: 10px 22px;
  border-radius: var(--radius-full);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.88rem;
  font-weight: 600;
  border: 1px solid #374151;
  animation: toastPop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes toastPop {
  from { opacity: 0; transform: translate(-50%, -12px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

.floating-toast .toast-icon {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #10b981;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
}

/* 地圖圖例 (Legend) */
.map-legend {
  position: absolute;
  bottom: 24px;
  right: 16px;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.76rem;
  color: var(--text-sub);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.legend-icon {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}
.legend-icon.icon-spot { background: var(--cat-spot); }
.legend-icon.icon-hotel { background: var(--cat-hotel); }
.legend-icon.icon-restaurant { background: var(--cat-restaurant); }
.legend-icon.icon-transport { background: var(--cat-transport); }

.legend-line {
  width: 22px;
  height: 4px;
  border-radius: 2px;
}
.legend-line.line-drive {
  background: #b45309;
}
.legend-line.line-transit {
  background: #4338ca;
  background-image: linear-gradient(to right, #4338ca 50%, transparent 50%);
  background-size: 8px 100%;
}

/* 地圖底圖樣式切換器 */
.map-tile-picker {
  display: flex;
  background: #ffffff;
  padding: 3px;
  border-radius: var(--radius-full);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
  border: 1px solid var(--border-light);
}

.tile-btn {
  padding: 6px 11px;
  border-radius: var(--radius-full);
  background: transparent;
  border: none;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-sub);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.tile-btn:hover {
  color: var(--text-main);
}

.tile-btn.active {
  background: #1e293b;
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

/* 地圖頂部天數切換膠囊列 */
.map-day-selector {
  display: flex;
  background: #ffffff;
  padding: 3px;
  border-radius: var(--radius-full);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
  border: 1px solid var(--border-light);
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: none;
}
.map-day-selector::-webkit-scrollbar {
  display: none;
}

.map-day-pill {
  padding: 6px 12px;
  border-radius: var(--radius-full);
  background: transparent;
  border: none;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-sub);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.map-day-pill:hover {
  color: var(--text-main);
  background: #f1f5f9;
}

.map-day-pill.active {
  background: var(--gold-gradient);
  color: #ffffff;
  box-shadow: 0 2px 6px var(--gold-glow);
}

/* ================= 奢華全天數一體化膠囊標記 (All-Days Capsule Pin) ================= */
.all-days-capsule-wrapper {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  transform-origin: center 26px;
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  user-select: none;
}

.all-days-capsule-wrapper:hover,
.all-days-capsule-wrapper.active-focus {
  transform: scale(1.22);
  z-index: 9999 !important;
}

.capsule-body {
  display: inline-flex;
  align-items: center;
  background: #ffffff;
  border-radius: 9999px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.28), 0 1px 3px rgba(0, 0, 0, 0.1);
  padding: 2px 6px 2px 2px;
  border: 1.5px solid rgba(0, 0, 0, 0.08);
  height: 25px;
  white-space: nowrap;
}

.capsule-day-tag {
  color: #ffffff;
  font-size: 0.68rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 9999px;
  line-height: 1;
  letter-spacing: 0.02em;
  margin-right: 4px;
}

.capsule-seq-text {
  font-size: 0.76rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1;
  margin-right: 4px;
}

.capsule-cat-glyph {
  font-size: 0.72rem;
  line-height: 1;
}

.capsule-arrow-tip {
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 5px solid #ffffff;
  margin-top: -1px;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.15));
}

.capsule-hover-tooltip {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  background: #111827;
  color: #ffffff;
  font-size: 0.74rem;
  font-weight: 600;
  padding: 4px 9px;
  border-radius: 6px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.18s, bottom 0.18s;
  z-index: 10000;
}

.all-days-capsule-wrapper:hover .capsule-hover-tooltip {
  opacity: 1;
  bottom: 34px;
}

/* ================= 奢華單日水滴圖釘標記 (Single Day Teardrop Pin) ================= */
.custom-leaflet-icon-container {
  background: transparent !important;
  border: none !important;
  overflow: visible !important;
}

.luxury-pin-wrapper {
  position: relative;
  width: 28px;
  height: 36px;
  cursor: pointer;
  transform-origin: 14px 36px;
  transition: transform 0.22s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.luxury-pin-wrapper:hover,
.luxury-pin-wrapper.active-focus {
  transform: scale(1.24);
  z-index: 9999 !important;
}

.pin-svg {
  display: block;
  width: 28px;
  height: 36px;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.3));
}

.pin-name-bubble {
  position: absolute;
  bottom: 38px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(6px);
  padding: 4px 10px;
  border-radius: 9999px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(0, 0, 0, 0.08);
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s, bottom 0.2s;
  display: flex;
  align-items: center;
  gap: 4px;
}

.luxury-pin-wrapper:hover .pin-name-bubble,
.luxury-pin-wrapper.pin-pinned .pin-name-bubble {
  opacity: 1;
  bottom: 42px;
}

.bubble-cat {
  font-size: 0.75rem;
}

.pin-pulse-dot {
  position: absolute;
  bottom: -2px;
  left: 14px;
  transform: translateX(-50%);
  width: 6px;
  height: 3px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.3);
}

/* Popup 資訊視窗樣式 */
.leaflet-popup-content-wrapper {
  border-radius: var(--radius-md) !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15) !important;
  padding: 4px !important;
}

.popup-card {
  padding: 6px 8px;
}

.popup-tag {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.popup-title {
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 4px;
  font-family: var(--font-serif);
}

.popup-note {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 8px;
  line-height: 1.4;
}

.popup-link {
  display: inline-block;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--gold-dark);
  text-decoration: none;
}

.popup-link:hover {
  text-decoration: underline;
}

/* ================= 匯出與匯入 Modal ================= */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.6);
  backdrop-filter: blur(4px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-dialog {
  background: #ffffff;
  border-radius: var(--radius-lg);
  max-width: 680px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  animation: modalFadeIn 0.25s ease-out;
}

@keyframes modalFadeIn {
  from { opacity: 0; transform: scale(0.96) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 1.15rem;
  font-weight: 700;
  font-family: var(--font-serif);
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-close-btn {
  background: none;
  border: none;
  font-size: 1.6rem;
  line-height: 1;
  color: #9ca3af;
  cursor: pointer;
}

.modal-close-btn:hover {
  color: var(--text-main);
}

.modal-body {
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-desc {
  font-size: 0.88rem;
  color: var(--text-sub);
  line-height: 1.6;
  margin-bottom: 16px;
}

.modal-desc code {
  background: #f1f5f9;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
  color: var(--gold-dark);
}

.export-textarea {
  width: 100%;
  height: 320px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid #d1d5db;
  background: #f8fafc;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.82rem;
  color: #1e293b;
  line-height: 1.5;
  resize: vertical;
  outline: none;
}

.export-textarea:focus {
  border-color: var(--gold);
  background: #ffffff;
}

.modal-footer {
  padding: 14px 24px;
  border-top: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  background: #fafafa;
}

/* ================= 響應式佈局 (Mobile & Tablet) ================= */
@media (max-width: 900px) {
  .mobile-view-toggle {
    display: flex;
  }

  .planner-workspace {
    flex-direction: column;
    height: calc(100vh - var(--header-height) - 48px);
  }

  .planner-sidebar {
    width: 100%;
    min-width: 100%;
    max-width: 100%;
    height: 100%;
    border-right: none;
  }

  .planner-map-wrapper {
    width: 100%;
    height: 100%;
    display: none;
  }

  /* 視圖切換狀態控制 */
  .planner-workspace.show-map .planner-sidebar {
    display: none;
  }
  .planner-workspace.show-map .planner-map-wrapper {
    display: block;
  }

  .header-actions .btn-secondary span {
    display: none;
  }
  .header-actions .btn-secondary {
    padding: 7px 10px;
  }
}
