html, body { height: 100%; margin: 0; }
#map { height: 100%; width: 100%; }

.info {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 1000;
  background: rgba(255,255,255,0.95);
  padding: 10px 12px;
  border-radius: 8px;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  font-size: 14px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.12);
  max-width: 420px;
}

/* Standard-Flugpunkt (blau, dezent) */
.flight-marker {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #2563eb;
  box-shadow:
    0 0 0 1px rgba(37, 99, 235, 0.35),
    0 0 4px rgba(37, 99, 235, 0.28);
}

/* Letzter angeflogener Flughafen (rot) + Puls */
.flight-marker.final {
  width: 14px;
  height: 14px;
  background: #ef4444;
  box-shadow:
    0 0 0 2px rgba(239, 68, 68, 0.40),
    0 0 10px rgba(239, 68, 68, 0.50);
  animation: pulse 2.5s ease-out infinite;
}

@keyframes pulse {
  0% {
    box-shadow:
      0 0 0 0 rgba(239, 68, 68, 0.45),
      0 0 10px rgba(239, 68, 68, 0.50);
  }
  70% {
    box-shadow:
      0 0 0 12px rgba(239, 68, 68, 0),
      0 0 14px rgba(239, 68, 68, 0.25);
  }
  100% {
    box-shadow:
      0 0 0 0 rgba(239, 68, 68, 0),
      0 0 10px rgba(239, 68, 68, 0.50);
  }
}

/* === Airport Display / FIDS Popup === */
.leaflet-popup.lawa-popup .leaflet-popup-content-wrapper{
  background: transparent;
  box-shadow: none;
  padding: 0;
}
.leaflet-popup.lawa-popup .leaflet-popup-content{
  margin: 0;
}
.leaflet-popup.lawa-popup .leaflet-popup-tip{
  background: #0b0f14;
  box-shadow: 0 10px 30px rgba(0,0,0,0.35);
}

.fids{
  background: rgba(11, 15, 20, 0.88);
  color: #e5e7eb;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0,0,0,0.35);
  border: 1px solid rgba(255,255,255,0.08);
  min-width: 280px;
  max-width: 360px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  backdrop-filter: blur(4px);
}

.fids-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding: 10px 12px;
  background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02));
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.fids-title{
  font-size: 12px;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: rgba(229,231,235,0.85);
}

.fids-badge{
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(34,197,94,0.12);
  color: rgba(34,197,94,0.95);
  border: 1px solid rgba(34,197,94,0.22);
}

.fids-badge.delayed{
  background: rgba(250,204,21,0.14);
  color: rgba(250,204,21,0.95);
  border: 1px solid rgba(250,204,21,0.35);
}

.fids-body{ padding: 10px 12px 12px; }

.fids-card{
  padding: 10px 10px 9px;
  border-radius: 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
}

.fids-card + .fids-card{ margin-top: 10px; }

.fids-top{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap: 10px;
}

