/* ============================================================
   珠港澳 Citywalk 贴路导航 — 样式
   ============================================================ */

:root {
  --ink: #0f172a;
  --ink-2: #334155;
  --ink-3: #64748b;
  --ink-4: #94a3b8;
  --line: #e6ebf4;
  --bg: #f2f5fa;
  --card: #ffffff;
  --accent: #2563eb;
  --accent-2: #3b82f6;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 8px 24px -12px rgba(15, 23, 42, .12);
  --shadow-lift: 0 2px 4px rgba(15, 23, 42, .06), 0 14px 32px -12px rgba(15, 23, 42, .22);
}

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

html, body { height: 100%; }

body {
  display: flex;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro SC", "PingFang SC",
    "HarmonyOS Sans SC", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ============ 侧边栏 ============ */
#sidebar {
  width: 408px;
  flex-shrink: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border-right: 1px solid var(--line);
  z-index: 1000;
}

/* ---- 头部 ---- */
.header {
  position: relative;
  overflow: hidden;
  padding: 20px 20px 16px;
  color: #fff;
  background: linear-gradient(140deg, #0a1a3c 0%, #16357a 52%, #1d4ed8 135%);
}
.header::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(560px 220px at 88% -60px, rgba(59, 130, 246, .55), transparent 62%),
    radial-gradient(420px 180px at -50px 130%, rgba(14, 165, 233, .4), transparent 60%);
  pointer-events: none;
}
.header::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(147, 197, 253, .55), transparent);
}

