/* ============================================================
   topdevphone — Maps app styles
   Green→blue identity (#34c759 → #0a84ff).

   The map itself is ONE inline <svg>; the three "layers"
   (Standard / Satellite / Atlas) are pure palette swaps driven by
   the .pal-* class on .np-map — every shape inside the SVG paints
   from a CSS custom property, so switching layers never re-parses
   markup and never touches the network.

   NO raster imagery ships with this resource (copyright — see
   docs/MAP-README.md). `.np-basemap` is the OPTIONAL layer an owner
   can point at their own legally-held map image; it is empty and
   hidden unless Config.Maps.image is set, so the default build makes
   zero image requests.
   ============================================================ */

/* ---------- chrome above the map ---------- */
.np-top { flex: 0 0 auto; padding: 0 14px 8px; }
.np-search {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-tertiary); border-radius: 11px;
  padding: 0 11px; margin-bottom: 10px;
}
.np-search .np-search-ic { color: var(--text-tertiary); font-size: 15px; display: flex; }
.np-search .input { background: none; padding: 10px 0; border-radius: 0; }
.np-layers { margin-bottom: 0; }

/* ---------- viewport ---------- */
.np-map-vp {
  flex: 1; position: relative; overflow: hidden;
  background: var(--bg-primary);
  touch-action: none; cursor: grab;
  border-top: 1px solid var(--separator);
}
.np-map-vp:active { cursor: grabbing; }

.np-map {
  position: absolute; left: 0; top: 0;
  transform-origin: 0 0;
  will-change: transform;
  --pz: 1;
}
.np-map .np-svg { display: block; width: 100%; height: 100%; }

/* ---------- optional owner-supplied raster basemap ----------
   Positioned by the SAME projection as the vector art: the config's
   world extents become a % rect over the viewBox (see maps.js
   applyBaseImage). Never populated unless Config.Maps.image exists. */
.np-basemap {
  position: absolute; z-index: 0; pointer-events: none;
  background-repeat: no-repeat; background-position: center;
  background-size: 100% 100%;
}
.np-map .np-svg { position: relative; z-index: 1; }
/* raster active → hide the vector art but keep it in the DOM (the pin
   layer, labels and the projection are untouched) */
.np-map.has-base .np-art { display: none; }
.np-map.has-base .np-lbl { display: none; }
.np-map.has-base.base-labels .np-lbl { display: block; }

