/* ── LOGIN ── */
#login {
  position: fixed; inset: 0;
  background: #060806;
  display: flex; align-items: center; justify-content: center;
  z-index: 199999;
  transition: opacity .7s;
}
#login.gone { opacity: 0; pointer-events: none; }

.lg-corners { position: absolute; inset: 18px; pointer-events: none; }
.lg-corners span {
  position: absolute; width: 18px; height: 18px;
  border-color: rgba(1,195,142,.2); border-style: solid;
}
.lg-corners span:nth-child(1) { top: 0; left: 0;  border-width: 1px 0 0 1px; }
.lg-corners span:nth-child(2) { top: 0; right: 0; border-width: 1px 1px 0 0; }
.lg-corners span:nth-child(3) { bottom: 0; left: 0;  border-width: 0 0 1px 1px; }
.lg-corners span:nth-child(4) { bottom: 0; right: 0; border-width: 0 1px 1px 0; }

.lg-wrap {
  display: flex; flex-direction: column; align-items: center;
  width: 340px;
}

.lg-logo svg {
  width: 64px; height: 64px;
  animation: bspin 6s linear infinite;
  transform-origin: 38px 38px;
  margin-bottom: 20px;
}

.lg-title {
  font-family: var(--fc); font-size: 38px; font-weight: 700;
  letter-spacing: 5px; color: #fff; line-height: 1;
}
.lg-title em { color: var(--ice); font-style: normal; }

.lg-sub {
  font-family: var(--fm); font-size: 8px; letter-spacing: 4px;
  color: var(--txt3); margin-top: 6px; text-align: center;
}
.lg-uae {
  font-family: var(--fm); font-size: 7px; letter-spacing: 2px;
  color: var(--uae-gold); margin-top: 3px; opacity: .5;
}

.lg-sep {
  width: 100%; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(1,195,142,.18), transparent);
  margin: 28px 0 24px;
}

.lg-field { width: 100%; margin-bottom: 14px; }
.lg-lbl {
  display: block; font-family: var(--fm); font-size: 7px;
  letter-spacing: 3px; color: var(--txt3); margin-bottom: 6px;
}
.lg-input {
  width: 100%; background: rgba(255,255,255,.03);
  border: 1px solid rgba(1,195,142,.15);
  border-radius: 2px; padding: 10px 12px;
  font-family: var(--fm); font-size: 11px; letter-spacing: 2px;
  color: var(--txt); outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.lg-input::placeholder { color: var(--txt3); opacity: .5; }
.lg-input:focus {
  border-color: rgba(1,195,142,.45);
  box-shadow: 0 0 0 1px rgba(1,195,142,.08), inset 0 0 8px rgba(1,195,142,.03);
}

.lg-err {
  font-family: var(--fm); font-size: 8px; letter-spacing: 2px;
  color: var(--red); text-align: center; min-height: 14px;
  margin-bottom: 10px; opacity: 0; transition: opacity .2s;
}
.lg-err.show { opacity: 1; }

.lg-btn {
  width: 100%; padding: 12px;
  background: rgba(1,195,142,.08);
  border: 1px solid rgba(1,195,142,.3);
  border-radius: 2px; cursor: pointer;
  font-family: var(--fc); font-size: 11px; font-weight: 700;
  letter-spacing: 4px; color: var(--ice);
  transition: background .2s, border-color .2s, box-shadow .2s;
}
.lg-btn:hover {
  background: rgba(1,195,142,.14);
  border-color: rgba(1,195,142,.55);
  box-shadow: 0 0 20px rgba(1,195,142,.08);
}
.lg-btn:active { background: rgba(1,195,142,.2); }
.lg-btn.loading { opacity: .5; pointer-events: none; }
.lg-btn.shake { animation: lgshake .4s ease; }

.lg-footer {
  margin-top: 22px;
  font-family: var(--fm); font-size: 7px; letter-spacing: 2px;
  color: var(--txt3); opacity: .35; text-align: center;
}

@keyframes lgshake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-6px); }
  40%       { transform: translateX(6px); }
  60%       { transform: translateX(-4px); }
  80%       { transform: translateX(4px); }
}

/* ── BOOT ── */
#boot {
  position: fixed; inset: 0;
  background: #060806;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  z-index: 99999; transition: opacity 1s;
}
#boot.gone { opacity: 0; pointer-events: none; }

