/* Airport / Heliport map page. Colours match search.php and detail.php. */
:root {
  --navy: #12315b;
  --blue: #1a5fb4;
  --bg: #f6f7f9;
  --ink: #1c2230;
  --muted: #5b6473;
  --line: #ccd2db;
  --panel-w: 390px;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

/* ---- top bar ---- */
.topbar {
  flex: 0 0 auto;
  background: var(--navy);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: .5rem 1rem;
}
.topbar h1 { margin: 0; font-size: 1.1rem; flex: 1; }
.topbar a { color: #cfe0ff; text-decoration: none; font-size: .9rem; white-space: nowrap; }
.topbar a:hover, .topbar a:focus-visible { text-decoration: underline; }

/* ---- layout ---- */
#app {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: var(--panel-w) 1fr;
}
#panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: #fff;
  border-right: 1px solid var(--line);
}
#mapwrap { position: relative; min-height: 0; min-width: 0; }
#map { position: absolute; inset: 0; background: #d9dee6; }

/* ---- panel: header + filters ---- */
.panel-head {
  flex: 0 0 auto;
  padding: .7rem .9rem .5rem;
  border-bottom: 1px solid #eceff3;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: .5rem;
}
.panel-head .count { font-size: .95rem; }
.panel-head .count strong { font-size: 1.1rem; }
.panel-head .sub { color: var(--muted); font-size: .82rem; }