.fids-flight{
  font-weight: 800;
  color: rgba(250,204,21,0.95);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

.fids-route{
  font-weight: 800;
  font-size: 14px;
  color: #f3f4f6;
  text-align: right;
  line-height: 1.2;
}

.fids-route .arrow{
  opacity: 0.7;
  padding: 0 6px;
}

.fids-sub{
  margin-top: 6px;
  font-size: 12px;
  color: rgba(229,231,235,0.85);
}

.fids-grid{
  margin-top: 8px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 10px;
  font-size: 12px;
}

.fids-k{
  color: rgba(229,231,235,0.65);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.fids-v{
  color: rgba(229,231,235,0.92);
  font-weight: 700;
}

.fids-bottom{
  margin-top: 10px;
  display:flex;
  flex-wrap: wrap;
  gap: 8px;
}

.fids-chip{
  font-size: 11px;
  padding: 5px 8px;
  border-radius: 10px;
  background: rgba(59,130,246,0.10);
  border: 1px solid rgba(59,130,246,0.22);
  color: rgba(147,197,253,0.95);
}

.fids-chip.muted{
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.10);
  color: rgba(229,231,235,0.80);
}

/* Status-Chips: PÜNKTLICH (grün) / VERSPÄTET (gelb) */
.fids-chip.status-ok{
  background: rgba(34,197,94,0.12);
  border: 1px solid rgba(34,197,94,0.28);
  color: rgba(34,197,94,0.95);
}

.fids-chip.status-delayed{
  background: rgba(250,204,21,0.14);
  border: 1px solid rgba(250,204,21,0.35);
  color: rgba(250,204,21,0.95);
}

/* Klickbarer Chip (Button) ohne Button-Optik */
.fids-chip.btn{
  appearance: none;
  border: 1px solid rgba(59,130,246,0.22);
  cursor: pointer;
  font: inherit;
}
.fids-chip.btn:focus{
  outline: 2px solid rgba(250,204,21,0.45);
  outline-offset: 2px;
}

.fids-chip.id{
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.10);
  color: rgba(229,231,235,0.85);
}

.fids-note{
  margin-top: 8px;
  font-size: 11px;
  color: rgba(229,231,235,0.60);
}

/* =========================
   Modal für Pilotenliste
   (Größe & Typo wie .fids)
   ========================= */
.modal-backdrop{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(3px);
  z-index: 5000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
}
.modal-backdrop.open{ display: flex; }

/* Modal: exakt FIDS-Breite (min 280, max 360) */
.modal{
  width: min(360px, calc(100vw - 36px)); /* Desktop ~360px, mobil responsiv */
  min-width: 280px;
  max-width: 360px;

  border-radius: 14px;
  background: rgba(11, 15, 20, 0.88);
  color: #e5e7eb;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0,0,0,0.35);
  border: 1px solid rgba(255,255,255,0.08);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  backdrop-filter: blur(4px);
}

/* Header wie .fids-head */
.modal-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding: 10px 12px;
  background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02));
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.modal-title{
  font-size: 12px;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: rgba(229,231,235,0.85);
}

.modal-close{
  appearance: none;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.06);
  color: rgba(229,231,235,0.9);
  border-radius: 10px;
  padding: 6px 10px;
  cursor: pointer;
  font: inherit;
}
.modal-close:focus{
  outline: 2px solid rgba(250,204,21,0.45);
  outline-offset: 2px;
}

/* Body wie .fids-body + Scroll */
.modal-body{
  padding: 10px 12px 12px;
  max-height: min(60vh, 320px);
  overflow: auto;
}

/* Liste */
.modal-list{
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}

/* Eintrag: übersichtlicher (Name links, Badges rechts) */
.modal-item{
  padding: 10px 10px 9px;
  border-radius: 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);

  display: grid;
  grid-template-columns: 1fr auto; /* Name | rechte Meta-Spalte */
  align-items: center;
  gap: 10px;

  font-size: 12px;
  color: rgba(229,231,235,0.92);
}

/* Name: sauber abgeschnitten, wenn zu lang */
.modal-item .name{
  font-weight: 800;
  color: #f3f4f6;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Rechte Seite: Chips/Badges in einer Reihe, sauber ausgerichtet */
.modal-item .meta{
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  white-space: nowrap;
}

/* Optionaler Text-Chip (z.B. "11 Flüge") falls du ihn später ergänzt */
.modal-chip{
  font-size: 11px;
  padding: 5px 8px;
  border-radius: 10px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.10);
  color: rgba(229,231,235,0.80);
}

/* Shields-Badge: konsistente Größe/Align */
.rank-badge{
  height: 18px;
  width: auto;
  display: block;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.25));
}

/* Leeres Placeholder-Element (falls du aktuell <span class="muted">–</span> nutzt) */
.modal-item .muted{
  font-size: 11px;
  padding: 5px 8px;
  border-radius: 10px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.10);
  color: rgba(229,231,235,0.65);
}

