/* FAA Radar Scope Aesthetic */
/* Dark background, phosphor green, monospace everything */

:root {
  --phosphor: #00cc44;
  --phosphor-bright: #33ff66;
  --phosphor-dim: rgba(0, 204, 68, 0.4);
  --phosphor-faint: rgba(0, 204, 68, 0.15);
  --bg: #0a0a0a;
  --panel-bg: rgba(0, 10, 2, 0.85);
  --border: rgba(0, 204, 68, 0.3);
}

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

body {
  background: var(--bg);
  color: var(--phosphor);
  font-family: 'Consolas', 'Courier New', monospace;
  overflow: hidden;
  height: 100vh;
  width: 100vw;
}

#cesiumContainer {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
}

/* Hide default Cesium UI elements we don't need */
.cesium-viewer-toolbar,
.cesium-viewer-animationContainer,
.cesium-viewer-timelineContainer,
.cesium-viewer-fullscreenContainer,
.cesium-viewer-vrContainer,
.cesium-viewer-geocoderContainer,
.cesium-viewer-infoBoxContainer,
.cesium-viewer-selectionIndicatorContainer,
.cesium-viewer-bottom,
.cesium-credit-logoContainer,
.cesium-credit-expand-link,
.cesium-widget-credits {
  display: none !important;
}

/* Override Cesium credit bar */
.cesium-viewer .cesium-widget-credits {
  display: none !important;
}

/* HUD Top Bar */
#hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  pointer-events: none;
}

#hud-top {
  display: flex;
  justify-content: space-between;
  padding: 8px 16px;
  background: var(--panel-bg);
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  letter-spacing: 2px;
}

#scope-title {
  color: var(--phosphor-bright);
  text-shadow: 0 0 8px var(--phosphor-dim);
}

#clock {
  color: var(--phosphor);
}

#hud-stats {
  display: flex;
  gap: 24px;
  padding: 4px 16px;
  font-size: 11px;
  color: var(--phosphor-dim);
  letter-spacing: 1px;
}

#throttle-warning {
  background: rgba(204, 136, 0, 0.9);
  color: #000;
  text-align: center;
  padding: 4px 16px;
  font-size: 12px;
  font-weight: bold;
  letter-spacing: 2px;
}

#throttle-warning.hidden { display: none; }

/* Controls Panel */
#controls {
  position: absolute;
  bottom: 16px;
  left: 16px;
  z-index: 100;
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 11px;
  letter-spacing: 1px;
}

.control-group {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.toggle-label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
}

.toggle-label input[type="checkbox"] {
  appearance: none;
  width: 14px;
  height: 14px;
  border: 1px solid var(--phosphor-dim);
  background: transparent;
  cursor: pointer;
  position: relative;
}

.toggle-label input[type="checkbox"]:checked {
  background: var(--phosphor);
  border-color: var(--phosphor);
}

.toggle-label input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  top: 1px;
  left: 4px;
  width: 4px;
  height: 8px;
  border: solid var(--bg);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.range-label {
  display: flex;
  align-items: center;
  gap: 8px;
}

input[type="range"] {
  -webkit-appearance: none;
  width: 80px;
  height: 4px;
  background: var(--phosphor-dim);
  border-radius: 2px;
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--phosphor);
  cursor: pointer;
}

select {
  background: var(--bg);
  color: var(--phosphor);
  border: 1px solid var(--phosphor-dim);
  padding: 2px 4px;
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
  outline: none;
}

.scope-btn {
  background: transparent;
  border: 1px solid var(--phosphor-dim);
  color: var(--phosphor);
  padding: 4px 10px;
  font-family: inherit;
  font-size: 11px;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 0.2s;
}

.scope-btn:hover {
  background: var(--phosphor-faint);
  border-color: var(--phosphor);
}

.scope-btn.active {
  background: var(--phosphor);
  color: var(--bg);
  border-color: var(--phosphor);
}

.scope-btn:disabled {
  opacity: 0.3;
  cursor: default;
  pointer-events: none;
}

/* Aircraft Info Panel */
#aircraft-info {
  position: absolute;
  top: 60px;
  right: 16px;
  z-index: 100;
  background: var(--panel-bg);
  border: 1px solid var(--phosphor);
  border-radius: 4px;
  padding: 16px;
  min-width: 220px;
  font-size: 12px;
  line-height: 1.6;
  box-shadow: 0 0 20px rgba(0, 204, 68, 0.1);
}

#aircraft-info.hidden {
  display: none;
}

#info-close {
  position: absolute;
  top: 4px;
  right: 8px;
  cursor: pointer;
  font-size: 18px;
  color: var(--phosphor-dim);
}

#info-close:hover {
  color: var(--phosphor-bright);
}

#info-callsign {
  font-size: 18px;
  font-weight: bold;
  color: var(--phosphor-bright);
  text-shadow: 0 0 10px var(--phosphor-dim);
  margin-bottom: 8px;
  letter-spacing: 2px;
}