details.filters { flex: 0 0 auto; border-bottom: 1px solid #eceff3; }
details.filters > summary {
  cursor: pointer;
  padding: .55rem .9rem;
  font-weight: 600;
  font-size: .9rem;
  color: var(--navy);
  list-style-position: inside;
}
.filters-body { padding: 0 .9rem .8rem; display: grid; gap: .6rem; }
.filters-body .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.field { display: flex; flex-direction: column; gap: .2rem; min-width: 0; }
.field label {
  font-size: .72rem; font-weight: 600; color: #444;
  text-transform: uppercase; letter-spacing: .03em;
}
.field input, .field select {
  padding: .45rem .5rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 1rem;
  width: 100%;
  background: #fff;
  color: var(--ink);
}
.field input:focus-visible, .field select:focus-visible,
button:focus-visible, .chip input:focus-visible + .chip-box,
.row:focus-visible, a:focus-visible {
  outline: 2px solid #ffb703;
  outline-offset: 1px;
}

.chips { display: flex; flex-wrap: wrap; gap: .35rem; }
.chip { cursor: pointer; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip-box {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .28rem .6rem; border-radius: 20px;
  border: 1px solid var(--line); background: #f3f5f8; color: #7a8291;
  font-size: .82rem; font-weight: 600;
}
.chip-box small { font-weight: 500; opacity: .85; }
.chip input:checked + .chip-box { background: #fff; color: var(--ink); border-color: #98a2b3; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.chip .dot { opacity: .35; }
.chip input:checked + .chip-box .dot { opacity: 1; }
.dot {
  width: .8rem; height: .8rem; border-radius: 50%;
  border: 1.5px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.25);
  flex: 0 0 auto; display: inline-block;
}

.toggles { display: grid; gap: .3rem; font-size: .88rem; }
.toggles label { display: flex; align-items: center; gap: .45rem; cursor: pointer; }
.toggles input { width: 1.05rem; height: 1.05rem; }

button, .btn {
  background: var(--blue); color: #fff; border: none;
  padding: .5rem .9rem; border-radius: 6px; font-size: .9rem;
  cursor: pointer; text-decoration: none; display: inline-block; font-family: inherit;
}
button.secondary, .btn.secondary { background: #e4e7ec; color: var(--ink); }
button:hover, .btn:hover { filter: brightness(1.06); }
.btn-row { display: flex; gap: .5rem; flex-wrap: wrap; }

[hidden] { display: none !important; }

/* ---- panel: results list ---- */
.list-head {
  flex: 0 0 auto;
  padding: .45rem .9rem;
  font-size: .8rem;
  color: var(--muted);
  background: #f8f9fb;
  border-bottom: 1px solid #eceff3;
  min-height: 2rem;
}
.list-head .linklike {
  background: none; color: var(--blue); padding: 0; margin-left: .4rem;
  text-decoration: underline; font-size: inherit;
}
.results-wrap { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
#results { list-style: none; margin: 0; padding: 0; }
.foot { flex: 0 0 auto; padding: .4rem .9rem; font-size: .72rem; color: var(--muted); border-top: 1px solid #eceff3; background: #f8f9fb; }
#results li { border-bottom: 1px solid #eef0f3; }
.row {
  display: flex; align-items: center; gap: .65rem; width: 100%;
  text-align: left; background: #fff; color: var(--ink);
  padding: .55rem .9rem; border-radius: 0; font-size: .95rem;
}
.row:hover { background: #f1f6ff; filter: none; }
.row-main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.row-main strong { font-size: .95rem; overflow-wrap: anywhere; }
.row-sub { color: var(--muted); font-size: .8rem; }
.row-dist { font-size: .82rem; font-weight: 600; color: var(--navy); white-space: nowrap; }
.hint { padding: 1rem .9rem; color: var(--muted); font-size: .9rem; line-height: 1.4; }
#more { margin: .7rem auto; display: block; }

/* ---- map overlays ---- */
#loading {
  position: absolute; inset: 0; z-index: 1200;
  display: flex; align-items: center; justify-content: center;
  background: rgba(246,247,249,.85); font-weight: 600; color: var(--navy);
  text-align: center; padding: 1rem;
}
#loading.error { color: #a4231a; }
#isolate-banner {
  position: absolute; z-index: 1100; top: .6rem; left: 50%; transform: translateX(-50%);
  background: #fff; border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,.3);
  padding: .45rem .6rem .45rem .8rem; display: flex; gap: .7rem; align-items: center;
  max-width: calc(100% - 7rem); font-size: .88rem;
}
#isolate-banner[hidden] { display: none; }
#isolate-banner span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#isolate-banner button { padding: .35rem .7rem; white-space: nowrap; }

.leaflet-bar a.mapbtn {
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; cursor: pointer;
}
.leaflet-bar a.mapbtn svg { width: 18px; height: 18px; fill: none; stroke: #222; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.leaflet-bar a.mapbtn.active { background: #fff3bf; }

/* popup */
.pop { min-width: 220px; }
.pop-name { font-weight: 700; font-size: 1rem; margin-bottom: .3rem; color: var(--navy); }
.badge {
  display: inline-block; background: #eef2f9; color: var(--navy);
  border-radius: 20px; padding: .08rem .55rem; font-size: .76rem; font-weight: 600; margin: 0 .25rem .25rem 0;
}
.pop-meta { font-size: .86rem; color: #333; line-height: 1.45; margin: .2rem 0 .5rem; }
.pop-actions { display: flex; flex-wrap: wrap; gap: .4rem; }
.pop-actions .btn, .pop-actions button { font-size: .82rem; padding: .4rem .65rem; }
.leaflet-popup-content { margin: 12px 14px; }
.leaflet-container a.btn { color: #fff; }
.leaflet-container a.btn.secondary { color: var(--ink); }

/* keep the credit line from covering the scale bar on narrow screens */
.leaflet-control-attribution { max-width: calc(100% - 120px); font-size: 11px; }
@media (max-width: 800px) { .leaflet-control-attribution { font-size: 10px; } }

/* clusters: restyle the default green/yellow/orange to match the site */
.marker-cluster-small,  .marker-cluster-small div  { background-color: rgba(26,95,180,.35); }
.marker-cluster-medium, .marker-cluster-medium div { background-color: rgba(18,49,91,.45); }
.marker-cluster-large,  .marker-cluster-large div  { background-color: rgba(120,20,90,.45); }
.marker-cluster div { color: #fff; font-weight: 700; text-shadow: 0 1px 2px rgba(0,0,0,.6); }
.marker-cluster-small div { background-color: rgba(26,95,180,.85); }
.marker-cluster-medium div { background-color: rgba(18,49,91,.9); }
.marker-cluster-large div { background-color: rgba(120,20,90,.9); }

.me-dot { background: #1a73e8; border: 3px solid #fff; border-radius: 50%; box-shadow: 0 0 0 2px rgba(26,115,232,.4); }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
noscript .ns { padding: 1rem; }

/* ---- phones and narrow windows: map on top, list underneath ---- */
#btn-size { display: none; }
@media (max-width: 800px) {
  #app { grid-template-columns: 1fr; grid-template-rows: 46% 54%; }
  #app.map-tall { grid-template-rows: 78% 22%; }
  #mapwrap { order: -1; }
  #panel { border-right: none; border-top: 1px solid var(--line); }
  #btn-size { display: inline-block; padding: .3rem .6rem; font-size: .78rem; }
  .topbar { padding: .4rem .8rem; }
  .topbar h1 { font-size: 1rem; }
  .panel-head { padding: .45rem .8rem; }
  .filters-body .row2 { grid-template-columns: 1fr 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .leaflet-fade-anim .leaflet-popup, .leaflet-zoom-anim .leaflet-zoom-animated { transition: none !important; }
}