.b-row { display: flex; align-items: center; gap: 22px; margin-bottom: 44px; }
.b-svg { width: 76px; height: 76px; animation: bspin 5s linear infinite; transform-origin: 38px 38px; }
.b-name { font-family: var(--fc); font-size: 46px; font-weight: 700; letter-spacing: 5px; color: #fff; line-height: 1; }
.b-name em { color: var(--ice); font-style: normal; }
.b-sub { font-family: var(--fm); font-size: 9px; letter-spacing: 4px; color: var(--txt3); margin-top: 5px; }
.b-uae { font-family: var(--fm); font-size: 8px; letter-spacing: 2px; color: var(--uae-gold); margin-top: 3px; opacity: .6; }
.b-track { width: 320px; height: 1px; background: rgba(255,255,255,.08); margin-bottom: 12px; position: relative; }
.b-fill { height: 1px; background: linear-gradient(90deg,#007a5a,#01C38E); width: 0; transition: width .09s; position: relative; }
.b-fill::after { content: ''; position: absolute; right: 0; top: -3px; width: 7px; height: 7px; border-radius: 50%; background: #01C38E; box-shadow: 0 0 10px #01C38E; }
.b-msg { font-family: var(--fm); font-size: 9px; color: rgba(1,195,142,.55); letter-spacing: 3px; text-transform: uppercase; text-align: center; min-height: 14px; }

/* ── SHELL ── */
#shell {
  display: grid;
  grid-template-columns: 272px 1fr 292px;
  grid-template-rows: 48px 1fr;
  height: 100vh;
  opacity: 0; transition: opacity .7s;
}
#shell.on { opacity: 1; }

/* ── TOPBAR ── */
#topbar {
  grid-column: 1 / -1;
  background: rgba(10,13,10,.97);
  border-bottom: 1px solid var(--b1);
  display: flex; align-items: center;
  padding: 0 14px; gap: 10px;
  z-index: 200; backdrop-filter: blur(16px);
}
.t-brand { display: flex; align-items: center; gap: 9px; margin-right: 6px; flex-shrink: 0; }
.t-bsvg { width: 26px; height: 26px; }
.t-bname { font-family: var(--fc); font-size: 17px; font-weight: 700; letter-spacing: 3px; color: #fff; }
.t-bname em { color: var(--ice); font-style: normal; }
.t-sep { width: 1px; height: 22px; background: var(--b2); flex-shrink: 0; }
.t-info { font-family: var(--fm); font-size: 7px; color: var(--txt3); letter-spacing: 1px; line-height: 1.8; }
.t-info strong { color: var(--txt2); display: block; font-size: 8px; }
.t-uae { display: flex; align-items: center; margin-left: 4px; }
.us { width: 4px; height: 18px; }
.t-pills { display: flex; gap: 5px; margin-left: 8px; }
.pill { display: flex; align-items: center; gap: 5px; padding: 3px 9px; font-family: var(--fm); font-size: 7px; letter-spacing: 1px; text-transform: uppercase; cursor: pointer; border: 1px solid transparent; transition: all .2s; border-radius: 1px; }
.pill.ok  { background: rgba(52,211,153,.07); border-color: rgba(52,211,153,.2); color: var(--jade); }
.pill.warn{ background: rgba(251,191,36,.07); border-color: rgba(251,191,36,.18); color: var(--amber); animation: blink 1.6s infinite; }
.pdot { width: 4px; height: 4px; border-radius: 50%; background: currentColor; }
.t-sp { flex: 1; }
.t-clk { font-family: var(--fm); font-size: 12px; color: var(--ice); letter-spacing: 2px; text-align: right; }
.t-dt  { font-family: var(--fm); font-size: 7px; color: var(--txt3); letter-spacing: 1px; text-align: right; margin-top: 1px; }

/* ── LEFT ── */
#left { background: var(--panel); border-right: 1px solid var(--b1); overflow-y: auto; }

/* ── MAP ── */
#map { position: relative; overflow: hidden; background: #0a0e0a; }
#sat-map { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1; }
#mapFx   { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 2; pointer-events: none; }

/* Leaflet overrides — dark theme */
.leaflet-container              { background: #0C0E0C; }
.leaflet-control-zoom           { border: 1px solid var(--b2) !important; border-radius: 2px !important; }
.leaflet-control-zoom a         { background: rgba(10,13,10,.92) !important; color: var(--txt2) !important; border-color: var(--b1) !important; font-size: 14px !important; }
.leaflet-control-zoom a:hover   { background: rgba(1,195,142,.12) !important; color: var(--ice) !important; }
.leaflet-control-attribution    { display: none !important; }
.mhud { position: absolute; z-index: 3; pointer-events: none; font-family: var(--fm); font-size: 8px; color: rgba(1,195,142,.35); line-height: 1.9; letter-spacing: .5px; }
.mhud.tl { top: 10px; left: 10px; }
.mhud.tr { top: 10px; right: 10px; text-align: right; }
.mhud.bl { bottom: 58px; left: 10px; }
.mhud.br { bottom: 58px; right: 10px; text-align: right; }
.mhv { color: var(--ice); } .mhw { color: var(--amber); } .mhg { color: var(--jade); } .mhr { color: var(--red); }
.mcorner { position: absolute; z-index: 3; width: 14px; height: 14px; pointer-events: none; }
.mcorner.tl { top: 6px; left: 6px; border-top: 1px solid rgba(1,195,142,.3); border-left: 1px solid rgba(1,195,142,.3); }
.mcorner.tr { top: 6px; right: 6px; border-top: 1px solid rgba(1,195,142,.3); border-right: 1px solid rgba(1,195,142,.3); }
.mcorner.bl { bottom: 54px; left: 6px; border-bottom: 1px solid rgba(1,195,142,.3); border-left: 1px solid rgba(1,195,142,.3); }
.mcorner.br { bottom: 54px; right: 6px; border-bottom: 1px solid rgba(1,195,142,.3); border-right: 1px solid rgba(1,195,142,.3); }
/* search bar */
#searchbar {
  position: absolute; top: 10px; left: 50%; transform: translateX(-50%);
  z-index: 5; display: flex; flex-direction: column; min-width: 260px; max-width: 340px; width: 30%;
}
#search-input {
  background: rgba(10,13,10,.93); border: 1px solid var(--b2);
  color: var(--ice); font-family: var(--fm); font-size: 9px;
  letter-spacing: 2px; text-transform: uppercase;
  padding: 7px 14px; outline: none; border-radius: 2px;
  backdrop-filter: blur(16px); width: 100%; box-sizing: border-box;
}
#search-input::placeholder { color: var(--txt3); }
#search-input:focus { border-color: rgba(1,195,142,.45); }
#search-results {
  background: rgba(8,10,8,.98); border: 1px solid var(--b2); border-top: none;
  max-height: 210px; overflow-y: auto; display: none; border-radius: 0 0 2px 2px;
}
#search-results.open { display: block; }
.sr-item {
  padding: 8px 14px; font-family: var(--fm); font-size: 8px;
  color: var(--txt2); letter-spacing: .5px; cursor: pointer;
  border-bottom: 1px solid rgba(255,255,255,.04); transition: background .1s;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sr-item:last-child { border-bottom: none; }
.sr-item:hover { background: rgba(1,195,142,.08); color: var(--ice); }
.sr-empty { color: var(--txt3); cursor: default; }
.sr-empty:hover { background: transparent; color: var(--txt3); }

/* layer CTA */
#layerbar {
  position: absolute; bottom: 60px; left: 50%; transform: translateX(-50%);
  z-index: 4; display: flex; align-items: center; gap: 3px;
  background: rgba(10,13,10,.93); border: 1px solid var(--b2);
  padding: 5px 8px; backdrop-filter: blur(16px); border-radius: 2px;
}
.lylbl { font-family: var(--fm); font-size: 7px; color: var(--txt3); letter-spacing: 2px; margin-right: 4px; white-space: nowrap; }
.lyb {
  padding: 4px 12px; font-family: var(--fc); font-size: 8px; font-weight: 600;
  letter-spacing: 2px; text-transform: uppercase;
  background: transparent; border: 1px solid transparent;
  color: var(--txt3); cursor: pointer; transition: all .18s; border-radius: 1px; white-space: nowrap;
}
.lyb:hover { color: var(--txt2); border-color: var(--b2); }
.lyb.on { background: rgba(1,195,142,.1); border-color: rgba(1,195,142,.3); color: var(--ice); }

#scbar { position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%); z-index: 4; display: flex; gap: 4px; background: rgba(10,13,10,.93); border: 1px solid var(--b2); padding: 6px 8px; backdrop-filter: blur(16px); border-radius: 2px; }
.scb { padding: 5px 13px; font-family: var(--fc); font-size: 9px; font-weight: 600; letter-spacing: 2px; text-transform: uppercase; background: transparent; border: 1px solid transparent; color: var(--txt3); cursor: pointer; transition: all .18s; border-radius: 1px; white-space: nowrap; }
.scb:hover { color: var(--txt2); border-color: var(--b2); }
.scb.on { background: rgba(1,195,142,.1); border-color: rgba(1,195,142,.3); color: var(--ice); }

/* ── RIGHT ── */
#right { background: var(--panel); border-left: 1px solid var(--b1); overflow-y: auto; }

/* ── POPUP ── */
#popup {
  position: fixed; top: 50%; left: 50%;
  transform: translate(-50%,-50%) scale(.93);
  background: rgba(11,14,11,.98); border: 1px solid var(--b2);
  padding: 22px 24px; width: 400px; max-height: 82vh; overflow-y: auto;
  opacity: 0; pointer-events: none; transition: all .22s;
  z-index: 9000; backdrop-filter: blur(24px); border-radius: 3px;
}
#popup.on { opacity: 1; pointer-events: all; transform: translate(-50%,-50%) scale(1); }

