/* SkyBag v0.1 — base styles */

:root {
  --bg-deep: #0f1620;
  --bg-mid: #131c28;
  --bg-map: #1a2538;
  --border-faint: rgba(255, 255, 255, 0.08);
  --border-soft: rgba(255, 255, 255, 0.12);
  --text-primary: #c2c0b6;
  --text-muted: #888780;
  --text-dim: #5f5e5a;
  --accent-teal: #5dcaa5;
  --accent-teal-dark: #04342c;
  --accent-amber: #fac775;
  --color-hourly: #5dcaa5;
  --color-synoptic: #ef9f27;
  --color-gapfill: #ba7517;
  --color-nexrad-live: #6b7a99;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', system-ui, sans-serif;
  font-size: 13px;
  color: var(--text-primary);
  background: var(--bg-deep);
}

body {
  display: flex;
  flex-direction: column;
}

/* Top header bar */
.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 14px;
  background: var(--bg-deep);
  border-bottom: 0.5px solid var(--border-faint);
  flex-shrink: 0;
  flex-wrap: wrap;
  z-index: 1000;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.status-dot {
  width: 8px;
  height: 8px;
  background: var(--accent-teal);
  border-radius: 50%;
}

.brand-name {
  font-weight: 500;
  color: var(--text-primary);
}

.brand-version {
  color: var(--text-muted);
  font-size: 11px;
}

.route-input {
  background: #0a1118;
  border: 0.5px solid var(--border-soft);
  color: var(--text-primary);
  padding: 5px 10px;
  font-size: 13px;
  width: 200px;
  border-radius: 6px;
  font-family: 'SF Mono', Menlo, monospace;
  outline: none;
}

.route-input:focus {
  border-color: var(--accent-teal);
}

.btn {
  background: transparent;
  color: var(--text-primary);
  border: 0.5px solid var(--border-soft);
  padding: 5px 12px;
  font-size: 12px;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, border-color 0.15s;
}

.btn:hover {
  background: rgba(255, 255, 255, 0.04);
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn:disabled:hover {
  background: transparent;
}

.btn-primary {
  background: var(--accent-teal);
  color: var(--accent-teal-dark);
  border: none;
  font-weight: 500;
  padding: 5px 14px;
}

.btn-primary:hover {
  background: #6fd5b3;
}

.btn-cycle[data-state="HRRR"],
.btn-cycle[data-state="NEXRAD"],
.btn-cycle[data-state="Both"],
.btn-cycle[data-state="On"] {
  background: rgba(93, 202, 165, 0.12);
  color: var(--accent-teal);
  border-color: rgba(93, 202, 165, 0.4);
}

.btn-cycle[data-state="None"],
.btn-cycle[data-state="Off"] {
  background: transparent;
  color: var(--text-primary);
  border-color: var(--border-soft);
}

.readout {
  display: flex;
  gap: 12px;
  padding-left: 16px;
  border-left: 0.5px solid var(--border-faint);
  font-size: 12px;
}

.readout-label {
  color: var(--text-muted);
  margin-right: 4px;
}

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

.header-buttons {
  display: flex;
  gap: 6px;
}

.status {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.3;
  padding-left: 12px;
  border-left: 0.5px solid var(--border-faint);
  font-family: 'SF Mono', Menlo, monospace;
}

.status-hrrr {
  color: var(--accent-teal);
}

/* Map area */
#map {
  flex: 1;
  background: var(--bg-map);
  position: relative;
  min-height: 0;
}

/* Leaflet control theming for dark UI */
.leaflet-control-zoom a {
  background: rgba(15, 22, 32, 0.85) !important;
  color: var(--text-primary) !important;
  border: 0.5px solid var(--border-soft) !important;
}

.leaflet-control-zoom a:hover {
  background: rgba(15, 22, 32, 0.95) !important;
  color: var(--accent-teal) !important;
}

.leaflet-control-attribution {
  background: rgba(15, 22, 32, 0.7) !important;
  color: var(--text-muted) !important;
  font-size: 10px !important;
  padding: 2px 6px !important;
}

.leaflet-control-attribution a {
  color: var(--text-primary) !important;
}

/* Bottom timeline */
.timeline {
  display: flex;
  align-items: center;
  gap: 12px;
  /* Extra bottom padding clears the iOS home-indicator gesture zone in
     portrait mode; on desktop it's just a bit of breathing room. */
  padding: 12px 14px 36px;
  background: var(--bg-mid);
  border-top: 0.5px solid var(--border-faint);
  flex-shrink: 0;
  z-index: 1000;
}

