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

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: #0d1117;
  color: #e6edf3;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Header */
#header {
  background: linear-gradient(135deg, #1a237e 0%, #0d47a1 50%, #01579b 100%);
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 10px rgba(0,0,0,0.5);
  z-index: 1000;
  flex-shrink: 0;
}

#header h1 {
  font-size: 1.3rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 10px;
}

#header h1 .icon {
  font-size: 1.5rem;
}

#header-right {
  display: flex;
  align-items: center;
  gap: 15px;
  font-size: 0.85rem;
}

#last-updated {
  color: #90caf9;
  font-size: 0.78rem;
}

#status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #4caf50;
  display: inline-block;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* Main layout */
#main {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* Map container */
#map {
  flex: 1;
  height: 100%;
}

/* Side panel */
#side-panel {
  width: 280px;
  background: #161b22;
  border-left: 1px solid #30363d;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  flex-shrink: 0;
}

.panel-section {
  padding: 14px 16px;
  border-bottom: 1px solid #30363d;
}

.panel-section h3 {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #58a6ff;
  margin-bottom: 10px;
  font-weight: 600;
}

/* Time controls */
#time-control {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#time-display {
  text-align: center;
  font-size: 0.9rem;
  font-weight: 600;
  color: #e6edf3;
  background: #0d1117;
  padding: 8px;
  border-radius: 6px;
  border: 1px solid #30363d;
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#timeline-slider {
  width: 100%;
  accent-color: #58a6ff;
  cursor: pointer;
}

#playback-controls {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.ctrl-btn {
  background: #21262d;
  border: 1px solid #30363d;
  color: #e6edf3;
  padding: 8px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 5px;
}

.ctrl-btn:hover {
  background: #30363d;
  border-color: #58a6ff;
}

.ctrl-btn.active {
  background: #1f6feb;
  border-color: #388bfd;
}

/* Speed control */
#speed-control {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
}

#speed-control label {
  color: #8b949e;
  white-space: nowrap;
}

#speed-select {
  flex: 1;
  background: #21262d;
  border: 1px solid #30363d;
  color: #e6edf3;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.82rem;
  cursor: pointer;
}

/* Layer controls */
.layer-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  font-size: 0.85rem;
  cursor: pointer;
}

.layer-item input[type="checkbox"],
.layer-item input[type="radio"] {
  accent-color: #58a6ff;
  cursor: pointer;
  width: 15px;
  height: 15px;
}

.layer-item label {
  cursor: pointer;
  flex: 1;
}

/* Opacity slider */
.opacity-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  font-size: 0.8rem;
  color: #8b949e;
}

.opacity-row input[type="range"] {
  flex: 1;
  accent-color: #58a6ff;
}

/* Legend */
#radar-legend {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.legend-bar {
  height: 20px;
  border-radius: 3px;
  background: linear-gradient(to right,
    #00BFFF,
    #0096FF,
    #00FF00,
    #ADFF2F,
    #FFFF00,
    #FFA500,
    #FF4500,
    #FF0000,
    #8B0000,
    #FF00FF
  );
  border: 1px solid #30363d;
}

.legend-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: #8b949e;
}

.legend-title {
  font-size: 0.75rem;
  color: #8b949e;
  margin-bottom: 4px;
}

/* Info section */
.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 0;
  font-size: 0.8rem;
  border-bottom: 1px solid #21262d;
}

.info-row:last-child {
  border-bottom: none;
}

.info-label {
  color: #8b949e;
}

.info-value {
  color: #e6edf3;
  font-weight: 500;
}

/* Footer bar */
#footer {
  background: #161b22;
  border-top: 1px solid #30363d;
  padding: 5px 16px;
  font-size: 0.72rem;
  color: #8b949e;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

/* Loading overlay */
#loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(13,17,23,0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
}

#loading-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 4px solid #30363d;
  border-top-color: #58a6ff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Leaflet overrides */
.leaflet-control-attribution {
  background: rgba(13,17,23,0.85) !important;
  color: #8b949e !important;
}

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

.leaflet-control-zoom a {
  background: #21262d !important;
  color: #e6edf3 !important;
  border-color: #30363d !important;
}

.leaflet-control-zoom a:hover {
  background: #30363d !important;
}

/* Popup styles */
.leaflet-popup-content-wrapper {
  background: #21262d;
  color: #e6edf3;
  border: 1px solid #30363d;
}

.leaflet-popup-tip {
  background: #21262d;
}

/* Frame count badge */
#frame-badge {
  display: inline-block;
  background: #21262d;
  border: 1px solid #30363d;
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 0.75rem;
  color: #8b949e;
  text-align: center;
  margin-top: 4px;
}

/* Scrollbar */
#side-panel::-webkit-scrollbar {
  width: 4px;
}
#side-panel::-webkit-scrollbar-track {
  background: #0d1117;
}
#side-panel::-webkit-scrollbar-thumb {
  background: #30363d;
  border-radius: 2px;
}
