/* ==========================================================================
   CSS VARIABLES & DESIGN SYSTEM (OBSIDIAN/NEON RADAR THEME)
   ========================================================================== */
:root {
  /* Theme Backgrounds */
  --bg-space: #030508;
  --bg-main: #070a0e;
  --bg-panel: rgba(10, 15, 24, 0.75);
  --bg-card: rgba(15, 23, 36, 0.65);
  --bg-card-hover: rgba(22, 32, 51, 0.85);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(0, 243, 255, 0.15);
  --border-glow-heavy: rgba(0, 243, 255, 0.35);

  /* Neon Accent Palette */
  --neon-cyan: #00f3ff;
  --neon-pink: #ff005b;
  --neon-green: #39ff14;
  --neon-yellow: #ffd700;
  --neon-orange: #ff6c00;
  --neon-purple: #b600ff;
  --neon-lime: #a6ff00;
  --neon-blue: #005eff;

  /* Vario States */
  --color-glider: var(--neon-cyan);
  --color-tug: var(--neon-yellow);
  --color-lift: var(--neon-green);
  --color-sink: var(--neon-pink);
  --color-stable: #94a3b8;

  /* Typography */
  --font-display: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Transitions & Layout */
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --sidebar-width: 380px;
}

/* ==========================================================================
   BASE STYLING & RESET
   ========================================================================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body, html {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: var(--font-body);
  background-color: var(--bg-space);
  color: #e2e8f0;
}

.monospace {
  font-family: var(--font-mono);
}

/* ==========================================================================
   APP HEADER BAR (Branding and Feed Control)
   ========================================================================== */
.app-header {
  height: 60px;
  background-color: #080c12;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 1100;
  flex-shrink: 0;
  position: relative;
}

.brand-area {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  font-size: 26px;
  text-shadow: 0 0 10px rgba(0, 243, 255, 0.5);
  animation: pulse-glow 2s infinite alternate;
}

.brand-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 18px;
  letter-spacing: 0.5px;
  background: linear-gradient(135deg, #ffffff 40%, var(--neon-cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-subtitle {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-secondary);
  letter-spacing: 2px;
  margin-top: 1px;
}

/* Feed Selector Toggle Buttons */
.feed-selector {
  display: flex;
  background-color: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-color);
  padding: 3px;
  border-radius: 30px;
  gap: 4px;
}

.feed-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 12px;
  padding: 6px 16px;
  border-radius: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all var(--transition-fast);
}

.feed-btn:hover {
  color: #ffffff;
}

.feed-btn.active {
  background-color: var(--bg-card-hover);
  color: #ffffff;
  box-shadow: 0 0 10px rgba(0, 243, 255, 0.1);
  border: 1px solid rgba(0, 243, 255, 0.25);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  background-color: var(--neon-green);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--neon-green);
  display: inline-block;
  animation: pulse-glow 1.5s infinite alternate;
}

.feed-btn:not(.active) .pulse-dot {
  background-color: var(--text-muted);
  box-shadow: none;
  animation: none;
}

/* ==========================================================================
   APP CONTENT CONTAINER
   ========================================================================== */
.app-container {
  display: flex;
  width: 100vw;
  height: calc(100vh - 60px);
  position: relative;
}

/* ==========================================================================
   SIDEBAR (Dashboard Controls & Active Targets)
   ========================================================================== */
.sidebar {
  width: var(--sidebar-width);
  height: 100%;
  background-color: var(--bg-main);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  transition: transform var(--transition-speed) cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 10px 0 30px rgba(0, 0, 0, 0.6);
  flex-shrink: 0;
  overflow: hidden;
}

/* Collapsible sidebar toggle on desktop */
.toggle-sidebar-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
  display: none; /* Mobile only */
}

/* Stats dashboard inside sidebar */
.status-summary {
  padding: 16px 24px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  border-bottom: 1px solid var(--border-color);
  background: rgba(8, 12, 18, 0.4);
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;
  overflow: hidden;
}

.stat-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 100%;
  background-color: var(--neon-cyan);
}

.stat-card:last-child::after {
  background-color: var(--neon-yellow);
}

.stat-label {
  font-size: 10px;
  color: var(--text-secondary);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 800;
  color: #ffffff;
}

/* Scrollable Container for Sidebar Panels */
.sidebar-scrollable {
  flex-grow: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.sidebar-scrollable::-webkit-scrollbar {
  width: 6px;
}
.sidebar-scrollable::-webkit-scrollbar-track {
  background: transparent;
}
.sidebar-scrollable::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
}
.sidebar-scrollable::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 243, 255, 0.3);
}

