/* ============================================
   成都时空数据可视化 - 样式表
   ============================================ */

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

html, body {
  width: 100%; height: 100%; overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #0a0e1a;
}

#map { position: absolute; top: 0; left: 0; right: 0; bottom: 0; z-index: 1; transition: filter 0.8s; }

/* 雨天遮罩 */
#rain-overlay {
  position: absolute; top: 0; left: 0; right: 0; bottom: 0; z-index: 2;
  background: linear-gradient(rgba(100,120,160,0.3), rgba(80,100,140,0.2));
  pointer-events: none; opacity: 0; transition: opacity 1s;
}

/* ---- 控制面板 ---- */
#control-panel {
  position: absolute; top: 16px; left: 16px; width: 340px;
  max-height: calc(100vh - 120px);
  background: rgba(15, 20, 32, 0.88);
  backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
  border-radius: 16px; border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  color: #e8eaf0; z-index: 1000;
  overflow-y: auto; overflow-x: hidden;
}
#control-panel::-webkit-scrollbar { width: 6px; }
#control-panel::-webkit-scrollbar-track { background: transparent; }
#control-panel::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 3px; }

/* ---- 天气栏 ---- */
.weather-bar {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 22px;
  background: linear-gradient(135deg, rgba(33,150,243,0.15), rgba(76,175,80,0.08));
  border-radius: 16px 16px 0 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.weather-icon { font-size: 36px; line-height: 1; }
.weather-main { flex: 1; }
.weather-temp { font-size: 22px; font-weight: 700; color: #fff; }
.weather-cond { font-size: 13px; color: rgba(255,255,255,0.7); margin-top: 2px; }
.weather-extra { display: flex; gap: 12px; font-size: 10px; color: rgba(255,255,255,0.4); margin-top: 4px; }
.weather-extra span { display: flex; align-items: center; gap: 3px; }

/* ---- 面板标题 ---- */
.panel-header {
  padding: 14px 22px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.panel-header h1 {
  font-size: 17px; font-weight: 700; letter-spacing: 0.5px;
  background: linear-gradient(90deg, #64b5f6, #81c784);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.panel-header .subtitle { font-size: 11px; color: rgba(255,255,255,0.5); margin-top: 3px; }
.panel-header .badges { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.panel-header .badge {
  font-size: 9px; padding: 2px 7px; border-radius: 10px;
  background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.6);
}

/* ---- 采样信息 ---- */
.sampling-info {
  padding: 12px 22px;
  background: linear-gradient(135deg, rgba(37,99,235,0.12), rgba(124,58,237,0.08));
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.sampling-date, .sampling-time {
  display: flex; align-items: center; gap: 8px; margin-bottom: 6px;
}
.si-label {
  font-size: 9px; font-weight: 600; color: rgba(255,255,255,0.35);
  text-transform: uppercase; letter-spacing: 0.5px;
  min-width: 48px;
}
.si-value {
  font-size: 13px; font-weight: 600; color: rgba(255,255,255,0.9);
}
.si-duration {
  font-size: 10px; color: #60a5fa; font-weight: 700;
  background: rgba(96,165,250,0.15); padding: 1px 6px; border-radius: 8px;
}
.sampling-meta {
  display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px;
}
.si-chip {
  font-size: 9px; color: rgba(255,255,255,0.55);
  background: rgba(255,255,255,0.06); padding: 2px 7px; border-radius: 10px;
}
.sampling-ref {
  font-size: 8.5px; color: rgba(255,255,255,0.25); margin-top: 8px; line-height: 1.5;
}

/* ---- 通用 section ---- */
.section { padding: 14px 22px; border-bottom: 1px solid rgba(255,255,255,0.04); }
.section h3 {
  font-size: 11px; font-weight: 600; color: rgba(255,255,255,0.45);
  text-transform: uppercase; letter-spacing: 1px; margin-bottom: 10px;
}

/* ---- 图层开关 ---- */
.layer-toggles { display: flex; flex-direction: column; gap: 6px; }
.layer-toggles label {
  display: flex; align-items: center; gap: 8px; cursor: pointer;
  font-size: 12px; color: rgba(255,255,255,0.8); padding: 4px 0; transition: color 0.2s;
}
.layer-toggles label:hover { color: #fff; }
.layer-toggles input[type="checkbox"] {
  appearance: none; -webkit-appearance: none;
  width: 32px; height: 18px; border-radius: 9px;
  background: rgba(255,255,255,0.12); position: relative; cursor: pointer;
  transition: background 0.3s; flex-shrink: 0;
}
.layer-toggles input[type="checkbox"]::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform 0.3s;
}
.layer-toggles input[type="checkbox"]:checked { background: #2196F3; }
.layer-toggles input[type="checkbox"]:checked::after { transform: translateX(14px); }
.layer-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

/* ---- 统计卡片 ---- */
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stat-card {
  background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.06);
  border-radius: 8px; padding: 10px 12px; text-align: center; transition: background 0.2s;
}
.stat-card:hover { background: rgba(255,255,255,0.07); }
.stat-value { display: block; font-size: 20px; font-weight: 700; color: #64b5f6; line-height: 1.2; }
.stat-card:nth-child(2) .stat-value { color: #ef5350; }
.stat-card:nth-child(3) .stat-value { color: #66bb6a; }
.stat-card:nth-child(4) .stat-value { color: #ffa726; }
.stat-card:nth-child(5) .stat-value { color: #ab47bc; }
.stat-card:nth-child(6) .stat-value { color: #26c6da; }
.stat-card:nth-child(7) .stat-value { color: #ec407a; }
.stat-label { display: block; font-size: 9px; color: rgba(255,255,255,0.4); margin-top: 3px; }

/* ---- 图表 ---- */
#time-chart { width: 100%; height: 72px; display: block; border-radius: 6px; background: rgba(0,0,0,0.2); }
.chart-hint { font-size: 10px; color: rgba(255,255,255,0.3); margin-top: 5px; }

/* ---- 数据来源 ---- */
.ds-item { display: flex; gap: 8px; padding: 6px 0; border-bottom: 1px solid rgba(255,255,255,0.03); }
.ds-item:last-child { border-bottom: none; }
.ds-icon { flex-shrink: 0; width: 20px; text-align: center; font-size: 14px; }
.ds-content { flex: 1; min-width: 0; }
.ds-name { font-size: 11px; color: rgba(255,255,255,0.75); font-weight: 500; }
.ds-source { font-size: 9px; color: rgba(255,255,255,0.35); margin-top: 1px; }

/* ---- 时间控制器 ---- */
#time-controller {
  position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%);
  width: min(680px, calc(100vw - 380px));
  background: rgba(15,20,32,0.88); backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
  border-radius: 14px; border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4); padding: 12px 20px;
  display: flex; align-items: center; gap: 14px; z-index: 1000;
}
#play-btn {
  width: 38px; height: 38px; border-radius: 50%; border: none;
  background: linear-gradient(135deg, #2196F3, #1976D2); color: #fff; font-size: 13px;
  cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  transition: transform 0.15s, box-shadow 0.2s; box-shadow: 0 4px 12px rgba(33,150,243,0.4);
}
#play-btn:hover { transform: scale(1.08); box-shadow: 0 6px 18px rgba(33,150,243,0.5); }
#play-btn:active { transform: scale(0.95); }

.time-slider-container { flex: 1; display: flex; flex-direction: column; gap: 5px; }
#time-slider {
  appearance: none; -webkit-appearance: none; width: 100%; height: 6px; border-radius: 3px;
  background: linear-gradient(90deg, rgba(33,150,243,0.3), rgba(76,175,80,0.3)); outline: none; cursor: pointer;
}
#time-slider::-webkit-slider-thumb {
  appearance: none; -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; border: 3px solid #2196F3; cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
#time-slider::-moz-range-thumb {
  width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 3px solid #2196F3; cursor: pointer;
}
.time-display { display: flex; justify-content: space-between; align-items: center; }
#current-time { font-size: 15px; font-weight: 700; color: #fff; font-variant-numeric: tabular-nums; letter-spacing: 1px; }
.time-range { font-size: 10px; color: rgba(255,255,255,0.3); }
.speed-control { display: flex; flex-direction: column; align-items: center; gap: 2px; flex-shrink: 0; }
.speed-control label { font-size: 9px; color: rgba(255,255,255,0.35); text-transform: uppercase; letter-spacing: 0.5px; }
#speed-select {
  background: rgba(255,255,255,0.08); color: #fff; border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px; padding: 3px 6px; font-size: 11px; cursor: pointer; outline: none;
}
#speed-select option { background: #1a1f2e; }

/* ---- 图例 ---- */
#legend {
  position: absolute; bottom: 20px; right: 16px;
  background: rgba(15,20,32,0.88); backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
  border-radius: 12px; border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 4px 16px rgba(0,0,0,0.3); padding: 12px 14px; z-index: 1000; max-width: 190px;
}
#legend h4 { font-size: 10px; font-weight: 600; color: rgba(255,255,255,0.45); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 6px; }
.legend-item { display: flex; align-items: center; gap: 7px; padding: 2px 0; font-size: 11px; color: rgba(255,255,255,0.7); }
.legend-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.legend-sep { height: 1px; background: rgba(255,255,255,0.06); margin: 4px 0; }
.legend-line { width: 16px; height: 3px; border-radius: 2px; flex-shrink: 0; }

/* ---- 出租车标记 ---- */
.taxi-marker { background: transparent !important; border: none !important; }
.taxi-dot {
  width: 13px; height: 13px; border-radius: 50%; border: 2px solid #fff;
  box-shadow: 0 0 4px var(--glow), 0 1px 3px rgba(0,0,0,0.4); transition: transform 0.1s;
}
.taxi-dot.occupied { animation: taxiPulse 1.5s ease-in-out infinite; }
@keyframes taxiPulse {
  0%, 100% { box-shadow: 0 0 4px var(--glow), 0 0 0 0 var(--glow); }
  50% { box-shadow: 0 0 8px var(--glow), 0 0 0 6px transparent; }
}

/* ---- POI 标记 ---- */
.poi-marker { background: transparent !important; border: none !important; }
.poi-pin {
  width: 26px; height: 26px; border-radius: 50%; background: var(--poi-color);
  display: flex; align-items: center; justify-content: center;
  border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,0.3);
  cursor: pointer; transition: transform 0.2s; position: relative;
}
.poi-pin:hover { transform: scale(1.3); z-index: 10000; }
.poi-icon { font-size: 12px; line-height: 1; }
.poi-label {
  position: absolute; top: 28px; left: 50%; transform: translateX(-50%);
  white-space: nowrap; font-size: 10px; font-weight: 500; color: #1a1a2e;
  background: rgba(255,255,255,0.92); padding: 1px 6px; border-radius: 4px;
  pointer-events: none; opacity: 0; transition: opacity 0.2s;
}
.poi-pin:hover .poi-label { opacity: 1; }

/* ---- 地铁站标记 ---- */
.metro-marker { background: transparent !important; border: none !important; }
.metro-station { position: relative; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.metro-ring {
  position: absolute; border-radius: 50%; border: 2px solid; opacity: 0.4;
}
.metro-dot {
  border-radius: 50%; border: 2px solid #fff; z-index: 2;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3); transition: transform 0.2s;
}
.metro-station:hover .metro-dot { transform: scale(1.4); }
.metro-station.interchange .metro-dot { animation: metroGlow 2s ease-in-out infinite; }
@keyframes metroGlow {
  0%, 100% { box-shadow: 0 0 4px rgba(255,255,255,0.3), 0 1px 4px rgba(0,0,0,0.3); }
  50% { box-shadow: 0 0 12px rgba(255,255,255,0.5), 0 1px 4px rgba(0,0,0,0.3); }
}
.metro-label {
  position: absolute; top: 100%; left: 50%; transform: translateX(-50%); margin-top: 4px;
  white-space: nowrap; font-size: 10px; color: rgba(26,26,46,0.85);
  background: rgba(255,255,255,0.85); padding: 1px 5px; border-radius: 3px;
  pointer-events: none; opacity: 0; transition: opacity 0.2s;
}
.metro-station:hover .metro-label { opacity: 1; }

/* ---- 签到脉冲 ---- */
.checkin-marker { background: transparent !important; border: none !important; }
.checkin-pulse {
  width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; position: relative;
}
.checkin-ring {
  position: absolute; width: 100%; height: 100%; border-radius: 50%;
  border: 2px solid var(--ck-color); animation: checkinRing 1.5s ease-out infinite;
}
.checkin-ring2 {
  position: absolute; width: 100%; height: 100%; border-radius: 50%;
  border: 2px solid var(--ck-color); animation: checkinRing 1.5s ease-out 0.5s infinite;
}
@keyframes checkinRing {
  0% { transform: scale(0.3); opacity: 1; }
  100% { transform: scale(1.8); opacity: 0; }
}
.checkin-icon { font-size: 14px; z-index: 2; filter: drop-shadow(0 1px 2px rgba(0,0,0,0.4)); }

/* ---- Popup ---- */
.leaflet-popup-content-wrapper {
  background: rgba(15,20,32,0.95); backdrop-filter: blur(20px);
  border-radius: 10px; border: 1px solid rgba(255,255,255,0.1);
  box-shadow: 0 8px 24px rgba(0,0,0,0.5); color: #e8eaf0;
}
.leaflet-popup-content { margin: 12px 14px; font-size: 12px; line-height: 1.5; min-width: 160px; }
.leaflet-popup-tip { background: rgba(15,20,32,0.95); }
.leaflet-popup-close-button { color: rgba(255,255,255,0.5) !important; }
.popup-title { font-size: 14px; font-weight: 700; color: #fff; margin-bottom: 3px; }
.popup-cat { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; }
.popup-desc { font-size: 11px; color: rgba(255,255,255,0.55); margin-bottom: 6px; }
.popup-meta { font-size: 10px; color: rgba(255,255,255,0.3); font-family: monospace; }
.popup-status { display: flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; margin-bottom: 4px; }
.popup-status.occupied { color: #ef5350; }
.popup-status.cruising { color: #64b5f6; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.popup-route { font-size: 11px; color: rgba(255,255,255,0.65); }
.popup-bar { width: 100%; height: 5px; background: rgba(255,255,255,0.1); border-radius: 3px; margin: 6px 0; overflow: hidden; }
.popup-bar-fill { height: 100%; background: linear-gradient(90deg, #4CAF50, #FF9800, #F44336); border-radius: 3px; width: 0%; transition: width 0.3s; }

/* ---- Leaflet 控件 ---- */
.leaflet-control-zoom { border: none !important; box-shadow: 0 4px 12px rgba(0,0,0,0.3) !important; }
.leaflet-control-zoom a {
  background: rgba(15,20,32,0.88) !important; backdrop-filter: blur(20px); color: #fff !important;
  border: 1px solid rgba(255,255,255,0.08) !important; border-radius: 8px !important; margin-bottom: 4px !important;
}
.leaflet-control-zoom a:hover { background: rgba(33,150,243,0.3) !important; }
.leaflet-bar { border: none !important; }

/* ---- 响应式 ---- */
@media (max-width: 768px) {
  #control-panel { width: 280px; max-height: calc(100vh - 180px); }
  #time-controller { width: calc(100vw - 32px); left: 16px; transform: none; }
  #legend { display: none; }
}