.modal-close{
  position: relative;
  appearance: none;
  width: 28px;
  height: 28px;

  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.06);
  cursor: pointer;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  padding: 0;
}

/* Das eigentliche X */
.modal-close::before,
.modal-close::after{
  content: "";
  position: absolute;
  width: 14px;
  height: 2px;
  background: rgba(229,231,235,0.85);
  border-radius: 2px;
}

.modal-close::before{
  transform: rotate(45deg);
}

.modal-close::after{
  transform: rotate(-45deg);
}

/* Hover */
.modal-close:hover{
  background: rgba(255,255,255,0.10);
  border-color: rgba(255,255,255,0.22);
}

/* Fokus (Tastatur) */
.modal-close:focus{
  outline: 2px solid rgba(250,204,21,0.45);
  outline-offset: 2px;
}

/* =========================
   Seatmap (Passagiere)
   ========================= */
.seatmap-legend{
  display:flex;
  gap: 12px;
  align-items:center;
  margin-bottom: 10px;
  font-size: 11px;
  color: rgba(229,231,235,0.70);
}
.legend-item{
  display:flex;
  align-items:center;
  gap: 6px;
}

.seatmap-wrap{
  overflow: auto;
}

.seatmap{
  display: grid;
  gap: 8px;
}

.seatmap-header,
.seatmap-row{
  display: grid;
  grid-template-columns: 34px 1fr 18px 1fr; /* RowLabel | Left | Aisle | Right */
  align-items: center;
  gap: 8px;
}

.seatmap-rowlabel{
  font-size: 11px;
  color: rgba(229,231,235,0.65);
  text-align: right;
  padding-right: 4px;
}

.seatmap-block{
  display: grid;
  grid-template-columns: repeat(3, 18px); /* A B C bzw. D E F */
  gap: 6px;
  justify-content: start;
}

.seatmap-aisle{
  height: 1px;
  opacity: 0.35;
}

.seatmap-col{
  font-size: 10px;
  color: rgba(229,231,235,0.65);
  text-align: center;
}

.seat{
  width: 18px;
  height: 18px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.06);
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
}

.seat--free{
  background: rgba(255,255,255,0.04);
  border-color: rgba(255,255,255,0.08);
}

.seat--occupied{
  background: rgba(59,130,246,0.22);
  border-color: rgba(59,130,246,0.35);
}

.seat--occupied:hover{
  background: rgba(250,204,21,0.18);
  border-color: rgba(250,204,21,0.35);
}

.seatmap-loading{
  font-size: 12px;
  color: rgba(229,231,235,0.75);
  padding: 8px 2px;
}

.seatmap-error{
  font-size: 12px;
  color: rgba(239,68,68,0.95);
  padding: 8px 2px;
}
.seatmap-error-detail{
  margin-top: 6px;
  font-size: 11px;
  color: rgba(229,231,235,0.65);
}
/* Live-Flugzeuge */
.aircraft-marker{
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(34,197,94,0.95);          /* grün */
  border: 1px solid rgba(255,255,255,0.25);
  box-shadow: 0 0 10px rgba(34,197,94,0.35);
}
/* =========================
   Radar Sidebar (AirNav-like)
   ========================= */
.radar-sidebar{
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  width: 320px;
  max-width: 92vw;
  z-index: 6000;
  background: rgba(245,245,245,0.98);
  color: #0b0f14;
  border-right: 1px solid rgba(0,0,0,0.10);
  box-shadow: 10px 0 30px rgba(0,0,0,0.18);
  display: none;
  overflow: hidden;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

.radar-sidebar.open{ display: block; }

.radar-sidebar__head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 10px;
  padding: 14px 14px;
  border-bottom: 1px solid rgba(0,0,0,0.10);
  background: rgba(255,255,255,0.92);
}

.radar-sidebar__callsign{
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 18px;
  line-height: 1.1;
}

