/* ===== 極簡風格：白底、黑色圖釘、Material Symbols ===== */
:root {
  --bg: #F7F7F7;
  --surface: #FFFFFF;
  --ink: #1A1A1A;
  --muted: #757575;
  --border: #E5E5E5;
  --danger: #C0392B;
  --font: 'Inter', 'Noto Sans TC', -apple-system, 'PingFang TC', 'Microsoft JhengHei', sans-serif;
  --shadow: 0 1px 3px rgba(0, 0, 0, .06), 0 4px 14px rgba(0, 0, 0, .05);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }

body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

.material-symbols-outlined {
  font-size: 20px;
  line-height: 1;
  vertical-align: middle;
  user-select: none;
}

/* ---- 頂欄 ---- */
.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  z-index: 1100;
}

.site-title {
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: .2px;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-actions { display: flex; gap: 8px; }

.btn {
  font-family: var(--font);
  font-size: .875rem;
  font-weight: 500;
  padding: 7px 16px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: border-color .15s, background .15s;
}
.btn:hover { border-color: var(--ink); }
.btn .material-symbols-outlined { font-size: 18px; }

.btn-dark {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}
.btn-dark:hover { background: #000; }

.btn-danger { color: var(--danger); }
.btn-danger:hover { border-color: var(--danger); }

.menu-toggle {
  display: none;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  padding: 6px 8px;
  cursor: pointer;
  color: var(--ink);
}

/* ---- 快速篩選列 ---- */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  flex-shrink: 0;
  z-index: 1050;
}
.filter-bar::-webkit-scrollbar { display: none; }

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

.chip {
  font-family: var(--font);
  font-size: .82rem;
  font-weight: 500;
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  transition: border-color .15s, background .15s, color .15s;
}
.chip .material-symbols-outlined { font-size: 16px; }
.chip:hover { border-color: var(--ink); }
.chip.active { background: var(--ink); color: #fff; border-color: var(--ink); }

.chip-sep {
  width: 1px;
  align-self: stretch;
  background: var(--border);
  flex-shrink: 0;
}

/* ---- 主版面 ---- */
.layout { flex: 1; display: flex; min-height: 0; position: relative; }

.sidebar {
  width: 340px;
  flex-shrink: 0;
  overflow-y: auto;
  padding: 20px;
  background: var(--surface);
  border-right: 1px solid var(--border);
}

.subtitle {
  font-size: .82rem;
  color: var(--muted);
  margin-bottom: 18px;
}

.section-title {
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--muted);
  margin: 22px 0 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.section-title .material-symbols-outlined { font-size: 17px; }
section:first-of-type .section-title { margin-top: 0; }

.place-list { list-style: none; }

.place-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px;
  margin-bottom: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}
.place-item:hover { border-color: #BDBDBD; box-shadow: var(--shadow); }
.place-item.active { border-color: var(--ink); }

.cat-chip {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}
.cat-chip .material-symbols-outlined { font-size: 17px; }
.cat-chip.food { background: var(--ink); color: #fff; }
.cat-chip.attraction { background: var(--surface); color: var(--ink); border: 1.5px solid var(--ink); }

.place-item .p-body { flex: 1; min-width: 0; }
.place-item .p-thumb {
  width: 56px; height: 56px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid var(--border);
}
.place-item .p-name { font-size: .95rem; font-weight: 600; }
.place-item .p-desc {
  font-size: .8rem;
  color: var(--muted);
  margin-top: 3px;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---- 地圖 ---- */
#map { flex: 1; min-width: 0; background: var(--bg); }

/* 圖釘：黑圓＝美食、白圓＝景點 */
.pin {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .28);
}
.pin .material-symbols-outlined { font-size: 18px; }
.pin.food { background: var(--ink); color: #fff; border: 2px solid #fff; }
.pin.attraction { background: #fff; color: var(--ink); border: 2px solid var(--ink); }

/* Leaflet 彈窗 */
.leaflet-popup-content-wrapper {
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .12);
}
.leaflet-popup-tip { background: var(--surface); }
.leaflet-popup-content { margin: 14px 18px; line-height: 1.5; }

.popup-title { font-size: 1rem; font-weight: 600; margin-bottom: 4px; }
.popup-desc { font-size: .85rem; color: #4A4A4A; margin-bottom: 8px; }
.popup-row {
  font-size: .8rem;
  color: var(--muted);
  margin-top: 6px;
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.popup-row .material-symbols-outlined { font-size: 17px; flex-shrink: 0; margin-top: 1px; color: var(--ink); }

.popup-imgs {
  display: grid;
  gap: 6px;
  margin-bottom: 10px;
}
.popup-imgs.cols-1 { grid-template-columns: 1fr; }
.popup-imgs.cols-2 { grid-template-columns: 1fr 1fr; }
.popup-imgs img {
  width: 100%;
  height: 110px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.popup-links {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.popup-link {
  font-size: .78rem;
  font-weight: 500;
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--ink);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: border-color .15s;
}
.popup-link:hover { border-color: var(--ink); }
.popup-link .material-symbols-outlined { font-size: 15px; margin: 0; }

/* 側欄無結果提示 */
.empty-hint {
  font-size: .85rem;
  color: var(--muted);
  text-align: center;
  padding: 24px 0;
}

/* 路線色點與最近車站 */
.line-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 4px;
  vertical-align: middle;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12);
}
.line-dot + .line-dot { margin-left: -1px; }

.p-station {
  font-size: .76rem;
  color: var(--muted);
  margin-top: 5px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.p-station .material-symbols-outlined { font-size: 15px; }

.station-row { display: flex; gap: 8px; }
.station-row select { flex: 1; }
.station-row .btn { flex-shrink: 0; }

/* 車站 tooltip */
.leaflet-tooltip {
  font-family: var(--font);
  font-size: .78rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .1);
}

/* ---- 手機版 ---- */
@media (max-width: 800px) {
  .hide-mobile { display: none !important; }
  .menu-toggle { display: inline-flex; }
  .topbar { justify-content: space-between; }
  .sidebar {
    position: absolute;
    top: 0; left: 0; bottom: 0;
    z-index: 1000;
    transform: translateX(-105%);
    transition: transform .25s ease;
    width: min(85vw, 340px);
    box-shadow: 8px 0 24px rgba(0, 0, 0, .1);
  }
  .sidebar.open { transform: translateX(0); }
  .site-title { font-size: .95rem; }
}

/* ---- 管理後台 ---- */
.admin-wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 24px 20px 60px;
  width: 100%;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 20px;
}

.card h2 {
  margin-bottom: 16px;
  font-size: 1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}
.card h2 .material-symbols-outlined { font-size: 20px; }

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 18px;
}
.form-grid .full { grid-column: 1 / -1; }

label {
  display: block;
  font-size: .78rem;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 4px;
}

input, select, textarea {
  width: 100%;
  font-family: var(--font);
  font-size: .9rem;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  transition: border-color .15s;
}
textarea { resize: vertical; min-height: 60px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--ink); }

.form-actions { margin-top: 16px; display: flex; gap: 10px; flex-wrap: wrap; }

.msg { margin-top: 10px; font-size: .85rem; }
.msg.ok { color: #2E7D32; }
.msg.err { color: var(--danger); }

#pickMap {
  height: 260px;
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-top: 8px;
}

.admin-table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.admin-table th {
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
  border-bottom: 1px solid var(--ink);
  padding: 10px 8px;
  text-align: left;
}
.admin-table td {
  border-bottom: 1px solid var(--border);
  padding: 10px 8px;
  vertical-align: top;
}
.admin-table td small { color: var(--muted); }
.admin-table .cat-cell { display: inline-flex; align-items: center; gap: 6px; }
.admin-table .cat-cell .material-symbols-outlined { font-size: 17px; }
.table-scroll { overflow-x: auto; }

.btn-sm { font-size: .8rem; padding: 4px 12px; }
.btn-sm .material-symbols-outlined { font-size: 16px; }

/* 適合時間 checkbox */
.check-row { display: flex; gap: 18px; flex-wrap: wrap; padding: 4px 0; }
.check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: .88rem;
  color: var(--ink);
  cursor: pointer;
  margin: 0;
}
.check input { width: auto; accent-color: var(--ink); }
.check .material-symbols-outlined { font-size: 17px; color: var(--muted); }

/* 圖片上傳槽 */
.img-slots { display: flex; gap: 16px; flex-wrap: wrap; }
.img-slot { display: flex; flex-direction: column; gap: 8px; }
.img-preview {
  width: 180px; height: 120px;
  border: 1px dashed #C9C9C9;
  border-radius: 12px;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.img-preview img { width: 100%; height: 100%; object-fit: cover; }
.img-ph { font-size: 32px !important; color: #BDBDBD; }
.img-actions { display: flex; gap: 8px; }

/* 列表縮圖 */
.name-cell { display: inline-flex; align-items: center; gap: 10px; }
.t-thumb {
  width: 44px; height: 44px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.login-card { max-width: 380px; margin: 60px auto; }
.login-card .form-grid { grid-template-columns: 1fr; }
.hint { font-size: .78rem; color: var(--muted); margin-top: 10px; line-height: 1.5; }