.btn-play {
  background: var(--accent-teal);
  color: var(--accent-teal-dark);
  border: none;
  /* 44×44 px meets Apple HIG minimum touch target */
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

.btn-play:hover {
  background: #6fd5b3;
}

.slider-wrapper {
  flex: 1;
  position: relative;
}

#forecast-slider {
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  cursor: pointer;
}

#forecast-slider::-webkit-slider-runnable-track {
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
}

#forecast-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent-teal);
  border: 2px solid var(--bg-mid);
  /* Centers the thumb over the track: -(thumb - track) / 2 = -(30-8)/2 */
  margin-top: -11px;
  cursor: pointer;
}

#forecast-slider::-moz-range-track {
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
}

#forecast-slider::-moz-range-thumb {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent-teal);
  border: 2px solid var(--bg-mid);
  cursor: pointer;
}

.run-bar {
  display: flex;
  height: 6px;
  gap: 1px;
  margin-top: 4px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 1px;
}

/* Step 15: run-bar segments */
.run-seg {
  flex: 1;
  height: 100%;
  min-width: 0;
  cursor: default;
}

.run-seg--nexrad-live { background: var(--color-nexrad-live); }
.run-seg--hourly      { background: var(--color-hourly); }
.run-seg--synoptic    { background: var(--color-synoptic); }
.run-seg--gap         { background: var(--color-gapfill); }
.run-seg--empty       { background: rgba(255, 255, 255, 0.06); }

.run-bar-tooltip {
  position: fixed;
  background: rgba(15, 22, 32, 0.95);
  color: var(--text-primary);
  border: 0.5px solid var(--border-soft);
  padding: 4px 8px;
  font-size: 11px;
  font-family: 'SF Mono', Menlo, monospace;
  border-radius: 4px;
  pointer-events: none;
  white-space: nowrap;
  z-index: 9999;
  display: none;
}

.forecast-readout {
  color: var(--text-primary);
  font-size: 12px;
  font-family: 'SF Mono', Menlo, monospace;
  min-width: 230px;
  text-align: right;
  white-space: nowrap;
}

/* Step 19: dBZ legend */
.dbz-legend {
  background: rgba(15, 22, 32, 0.88);
  border: 0.5px solid var(--border-soft);
  border-radius: 6px;
  padding: 7px 9px;
  font-family: 'SF Mono', Menlo, monospace;
  font-size: 10px;
  color: var(--text-muted);
  line-height: 1;
  pointer-events: none;
}

.legend-title {
  text-align: center;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-dim);
  margin-bottom: 5px;
}

.legend-row {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 3px;
}

.legend-row:last-child {
  margin-bottom: 0;
}

.legend-swatch {
  width: 11px;
  height: 11px;
  border-radius: 2px;
  flex-shrink: 0;
  display: inline-block;
}

/* Step 7b: route input error state */
.route-input.error,
input.error {
  outline: 1px solid #d65a5a;
  outline-offset: 0;
}

/* Step 18+: speed and departure inputs */
.flight-inputs {
  display: flex;
  align-items: center;
  gap: 5px;
  padding-left: 12px;
  border-left: 0.5px solid var(--border-faint);
}

.flight-inputs-dep-label {
  padding-left: 6px;
}

.flight-input {
  background: #0a1118;
  border: 0.5px solid var(--border-soft);
  color: var(--text-primary);
  padding: 5px 8px;
  font-size: 13px;
  border-radius: 6px;
  font-family: 'SF Mono', Menlo, monospace;
  outline: none;
  width: 54px;
}

.flight-input:focus {
  border-color: var(--accent-teal);
}

.flight-input--dep {
  width: 62px;
}

.flight-input--dep-date {
  width: 115px;
  color-scheme: dark;
}

/* Remove number-input spin arrows */
.flight-input[type="number"]::-webkit-inner-spin-button,
.flight-input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  appearance: none;
  margin: 0;
}

.flight-input[type="number"] {
  -moz-appearance: textfield;
}

/* Input fill-state classes — toggled by JS */
.input-empty {
  background: rgba(250, 199, 117, 0.15) !important;
}

.input-filled {
  background: #2a3340 !important;
}

/* Step 18+: aircraft icon — reset Leaflet divIcon defaults */
.aircraft-icon {
  background: transparent !important;
  border: none !important;
}