/* ── TOAST ── */
#toast {
  position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%);
  background: rgba(10,13,10,.97); border: 1px solid rgba(1,195,142,.28);
  padding: 9px 18px; font-family: var(--fm); font-size: 8px; color: var(--ice);
  letter-spacing: 1.5px; text-transform: uppercase; z-index: 99999;
  opacity: 0; transition: opacity .3s; pointer-events: none;
  white-space: nowrap; border-radius: 2px;
}
#toast.on { opacity: 1; }

/* Live flights overlay — plane markers + trails (on/off controlled from Settings) */
.flight-icon, .flight-icon-mil { background: transparent; border: none; }
.flight-icon svg, .flight-icon-mil svg { width: 100%; height: 100%; filter: drop-shadow(0 0 2px rgba(0,0,0,.8)); }

.flight-popup { font-family: var(--fm); font-size: 11px; line-height: 1.6; }
.flight-popup .flight-callsign { font-weight: 700; color: var(--ice); margin-bottom: 2px; }
.flight-popup-mil .flight-callsign { color: var(--gold2); }
.flight-popup .flight-row { color: #64748b; }
.flight-popup .flight-row b { color: #cbd5e1; }

/* Settings gear button (topbar) */
.t-settings {
  display: flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; background: transparent;
  border: 1px solid rgba(255,255,255,.1); border-radius: 2px;
  color: var(--txt3); font-size: 13px; cursor: pointer;
  transition: background .2s, border-color .2s, color .2s; margin-right: 6px;
}
.t-settings:hover { background: rgba(0,229,160,.08); border-color: rgba(0,229,160,.35); color: var(--ice); }

/* Settings panel — right-side sliding overlay, same chrome as the NRBCE panel */
#settings-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(4,5,10,.72);
  backdrop-filter: blur(2px);
  z-index: 1000;
  align-items: stretch; justify-content: flex-end;
}
#settings-overlay.on { display: flex; }
#settings-panel {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 380px; max-width: 100vw;
  background: var(--panel);
  border-left: 1px solid var(--b1);
  display: flex; flex-direction: column; overflow: hidden;
  box-shadow: -6px 0 40px rgba(0,0,0,.6);
  animation: tmed-slidein .22s cubic-bezier(.22,1,.36,1);
}
.settings-body { flex: 1; overflow-y: auto; padding: 4px 16px 20px; }
.settings-section {
  font-family: var(--fc); font-size: 9px; font-weight: 700; letter-spacing: .1em;
  color: var(--txt3); margin: 18px 0 8px; padding-top: 14px; border-top: 1px solid rgba(255,255,255,.04);
}
.settings-section:first-child { margin-top: 10px; padding-top: 0; border-top: none; }

.settings-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid rgba(255,255,255,.04);
}
.settings-row-label { font-family: var(--fc); font-size: 11px; color: var(--txt); }
.settings-row-sub { font-family: var(--fm); font-size: 9px; color: var(--txt3); margin-top: 3px; }

.settings-switch { position: relative; display: inline-block; width: 34px; height: 19px; flex-shrink: 0; }
.settings-switch input { opacity: 0; width: 0; height: 0; }
.settings-switch-track {
  position: absolute; inset: 0; cursor: pointer;
  background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.12);
  border-radius: 10px; transition: background .18s, border-color .18s;
}
.settings-switch-track::before {
  content: ''; position: absolute; left: 2px; top: 2px;
  width: 13px; height: 13px; border-radius: 50%;
  background: var(--txt2); transition: transform .18s, background .18s;
}
.settings-switch input:checked + .settings-switch-track {
  background: rgba(0,229,160,.18); border-color: rgba(0,229,160,.5);
}
.settings-switch input:checked + .settings-switch-track::before {
  transform: translateX(15px); background: var(--ice);
}
