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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", sans-serif;
  background: #f5f5f5;
  color: #333;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Header */
#header {
  background: linear-gradient(135deg, #ff9800, #f44336);
  color: white;
  padding: 10px 20px;
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-shrink: 0;
}
#app-title {
  font-size: 1.4rem;
  font-weight: 700;
}
#subtitle {
  font-size: 0.85rem;
  opacity: 0.9;
}

/* Search bar */
#search-bar {
  background: white;
  padding: 10px 20px;
  border-bottom: 1px solid #e0e0e0;
  flex-shrink: 0;
}
#date-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.date-label {
  font-size: 0.9rem;
  color: #666;
  display: flex;
  align-items: center;
  gap: 4px;
}
.date-label input[type="date"] {
  padding: 6px 8px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 0.9rem;
}
#btn-query {
  padding: 8px 20px;
  background: #ff9800;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 600;
  transition: background 0.2s;
}
#btn-query:hover {
  background: #f57c00;
}
#btn-query:disabled {
  background: #ccc;
  cursor: not-allowed;
}
#quick-dates {
  margin-top: 8px;
  display: flex;
  gap: 6px;
}
.quick-btn {
  padding: 4px 12px;
  border: 1px solid #ff9800;
  background: white;
  color: #ff9800;
  border-radius: 14px;
  cursor: pointer;
  font-size: 0.8rem;
  transition: all 0.2s;
}
.quick-btn:hover {
  background: #ff9800;
  color: white;
}

/* Slider */
#slider-container {
  background: white;
  padding: 8px 20px 4px;
  border-bottom: 1px solid #e0e0e0;
  flex-shrink: 0;
}
#slider-label {
  font-size: 0.95rem;
  font-weight: 600;
  color: #ff9800;
  margin-right: 10px;
}
#slider {
  width: calc(100% - 120px);
  vertical-align: middle;
  accent-color: #ff9800;
}

/* Map */
#map-container {
  flex: 1;
  position: relative;
  min-height: 0;
}
#map {
  width: 100%;
  height: 100%;
}

/* Loading */
#loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.8);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  gap: 12px;
  font-size: 1rem;
  color: #666;
}
#loading-overlay.hidden {
  display: none;
}
.spinner {
  width: 36px;
  height: 36px;
  border: 4px solid #e0e0e0;
  border-top: 4px solid #ff9800;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Stats bar */
#stats-bar {
  background: white;
  padding: 10px 20px;
  border-top: 1px solid #e0e0e0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  font-size: 0.9rem;
}
#stats {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}
.stat-item {
  display: flex;
  align-items: center;
  gap: 4px;
}
.stat-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
}
#filter-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
  font-size: 0.85rem;
  white-space: nowrap;
}

/* Toast */
#toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 10px 24px;
  border-radius: 8px;
  font-size: 0.9rem;
  z-index: 9999;
  transition: opacity 0.3s;
}
#toast.hidden {
  opacity: 0;
  pointer-events: none;
}

/* Source note */
#source-note {
  background: #fff8e1;
  text-align: center;
  padding: 4px;
  font-size: 0.75rem;
  color: #999;
  flex-shrink: 0;
}

/* Map popup (custom) */
.weather-popup {
  font-size: 0.85rem;
  line-height: 1.6;
  max-height: 320px;
  overflow-y: auto;
}
.weather-popup h3 {
  margin-bottom: 4px;
  font-size: 0.95rem;
}
.weather-popup .province {
  font-size: 0.75rem;
  color: #999;
  margin-bottom: 8px;
}
.weather-popup .day-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 0;
  border-bottom: 1px solid #f0f0f0;
}
.weather-popup .day-row:last-child {
  border-bottom: none;
}
.weather-popup .day-date {
  font-weight: 600;
  min-width: 42px;
}
.weather-popup .day-temp {
  color: #666;
  font-size: 0.8rem;
  min-width: 70px;
}
.weather-popup .day-source {
  font-size: 0.7rem;
  color: #bbb;
}
.weather-popup .summary {
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid #e0e0e0;
  font-size: 0.8rem;
  color: #666;
}
.weather-popup .badge {
  display: inline-block;
  background: #4caf50;
  color: white;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  margin-top: 4px;
}
