/* trip.css — 旅程頁 */

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

body {
  margin: 0;
  padding: 0 0 140px;       /* 60 (bottom-nav) + 60 (rec-sheet handle) + buffer */
  font-family: ui-sans-serif, "Noto Sans TC", "PingFang TC", sans-serif;
  background: #fff;
  color: #201F21;
}

.d-none { display: none !important; }

.trip {
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  padding: 0 0 12px;
}

/* ---- 搜尋列 ---- */
.search-bar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: #fff;
  padding: 10px 16px;
}
.search-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.search-input-wrap input {
  width: 100%;
  border: 1px solid #e0e0e0;
  border-radius: 999px;
  padding: 10px 40px 10px 38px;
  font-size: 14px;
  background: #fff;
  outline: none;
  font-family: inherit;
}
.search-input-wrap input:focus { border-color: #201F21; }
.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #9e9e9e;
  font-size: 14px;
  pointer-events: none;
}
.clear-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: #9e9e9e;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.search-results-panel {
  position: absolute;
  left: 16px;
  right: 16px;
  top: 100%;
  margin-top: 4px;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.08);
  max-height: 60vh;
  overflow-y: auto;
  z-index: 40;
}
.search-result-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid #f3f3f3;
  cursor: pointer;
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: #fafafa; }
.search-result-distance {
  font-size: 12px;
  color: #757575;
  min-width: 56px;
  text-align: left;
}
.search-result-body { flex: 1; min-width: 0; }
.search-result-title {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.search-result-sub { font-size: 11px; color: #9e9e9e; margin-top: 2px; }
.search-result-arrow { color: #bdbdbd; font-size: 12px; }
.search-loading, .search-empty-row { padding: 14px; color: #9e9e9e; font-size: 13px; text-align: center; }

/* ---- 類型 tab ---- */
.type-tabs {
  display: flex;
  gap: 8px;
  padding: 0 16px 8px;
}
.type-tab {
  background: #fff;
  border: 1px solid #d9d9d9;
  border-radius: 999px;
  padding: 5px 14px;
  font-size: 12px;
  cursor: pointer;
  color: #555;
  font-family: inherit;
}
.type-tab.is-active { background: #201F21; color: #fff; border-color: #201F21; }

/* ---- 地圖 ---- */
.map-section {
  position: relative;
  margin: 0 16px;
}
#map {
  width: 100%;
  height: 320px;
  border-radius: 12px;
  background: #f0f0f0;
}
.map-info-card {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.12);
  padding: 10px;
  display: flex;
  gap: 10px;
  align-items: center;
}
.map-info-card .info-thumb {
  width: 64px;
  height: 64px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
}
.map-info-card .info-body { flex: 1; min-width: 0; }
.map-info-card .info-sub { font-size: 11px; color: #9e9e9e; }
.map-info-card .info-title {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.map-info-card .info-add {
  font-size: 12px;
  color: #201F21;
  margin-top: 4px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  font-family: inherit;
}
.map-info-card .info-close {
  position: absolute;
  top: 6px;
  right: 8px;
  background: none;
  border: none;
  color: #9e9e9e;
  cursor: pointer;
}

/* ---- 我的旅程 ---- */
.my-plans { padding: 16px; }
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.section-title { font-size: 15px; font-weight: 600; margin: 0; }
.btn-link-primary {
  background: none;
  border: none;
  color: #201F21;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.plans-list {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 4px;
}
.plans-list::-webkit-scrollbar { display: none; }
.plan-card {
  flex: 0 0 140px;
  cursor: pointer;
  position: relative;
}
.plan-card .plan-thumb {
  width: 100%;
  height: 140px;
  border-radius: 12px;
  object-fit: cover;
  background: #eaeaea;
}
.plan-card .plan-edit-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  background: rgba(255,255,255,0.95);
  border: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: #201F21;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}
.plan-card .plan-name {
  font-size: 13px;
  margin-top: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.plan-card .plan-date { font-size: 11px; color: #9e9e9e; margin-top: 2px; }
.plans-empty { text-align: center; padding: 24px 0; color: #9e9e9e; font-size: 13px; }

/* ---- 暫存區 ---- */
.stash-section {
  padding: 0 16px 24px;
  border-top: 1px solid #f0f0f0;
  padding-top: 16px;
}
.stash-mode { font-size: 12px; color: #9e9e9e; margin-left: 4px; }
.stash-count { font-size: 12px; color: #9e9e9e; }
.view-toggle { display: flex; gap: 6px; }
.view-btn {
  background: none;
  border: none;
  color: #9e9e9e;
  cursor: pointer;
  font-size: 14px;
  padding: 4px;
}
.view-btn.is-active { color: #201F21; }

.stash-list.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.stash-list.grid .stash-card { position: relative; cursor: pointer; }
.stash-list.grid .stash-card .stash-thumb {
  width: 100%;
  aspect-ratio: 4/5;
  object-fit: cover;
  border-radius: 10px;
  background: #eaeaea;
}
.stash-list.grid .stash-card .stash-overlay {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 8px 10px;
  background: linear-gradient(180deg, rgba(0,0,0,0) 0%, rgba(0,0,0,0.65) 100%);
  color: #fff;
  border-radius: 0 0 10px 10px;
}
.stash-list.grid .stash-card .stash-title {
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stash-list.grid .stash-card .stash-sub { font-size: 10px; opacity: 0.85; margin-top: 2px; }
.stash-list.grid .stash-card .stash-add {
  position: absolute;
  top: 6px;
  right: 6px;
  background: rgba(255,255,255,0.95);
  border: none;
  border-radius: 999px;
  font-size: 11px;
  padding: 3px 9px;
  cursor: pointer;
}

.stash-list.list { display: flex; flex-direction: column; gap: 8px; }
.stash-list.list .stash-card {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 8px;
  border-radius: 10px;
  background: #fafafa;
  cursor: pointer;
}
.stash-list.list .stash-card .stash-thumb {
  width: 56px;
  height: 56px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
}
.stash-list.list .stash-card .stash-body { flex: 1; min-width: 0; }
.stash-list.list .stash-card .stash-title {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stash-list.list .stash-card .stash-sub { font-size: 11px; color: #9e9e9e; margin-top: 2px; }
.stash-list.list .stash-card .stash-add {
  background: #fff;
  border: 1px solid #d9d9d9;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
}
.stash-empty { text-align: center; padding: 16px 0; color: #9e9e9e; font-size: 13px; }

/* ---- 推薦展覽 (上拉式 sheet) ---- */
.rec-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 60px;
  background: #fff;
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -3px 14px rgba(0,0,0,0.12);
  z-index: 80;
  transition: transform 0.3s ease;
  max-height: 70vh;
  display: flex;
  flex-direction: column;
}
.rec-sheet.collapsed { transform: translateY(calc(100% - 60px)); }
.rec-sheet.expanded  { transform: translateY(0); }

.sheet-handle-wrap {
  cursor: pointer;
  user-select: none;
  padding: 8px 16px 8px;
  flex-shrink: 0;
}
.sheet-handle {
  width: 40px;
  height: 5px;
  background: #d9d9d9;
  border-radius: 3px;
  margin: 0 auto 6px;
}
.sheet-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.sheet-chevron {
  color: #9e9e9e;
  font-size: 14px;
  transition: transform 0.3s ease;
}
.rec-sheet.expanded .sheet-chevron { transform: rotate(180deg); }
.sheet-content {
  padding: 0 16px 20px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.rec-list { display: flex; flex-direction: column; gap: 8px; }
.rec-card {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border-radius: 10px;
  background: #fafafa;
  cursor: pointer;
}
.rec-card .rec-thumb {
  width: 64px;
  height: 64px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  background: #eaeaea;
}
.rec-card .rec-body { flex: 1; min-width: 0; }
.rec-card .rec-title {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rec-card .rec-sub { font-size: 11px; color: #9e9e9e; margin-top: 2px; }
.rec-card .rec-meta { font-size: 11px; color: #9e9e9e; margin-top: 2px; }
.rec-card .rec-add {
  flex-shrink: 0;
  background: #fff;
  border: 1px solid #d9d9d9;
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
}
.rec-card .rec-countdown {
  display: inline-block;
  background: #fff3e0;
  color: #e65100;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 4px;
  margin-left: 6px;
  vertical-align: middle;
}
.rec-card .rec-countdown.normal { background: #f0f4ff; color: #3a5bd9; }
.rec-card .rec-countdown.muted { background: #f5f5f5; color: #9e9e9e; }
.rec-empty { text-align: center; padding: 16px 0; color: #9e9e9e; font-size: 13px; }

/* ---- modal 共用 ---- */
.picker-list { list-style: none; padding: 0; margin: 0; }
.picker-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid #f0f0f0;
}
.picker-list li:last-child { border-bottom: none; }
.picker-list .picker-name { font-size: 14px; font-weight: 500; }
.picker-list .picker-date { font-size: 11px; color: #9e9e9e; margin-top: 2px; }
.picker-list .picker-add {
  background: #fff;
  border: 1px solid #d9d9d9;
  border-radius: 6px;
  padding: 4px 12px;
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
}

.plan-cover-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
  border-radius: 12px;
  overflow: hidden;
  background: #f0f0f0;
}
.plan-cover-wrap img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cover-edit-btn {
  position: absolute;
  bottom: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255,255,255,0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
  margin: 0;
  color: #201F21;
}
.muted-tip { margin-left: 6px; font-size: 11px; color: #bdbdbd; }

.btn-delete-plan {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #fff;
  border: 1px solid #d9534f;
  color: #d9534f;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  margin-top: 8px;
}
.btn-delete-plan:hover {
  background: #fff1f0;
}

/* ---- 行程編輯頁 (overlay) ---- */
.plan-editor {
  position: fixed;
  inset: 0;
  background: #fff;
  z-index: 100;
  overflow-y: auto;
  padding-bottom: 100px;
}
.editor-search-bar {
  padding: 10px 16px;
  background: #fff;
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid #f3f3f3;
}
.editor-back {
  background: none;
  border: none;
  font-size: 18px;
  color: #201F21;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.editor-tabs { display: flex; gap: 8px; padding: 8px 16px; }
.editor-map-wrap { margin: 0 16px; }
#editor-map {
  width: 100%;
  height: 280px;
  border-radius: 12px;
  background: #f0f0f0;
}
.editor-body { padding: 16px; }
.editor-plan-name { font-size: 15px; font-weight: 600; }
.editor-plan-date { font-size: 12px; color: #9e9e9e; margin-top: 2px; }

.editor-stops {
  list-style: none;
  padding: 0;
  margin: 12px 0 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.editor-stop {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid #ececec;
  border-radius: 10px;
  background: #fff;
  cursor: grab;
}
.editor-stop.sortable-chosen { background: #f7f7f7; }
.editor-stop .stop-handle { color: #bdbdbd; cursor: grab; font-size: 14px; }
.editor-stop .stop-thumb {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  object-fit: cover;
  background: #eaeaea;
  flex-shrink: 0;
}
.editor-stop .stop-icon {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: #f5f5f5;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #9e9e9e;
  font-size: 14px;
  flex-shrink: 0;
}
.editor-stop .stop-icon-current {
  background: #201F21;
  color: #fff;
}
.editor-stop.is-current {
  border-color: #201F21;
  background: #fafafa;
}
.editor-stop.is-current .stop-title {
  font-weight: 600;
}
.editor-stop.sortable-ghost { opacity: 0.4; }
.editor-stop .stop-title {
  flex: 1;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.editor-stop .stop-remove {
  background: none;
  border: none;
  color: #9e9e9e;
  cursor: pointer;
  font-size: 14px;
}
.drag-tip {
  font-size: 11px;
  color: #bdbdbd;
  display: flex;
  align-items: center;
  gap: 4px;
}
.editor-stop-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.btn-add-current {
  background: #fff;
  border: 1px dashed #d9d9d9;
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 12px;
  color: #555;
  cursor: pointer;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.btn-add-current:hover {
  border-color: #201F21;
  color: #201F21;
}

.editor-search-add {
  position: relative;
  margin-top: 12px;
}
.editor-search-add input {
  width: 100%;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 9px 12px 9px 34px;
  font-size: 13px;
  outline: none;
  font-family: inherit;
}
.editor-search-add .search-icon { left: 12px; }
.editor-add-results {
  margin-top: 6px;
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid #ececec;
  border-radius: 8px;
}
.editor-add-results .add-result-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid #f3f3f3;
}
.editor-add-results .add-result-item:last-child { border: none; }
.editor-add-results .add-result-title {
  font-size: 13px;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.editor-add-results .add-result-add {
  background: #fff;
  border: 1px solid #d9d9d9;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
  margin-left: 10px;
}

.editor-section { margin-top: 18px; }
.editor-section-title { font-size: 13px; font-weight: 600; margin-bottom: 8px; }
.editor-transport { display: flex; gap: 18px; color: #757575; }
.transport-btn {
  background: none;
  border: none;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: inherit;
  padding: 0;
}
.transport-btn.is-active { color: #201F21; font-weight: 600; }
.editor-route-summary { font-size: 13px; }

.editor-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 24px;
  gap: 12px;
}
.editor-actions .btn {
  flex: 1;
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 14px;
}

/* ---- 底部 nav ---- */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #fff;
  display: flex;
  border-top: 1px solid #ececec;
  z-index: 50;
}
.bottom-nav .nav-item {
  flex: 1;
  text-align: center;
  padding: 8px 0 12px;
  color: #9e9e9e;
  text-decoration: none;
  font-size: 11px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.bottom-nav .nav-item.active { color: #201F21; }
.bottom-nav .nav-item i { font-size: 16px; }

/* ---- toast ---- */
.trip-toast {
  position: fixed;
  left: 50%;
  bottom: 100px;
  transform: translateX(-50%) translateY(20px);
  background: rgba(32,31,33,0.92);
  color: #fff;
  padding: 10px 20px;
  border-radius: 999px;
  font-size: 13px;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}
.trip-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