/* Panel Sections */
.section {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-color);
}

.section:last-child {
  border-bottom: none;
}

.section-title {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.section-title .count-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  background-color: rgba(255, 255, 255, 0.06);
  padding: 2px 8px;
  border-radius: 10px;
  color: #ffffff;
}

/* ==========================================================================
   AIRCRAFT LIST & CARDS
   ========================================================================== */
.aircraft-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.aircraft-item {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 12px 14px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.aircraft-item:hover {
  border-color: var(--border-glow);
  background: var(--bg-card-hover);
  transform: translateY(-1px);
}

.aircraft-item.selected {
  border-color: var(--neon-cyan);
  box-shadow: 0 0 15px rgba(0, 243, 255, 0.15);
  background: rgba(0, 243, 255, 0.04);
}

.aircraft-item.tug-type.selected {
  border-color: var(--neon-yellow);
  box-shadow: 0 0 15px rgba(255, 215, 0, 0.15);
  background: rgba(255, 215, 0, 0.03);
}

.aircraft-left {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ac-ident-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ac-reg {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  color: #ffffff;
  letter-spacing: 0.2px;
}

.ac-cn-badge {
  background-color: var(--neon-cyan);
  color: #030508;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 4px;
  text-transform: uppercase;
}

.aircraft-item.tug-type .ac-cn-badge {
  background-color: var(--neon-yellow);
}

.ac-meta {
  font-size: 11px;
  color: var(--text-secondary);
}

.aircraft-right {
  text-align: right;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ac-alt {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 13px;
  color: #ffffff;
}

.ac-vario {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
}

.ac-vario.lift { color: var(--color-lift); }
.ac-vario.sink { color: var(--color-sink); }
.ac-vario.stable { color: var(--color-stable); }

/* --- STATUS DOT STYLING --- */
.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    vertical-align: middle;
    margin-right: 6px;
    flex-shrink: 0;
}
.status-dot.active-glider {
    background-color: var(--color-glider);
    box-shadow: 0 0 8px var(--color-glider);
    animation: pulse-glider-dot 2s infinite;
}
.status-dot.active-tug {
    background-color: var(--color-tug);
    box-shadow: 0 0 8px var(--color-tug);
    animation: pulse-tug-dot 2s infinite;
}
.status-dot.grounded {
    background-color: #f59e0b; /* Solid Warm Amber */
    box-shadow: 0 0 4px rgba(245, 158, 11, 0.4);
    animation: breathing-grounded-dot 3s infinite;
}

@keyframes pulse-glider-dot {
    0% {
        transform: scale(0.9);
        box-shadow: 0 0 0 0 rgba(6, 182, 212, 0.6);
    }
    70% {
        transform: scale(1.1);
        box-shadow: 0 0 0 6px rgba(6, 182, 212, 0);
    }
    100% {
        transform: scale(0.9);
        box-shadow: 0 0 0 0 rgba(6, 182, 212, 0);
    }
}

@keyframes pulse-tug-dot {
    0% {
        transform: scale(0.9);
        box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.6);
    }
    70% {
        transform: scale(1.1);
        box-shadow: 0 0 0 6px rgba(245, 158, 11, 0);
    }
    100% {
        transform: scale(0.9);
        box-shadow: 0 0 0 0 rgba(245, 158, 11, 0);
    }
}

@keyframes breathing-grounded-dot {
    0% {
        opacity: 0.6;
    }
    50% {
        opacity: 1.0;
    }
    100% {
        opacity: 0.6;
    }
}

/* --- GROUNDED AIRCRAFT STYLING --- */
.aircraft-item.grounded-type {
    background: rgba(245, 158, 11, 0.03); /* Subtle warm amber hint */
    border: 1px solid rgba(245, 158, 11, 0.1);
    border-left: 3px solid rgba(245, 158, 11, 0.6); /* Clear amber status stripe */
}

.aircraft-item.grounded-type .ac-reg {
    color: #f3f4f6; /* Readable text */
}

.aircraft-item.grounded-type .ac-alt {
    color: var(--text-secondary);
}

.aircraft-item.grounded-type .ac-cn-badge {
    background-color: rgba(245, 158, 11, 0.15);
    color: var(--color-tug);
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.aircraft-item.grounded-type:hover {
    border-color: rgba(245, 158, 11, 0.3);
    background: rgba(245, 158, 11, 0.07);
}

.aircraft-item.grounded-type.selected {
    border-color: var(--color-tug);
    box-shadow: 0 0 12px rgba(245, 158, 11, 0.15);
}

.aircraft-item.grounded-type .ac-vario {
    color: var(--color-tug) !important; /* Stand out in amber */
    text-shadow: 0 0 8px rgba(245, 158, 11, 0.3);
    font-weight: 700;
}

.empty-state {
  text-align: center;
  padding: 30px 16px;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: rgba(255,255,255,0.01);
  border: 1px dashed rgba(255,255,255,0.05);
  border-radius: 12px;
}
.empty-state p { font-size: 13px; font-weight: 500; }
.empty-state .hint { font-size: 10px; color: var(--text-muted); }

/* ==========================================================================
   MAP OPTIONS CONTROLLER & TOGGLES
   ========================================================================== */
.control-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}
.control-group:last-child {
  margin-bottom: 0;
}

.ctrl-toggle {
  display: flex;
  align-items: center;
  cursor: pointer;
  user-select: none;
  font-size: 12px;
  color: var(--text-secondary);
  justify-content: space-between;
  width: 100%;
}

.ctrl-toggle input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: relative;
  display: inline-block;
  width: 34px;
  height: 18px;
  background-color: #1a2333;
  border-radius: 9px;
  transition: all var(--transition-fast);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.toggle-slider::before {
  content: "";
  position: absolute;
  height: 12px;
  width: 12px;
  left: 2px;
  bottom: 2px;
  background-color: var(--text-secondary);
  border-radius: 50%;
  transition: transform var(--transition-fast);
}

.ctrl-toggle input:checked + .toggle-slider {
  background-color: rgba(0, 243, 255, 0.15);
  border-color: var(--neon-cyan);
}

.ctrl-toggle input:checked + .toggle-slider::before {
  transform: translateX(16px);
  background-color: var(--neon-cyan);
  box-shadow: 0 0 6px var(--neon-cyan);
}

.ctrl-toggle:hover .toggle-slider {
  border-color: rgba(0, 243, 255, 0.3);
}

.slider-label {
  font-size: 11px;
  color: var(--text-secondary);
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
}

.neon-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: #1a2333;
  outline: none;
}

