/* ============================================================
   动态数字地图行程可视化 — 完整样式
   ============================================================ */

/* --- CSS 变量（季节主题） --- */
:root {
  --theme-primary: #FF6B6B;
  --theme-secondary: #4ECDC4;
  --theme-accent: #FFD93D;
  --theme-bg: #1a1a2e;
  --theme-surface: #16213e;
  --theme-text: #e0e0e0;
  --theme-text-dim: #8892a4;
  --sidebar-width: 360px;
  --detail-width: 380px;
  --topbar-height: 56px;
  --transition-speed: 0.4s;
}

/* 季节：春 */
body.season-spring {
  --season-tint: rgba(129, 199, 132, 0.12);
  --season-accent: #81C784;
  --season-glow: rgba(129, 199, 132, 0.3);
}
/* 季节：夏 */
body.season-summer {
  --season-tint: rgba(255, 183, 77, 0.14);
  --season-accent: #FFB74D;
  --season-glow: rgba(255, 183, 77, 0.35);
}
/* 季节：秋 */
body.season-autumn {
  --season-tint: rgba(255, 138, 101, 0.12);
  --season-accent: #FF8A65;
  --season-glow: rgba(255, 138, 101, 0.3);
}
/* 季节：冬 */
body.season-winter {
  --season-tint: rgba(144, 202, 249, 0.12);
  --season-accent: #90CAF9;
  --season-glow: rgba(144, 202, 249, 0.3);
}

/* ============================================================
   基础重置
   ============================================================ */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  background: var(--theme-bg);
  color: var(--theme-text);
  overflow: hidden;
  height: 100vh;
  width: 100vw;
  user-select: none;
  -webkit-font-smoothing: antialiased;
}

/* ============================================================
   顶部导航栏
   ============================================================ */