/* ---------- SVG paint (palette-driven) ---------- */
.np-shadow { fill: rgba(0, 0, 0, 0.35); transform: translate(3px, 5px); }
.np-beach { fill: none; stroke: var(--map-sand); stroke-width: 9; stroke-linejoin: round; }
.np-land { fill: url(#npmLand); }

.np-waves { fill: none; stroke: var(--map-wave); stroke-width: 1.6; opacity: 0.5; }
.np-green { fill: var(--map-green); opacity: 0.85; }
.np-desert { fill: var(--map-desert); opacity: 0.9; }
.np-hill { fill: none; stroke: var(--map-hill); stroke-width: 2.4; stroke-linecap: round; opacity: 0.85; }
.np-water { fill: var(--map-inland); }
.np-river { fill: none; stroke: var(--map-inland); stroke-width: 4.5; stroke-linecap: round; stroke-linejoin: round; }
.np-glow { pointer-events: none; }

.np-grid line { stroke: var(--map-road); stroke-width: 1.5; opacity: var(--map-road-a, 0.9); }
.np-blocks path { fill: var(--map-build); opacity: 0.75; }

.np-hwy-case { fill: none; stroke: var(--map-hwy-case); stroke-width: 8.5; stroke-linecap: round; stroke-linejoin: round; }
.np-hwy { fill: none; stroke: var(--map-hwy); stroke-width: 5.2; stroke-linecap: round; stroke-linejoin: round; }

.np-apron { fill: var(--map-apron); }
.np-runway { fill: var(--map-runway); }
.np-taxi { fill: var(--map-runway); opacity: 0.7; }
.np-terminal { fill: var(--map-build); }
.np-pier { fill: var(--map-apron); }
.np-crate { fill: var(--map-build); }

.np-lbl text {
  fill: var(--map-label); font-family: var(--font);
  font-weight: 800; letter-spacing: 2px; text-anchor: middle;
  paint-order: stroke; stroke: var(--map-label-halo); stroke-width: 3.4; stroke-linejoin: round;
}
.np-lbl .np-lbl-xl { font-size: 26px; letter-spacing: 3px; }
.np-lbl .np-lbl-md { font-size: 17px; }
.np-lbl .np-lbl-sm { font-size: 13px; letter-spacing: 1.4px; }
.np-lbl .np-lbl-sea { font-size: 20px; fill: var(--map-label-sea); stroke: none; opacity: 0.75; }
.np-lbl .np-lbl-sea-sm { font-size: 14px; fill: var(--map-label-sea); stroke: none; opacity: 0.85; }

/* ---------- palette: Standard (bright road map) ---------- */
.np-map.pal-standard {
  --map-sea-1: #4aa3d8; --map-sea-2: #2f7fb8; --map-sea-3: #1d5d8f;
  --map-land-1: #ecebe2; --map-land-2: #ddd9c9;
  --map-sand: #f6ebc9; --map-wave: rgba(255, 255, 255, 0.55);
  --map-green: #bcd7a6; --map-desert: #eadfb8; --map-hill: #c6bda2; --map-inland: #5aabd8;
  --map-road: #ffffff; --map-road-a: 0.95; --map-build: #cdc6b3;
  --map-hwy: #ffd166; --map-hwy-case: #e0a83c;
  --map-apron: #c9c3b4; --map-runway: #8f8a7c;
  --map-label: #4c4738; --map-label-halo: rgba(255, 255, 255, 0.85);
  --map-label-sea: #eaf6ff; --map-glow: #ffffff;
}

/* ---------- palette: Satellite (dark aerial) ---------- */
.np-map.pal-satellite {
  --map-sea-1: #0a2438; --map-sea-2: #06182a; --map-sea-3: #030d1a;
  --map-land-1: #3f4a2e; --map-land-2: #2b3220;
  --map-sand: #6d6144; --map-wave: rgba(120, 190, 230, 0.16);
  --map-green: #4d6234; --map-desert: #6b5f3c; --map-hill: #6a6b4a; --map-inland: #12405c;
  --map-road: #b9b6a6; --map-road-a: 0.32; --map-build: #55503f;
  --map-hwy: #d9c98a; --map-hwy-case: #2a2a1e;
  --map-apron: #4b4a42; --map-runway: #9a978a;
  --map-label: #f0efe6; --map-label-halo: rgba(0, 0, 0, 0.55);
  --map-label-sea: #7fb6d8; --map-glow: #ffd9a0;
}

/* ---------- palette: Atlas (parchment / classic) ---------- */
.np-map.pal-atlas {
  --map-sea-1: #9fb9c6; --map-sea-2: #8aa7b6; --map-sea-3: #7595a6;
  --map-land-1: #f3ecd9; --map-land-2: #e8dcc0;
  --map-sand: #f7f1de; --map-wave: rgba(255, 255, 255, 0.4);
  --map-green: #dcdcbb; --map-desert: #ece0bd; --map-hill: #b6a883; --map-inland: #a9c6d4;
  --map-road: #b9ab8c; --map-road-a: 0.65; --map-build: #d8caa6;
  --map-hwy: #d8804f; --map-hwy-case: #a95a33;
  --map-apron: #ddd0ae; --map-runway: #a8977a;
  --map-label: #5d5136; --map-label-halo: rgba(255, 255, 255, 0.75);
  --map-label-sea: #ffffff; --map-glow: #ffffff;
}

/* ---------- pins ---------- */
.np-pins { position: absolute; inset: 0; pointer-events: none; }
.np-pin {
  position: absolute; pointer-events: auto;
  transform: translate(-50%, -100%) scale(var(--pz));
  transform-origin: 50% 100%;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 0; background: none; color: inherit;
}
.np-pin .np-pin-dot {
  width: 26px; height: 26px; border-radius: 50% 50% 50% 4px;
  transform: rotate(45deg);
  background: linear-gradient(140deg, #34c759, #0a84ff);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.45);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 13px;
  border: 1.5px solid rgba(255, 255, 255, 0.85);
}
.np-pin .np-pin-dot .ic { transform: rotate(-45deg); }
.np-pin .np-pin-label {
  font-size: 9.5px; font-weight: 800; letter-spacing: 0.2px; white-space: nowrap;
  color: #fff; background: rgba(16, 16, 20, 0.72);
  padding: 2px 6px; border-radius: 7px; backdrop-filter: blur(6px);
}
.np-pin:active .np-pin-dot { filter: brightness(1.2); }

.np-pin.np-wp .np-pin-dot { background: linear-gradient(140deg, #ff9f43, #ff453a); animation: npWpDrop 0.4s cubic-bezier(0.3, 1.5, 0.5, 1); }
.np-pin.np-wp .np-pin-label { background: rgba(255, 69, 58, 0.9); font-variant-numeric: tabular-nums; }
@keyframes npWpDrop { from { transform: rotate(45deg) translateY(-18px); opacity: 0; } }

/* tap readout marker (single tap = "what coordinate is this?") */
.np-probe {
  position: absolute; pointer-events: none;
  transform: translate(-50%, -50%) scale(var(--pz));
  width: 0; height: 0;
}
.np-probe .np-probe-ring {
  position: absolute; left: -11px; top: -11px; width: 22px; height: 22px;
  border-radius: 50%; border: 2px solid var(--accent-green, #34c759);
  background: rgba(52, 199, 89, 0.18);
  box-shadow: 0 0 0 1.5px rgba(0, 0, 0, 0.35);
  animation: npProbeIn 0.28s ease-out;
}
.np-probe .np-probe-ring::after {
  content: ''; position: absolute; left: 50%; top: 50%;
  width: 4px; height: 4px; margin: -2px 0 0 -2px; border-radius: 50%;
  background: var(--accent-green, #34c759);
}
@keyframes npProbeIn { from { transform: scale(2.2); opacity: 0; } }

/* "You are here" */
.np-me {
  position: absolute; pointer-events: none;
  transform: translate(-50%, -50%) scale(var(--pz));
  display: flex; flex-direction: column; align-items: center;
}
.np-me .np-me-ring {
  position: absolute; left: 50%; top: 50%; width: 40px; height: 40px; margin: -20px 0 0 -20px;
  border-radius: 50%; background: rgba(10, 132, 255, 0.28);
  animation: npPulse 2.2s ease-out infinite;
}
@keyframes npPulse { 0% { transform: scale(0.45); opacity: 0.85; } 100% { transform: scale(1.15); opacity: 0; } }
.np-me .np-me-dot {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--accent-blue); border: 2.5px solid #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
  position: relative;
}
/* heading cone */
.np-me .np-me-dot::after {
  content: ''; position: absolute; left: 50%; top: 50%;
  width: 0; height: 0; margin-left: -7px; margin-top: -20px;
  border-left: 7px solid transparent; border-right: 7px solid transparent;
  border-bottom: 13px solid rgba(10, 132, 255, 0.55);
  transform-origin: 50% 20px; transform: rotate(var(--hd, 0deg));
}
.np-me .np-me-label {
  margin-top: 3px; font-size: 9.5px; font-weight: 800; color: #fff;
  background: rgba(10, 132, 255, 0.9); padding: 1.5px 6px; border-radius: 7px;
}

/* ---------- floating controls ---------- */
.np-map-ctl {
  position: absolute; right: 10px; bottom: 12px; z-index: 4;
  display: flex; flex-direction: column; gap: 1px;
  border-radius: 12px; overflow: hidden;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
}
.np-map-ctl button {
  width: 36px; height: 36px; font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--bg-secondary) 92%, transparent);
  color: var(--text-primary); backdrop-filter: blur(10px);
}
.np-map-ctl button:last-child { color: var(--accent-blue); }
.np-map-ctl button:active { background: var(--bg-tertiary); }

.np-zoom {
  position: absolute; left: 10px; bottom: 12px; z-index: 4;
  font-size: 10.5px; font-weight: 700; color: #fff;
  background: rgba(16, 16, 20, 0.6); backdrop-filter: blur(8px);
  padding: 4px 9px; border-radius: 9px; pointer-events: none;
}

/* ---------- search results overlay ---------- */
.np-results {
  position: absolute; left: 10px; right: 10px; top: 10px; z-index: 6;
  background: color-mix(in srgb, var(--bg-secondary) 95%, transparent);
  backdrop-filter: blur(16px);
  border-radius: var(--radius-card); overflow: hidden;
  max-height: 62%; overflow-y: auto;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}
.np-results::-webkit-scrollbar { width: 0; }
.np-res { display: flex; align-items: center; gap: 10px; padding: 10px 12px; cursor: pointer; }
.np-res + .np-res { border-top: 1px solid var(--separator); }
.np-res:active { background: var(--bg-tertiary); }
.np-res-ic {
  width: 28px; height: 28px; border-radius: 8px; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(140deg, #34c759, #0a84ff); color: #fff; font-size: 14px;
}
.np-res-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.np-res-main b { font-size: 13.5px; font-weight: 600; }
.np-res-main i { font-size: 11px; font-style: normal; color: var(--text-secondary); }
.np-res-co { font-size: 10.5px; color: var(--text-tertiary); flex: 0 0 auto; }
.np-res-empty { padding: 18px; text-align: center; color: var(--text-tertiary); font-size: 12.5px; }

/* ---------- footer readout ---------- */
.np-foot {
  flex: 0 0 auto; display: flex; align-items: center; gap: 10px;
  padding: 10px 14px 22px;
  background: var(--bg-secondary); border-top: 1px solid var(--separator);
}
.np-foot .np-foot-main { flex: 1; min-width: 0; }
.np-foot .np-foot-title {
  font-size: 13px; font-weight: 700; display: flex; align-items: center; gap: 6px;
}
.np-foot .np-foot-title .ic { width: 14px; height: 14px; color: var(--accent-green); }
.np-foot .np-foot-sub { font-size: 11.5px; color: var(--text-secondary); margin-top: 2px; }
.np-foot .np-foot-sub.mono { font-variant-numeric: tabular-nums; }
.np-foot .np-foot-btn {
  flex: 0 0 auto; padding: 7px 14px; border-radius: 10px;
  background: var(--bg-tertiary); color: var(--accent-blue);
  font-size: 12.5px; font-weight: 700;
}
.np-foot .np-foot-btn.primary {
  background: linear-gradient(140deg, #34c759, #0a84ff); color: #fff;
}
.np-foot .np-foot-btn:active { filter: brightness(1.3); }