.neon-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--neon-cyan);
  cursor: pointer;
  box-shadow: 0 0 8px var(--neon-cyan);
  transition: transform 0.1s;
}

.neon-slider::-webkit-slider-thumb:hover {
  transform: scale(1.3);
}

/* ==========================================================================
   MONITORED AIRFIELDS PANEL
   ========================================================================== */
.airfields-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 180px;
  overflow-y: auto;
  padding-right: 4px;
}

.airfield-item-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12px;
  transition: all 0.2s ease;
  cursor: pointer;
}

.airfield-item-row:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--neon-cyan);
}

.airfield-name-col {
  color: #ffffff;
  font-weight: 600;
  display: flex;
  align-items: center;
}

.airfield-code-badge {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 800;
  background-color: #151e2e;
  color: var(--neon-cyan);
  padding: 1px 4px;
  border-radius: 3px;
  margin-left: 6px;
}

.airfield-elev-col {
  color: var(--text-secondary);
  font-family: var(--font-display);
  font-size: 11px;
}

.add-airfield-box {
  margin-top: 10px;
}

.airfield-form-modal {
  display: none;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-color);
  padding: 12px;
  border-radius: 10px;
  backdrop-filter: blur(8px);
}

.airfield-form-modal input {
  background: #101726;
  border: 1px solid var(--border-color);
  color: #fff;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-family: var(--font-body);
}

.airfield-form-modal input:focus {
  outline: none;
  border-color: var(--neon-cyan);
}

/* ==========================================================================
   MAP WORKSPACE & OVERLAYS
   ========================================================================== */
.map-container {
  flex-grow: 1;
  height: 100%;
  position: relative;
}

#map {
  width: 100%;
  height: 100%;
  background-color: var(--bg-space);
}