.top-bar {
  height: var(--topbar-height);
  background: var(--theme-surface);
  display: flex;
  align-items: center;
  padding: 0 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  gap: 24px;
  z-index: 1000;
  position: relative;
  backdrop-filter: blur(10px);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.5px;
}
.logo i {
  font-size: 1.4rem;
  background: linear-gradient(135deg, #FF6B6B, #FFD93D);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.header-info {
  display: flex;
  gap: 20px;
  font-size: 0.85rem;
  color: var(--theme-text-dim);
}
.header-info i {
  margin-right: 4px;
  color: var(--season-accent, #FFD93D);
}

.header-controls {
  margin-left: auto;
  display: flex;
  gap: 16px;
  align-items: center;
}

.weather-selector,
.time-selector,
.season-selector {
  display: flex;
  gap: 4px;
  background: rgba(255,255,255,0.05);
  border-radius: 8px;
  padding: 3px;
}

.wx-btn,
.time-btn,
.season-btn {
  width: 34px;
  height: 30px;
  border: none;
  background: transparent;
  color: #aaa;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.25s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.wx-btn:hover,
.time-btn:hover,
.season-btn:hover {
  color: #fff;
  background: rgba(255,255,255,0.1);
}
.wx-btn.active,
.time-btn.active,
.season-btn.active {
  color: #fff;
  background: rgba(255,255,255,0.18);
  box-shadow: 0 0 8px var(--season-glow);
}

/* ============================================================
   主体布局
   ============================================================ */
.main-container {
  display: flex;
  height: calc(100vh - var(--topbar-height));
  position: relative;
}

/* ============================================================
   左侧边栏
   ============================================================ */
.sidebar {
  width: var(--sidebar-width);
  background: var(--theme-surface);
  border-right: 1px solid rgba(255,255,255,0.06);
  display: flex;
  flex-direction: column;
  z-index: 500;
  transition: transform var(--transition-speed);
}

.sidebar-header {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.sidebar-header h2 {
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.sidebar-header h2 i {
  color: var(--season-accent, #FFD93D);
}

.sidebar-tabs {
  display: flex;
  gap: 4px;
  background: rgba(255,255,255,0.04);
  border-radius: 8px;
  padding: 3px;
}
.tab-btn {
  flex: 1;
  padding: 7px 0;
  border: none;
  background: transparent;
  color: #888;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.82rem;
  transition: all 0.25s;
}
.tab-btn:hover { color: #ccc; }
.tab-btn.active {
  background: rgba(255,255,255,0.12);
  color: #fff;
  font-weight: 600;
}

.tab-content {
  display: none;
  flex: 1;
  overflow: hidden;
}
.tab-content.active { display: flex; flex-direction: column; }

/* --- 时间线滚动区 --- */
.timeline-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
}

.timeline-scroll::-webkit-scrollbar {
  width: 4px;
}
.timeline-scroll::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.12);
  border-radius: 2px;
}

/* --- 单日卡片 --- */
.day-card {
  position: relative;
  padding: 14px 16px 14px 24px;
  margin-bottom: 10px;
  background: rgba(255,255,255,0.03);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s;
  border: 1px solid transparent;
}
.day-card:hover {
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.1);
}
.day-card.active {
  background: rgba(255,255,255,0.08);
  border-color: var(--season-accent, #FFD93D);
  box-shadow: 0 0 20px rgba(0,0,0,0.3), inset 0 0 0 1px var(--season-glow);
}

/* 时间线竖线 */
.day-card::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 22px;
  bottom: -10px;
  width: 2px;
  background: rgba(255,255,255,0.08);
  z-index: 0;
}
.day-card:last-child::before { display: none; }

/* 时间线圆点 */
.day-card::after {
  content: '';
  position: absolute;
  left: 4.5px;
  top: 18px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--card-color, #FFD93D);
  z-index: 1;
  box-shadow: 0 0 8px var(--card-color, #FFD93D);
  transition: all 0.3s;
}
.day-card.active::after {
  width: 12px;
  height: 12px;
  left: 3px;
  top: 16.5px;
  box-shadow: 0 0 16px var(--card-color, #FFD93D);
}

.day-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.day-label {
  font-weight: 700;
  font-size: 0.9rem;
  color: #fff;
}
.day-date {
  font-size: 0.72rem;
  color: var(--theme-text-dim);
}
.day-route {
  font-size: 0.8rem;
  color: #bbb;
  line-height: 1.5;
}
.day-transport {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  color: var(--season-accent, #FFD93D);
  margin-top: 4px;
  background: rgba(255,255,255,0.05);
  padding: 2px 8px;
  border-radius: 10px;
}

.day-stops {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 8px;
}
.stop-tag {
  font-size: 0.68rem;
  padding: 2px 8px;
  border-radius: 8px;
  background: rgba(255,255,255,0.06);
  color: #aaa;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 3px;
}
.stop-tag:hover {
  background: rgba(255,255,255,0.14);
  color: #fff;
}
.stop-tag.hotel { border-left: 2px solid #4ECDC4; }
.stop-tag.food  { border-left: 2px solid #FF6B6B; }
.stop-tag.view  { border-left: 2px solid #FFD93D; }

/* --- 交通列表 --- */
.transport-list {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.transport-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: rgba(255,255,255,0.03);
  border-radius: 10px;
  font-size: 0.85rem;
  transition: all 0.2s;
}
.transport-item:hover {
  background: rgba(255,255,255,0.06);
}
.transport-icon {
  font-size: 1.3rem;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.06);
  border-radius: 50%;
}
.transport-dist {
  margin-left: auto;
  color: var(--theme-text-dim);
  font-size: 0.78rem;
}

/* --- 统计 --- */
.stats-grid {
  padding: 20px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.stat-card {
  padding: 18px 14px;
  background: rgba(255,255,255,0.03);
  border-radius: 10px;
  text-align: center;
  transition: all 0.2s;
}
.stat-card:hover {
  background: rgba(255,255,255,0.06);
}
.stat-number {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--season-accent, #FFD93D);
}
.stat-label {
  font-size: 0.72rem;
  color: var(--theme-text-dim);
  margin-top: 4px;
}

/* ============================================================
   地图区域
   ============================================================ */
.map-wrapper {
  flex: 1;
  position: relative;
  overflow: hidden;
}

#map {
  width: 100%;
  height: 100%;
  z-index: 1;
}

/* Leaflet 深色主题覆盖 */
.leaflet-container {
  background: #1a1a2e;
}
.leaflet-tile-pane {
  filter: brightness(0.75) saturate(0.8);
}

/* 昼夜 / 季节覆盖层 */
.map-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  transition: background 1.5s ease;
}
/* 白天 */
body.time-day .map-overlay {
  background: transparent;
}
/* 黄昏 */
body.time-dusk .map-overlay {
  background: linear-gradient(180deg,
    rgba(255, 140, 50, 0.15) 0%,
    rgba(180, 100, 70, 0.08) 40%,
    rgba(30, 20, 60, 0.2) 100%);
}
/* 夜晚 */
body.time-night .map-overlay {
  background: linear-gradient(180deg,
    rgba(10, 10, 40, 0.55) 0%,
    rgba(20, 15, 50, 0.45) 50%,
    rgba(5, 5, 25, 0.6) 100%);
}

/* 季节色彩叠加 */
body.season-spring .map-overlay {
  background-blend-mode: overlay;
}
body.season-summer .map-overlay {
  background-blend-mode: soft-light;
}
body.season-autumn .map-overlay {
  background-blend-mode: overlay;
}
body.season-winter .map-overlay {
  background-blend-mode: soft-light;
}

/* 天气画布 */
#weatherCanvas {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
}

/* ============================================================
   地图图例
   ============================================================ */
.map-legend {
  position: absolute;
  bottom: 60px;
  right: 12px;
  z-index: 5;
  background: rgba(22, 33, 62, 0.92);
  backdrop-filter: blur(8px);
  border-radius: 10px;
  padding: 12px 16px;
  border: 1px solid rgba(255,255,255,0.1);
  font-size: 0.72rem;
  min-width: 160px;
}
.legend-title {
  font-weight: 700;
  color: #fff;
  margin-bottom: 8px;
  font-size: 0.78rem;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 0;
  color: #bbb;
}
.legend-line {
  width: 24px;
  height: 3px;
  border-radius: 2px;
  flex-shrink: 0;
}

/* ============================================================
   地图控制按钮
   ============================================================ */
.map-controls {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 5;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ctrl-btn {
  width: 40px;
  height: 40px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(22, 33, 62, 0.9);
  backdrop-filter: blur(8px);
  color: #ddd;
  border-radius: 10px;
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.25s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ctrl-btn:hover {
  background: rgba(255,255,255,0.15);
  color: #fff;
  border-color: rgba(255,255,255,0.25);
}
.ctrl-btn.playing {
  background: var(--season-accent, #FFD93D);
  color: #1a1a2e;
  border-color: transparent;
  animation: pulse-btn 1.2s ease-in-out infinite;
}
@keyframes pulse-btn {
  0%, 100% { box-shadow: 0 0 8px var(--season-glow); }
  50% { box-shadow: 0 0 20px var(--season-glow), 0 0 4px var(--season-accent); }
}

/* ============================================================
   地图信息条
   ============================================================ */
.map-info-bar {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  background: rgba(22, 33, 62, 0.9);
  backdrop-filter: blur(8px);
  border-radius: 20px;
  padding: 8px 20px;
  font-size: 0.8rem;
  color: #ccc;
  border: 1px solid rgba(255,255,255,0.08);
  transition: all 0.3s;
}

/* ============================================================
   自定义 Leaflet 弹窗
   ============================================================ */
.leaflet-popup-content-wrapper {
  background: rgba(22, 33, 62, 0.95) !important;
  backdrop-filter: blur(12px);
  color: #e0e0e0 !important;
  border-radius: 12px !important;
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}
.leaflet-popup-tip {
  background: rgba(22, 33, 62, 0.95) !important;
}
.leaflet-popup-content {
  margin: 12px 16px !important;
  font-size: 0.85rem !important;
  line-height: 1.6 !important;
}
.leaflet-popup-close-button {
  color: #aaa !important;
}

.popup-title {
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 4px;
  color: #fff;
}
.popup-meta {
  font-size: 0.72rem;
  color: var(--theme-text-dim);
  margin-bottom: 8px;
  display: flex;
  gap: 12px;
}
.popup-meta i { color: var(--season-accent, #FFD93D); }
.popup-desc {
  font-size: 0.8rem;
  color: #bbb;
  line-height: 1.5;
}
.popup-tags {
  display: flex;
  gap: 4px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.popup-tag {
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(255,255,255,0.08);
  color: #aaa;
}

/* 自定义标记样式 */
.custom-marker {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  transition: transform 0.2s;
  font-size: 14px;
}
.custom-marker:hover {
  transform: scale(1.25);
}
.marker-attraction {
  background: rgba(255, 107, 107, 0.9);
  border: 2px solid #fff;
}
.marker-hotel {
  background: rgba(78, 205, 196, 0.9);
  border: 2px solid #fff;
}
.marker-food {
  background: rgba(255, 147, 58, 0.9);
  border: 2px solid #fff;
}
.marker-transport {
  background: rgba(108, 92, 231, 0.9);
  border: 2px solid #fff;
}

/* ============================================================
   右侧详情面板
   ============================================================ */
.detail-panel {
  width: var(--detail-width);
  background: var(--theme-surface);
  border-left: 1px solid rgba(255,255,255,0.06);
  display: flex;
  flex-direction: column;
  z-index: 500;
  transition: all var(--transition-speed);
}
.detail-panel.collapsed {
  transform: translateX(100%);
  width: 0;
  overflow: hidden;
}

.detail-header {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.detail-header h3 {
  font-size: 0.95rem;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
}
.detail-header h3 i { color: var(--season-accent, #FFD93D); }
.close-btn {
  width: 30px;
  height: 30px;
  border: none;
  background: rgba(255,255,255,0.06);
  color: #aaa;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1.1rem;
  transition: all 0.2s;
}
.close-btn:hover { background: rgba(255,255,255,0.14); color: #fff; }

.detail-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}
.detail-content::-webkit-scrollbar {
  width: 4px;
}
.detail-content::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.1);
  border-radius: 2px;
}
.detail-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: #555;
  text-align: center;
  gap: 16px;
}
.detail-placeholder i {
  font-size: 2.5rem;
  opacity: 0.3;
}
.detail-placeholder p {
  font-size: 0.85rem;
  line-height: 1.6;
}

/* 详情卡片 */
.detail-card {
  animation: fadeInUp 0.35s ease;
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
.detail-card .poi-image {
  width: 100%;
  height: 180px;
  border-radius: 10px;
  object-fit: cover;
  margin-bottom: 14px;
  background: linear-gradient(135deg, #2d3436, #636e72);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
}
.detail-card .poi-name {
  font-size: 1.2rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 4px;
}
.detail-card .poi-type {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 10px;
  font-size: 0.7rem;
  font-weight: 600;
  margin-bottom: 10px;
}
.poi-type.attraction { background: rgba(255,107,107,0.2); color: #FF6B6B; }
.poi-type.hotel      { background: rgba(78,205,196,0.2); color: #4ECDC4; }
.poi-type.food       { background: rgba(255,147,58,0.2); color: #FF9358; }

.detail-card .poi-rating {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
  font-size: 0.85rem;
  color: #FFD93D;
}
.detail-card .poi-desc {
  font-size: 0.82rem;
  color: #bbb;
  line-height: 1.7;
}
.detail-card .poi-info-row {
  display: flex;
  gap: 16px;
  margin-top: 12px;
  font-size: 0.78rem;
  color: var(--theme-text-dim);
}
.detail-card .poi-info-row i { color: var(--season-accent, #FFD93D); width: 16px; }

/* ============================================================
   AI 助手浮窗
   ============================================================ */
.ai-assistant {
  position: fixed;
  bottom: 24px;
  left: calc(var(--sidebar-width) + 24px);
  z-index: 2000;
}

.ai-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(22, 33, 62, 0.9);
  backdrop-filter: blur(12px);
  color: #fff;
  border-radius: 24px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  transition: all 0.3s;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}
.ai-toggle:hover {
  background: rgba(255,255,255,0.12);
  border-color: var(--season-accent, #FFD93D);
  box-shadow: 0 4px 20px var(--season-glow);
}
.ai-toggle i {
  font-size: 1.2rem;
  animation: robot-pulse 2s ease-in-out infinite;
}
@keyframes robot-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

.ai-panel {
  display: none;
  position: absolute;
  bottom: 56px;
  left: 0;
  width: 340px;
  height: 420px;
  background: rgba(22, 33, 62, 0.96);
  backdrop-filter: blur(16px);
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.12);
  flex-direction: column;
  box-shadow: 0 12px 40px rgba(0,0,0,0.5);
  overflow: hidden;
}
.ai-panel.open { display: flex; }

.ai-panel-header {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
  font-weight: 600;
  color: #fff;
}
.ai-close {
  width: 26px;
  height: 26px;
  border: none;
  background: rgba(255,255,255,0.06);
  color: #aaa;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1rem;
}

.ai-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.ai-messages::-webkit-scrollbar {
  width: 3px;
}
.ai-msg {
  display: flex;
  gap: 8px;
  animation: fadeInUp 0.3s ease;
}
.ai-msg.user {
  flex-direction: row-reverse;
}
.ai-avatar {
  font-size: 1.6rem;
  flex-shrink: 0;
  width: 32px;
  text-align: center;
}
.ai-bubble {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 0.8rem;
  line-height: 1.6;
  color: #ddd;
}
.ai-msg.bot .ai-bubble {
  background: rgba(255,255,255,0.06);
  border-bottom-left-radius: 4px;
}
.ai-msg.user .ai-bubble {
  background: rgba(255, 183, 77, 0.2);
  border-bottom-right-radius: 4px;
}

.ai-input-row {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.ai-input-row input {
  flex: 1;
  padding: 8px 14px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 20px;
  color: #eee;
  font-size: 0.82rem;
  outline: none;
  transition: border-color 0.2s;
}
.ai-input-row input:focus {
  border-color: var(--season-accent, #FFD93D);
}
.ai-input-row input::placeholder { color: #666; }
.ai-input-row button {
  width: 36px;
  height: 36px;
  border: none;
  background: var(--season-accent, #FFD93D);
  color: #1a1a2e;
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.2s;
  flex-shrink: 0;
}
.ai-input-row button:hover {
  transform: scale(1.08);
  box-shadow: 0 0 12px var(--season-glow);
}

/* ============================================================
   响应式
   ============================================================ */
@media (max-width: 1200px) {
  .detail-panel { display: none; }
  .sidebar { width: 300px; }
  :root { --sidebar-width: 300px; }
}
@media (max-width: 768px) {
  .sidebar { display: none; }
  .header-controls { display: none; }
  .ai-assistant { left: 16px; bottom: 16px; }
  .ai-panel { width: calc(100vw - 32px); }
}
