/* ════════════════════════════════════════════════════════════
   geoview-app.css — The rebuilt GeoView interactive mapping app.
   Brand-aligned chrome around a full-screen Leaflet map.

   Uses the shared design tokens from base.css (--accent navy,
   --accent2 green, --cta amber, Inter, light + dark) so the app
   feels continuous with the marketing site. No new colours are
   introduced here — everything keys off the CSS variables.
   ════════════════════════════════════════════════════════════ */

/* ─── App shell (fills the viewport below the 66px sticky nav) ── */
html, body { height: 100%; }
body.gv-body { overflow: hidden; }               /* the map scrolls, not the page */

.gv-app {
  display: flex;
  position: relative;                  /* the sidebar drawer overlays inside this */
  height: calc(100vh - 66px - 50px);   /* sticky nav + app bar */
  background: var(--bg-alt);
}

/* ─── App bar (GeoView v5-style chrome) ───────────────────── */
.gv-appbar {
  display: flex; align-items: center; gap: 12px;
  height: 50px; padding: 0 12px;
  background: var(--card); border-bottom: 1px solid var(--border);
  position: relative; z-index: 430;
}
.gv-bar-btn {
  width: 36px; height: 36px; flex-shrink: 0; border-radius: 9px;
  background: none; border: 1px solid var(--border); cursor: pointer;
  display: flex; align-items: center; justify-content: center; transition: border-color .15s;
}
.gv-bar-btn:hover { border-color: var(--accent); }
.gv-bar-btn svg { width: 17px; height: 17px; stroke: var(--text); fill: none; stroke-width: 2; }

.gv-bar-brand { font-size: 15px; font-weight: 800; letter-spacing: -.3px; color: var(--text); white-space: nowrap; }
.gv-bar-tag {
  font-size: 9.5px; font-weight: 800; letter-spacing: .7px; text-transform: uppercase;
  color: var(--accent); background: var(--accent-light); padding: 3px 8px; border-radius: 12px;
  vertical-align: 2px; margin-left: 4px;
}

.gv-bar-search { flex: 1; max-width: 480px; position: relative; }
.gv-bar-search svg {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 15px; height: 15px; stroke: var(--text-light); fill: none; stroke-width: 2;
}
.gv-bar-search input {
  width: 100%; font-family: inherit; font-size: 13px; color: var(--text);
  background: var(--bg-alt); border: 1.5px solid var(--border); border-radius: 18px;
  padding: 8px 14px 8px 34px; outline: none; transition: all .15s;
}
.gv-bar-search input:focus { border-color: var(--accent); background: var(--card); }

.gv-bar-pills { display: flex; align-items: center; gap: 8px; }
.gv-pill {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: inherit; font-size: 12.5px; font-weight: 700; color: var(--text);
  background: var(--card); border: 1.5px solid var(--border); border-radius: 18px;
  padding: 7px 14px; cursor: pointer; white-space: nowrap; transition: all .15s; text-decoration: none;
}
.gv-pill:hover { border-color: var(--accent); color: var(--accent); }
.gv-pill svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2; }
.gv-pill .gv-bar-chev { width: 12px; height: 12px; }
.gv-pill-accent { color: var(--accent); border-color: var(--accent); }

.gv-bar-drop { position: relative; }
.gv-bar-menu {
  position: absolute; top: calc(100% + 6px); left: 0; min-width: 200px;
  background: var(--card); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: var(--shadow-lg); padding: 6px; display: none; flex-direction: column; z-index: 500;
}
.gv-bar-drop.open .gv-bar-menu { display: flex; }
.gv-bar-menu button {
  font-family: inherit; font-size: 13px; font-weight: 600; color: var(--text);
  background: none; border: none; border-radius: 7px; padding: 9px 12px;
  text-align: left; cursor: pointer;
}
.gv-bar-menu button:hover { background: var(--bg-alt); color: var(--accent); }

