:root{
  --bg:#0b1220;
  --card:#0f1a33;
  --text:#eaf0ff;
  --muted:#b9c5e6;
  --accent:#3aa3ff;
  --accent2:#7cc7ff;
  --danger:#ff5c7a;
  --ok:#4ee59a;
  --stroke:#213155;
}

*{box-sizing:border-box}

body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
  background: radial-gradient(1200px 600px at 20% 10%, #162a57 0%, var(--bg) 60%);
  color:var(--text);
}

.top{
  padding: 32px 18px 12px;
  max-width: 1100px;
  margin:0 auto;
}

h1{margin:0 0 6px; font-size: 28px;}
.subtitle{margin:0; color:var(--muted); line-height:1.4; max-width: 920px;}

.wrap{max-width:1100px; margin: 0 auto; padding: 12px 18px 42px;}

.card{
  background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.03));
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 18px;
  padding: 18px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.35);
}

h2{margin: 0 0 12px; font-size: 18px;}

.hint{
  margin-top: 12px;
  color: var(--muted);
  font-size: 14px;
}

/* =========================
   MAP + PANEL LAYOUT (clean)
   ========================= */

.mapLayout{
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 12px;
  align-items: stretch;
}

/* Stack on small screens */
@media (max-width: 980px){
  .mapLayout{
    grid-template-columns: 1fr;
  }
}

/* ✅ FIX: Stable height so D3 fitSize stays centered */
.map{
  width: 100%;
  height: 560px;      /* change this if you want taller */
  min-height: 560px;
  border-radius: 14px;
  background: rgba(0,0,0,0.18);
  border: 1px solid rgba(255,255,255,0.08);
  overflow:hidden;
  position: relative;
}

.map svg{
  display:block; /* prevents tiny whitespace issues */
}

/* Right panel */
.panel{
  background: rgba(0,0,0,0.18);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  padding: 12px;
  height: 560px;     /* matches .map height */
  min-height: 560px;
  overflow: auto;
}

.panelTitle{
  font-weight: 700;
  margin-bottom: 6px;
}

.panelHint{
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 10px;
}

.panelList{
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.panelItem{
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.04);
  cursor: pointer;
}

.panelItem:hover{
  border-color: rgba(58,163,255,0.55);
  box-shadow: 0 0 0 3px rgba(58,163,255,0.12);
}

.panelCode{
  font-weight: 800;
  min-width: 52px;
}

.panelName{
  color: var(--text);
  font-size: 13px;
  line-height: 1.2;
}

/* =========================
   STATES + MAP INTERACTION
   ========================= */

.state{
  fill: rgba(255,255,255,0.08);
  stroke: var(--stroke);
  stroke-width: 1;
  cursor: pointer;
  transition: fill 120ms ease, filter 120ms ease, opacity 180ms ease;
}

.state:hover{
  fill: rgba(58,163,255,0.55);
  filter: drop-shadow(0 0 6px rgba(58,163,255,0.7));
}

.state.dim{opacity: 0}

.state.active{
  fill: rgba(58,163,255,0.35);
  filter: drop-shadow(0 0 10px rgba(58,163,255,0.85));
}

/* =========================
   AIRPORT MARKERS (clean)
   ========================= */

.airportMarker{
  cursor: pointer;
}

.leader{
  pointer-events: none;
}

/* labels hidden by default */
.airportLabel{
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease;
  font-size: 12px;
  fill: var(--text);
  paint-order: stroke;
  stroke: rgba(0,0,0,0.45);
  stroke-width: 2px;
  stroke-linejoin: round;
}

/* show label only on hover */
.airportMarker:hover .airportLabel{
  opacity: 1;
}

/* hover glow on plane icon */
.airportMarker path{
  transition: transform 120ms ease, filter 120ms ease;
}

.airportMarker:hover path{
  filter: drop-shadow(0 0 6px rgba(255,255,255,0.65));
  transform: scale(1.06);
  transform-origin: center;
}

/* leader line hidden until hover */
.airportMarker .leader{
  opacity: 0;
  transition: opacity 120ms ease;
}

.airportMarker:hover .leader{
  opacity: 1;
}

/* =========================
   MODAL + FORM
   ========================= */

.modalBackdrop{
  position: fixed;
  inset:0;
  background: rgba(0,0,0,0.6);
  display:flex;
  align-items:center;
  justify-content:center;
  padding: 18px;
}

.hidden{display:none !important}

.modal{
  width: min(720px, 100%);
  background: #0e1730;
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 18px;
  box-shadow: 0 18px 60px rgba(0,0,0,0.5);
}

.modalHeader{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  padding: 16px 16px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.10);
}

.modalTitle{font-weight:700; font-size: 16px;}
.modalSub{color:var(--muted); font-size: 13px; margin-top: 2px;}

.iconBtn{
  background: transparent;
  border: 1px solid rgba(255,255,255,0.18);
  color: var(--text);
  width: 34px;
  height: 34px;
  border-radius: 10px;
  cursor:pointer;
}

.form{padding: 14px 16px 18px;}

label{display:block; margin: 10px 0;}
label span{display:block; font-size: 13px; color: var(--muted); margin-bottom: 6px;}

input, select{
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(0,0,0,0.20);
  color: var(--text);
  outline:none;
}

input:focus, select:focus{
  border-color: rgba(58,163,255,0.55);
  box-shadow: 0 0 0 3px rgba(58,163,255,0.18);
}

.checkboxRow{display:flex; gap:10px; align-items:center;}
.checkboxRow input{width:auto; transform: translateY(1px);}

.grid3{display:grid; grid-template-columns: 1fr 140px 1fr; gap: 10px;}
.grid2{display:grid; grid-template-columns: 1fr 1fr; gap: 10px;}

@media (max-width: 720px){
  .grid3{grid-template-columns: 1fr 120px 1fr;}
  .grid2{grid-template-columns: 1fr;}
}

.btnRow{
  display:flex;
  justify-content:center;
  gap: 12px;
  margin-top: 12px;
}

.btn{
  min-width: 160px;
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.16);
  cursor:pointer;
  font-weight: 650;
}

.btn.primary{
  background: linear-gradient(180deg, rgba(58,163,255,0.95), rgba(58,163,255,0.75));
}

.btn.secondary{
  background: rgba(255,255,255,0.06);
}

.formNote{margin-top: 10px; font-size: 13px; color: var(--muted);}
.formNote.error{color: var(--danger);}
.formNote.ok{color: var(--ok);}

/* =========================
   BACK BUTTON (optional)
   ========================= */
.toolbar{
  display:flex;
  justify-content:flex-start;
  margin-bottom:10px;
}

#backBtn{
  padding: 8px 14px;
  font-size: 14px;
}