.brand { position: relative; display: flex; align-items: center; gap: 12px; }
.brand-icon {
  width: 42px; height: 42px;
  display: grid; place-items: center;
  font-size: 1.35rem;
  background: rgba(255, 255, 255, .12);
  border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 12px;
  box-shadow: 0 6px 16px -6px rgba(0, 0, 0, .4);
}
.brand h1 { font-size: 1.14rem; font-weight: 800; letter-spacing: .01em; }
.brand p { font-size: .74rem; color: #a8c0ee; margin-top: 3px; font-weight: 500; }

.day-tabs {
  position: relative;
  display: flex;
  gap: 6px;
  margin-top: 16px;
  padding: 4px;
  background: rgba(255, 255, 255, .1);
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 12px;
}
.tab-btn {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 6px 7px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #b6c6e8;
  font-family: inherit;
  font-size: .84rem;
  font-weight: 700;
  cursor: pointer;
  transition: all .22s ease;
}
.tab-btn span { font-size: .64rem; font-weight: 600; opacity: .72; letter-spacing: .06em; }
.tab-btn:hover { color: #fff; }
.tab-btn.active {
  color: #fff;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  box-shadow: 0 6px 14px -4px rgba(37, 99, 235, .65);
}

/* ---- 时间轴 ---- */
.timeline {
  position: relative;
  flex: 1;
  overflow-y: auto;
  padding: 18px 16px 26px;
  scroll-behavior: smooth;
}
.timeline::-webkit-scrollbar { width: 8px; }
.timeline::-webkit-scrollbar-thumb { background: #d3dcec; border-radius: 8px; }
.timeline::-webkit-scrollbar-thumb:hover { background: #b9c6de; }

.timeline::before {
  content: '';
  position: absolute;
  left: 31px;
  top: 34px;
  bottom: 40px;
  width: 2px;
  border-radius: 2px;
  background: linear-gradient(180deg, #c9d6ee, #8fb7f5 55%, #c9d6ee);
}

.spot-card {
  position: relative;
  margin-bottom: 14px;
  padding: 14px 14px 14px 56px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease, background .2s ease;
}
.spot-card:hover {
  transform: translateY(-2px);
  border-color: #bcd0f8;
  box-shadow: var(--shadow-lift);
}
.spot-card.active {
  border-color: var(--accent);
  background: linear-gradient(180deg, #f5f9ff, #eef4ff);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12), var(--shadow-lift);
}

.spot-index {
  position: absolute;
  left: 19px;
  top: 17px;
  width: 27px; height: 27px;
  display: grid; place-items: center;
  font-size: .76rem; font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, #64748b, #475569);
  border: 2.5px solid #fff;
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(15, 23, 42, .25);
  transition: background .2s ease, transform .2s ease;
}
.spot-card.active .spot-index {
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  transform: scale(1.12);
}

.card-head { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 6px; }
.card-name {
  flex: 1;
  font-size: .94rem;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: .005em;
}
.card-time {
  flex-shrink: 0;
  margin-top: 1px;
  font-size: .7rem;
  font-weight: 700;
  color: #475569;
  background: #eef2f8;
  border: 1px solid #e2e8f2;
  padding: 3px 10px;
  border-radius: 999px;
}

.card-desc {
  font-size: .82rem;
  line-height: 1.65;
  color: var(--ink-2);
  margin-bottom: 10px;
}

.card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: .73rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.tag-bus   { background: #e9f0ff; color: #1d4ed8; border: 1px solid #c9dbff; }
.tag-taxi  { background: #f1ecff; color: #6d28d9; border: 1px solid #ddd0ff; }
.tag-walk  { background: #fef3e2; color: #b45309; border: 1px solid #fde0b8; }
.tag-mtr   { background: #fdeaea; color: #b91c1c; border: 1px solid #fbcaca; }
.tag-tram  { background: #e9f9ec; color: #15803d; border: 1px solid #c4ecd0; }
.tag-ship  { background: #e4f5fd; color: #0369a1; border: 1px solid #b7e3f7; }
.tag-end   { background: #eef1f6; color: #475569; border: 1px solid #dde3ec; }
.tag-cost  { margin-left: auto; background: #f8fafc; color: var(--ink-3); border: 1px solid var(--line); font-weight: 600; }
.tag-dist  { background: #f8fafc; color: var(--ink-4); border: 1px dashed #dbe2ec; font-weight: 600; }

.tip {
  margin-top: 11px;
  font-size: .77rem;
  line-height: 1.7;
  color: #6d5a17;
  background: linear-gradient(135deg, #fffdf0, #fff8dd);
  border: 1px solid #f5e3a1;
  border-radius: 10px;
  padding: 9px 12px;
}
.tip b { color: #92600a; }

/* ---- 底部统计 ---- */
.day-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 13px 16px 14px;
  background: var(--card);
  border-top: 1px solid var(--line);
  box-shadow: 0 -6px 18px -12px rgba(15, 23, 42, .18);
}
.stat { text-align: center; }
.stat .num { font-size: 1rem; font-weight: 800; color: var(--ink); letter-spacing: -.01em; }
.stat .num small { font-size: .66rem; font-weight: 700; color: var(--ink-4); margin-left: 1px; }
.stat .lbl { margin-top: 2px; font-size: .66rem; font-weight: 600; color: var(--ink-4); letter-spacing: .04em; }

/* ============ 地图 ============ */
#map { flex: 1; height: 100%; background: #dfe8f3; }

/* 编号图钉 */
.spot-pin-wrap { background: transparent; border: none; }
.spot-pin {
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  font-size: .72rem; font-weight: 800;
  color: #fff;
  background: var(--pin);
  background: linear-gradient(135deg, var(--pin), color-mix(in srgb, var(--pin), #000 22%));
  border: 2.5px solid #fff;
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(15, 23, 42, .42);
  transition: transform .25s cubic-bezier(.34, 1.56, .64, 1);
}
.spot-pin.active {
  transform: scale(1.3);
  animation: pin-pulse 1.7s ease-out infinite;
}
@keyframes pin-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(37, 99, 235, .45), 0 2px 8px rgba(15, 23, 42, .42); }
  70%  { box-shadow: 0 0 0 15px rgba(37, 99, 235, 0), 0 2px 8px rgba(15, 23, 42, .42); }
  100% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0),   0 2px 8px rgba(15, 23, 42, .42); }
}

/* 路线中点标签 */
.route-label-wrap { background: transparent; border: none; }
.route-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 11px;
  font-size: .7rem;
  font-weight: 800;
  color: #fff;
  white-space: nowrap;
  border-radius: 999px;
  border: 1.5px solid rgba(255, 255, 255, .92);
  box-shadow: 0 3px 10px rgba(15, 23, 42, .38);
  transition: opacity .3s ease;
}
.route-label.dim { opacity: .22; }

/* 图例 */
.map-legend {
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(8px);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 13px;
  box-shadow: 0 8px 24px -10px rgba(15, 23, 42, .28);
  font-size: .74rem;
}
.legend-title { font-weight: 800; font-size: .78rem; color: var(--ink); margin-bottom: 7px; letter-spacing: .02em; }
.legend-row { display: flex; align-items: center; gap: 9px; padding: 2.5px 0; color: var(--ink-2); font-weight: 600; }
.legend-row svg { flex-shrink: 0; }

/* 气泡 */
.leaflet-popup-content-wrapper {
  border-radius: 14px;
  box-shadow: 0 14px 40px -8px rgba(15, 23, 42, .35);
}
.leaflet-popup-content { margin: 13px 15px; }
.leaflet-popup-tip { box-shadow: none; }
.pop { font-size: .8rem; color: var(--ink-2); min-width: 210px; }
.pop-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.pop-idx {
  width: 22px; height: 22px;
  display: grid; place-items: center;
  border-radius: 50%;
  color: #fff;
  font-size: .7rem; font-weight: 800;
}
.pop-name { font-size: .92rem; color: var(--ink); }
.pop-row { margin: 4px 0; }
.pop-tip {
  margin-top: 9px;
  padding: 8px 10px;
  font-size: .74rem;
  line-height: 1.6;
  color: #6d5a17;
  background: #fff8dd;
  border: 1px solid #f5e3a1;
  border-radius: 9px;
}

/* Leaflet 控件微调 */
.leaflet-control-zoom a {
  width: 30px !important; height: 30px !important;
  line-height: 30px !important;
  color: var(--ink) !important;
}
.leaflet-control-zoom { border-radius: 10px !important; overflow: hidden; border: 1px solid var(--line) !important; box-shadow: 0 4px 14px -4px rgba(15,23,42,.3) !important; }
.leaflet-control-scale-line {
  background: rgba(255, 255, 255, .85) !important;
  border-color: var(--ink-3) !important;
  color: var(--ink-3) !important;
  font-weight: 600;
}

/* ============ 移动端 ============ */
@media (max-width: 860px) {
  body { flex-direction: column; }
  #map { order: 1; width: 100%; height: 42vh; }
  #sidebar { order: 2; width: 100%; height: 58vh; border-right: none; border-top: 1px solid var(--line); }
  .spot-card { padding-left: 52px; }
  .spot-index { left: 17px; }
  .timeline::before { left: 29px; }
  .map-legend { display: none; }
}