#info-details {
  color: var(--phosphor);
}

#info-details div {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px solid var(--phosphor-faint);
  padding: 2px 0;
}

#info-details .label {
  color: var(--phosphor-dim);
}

/* Scanline overlay for extra CRT feel */
#cesiumContainer::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0px,
    transparent 2px,
    rgba(0, 0, 0, 0.03) 2px,
    rgba(0, 0, 0, 0.03) 4px
  );
  z-index: 50;
}

/* ============================================================
   Settings Modal
   ============================================================ */

#settings-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
}

#settings-overlay.hidden { display: none; }

#settings-panel {
  background: var(--panel-bg);
  border: 1px solid var(--phosphor);
  border-radius: 6px;
  width: 380px;
  box-shadow: 0 0 40px rgba(0, 204, 68, 0.15);
  font-size: 11px;
}

#settings-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  letter-spacing: 2px;
  color: var(--phosphor-bright);
}

#settings-close {
  cursor: pointer;
  font-size: 20px;
  color: var(--phosphor-dim);
  line-height: 1;
}
#settings-close:hover { color: var(--phosphor-bright); }

.settings-section {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.settings-label {
  font-size: 10px;
  letter-spacing: 1.5px;
  color: var(--phosphor-dim);
  margin-bottom: 8px;
}

.settings-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.settings-color-row { flex-wrap: wrap; gap: 8px; }

.color-swatch {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
  transition: border-color 0.2s, transform 0.1s;
}
.color-swatch:hover { transform: scale(1.15); }
.color-swatch.active {
  border-color: #ffffff;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.3);
}

#set-custom-color {
  width: 28px; height: 28px;
  border: 1px solid var(--phosphor-dim);
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
  padding: 0;
}

.settings-preview {
  margin-top: 10px;
  padding: 6px 10px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border);
  border-radius: 3px;
  font-family: 'Consolas', 'Courier New', monospace;
  color: var(--phosphor);
  line-height: 1.4;
}

.settings-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 16px;
}
.settings-actions .scope-btn { padding: 6px 16px; }

.scope-input {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--phosphor-bright);
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 12px;
  letter-spacing: 1px;
  padding: 4px 8px;
  outline: none;
  text-transform: uppercase;
  width: 60px;
}

.scope-input.wide {
  width: 180px;
  text-transform: none;
}

.scope-input:focus {
  border-color: var(--phosphor);
  box-shadow: 0 0 6px var(--phosphor-dim);
}

.scope-input::placeholder {
  color: var(--phosphor-dim);
  text-transform: none;
}

.settings-hint {
  font-size: 10px;
  color: var(--phosphor-dim);
  letter-spacing: 0.5px;
}

.settings-field-label {
  font-size: 10px;
  letter-spacing: 1px;
  color: var(--phosphor-dim);
  width: 65px;
  flex-shrink: 0;
}

body.theme-light .scope-input {
  background: rgba(255, 255, 255, 0.6);
  color: #000000;
  border-color: rgba(0, 0, 0, 0.25);
}
body.theme-light .scope-input:focus {
  border-color: #1a1a1a;
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.1);
}

/* ============================================================
   Light Mode Theme Overrides
   ============================================================ */

body.theme-light {
  --phosphor: #1a1a1a;
  --phosphor-bright: #000000;
  --phosphor-dim: rgba(0, 0, 0, 0.45);
  --phosphor-faint: rgba(0, 0, 0, 0.1);
  --bg: #e8e8e8;
  --panel-bg: rgba(240, 240, 240, 0.92);
  --border: rgba(0, 0, 0, 0.2);
}

body.theme-light .scope-btn {
  color: #1a1a1a;
  border-color: rgba(0, 0, 0, 0.3);
}
body.theme-light .scope-btn:hover {
  background: rgba(0, 0, 0, 0.08);
  border-color: #1a1a1a;
}
body.theme-light .scope-btn.active {
  background: #1a1a1a;
  color: #ffffff;
  border-color: #1a1a1a;
}

body.theme-light .toggle-label input[type="checkbox"]:checked {
  background: #1a1a1a;
  border-color: #1a1a1a;
}
body.theme-light .toggle-label input[type="checkbox"]:checked::after {
  border-color: #ffffff;
}

body.theme-light input[type="range"] { background: rgba(0, 0, 0, 0.2); }
body.theme-light input[type="range"]::-webkit-slider-thumb { background: #1a1a1a; }

body.theme-light #settings-panel {
  background: rgba(240, 240, 240, 0.95);
  border-color: rgba(0, 0, 0, 0.3);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
}

body.theme-light #aircraft-info {
  border-color: rgba(0, 0, 0, 0.3);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

/* Remove scanline overlay in light mode */
body.theme-light #cesiumContainer::after { display: none; }