.map-overlay-controls {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#recenter-btn,
.map-ctrl-btn {
  background-color: rgba(10, 15, 24, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: #ffffff;
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
  transition: all var(--transition-fast) ease;
  font-family: var(--font-display);
  display: flex;
  align-items: center;
  gap: 6px;
}

#recenter-btn:hover,
.map-ctrl-btn:hover {
  background-color: #162033;
  border-color: var(--neon-cyan);
  box-shadow: 0 0 10px rgba(0, 243, 255, 0.2);
}

/* ==========================================================================
   GLASSMORPHISM TELEMETRY HUD PANEL (Selected Aircraft Info)
   ========================================================================== */
.selected-glider-panel {
  position: absolute;
  bottom: 24px;
  left: 24px;
  width: 350px;
  background: var(--bg-panel);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-glow);
  border-radius: 16px;
  padding: 18px;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.6);
  z-index: 1000;
  display: none; /* Shown dynamically */
  flex-direction: column;
  gap: 14px;
  animation: slideUp 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.selected-glider-header {
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 10px;
  position: relative;
}

.selected-glider-header h3 {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: 0.5px;
}

.selected-glider-header p {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 1px;
}

.badge-type {
  display: inline-block;
  font-size: 9px;
  font-weight: 800;
  background-color: rgba(0, 243, 255, 0.12);
  color: var(--neon-cyan);
  padding: 2px 6px;
  border-radius: 4px;
  margin-bottom: 4px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.selected-glider-panel.tug-type .badge-type {
  background-color: rgba(255, 215, 0, 0.12);
  color: var(--neon-yellow);
}

.close-panel-btn {
  position: absolute;
  top: 0;
  right: 0;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 18px;
  cursor: pointer;
  transition: color var(--transition-fast);
}
.close-panel-btn:hover {
  color: #ffffff;
}

/* Telemetry Grid inside Float HUD */
.telemetry-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.tel-box {
  background: rgba(7, 10, 14, 0.4);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
}

.tel-label {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
  margin-bottom: 4px;
  text-transform: uppercase;
}

.tel-value-row {
  display: flex;
  align-items: baseline;
  gap: 3px;
}

.tel-val {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 700;
  color: #ffffff;
}

.tel-unit {
  font-size: 9px;
  font-weight: 600;
  color: var(--text-secondary);
}

/* Specific Telemetry Items */
.vario-indicator {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 800;
  margin-top: 2px;
}
.vario-indicator.climb { color: var(--color-lift); }
.vario-indicator.sink { color: var(--color-sink); }
.vario-indicator.neutral { color: var(--color-stable); }

/* Altitude Tape widget */
.alt-tape-container {
  margin-top: 6px;
  width: 100%;
}
.alt-tape-track {
  height: 3px;
  background-color: rgba(255, 255, 255, 0.05);
  border-radius: 1.5px;
  overflow: hidden;
  position: relative;
}
.alt-tape-fill {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 0%; /* updated via JS */
  background: var(--neon-cyan);
  box-shadow: 0 0 6px var(--neon-cyan);
  transition: width var(--transition-normal);
}
.selected-glider-panel.tug-type .alt-tape-fill {
  background: var(--neon-yellow);
  box-shadow: 0 0 6px var(--neon-yellow);
}

/* Actions and buttons inside Float HUD */
.selected-glider-actions {
  display: flex;
  margin-top: 4px;
}

.action-btn {
  width: 100%;
  background-color: var(--neon-cyan);
  border: none;
  border-radius: 8px;
  color: #030508;
  padding: 10px;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.action-btn:hover {
  background-color: #22d3ee;
  box-shadow: 0 0 10px rgba(0, 243, 255, 0.4);
}

.selected-glider-panel.tug-type .action-btn {
  background-color: var(--neon-yellow);
}
.selected-glider-panel.tug-type .action-btn:hover {
  background-color: #fcd34d;
  box-shadow: 0 0 10px rgba(255, 215, 0, 0.4);
}

.action-btn.active {
  background-color: #111827;
  border: 1px solid var(--neon-cyan);
  color: var(--neon-cyan);
  box-shadow: none;
}
.selected-glider-panel.tug-type .action-btn.active {
  border-color: var(--neon-yellow);
  color: var(--neon-yellow);
}

/* ==========================================================================
   NETWORK STATUS BANNER
   ========================================================================== */
.status-banner {
  width: 100%;
  background-color: var(--neon-pink);
  color: #ffffff;
  text-align: center;
  padding: 6px 16px;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  z-index: 1200;
  box-shadow: 0 2px 10px rgba(0,0,0,0.5);
  position: relative;
  letter-spacing: 0.5px;
}

/* ==========================================================================
   LEAFLET CUSTOM COMPONENT MAP STYLING
   ========================================================================== */
/* Custom SVG Glider Markers */
.leaflet-glider-marker {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.glider-map-label {
  position: absolute;
  bottom: 38px; /* Position in front (above) the glider icon */
  left: 50%;
  transform: translateX(-50%);

  font-family: var(--font-mono);
  font-size: 11px; /* Made larger for better readability */
  font-weight: 800;
  color: #ffffff;
  background-color: rgba(3, 5, 8, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 2px 6px; /* Added more padding for a cleaner badge look */
  border-radius: 4px;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
  text-shadow: none;
  pointer-events: none; /* Prevents the label from blocking map clicks */
}

/* Vario climb pulsing aura */
.rotated-marker-wrapper {
  position: relative;
}

.pulse-aura {
  position: absolute;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--neon-green);
  opacity: 0;
  animation: aura-pulse 1.8s infinite cubic-bezier(0.215, 0.61, 0.355, 1);
  box-sizing: border-box;
}

@keyframes aura-pulse {
  0% {
    transform: scale(0.6);
    opacity: 0;
  }
  25% {
    opacity: 0.6;
  }
  100% {
    transform: scale(1.6);
    opacity: 0;
  }
}

@keyframes pulse-glow {
  0% {
    opacity: 0.7;
    filter: drop-shadow(0 0 1px currentColor);
  }
  100% {
    opacity: 1.0;
    filter: drop-shadow(0 0 8px currentColor);
  }
}

/* BGA Turnpoint Map Overlays */
.leaflet-waypoint-label {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  color: var(--text-secondary) !important;
  font-family: var(--font-mono) !important;
  font-size: 9px !important;
  font-weight: 700 !important;
  padding: 0 !important;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8), 0 0 4px rgba(0,0,0,0.5);
}

.leaflet-waypoint-label.active {
  color: var(--neon-yellow) !important;
  font-weight: 800 !important;
  font-size: 10px !important;
  text-shadow: 0 0 8px rgba(255, 215, 0, 0.4);
}

/* Dark mode leaflet popups */
.leaflet-popup-content-wrapper {
  background: var(--bg-panel) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: 12px !important;
  backdrop-filter: blur(10px) !important;
  box-shadow: 0 10px 25px rgba(0,0,0,0.5) !important;
}

.leaflet-popup-tip {
  background: var(--bg-panel) !important;
  border-left: 1px solid var(--border-color) !important;
  border-bottom: 1px solid var(--border-color) !important;
}

.leaflet-popup-content {
  font-family: var(--font-body) !important;
  font-size: 12px !important;
  line-height: 1.4 !important;
  color: var(--text-primary) !important;
}

.leaflet-popup-content strong {
  font-family: var(--font-display) !important;
  color: #ffffff !important;
  font-weight: 700 !important;
}

/* Floating Mobile Toggle Button */
.mobile-menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 8px;
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1001;
  background-color: rgba(7, 10, 14, 0.9);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-glow-heavy);
  border-radius: 30px;
  color: #ffffff;
  padding: 10px 20px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6);
  cursor: pointer;
  transition: all var(--transition-fast) ease;
}

