/*
 * UX v2 for the public airfields map. Loaded only with the new look
 * (templates/Pages/airfields_map.php); pairs with js/airfields-map-ux2.js.
 * Same sunlight rules as ux2.css: 16px+ text, dark ink, 44-48px targets.
 */
:root {
  --afx-ink: #111a22;
  --afx-hint: #4d5b68;
  --afx-line: #d5dde4;
  --afx-blue: #01579b;
  --afx-orange: #c43e00;
}

/* the map is the page: no footer under it to scroll to (it's in the menu) */
body:has(.ux2-map) .footer { display: none; }
/* and nothing else to scroll: a swipe always moves the map, never the page */
html:has(.ux2-map), body:has(.ux2-map) { overflow: hidden; overscroll-behavior: none; }
.ux2-map { height: calc(100dvh - var(--navbar-h)); min-height: 420px; }

/* bigger tap area round every airfield symbol (the icon itself stays chart-sized) */
.ux2-map .airfield-icon::after { content: ""; position: absolute; inset: -12px; }

/* ---- details card: hidden until an airfield is picked ---------------------- */
.ux2-map .airfields-side-panel.is-empty { display: none; }
.ux2-map .airfields-side-panel {
  width: 380px; font-size: 16px; color: var(--afx-ink); padding: 16px 18px;
  border: 0; border-radius: 10px; box-shadow: 0 4px 18px rgba(0, 0, 0, .22);
  top: calc(var(--navbar-h, 60px) + 70px); z-index: 1001;
}
.ux2-map .airfields-side-panel h4 { font-size: 20px; font-weight: 700; color: var(--afx-ink); padding-right: 48px; }
.ux2-map .airfields-side-panel .panel-close {
  position: absolute; top: 6px; right: 6px; width: 48px; height: 48px;
  font-size: 30px; color: var(--afx-ink);
}
.ux2-map .airfields-side-panel h6 { font-size: 13px; font-weight: 700; color: var(--afx-hint); margin: 16px 0 6px; }
.ux2-map .afx-sub { margin: 0 0 8px; color: var(--afx-hint); font-size: 15px; }
.ux2-map .afx-line { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--afx-line); }
.ux2-map .afx-label { color: var(--afx-hint); flex: 0 0 auto; max-width: 45%; }
.ux2-map .afx-value { font-weight: 700; margin-left: auto; text-align: right; font-variant-numeric: tabular-nums; word-break: break-word; }
.ux2-map .afx-item { padding: 6px 0; border-bottom: 1px solid var(--afx-line); font-weight: 600; }
.ux2-map .afx-copy {
  flex: 0 0 auto; min-height: 36px; padding: 0 10px; border: 2px solid var(--afx-blue); border-radius: 6px;
  background: #fff; color: var(--afx-blue); font-weight: 700; font-size: 14px;
}
.ux2-map .afx-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.ux2-map .afx-btn {
  display: flex; align-items: center; justify-content: center; text-align: center; min-height: 50px;
  border-radius: 8px; border: 2px solid var(--afx-blue); color: var(--afx-blue); background: #fff;
  font-weight: 700; font-size: 16px; text-decoration: none; padding: 0 8px;
}
.ux2-map .afx-btn-main { background: var(--afx-orange); border-color: var(--afx-orange); color: #fff; }
.ux2-map .afx-btn:hover, .ux2-map .afx-btn:focus { text-decoration: none; filter: brightness(1.1); }

/* ---- search ---------------------------------------------------------------- */
.ux2-map .afx-search {
  position: absolute; z-index: 1002; top: 10px; left: 60px; width: 360px; max-width: calc(100% - 72px);
}
.ux2-map .afx-search input {
  width: 100%; height: 48px; padding: 0 14px; font-size: 17px; color: var(--afx-ink);
  border: 2px solid #5f6d7a; border-radius: 8px; background: #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, .15);
}
.ux2-map .afx-search input:focus { outline: none; border-color: var(--afx-blue); box-shadow: 0 0 0 3px rgba(1, 87, 155, .25); }
.ux2-map .afx-results { list-style: none; margin: 4px 0 0; padding: 0; background: #fff; border-radius: 8px; box-shadow: 0 4px 14px rgba(0, 0, 0, .2); overflow: hidden; }
.ux2-map .afx-results:empty { display: none; }
.ux2-map .afx-results button {
  display: block; width: 100%; min-height: 48px; padding: 8px 14px; border: 0; border-bottom: 1px solid var(--afx-line);
  background: #fff; text-align: left; font-size: 16px; color: var(--afx-ink);
}
.ux2-map .afx-results button:hover, .ux2-map .afx-results button:focus { background: #eef4f9; }
.ux2-map .afx-noresult { padding: 12px 14px; color: var(--afx-hint); }

/* ---- hint chip, toast ------------------------------------------------------ */
.ux2-map .afx-hint {
  position: absolute; z-index: 1000; left: 50%; bottom: 40px; transform: translateX(-50%);
  background: rgba(17, 26, 34, .88); color: #fff; font-size: 15px; font-weight: 700;
  padding: 10px 14px; border-radius: 8px; pointer-events: none; max-width: calc(100% - 32px); text-align: center;
}
.ux2-map .afx-toast { bottom: 90px; }

/* ---- legend + extra map buttons --------------------------------------------- */
.ux2-map .afx-ctl button {
  display: block; width: 44px; height: 44px; border: 0; background: #fff; font-size: 22px; line-height: 44px; color: var(--afx-ink);
}
.ux2-map .afx-legend {
  position: absolute; z-index: 1002; left: 60px; top: 66px; width: 300px; max-width: calc(100% - 72px);
  max-height: calc(100% - 90px); overflow-y: auto; background: #fff; border-radius: 10px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, .22); padding: 12px 14px; font-size: 15px; color: var(--afx-ink);
}
.ux2-map .afx-legend h6 { margin: 6px 0; font-size: 13px; font-weight: 700; color: var(--afx-hint); }
.ux2-map .afx-leg-row { display: flex; align-items: center; gap: 10px; padding: 4px 0; }
.ux2-map .afx-leg-sym { width: 22px; height: 22px; flex: 0 0 auto; }
.ux2-map .afx-leg-area { width: 26px; height: 16px; flex: 0 0 auto; border: 2px solid; border-radius: 3px; }

/* ---- phones: details as a bottom sheet -------------------------------------- */
@media (max-width: 720px) {
  .ux2-map .airfields-side-panel {
    top: auto; left: 0; right: 0; bottom: 0; width: auto;
    max-height: 58vh; border-radius: 16px 16px 0 0; font-size: 16px;
    padding: 18px 16px calc(16px + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -4px 18px rgba(0, 0, 0, .25);
  }
  .ux2-map .airfields-side-panel::before {
    content: ""; display: block; width: 44px; height: 5px; border-radius: 3px; background: var(--afx-line); margin: -8px auto 10px;
  }
  .ux2-map .airfields-side-panel h4 { font-size: 19px; }
  .ux2-map .afx-search { left: 60px; right: 10px; width: auto; }
}

/* logged out: why the buttons go to login, and the way to sign up */
.ux2-map .afx-join { margin: 12px 0 0; font-size: 15px; color: var(--afx-hint); }
.ux2-map .afx-join a { color: var(--afx-blue); font-weight: 700; text-decoration: underline; }
