* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: #0b1026;
  color: #e8ebf2;
}

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

.panel {
  position: absolute;
  top: 16px;
  left: 16px;
  width: 320px;
  max-width: calc(100% - 32px);
  max-height: calc(100% - 32px);
  overflow-y: auto;
  background: rgba(11, 16, 38, 0.9);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 20px;
  z-index: 1000;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.panel h1 {
  margin: 0 0 4px 0;
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.subtitle {
  margin: 0 0 16px 0;
  font-size: 0.85rem;
  color: #8b93a8;
  line-height: 1.4;
}

.stats {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 18px;
}

.stat {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}

.stat-label {
  font-size: 0.75rem;
  color: #8b93a8;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-value {
  font-size: 0.9rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: #f0f3fa;
}

.location {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 18px;
}

.location-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.location h2 {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: #c6cbda;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#my-location-btn {
  background: rgba(91, 140, 255, 0.15);
  border: 1px solid rgba(91, 140, 255, 0.4);
  color: #5b8cff;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  flex-shrink: 0;
}

#my-location-btn:hover:not(:disabled) {
  background: rgba(91, 140, 255, 0.28);
}

#my-location-btn:disabled {
  opacity: 0.6;
  cursor: progress;
}

.controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 18px;
}

.controls label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  color: #c6cbda;
  cursor: pointer;
}

.controls input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #5b8cff;
  cursor: pointer;
}

.time-controls {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 14px;
}

.time-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.time-header h2 {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: #c6cbda;
}

#live-btn {
  background: rgba(91, 140, 255, 0.15);
  border: 1px solid rgba(91, 140, 255, 0.4);
  color: #5b8cff;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

#live-btn.active {
  background: rgba(91, 140, 255, 0.35);
  color: #fff;
}

#live-btn:hover {
  background: rgba(91, 140, 255, 0.25);
}

#time-slider {
  width: 100%;
  margin: 0 0 8px 0;
  cursor: pointer;
  accent-color: #5b8cff;
}

.time-value {
  font-size: 0.8rem;
  color: #8b93a8;
  text-align: center;
  margin-bottom: 12px;
  font-variant-numeric: tabular-nums;
}

.presets {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.presets button {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #c6cbda;
  padding: 6px 4px;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.presets button:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.2);
}

/* Leaflet customizations */
.leaflet-container {
  background: #0b1026;
}

.leaflet-control-attribution {
  background: rgba(11, 16, 38, 0.8) !important;
  color: #8b93a8 !important;
  border-top-left-radius: 8px;
}

.leaflet-control-attribution a {
  color: #a8b0c8 !important;
}

.leaflet-popup-content-wrapper {
  background: rgba(11, 16, 38, 0.95);
  color: #e8ebf2;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
}

.leaflet-popup-tip {
  background: rgba(11, 16, 38, 0.95);
}

.city-label {
  background: rgba(11, 16, 38, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #f0f3fa;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

@media (max-width: 480px) {
  .panel {
    top: auto;
    bottom: 16px;
    left: 16px;
    right: 16px;
    width: auto;
    max-height: 45%;
  }
}
