/* map-layers.css - The tracker map's Map layers button and panel (flights/js/map-layers.js, owner 2026-11-22).
   Easy to choose (owner): full-width rows at least 56 px tall where a tap anywhere toggles; an icon, a plain name and one
   short line; a real switch plus a tinted row when on; a layer's choices as large segmented buttons under its row while
   it is on. A bottom sheet with a Done button on a map 600 px wide or less, else a popover right of the button stack.
   v2 (2026-11-22, owner's phone: site dark, map light gave near-white text on a white sheet): every panel color comes from
   ONE source, the SITE theme (body.dark-mode, dark-mode.css), through the --ml-* variables below; the map's own light or
   dark (#trackerMap.map-dark) no longer touches the panel (it still styles the button, which sits in the map's stack).
   Text rules are scoped under #trackerMap so they beat dark-mode.css's body.dark-mode span/div/label and h2 rules.
   map-layers.js also scrolls a phone sheet into view when the map starts below the fold. ASCII only. */

/* The button: the same size and look as its neighbours in the left stack (map themed, like them); open = a pale blue tint. */
.leaflet-bar a.layers-btn { position: relative; display: flex; align-items: center; justify-content: center; width: 30px; height: 30px; background: #fff; color: #000; text-decoration: none; }
.leaflet-bar a.layers-btn svg { display: block; }
.leaflet-bar a.layers-btn[aria-expanded="true"] { background: #e6f4fc; color: #0b6fa4; }
body.dark-mode .leaflet-bar a.layers-btn[aria-expanded="true"] { background: #e6f4fc !important; color: #0b6fa4; }
#trackerMap.map-dark .leaflet-bar a.layers-btn[aria-expanded="true"] { background: #1e3a4f !important; color: #7fd0ff; }
/* The dot: a layer that is off by default (restrictions, charts, controller areas) is on. */
.leaflet-bar a.layers-btn .layers-dot { position: absolute; top: 3px; right: 3px; width: 8px; height: 8px; border-radius: 50%; background: #e8710a; box-shadow: 0 0 0 1.5px #fff; pointer-events: none; }
#trackerMap.map-dark .leaflet-bar a.layers-btn .layers-dot { background: #ffa04d; box-shadow: 0 0 0 1.5px #2b2b2b; }

/* The panel's colors: light by default, dark when the SITE is dark. */
.ml-panel {
    --ml-bg: #fff; --ml-text: #1d1d1f; --ml-muted: #5f6368; --ml-note: #a3480a; --ml-accent: #0b6fa4; --ml-on-accent: #fff;
    --ml-row-on: #e8f4fd; --ml-hover: rgba(0, 0, 0, 0.04); --ml-ico: #f1f3f4; --ml-ico-text: #3c4043; --ml-track: #9aa0a6;
    --ml-knob: #fff; --ml-done-hover: #eef6fb; --ml-lock-bg: #fbf3d5; --ml-lock-text: #6b5000; --ml-seg-bg: #fff; --ml-key: #3c4043;
    --ml-shadow: 0 4px 18px rgba(0, 0, 0, 0.28), 0 0 0 1px rgba(0, 0, 0, 0.08);
}
body.dark-mode .ml-panel {
    --ml-bg: #202124; --ml-text: #e8eaed; --ml-muted: #b6bcc4; --ml-note: #ffb37a; --ml-accent: #4db3f0; --ml-on-accent: #10202c;
    --ml-row-on: #1c3446; --ml-hover: rgba(255, 255, 255, 0.06); --ml-ico: #3c4043; --ml-ico-text: #e8eaed; --ml-track: #6b7076;
    --ml-knob: #fff; --ml-done-hover: #2f3b46; --ml-lock-bg: #4a3d12; --ml-lock-text: #ffe08a; --ml-seg-bg: #202124; --ml-key: #c4c9d0;
    --ml-shadow: 0 4px 18px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.12);
}

/* The panel: a child of the map (never cut off, above the controls). */
#trackerMap .ml-panel { position: absolute; z-index: 1001; top: 12px; left: 56px; width: 344px; max-width: calc(100% - 70px); max-height: calc(100% - 24px); box-sizing: border-box;
    overflow-y: auto; overscroll-behavior: contain; padding: 0 6px 8px; background: var(--ml-bg); color: var(--ml-text); border-radius: 12px;
    box-shadow: var(--ml-shadow); font-family: inherit; font-size: 14px; line-height: 1.3; cursor: auto; text-align: left; }
#trackerMap .ml-panel.ml-sheet { top: auto; left: 0; right: 0; bottom: 0; width: auto; max-width: none; border-radius: 16px 16px 0 0; padding: 0 8px calc(10px + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -4px 18px rgba(0, 0, 0, 0.3); }
#trackerMap.layers-open .leaflet-control-scale { visibility: hidden; }
#trackerMap .ml-head { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 6px 4px 10px; background: var(--ml-bg); }
#trackerMap .ml-panel .ml-title { margin: 0; padding: 0; font-size: 16px; font-weight: 700; line-height: 1.2; color: var(--ml-text) !important; border: 0; background: none; }
#trackerMap .ml-done { min-height: 44px; min-width: 64px; padding: 0 14px; border: 0; border-radius: 22px; background: transparent; color: var(--ml-accent); font: inherit; font-size: 15px; font-weight: 700; cursor: pointer; }
#trackerMap .ml-done:hover { background: var(--ml-done-hover); }
#trackerMap .ml-done:focus-visible { outline: 2px solid var(--ml-accent); outline-offset: 2px; }
#trackerMap .ml-list { display: flex; flex-direction: column; gap: 4px; background: none; }

/* A row: the whole row is the switch's label (or, for a feature this viewer does not have, a link). */
#trackerMap .ml-item { border-radius: 12px; background: transparent; }
#trackerMap .ml-item.ml-on { background: var(--ml-row-on); }
#trackerMap .ml-panel .ml-row { position: relative; display: flex; align-items: center; gap: 12px; min-height: 56px; box-sizing: border-box; padding: 8px 10px; border-radius: 12px;
    color: var(--ml-text); text-decoration: none; cursor: pointer; -webkit-tap-highlight-color: transparent; user-select: none; }
#trackerMap .ml-panel .ml-row:hover { background: var(--ml-hover); }
#trackerMap .ml-disabled .ml-row { cursor: default; opacity: 0.6; }
#trackerMap .ml-disabled .ml-row:hover { background: transparent; }
#trackerMap .ml-ico { flex: 0 0 auto; display: flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 50%; background: var(--ml-ico); color: var(--ml-ico-text); }
#trackerMap .ml-ico svg { display: block; width: 22px; height: 22px; }
#trackerMap .ml-on .ml-ico { background: var(--ml-accent); color: var(--ml-on-accent); }
#trackerMap .ml-txt { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; background: none; }
#trackerMap .ml-panel .ml-name { font-size: 15px; font-weight: 600; color: var(--ml-text); }
#trackerMap .ml-panel .ml-desc { font-size: 13px; color: var(--ml-muted); }
#trackerMap .ml-panel .ml-noted .ml-desc { color: var(--ml-note); }
/* The switch: a real checkbox (role=switch), visually replaced by the track and knob next to it, still focusable. */
#trackerMap .ml-panel .ml-sw { position: absolute; width: 1px; height: 1px; margin: 0; padding: 0; opacity: 0; pointer-events: none; }
#trackerMap .ml-panel .ml-track { flex: 0 0 auto; position: relative; width: 46px; height: 28px; border-radius: 14px; background: var(--ml-track); transition: background 0.15s; }
#trackerMap .ml-panel .ml-knob { position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--ml-knob); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35); transition: transform 0.15s; }
#trackerMap .ml-panel .ml-sw:checked + .ml-track { background: var(--ml-accent); }
#trackerMap .ml-panel .ml-sw:checked + .ml-track .ml-knob { transform: translateX(18px); }
#trackerMap .ml-panel .ml-sw:focus-visible + .ml-track { outline: 2px solid var(--ml-accent); outline-offset: 3px; }
@media (prefers-reduced-motion: reduce) { #trackerMap .ml-panel .ml-track, #trackerMap .ml-panel .ml-knob { transition: none; } }
/* A feature of another plan: its plan on the right ("Part of Gold"), the whole row a link to the plans. */
#trackerMap .ml-locked .ml-ico { background: var(--ml-lock-bg); color: var(--ml-lock-text); }
#trackerMap .ml-panel .ml-tier { flex: 0 0 auto; padding: 6px 12px; border-radius: 16px; background: var(--ml-lock-bg); color: var(--ml-lock-text); font-size: 13px; font-weight: 700; white-space: nowrap; }
#trackerMap .ml-panel a.ml-row:focus-visible { outline: 2px solid var(--ml-accent); outline-offset: -2px; }

/* A layer's choices, under its row while it is on. */
#trackerMap .ml-sub { padding: 2px 10px 12px 60px; background: none; }
#trackerMap .ml-sheet .ml-sub { padding-left: 10px; }
#trackerMap .ml-seg { display: flex; border: 1.5px solid var(--ml-accent); border-radius: 10px; overflow: hidden; background: none; }
#trackerMap .ml-seg-opt { position: relative; flex: 1 1 0; display: flex; }
#trackerMap .ml-seg-opt + .ml-seg-opt { border-left: 1.5px solid var(--ml-accent); }
#trackerMap .ml-seg-opt input { position: absolute; width: 1px; height: 1px; margin: 0; opacity: 0; pointer-events: none; }
#trackerMap .ml-panel .ml-seg-opt span { flex: 1 1 auto; display: flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 6px; background: var(--ml-seg-bg); color: var(--ml-accent);
    font-size: 14px; font-weight: 600; cursor: pointer; -webkit-tap-highlight-color: transparent; user-select: none; }
#trackerMap .ml-panel .ml-seg-opt input:checked + span { background: var(--ml-accent); color: var(--ml-on-accent); }
#trackerMap .ml-panel .ml-seg-opt input:focus-visible + span { outline: 2px solid var(--ml-accent); outline-offset: -5px; box-shadow: inset 0 0 0 4px var(--ml-seg-bg); }
#trackerMap .ml-panel .ml-help { margin: 6px 0 0; font-size: 12.5px; color: var(--ml-muted); }
#trackerMap .ml-panel .ml-range { display: block; margin-top: 10px; font-size: 14px; color: var(--ml-text); }
#trackerMap .ml-panel .ml-range-top { display: flex; justify-content: space-between; font-weight: 600; color: var(--ml-text); }
#trackerMap .ml-panel .ml-range-top span { color: var(--ml-text); }
#trackerMap .ml-panel .ml-range-top .ml-range-val { font-weight: 400; color: var(--ml-muted); }
#trackerMap .ml-range input { display: block; width: 100%; height: 36px; margin: 2px 0 0; accent-color: var(--ml-accent); cursor: pointer; }
#trackerMap .ml-panel .ml-src { margin-top: 4px; font-size: 11.5px; color: var(--ml-muted); }

/* The special use airspace color key (sua-status.js keyHtml), folded under its row. */
#trackerMap .ml-key summary { display: flex; align-items: center; min-height: 44px; color: var(--ml-accent); font-size: 14px; font-weight: 600; cursor: pointer; }
#trackerMap .ml-panel .ml-key .sua-key-line { display: flex; gap: 8px; align-items: flex-start; margin: 4px 0; font-size: 13px; line-height: 1.35; color: var(--ml-key); }