.gv-bar-clock {
  margin-left: auto; display: flex; flex-direction: column; align-items: flex-end;
  font-size: 11px; line-height: 1.35; color: var(--text-muted); white-space: nowrap;
}
.gv-bar-clock span:last-child { font-weight: 800; color: var(--text); font-variant-numeric: tabular-nums; }

@media (max-width: 980px) { .gv-bar-pills { display: none; } }
@media (max-width: 640px) { .gv-bar-clock, .gv-bar-tag { display: none; } }

/* ─── Sidebar ─────────────────────────────────────────────── */
/* Overlay drawer (v5-style): hidden by default, slides over the map,
   so the map never needs to resize. */
.gv-sidebar {
  position: absolute; top: 0; left: 0; bottom: 0;
  width: min(326px, 88vw);
  background: var(--card);
  border-right: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform .25s ease;
  z-index: 450;
}
.gv-sidebar.open { transform: translateX(0); }

.gv-sidebar-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 14px 12px 18px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.gv-sidebar-head h2 {
  font-size: 15.5px; font-weight: 800; letter-spacing: -.2px; color: var(--text);
  display: flex; align-items: center; gap: 8px;
}
.gv-sidebar-head h2 svg { width: 17px; height: 17px; stroke: var(--accent); fill: none; stroke-width: 2; }

.gv-sidebar-body { flex: 1; overflow-y: auto; }

/* Collapsible panels inside the sidebar */
.gv-panel { border-bottom: 1px solid var(--border); }
.gv-panel-head {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  padding: 13px 18px; font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .6px; color: var(--text-muted); background: none;
}
.gv-panel-head:hover { color: var(--text); }
.gv-panel-head .gv-chev { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 2.2; transition: transform .2s; }
.gv-panel.open .gv-chev { transform: rotate(180deg); }
.gv-panel-body { display: none; padding: 4px 14px 16px; }
.gv-panel.open .gv-panel-body { display: block; }