.mobile-menu-btn:active {
  transform: translateX(-50%) scale(0.95);
}

.mobile-badge {
  background-color: var(--neon-cyan);
  color: #030508;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 800;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 6px var(--neon-cyan);
}

/* ==========================================================================
   NATIVE RESPONSIVE BREAKPOINTS (Mobile/Tablet CSS)
   ========================================================================== */
@media (max-width: 1024px) {
  /* Tablet Breakpoint: Left sidebar remains, select details float over map */
  :root {
    --sidebar-width: 320px;
  }
}

@media (max-width: 768px) {
  /* Mobile Breakpoint: Sidebar hides off-screen, interactive overlays show */
  .app-container {
    flex-direction: column;
  }

  .sidebar {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100vw;
    height: 70vh;
    border-right: none;
    border-top: 1px solid var(--border-glow);
    transform: translateY(100%); /* Hides under screen edge */
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -15px 40px rgba(0, 0, 0, 0.7);
    z-index: 1050;
  }

  .sidebar.open {
    transform: translateY(0);
  }

  .toggle-sidebar-btn {
    display: block; /* Close button inside mobile menu drawer */
  }

  .mobile-menu-btn {
    display: flex; /* Float sheet trigger visible */
  }

  .selected-glider-panel {
    bottom: 74px; /* Above mobile menu button */
    left: 50%;
    transform: translateX(-50%);
    width: 92vw;
    max-width: 360px;
    animation: slideUpMobile 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  }

  @keyframes slideUpMobile {
    from {
      transform: translate(-50%, 20px);
      opacity: 0;
    }
    to {
      transform: translate(-50%, 0);
      opacity: 1;
    }
  }
}