.radar-sidebar__sub{
  margin-top: 4px;
  font-size: 12px;
  color: rgba(11,15,20,0.65);
}

.radar-sidebar__close{
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid rgba(0,0,0,0.12);
  background: rgba(0,0,0,0.04);
  cursor: pointer;
  position: relative;
}
.radar-sidebar__close::before,
.radar-sidebar__close::after{
  content:"";
  position:absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 2px;
  background: rgba(11,15,20,0.75);
  transform-origin: center;
}
.radar-sidebar__close::before{ transform: translate(-50%,-50%) rotate(45deg); }
.radar-sidebar__close::after{ transform: translate(-50%,-50%) rotate(-45deg); }

.radar-sidebar__body{
  height: calc(100vh - 64px);
  overflow: auto;
  padding: 12px 14px 18px;
}

.radar-empty{
  padding: 12px;
  border: 1px dashed rgba(0,0,0,0.18);
  border-radius: 12px;
  color: rgba(11,15,20,0.65);
  background: rgba(255,255,255,0.70);
}

/* Blocks/Sections like a tracker */
.radar-block{
  background: #ffffff;
  border: 1px solid rgba(0,0,0,0.10);
  border-radius: 12px;
  padding: 12px;
}

.radar-section{
  margin-top: 12px;
  background: #ffffff;
  border: 1px solid rgba(0,0,0,0.10);
  border-radius: 12px;
  overflow: hidden;
}

.radar-section__title{
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(11,15,20,0.70);
  border-bottom: 1px solid rgba(0,0,0,0.08);
  background: rgba(0,0,0,0.02);
}

.radar-k{
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(11,15,20,0.55);
}

.radar-v{
  font-size: 13px;
  font-weight: 700;
  color: rgba(11,15,20,0.90);
  text-align: right;
}

.radar-row{
  display:flex;
  align-items:baseline;
  justify-content:space-between;
  gap: 12px;
  padding: 10px 12px;
  border-top: 1px solid rgba(0,0,0,0.06);
}
.radar-row:first-of-type{ border-top: 0; }

.radar-grid{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 12px;
}

.radar-metric{
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 10px;
  padding: 10px;
  background: rgba(0,0,0,0.015);
}
.radar-metric .radar-v{
  margin-top: 6px;
  text-align: left;
  font-weight: 900;
}

/* Route row */
.radar-route{
  display:grid;
  grid-template-columns: 1fr 48px 1fr;
  gap: 10px;
  align-items:center;
}
.radar-airport{
  margin-top: 4px;
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.radar-route__mid{
  position: relative;
  height: 34px;
}
.radar-route__line{
  position:absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 2px;
  background: rgba(0,0,0,0.12);
  transform: translateY(-50%);
}
.radar-route__arrow{
  position:absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%,-50%);
  font-weight: 900;
  color: rgba(11,15,20,0.75);
}

.radar-note{
  padding: 10px 12px 12px;
  font-size: 12px;
  color: rgba(11,15,20,0.60);
  border-top: 1px solid rgba(0,0,0,0.06);
}

/* Mobile: Panel volle Breite */
@media (max-width: 520px){
  .sidepanel{ width: calc(100vw - 24px); }
}

/* Leaflet DIV-Icon sauber machen */
.aircraft-divicon{
  background: transparent !important;
  border: none !important;
}

.aircraft-icon{
  width: 18px;
  height: 18px;
  color: #7c3aed; /* lila wie ADSBexchange */
  filter:
    drop-shadow(0 0 1px rgba(0,0,0,0.8))
    drop-shadow(0 0 4px rgba(0,0,0,0.35));
  transform-origin: 50% 50%;
  pointer-events: none;
}

.aircraft-icon svg{
  width: 100%;
  height: 100%;
  display: block;
}

/* optional: selected */
.aircraft-icon.is-selected{
  color: #22c55e;
}