/* Layer rows */
.gv-layer {
  display: flex; align-items: center; gap: 10px; padding: 8px 6px; border-radius: 8px;
  font-size: 13.5px; color: var(--text); cursor: pointer;
}
.gv-layer:hover { background: var(--bg-alt); }
.gv-layer-sw { width: 12px; height: 12px; border-radius: 3px; flex-shrink: 0; box-shadow: 0 0 0 1px rgba(0,0,0,.12) inset; }
.gv-layer-name { flex: 1; }
.gv-switch { position: relative; width: 34px; height: 19px; flex-shrink: 0; }
.gv-switch input { opacity: 0; width: 0; height: 0; }
.gv-switch-track { position: absolute; inset: 0; background: var(--border-strong); border-radius: 20px; transition: .18s; }
.gv-switch-track::before { content: ""; position: absolute; left: 2px; top: 2px; width: 15px; height: 15px; background: #fff; border-radius: 50%; transition: .18s; box-shadow: 0 1px 2px rgba(0,0,0,.3); }
.gv-switch input:checked + .gv-switch-track { background: var(--accent2); }
.gv-switch input:checked + .gv-switch-track::before { transform: translateX(15px); }

/* Project list */
.gv-proj {
  display: block; padding: 9px 10px; border-radius: 8px; cursor: pointer;
  border: 1px solid transparent; transition: .14s;
}
.gv-proj:hover { background: var(--bg-alt); border-color: var(--border); }
.gv-proj-top { display: flex; align-items: center; gap: 7px; margin-bottom: 3px; }
.gv-proj-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.gv-proj-cat { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; }
.gv-proj-year { font-size: 10.5px; color: var(--text-light); margin-left: auto; }
.gv-proj-name { font-size: 12.5px; font-weight: 600; color: var(--text); line-height: 1.35; }
.gv-proj-loc { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.gv-proj-search {
  width: 100%; padding: 8px 11px; font: inherit; font-size: 12.5px; margin-bottom: 8px;
  border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--text);
}
.gv-proj-search:focus { outline: none; border-color: var(--accent); }

/* Legend */
.gv-legend-row { display: flex; align-items: center; gap: 9px; padding: 5px 6px; font-size: 12.5px; color: var(--text); }
.gv-legend-dot { width: 11px; height: 11px; border-radius: 50%; flex-shrink: 0; }

/* Base-map radios + helpers */
.gv-radio { display: flex; align-items: center; gap: 9px; padding: 7px 6px; border-radius: 8px; font-size: 13.5px; color: var(--text); cursor: pointer; }
.gv-radio:hover { background: var(--bg-alt); }
.gv-radio input { accent-color: var(--accent); width: 15px; height: 15px; }
.gv-muted { font-size: 12px; color: var(--text-muted); line-height: 1.5; padding: 4px 6px; }
.gv-badge { display: inline-block; min-width: 17px; text-align: center; font-size: 10.5px; font-weight: 700; color: var(--accent); background: var(--accent-light); border-radius: 10px; padding: 1px 6px; margin-left: 4px; }

/* Action rows + small buttons */
.gv-row-actions { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px 4px 2px; }
.gv-btn-sm { padding: 6px 10px !important; font-size: 12px !important; border-radius: 7px !important; }
.gv-ic { width: 13px; height: 13px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.gv-list { margin-top: 6px; display: flex; flex-direction: column; gap: 4px; }
.gv-x { width: 20px; height: 20px; border-radius: 5px; font-size: 16px; line-height: 1; color: var(--text-light); flex-shrink: 0; }
.gv-x:hover { background: var(--accent-light); color: var(--cta); }

/* Coordinate converter output */
.gv-conv-out { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.gv-conv-row { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.gv-conv-fmt { font-weight: 700; color: var(--accent2); min-width: 34px; }
.gv-conv-val { font-variant-numeric: tabular-nums; color: var(--text); word-break: break-all; }
.gv-conv-err { font-size: 12px; color: var(--cta); }

/* Captured coordinate rows */
.gv-coord-row { font-size: 12px; color: var(--text); padding: 3px 6px; font-variant-numeric: tabular-nums; }
.gv-coord-actions { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }

/* Sidebar footer */
.gv-sidebar-foot { padding: 16px 18px; border-top: 1px solid var(--border); }
.gv-sidebar-foot strong { font-size: 12.5px; color: var(--text); }

/* ─── Map area ────────────────────────────────────────────── */
.gv-main { position: relative; flex: 1; min-width: 0; }
#gvMap { position: absolute; inset: 0; background: var(--bg-alt); }

/* Sidebar collapse toggle (floats at top-left of the map) */

/* Floating toolbar (vertical, left edge — v5-style) */
.gv-toolbar {
  position: absolute; top: 14px; left: 14px; z-index: 410;
  display: flex; flex-direction: column; gap: 2px; padding: 5px;
  background: var(--card);
  border: 1px solid var(--border); border-radius: 11px; box-shadow: var(--shadow);
}

/* Results drawer (right side) */
.gv-results {
  position: absolute; top: 14px; right: 14px; z-index: 440;
  width: min(300px, 86vw); max-height: calc(100% - 28px);
  background: var(--card); border: 1.5px solid var(--card-border); border-radius: 12px;
  box-shadow: var(--shadow-lg); display: flex; flex-direction: column;
  transform: translateX(calc(100% + 24px)); transition: transform .25s ease;
}
.gv-results.open { transform: none; }
.gv-results-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 12px 12px 16px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.gv-results-head h3 {
  font-size: 14.5px; font-weight: 800; color: var(--text);
  display: flex; align-items: center; gap: 8px;
}
.gv-results-head h3 svg { width: 16px; height: 16px; stroke: var(--accent); fill: none; stroke-width: 2; }
.gv-results-body { flex: 1; overflow-y: auto; padding: 12px 16px 16px; }
.gv-results-sec { margin-bottom: 18px; }
.gv-results-sec:last-child { margin-bottom: 0; }
.gv-results-sec h4 {
  font-size: 11px; font-weight: 800; letter-spacing: .7px; text-transform: uppercase;
  color: var(--text-light); margin-bottom: 8px;
}

/* Floating analysis pills (right of the toolbar, v5-style) */
.gv-float-pills {
  position: absolute; top: 14px; left: 66px; z-index: 408;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  max-width: calc(100% - 80px);
}
.gv-float-pills .gv-pill { box-shadow: var(--shadow); }
.gv-tool {
  position: relative; width: 38px; height: 38px; border-radius: 8px; background: none;
  display: flex; align-items: center; justify-content: center; color: var(--text-muted);
}
.gv-tool svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.gv-tool:hover { background: var(--bg-alt); color: var(--text); }
.gv-tool.active { background: var(--accent-light); color: var(--accent); }
.gv-tool[data-tip]:hover::after {
  content: attr(data-tip); position: absolute; left: calc(100% + 10px); top: 50%; transform: translateY(-50%);
  background: var(--bg-dark); color: #fff; font-size: 11px; font-weight: 600; white-space: nowrap;
  padding: 5px 9px; border-radius: 6px; pointer-events: none; z-index: 5;
}
.gv-tool-sep { height: 1px; align-self: stretch; background: var(--border); margin: 2px 4px; }

/* Basemap switcher (bottom-right pill that expands) */
.gv-basemaps {
  position: absolute; bottom: 26px; right: 14px; z-index: 410;
  display: flex; gap: 6px; padding: 6px; background: var(--card);
  border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow);
}
.gv-basemap {
  width: 52px; height: 44px; border-radius: 8px; overflow: hidden; position: relative;
  border: 2px solid transparent; background-size: cover; background-position: center;
  font-size: 0;
}
.gv-basemap.active { border-color: var(--accent); }
.gv-basemap span {
  position: absolute; bottom: 0; left: 0; right: 0; font-size: 9px; font-weight: 700;
  color: #fff; background: rgba(0,0,0,.55); padding: 2px; text-align: center; letter-spacing: .3px;
}

/* Coordinate readout (bottom-centre, v5-style) */
.gv-coords {
  position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%); z-index: 410;
  display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600;
  font-variant-numeric: tabular-nums; color: var(--text); background: var(--card);
  border: 1px solid var(--border); border-radius: 9px; padding: 7px 11px; box-shadow: var(--shadow);
}
.gv-coords svg { width: 14px; height: 14px; stroke: var(--accent); fill: none; stroke-width: 2; }
.gv-coords-copy { color: var(--text-light); }
.gv-coords:hover .gv-coords-copy { color: var(--accent); }

/* Toast */
.gv-toast {
  position: absolute; bottom: 80px; left: 50%; transform: translateX(-50%) translateY(20px);
  z-index: 500; background: var(--bg-dark); color: #fff; font-size: 13px; font-weight: 600;
  padding: 10px 18px; border-radius: 10px; box-shadow: var(--shadow-lg);
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; max-width: 80%;
}
.gv-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ─── GeoAI assistant ─────────────────────────────────────── */
.gv-ai-fab {
  position: absolute; bottom: 84px; right: 14px; z-index: 420;
  display: inline-flex; align-items: center; gap: 9px; height: 48px; padding: 0 18px 0 14px;
  border-radius: 26px; background: var(--accent); color: #fff; font-size: 14px; font-weight: 700;
  box-shadow: 0 4px 18px rgba(1,42,107,.4);
}
.gv-ai-fab:hover { background: var(--accent-hover); transform: translateY(-1px); }
.gv-ai-fab svg { width: 19px; height: 19px; stroke: currentColor; fill: none; stroke-width: 2; }
.gv-ai-fab .gv-ai-pulse {
  width: 8px; height: 8px; border-radius: 50%; background: var(--accent2);
  box-shadow: 0 0 0 0 rgba(31,139,87,.6); animation: gvPulse 2s infinite;
}
@keyframes gvPulse { 0%{box-shadow:0 0 0 0 rgba(31,139,87,.6)} 70%{box-shadow:0 0 0 8px rgba(31,139,87,0)} 100%{box-shadow:0 0 0 0 rgba(31,139,87,0)} }
@media (prefers-reduced-motion: reduce){ .gv-ai-fab .gv-ai-pulse{ animation: none } }

.gv-ai-panel {
  position: absolute; bottom: 84px; right: 14px; z-index: 430; width: 370px; max-width: calc(100% - 28px);
  height: 520px; max-height: calc(100% - 110px); display: none; flex-direction: column;
  background: var(--card); border: 1px solid var(--border); border-radius: 16px;
  box-shadow: var(--shadow-lg); overflow: hidden;
}
.gv-ai-panel.open { display: flex; }
.gv-ai-head {
  display: flex; align-items: center; gap: 11px; padding: 14px 16px;
  background: var(--bg-dark); color: #fff;
}
.gv-ai-head .gv-ai-avatar {
  width: 34px; height: 34px; border-radius: 9px; background: linear-gradient(135deg,var(--accent),var(--accent2));
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.gv-ai-head .gv-ai-avatar svg { width: 19px; height: 19px; stroke: #fff; fill: none; stroke-width: 2; }
.gv-ai-head h3 { font-size: 14.5px; font-weight: 800; }
.gv-ai-head p { font-size: 11px; color: rgba(255,255,255,.6); }
.gv-ai-close { margin-left: auto; color: rgba(255,255,255,.7); width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; border-radius: 7px; }
.gv-ai-close:hover { background: rgba(255,255,255,.12); color: #fff; }
.gv-ai-close svg { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 2; }

.gv-ai-log { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.gv-msg { max-width: 84%; font-size: 13px; line-height: 1.55; padding: 10px 13px; border-radius: 13px; }
.gv-msg.bot { align-self: flex-start; background: var(--bg-alt); color: var(--text); border-bottom-left-radius: 4px; }
.gv-msg.user { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 4px; }
.gv-msg.bot strong { color: var(--accent); }

.gv-ai-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 16px 10px; }
.gv-chip {
  font-size: 11.5px; font-weight: 600; color: var(--accent); background: var(--accent-light);
  border: 1px solid transparent; padding: 6px 11px; border-radius: 16px;
}
.gv-chip:hover { border-color: var(--accent); }

.gv-ai-input { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--border); }
.gv-ai-input input {
  flex: 1; font: inherit; font-size: 13px; padding: 10px 13px; border: 1px solid var(--border);
  border-radius: 10px; background: var(--bg); color: var(--text);
}
.gv-ai-input input:focus { outline: none; border-color: var(--accent); }
.gv-ai-send { width: 40px; height: 40px; border-radius: 10px; background: var(--accent); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.gv-ai-send:hover { background: var(--accent-hover); }
.gv-ai-send svg { width: 18px; height: 18px; stroke: #fff; fill: none; stroke-width: 2; }

/* ─── Leaflet overrides to match the brand ────────────────── */
.leaflet-container { font-family: 'Inter', system-ui, sans-serif; background: var(--bg-alt); }
.leaflet-popup-content-wrapper { border-radius: 12px; box-shadow: var(--shadow-lg); padding: 2px; }
.leaflet-popup-content { margin: 12px 14px; font-size: 13px; }
.gv-popup strong { display: block; font-size: 13.5px; color: var(--text); margin-bottom: 4px; }
.gv-popup .gv-popup-loc { display: block; font-size: 12px; color: var(--text-muted); }
.gv-popup .gv-popup-meta { display: block; font-size: 11px; color: var(--text-light); margin-top: 5px; text-transform: uppercase; letter-spacing: .4px; font-weight: 700; }
.leaflet-bar a, .leaflet-touch .leaflet-bar a { color: var(--text); background: var(--card); border-color: var(--border) !important; }
.leaflet-bar a:hover { background: var(--bg-alt); }

/* ─── Responsive ──────────────────────────────────────────── */
@media (max-width: 820px) {
  .gv-sidebar { position: absolute; inset: 0 auto 0 0; box-shadow: var(--shadow-lg); }
  .gv-sidebar.collapsed { margin-left: -340px; }
  .gv-float-pills { left: 62px; right: 10px; }
  .gv-ai-panel { width: calc(100% - 20px); right: 10px; }
}
