/* Viking Networks — ReticPro-Grade Read-Only NZ Open-Data GIS Styling */
:root {
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html,
body {
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: #0b1120;
  color: #e2e8f0;
  margin: 0;
  overflow: hidden;
  max-width: 100vw;
  height: 100vh;
  height: 100dvh;
}

.font-mono {
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #0f172a; }
::-webkit-scrollbar-thumb { background: #334155; border-radius: 9999px; }
::-webkit-scrollbar-thumb:hover { background: #475569; }

.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

/* Left CAD-Style Compact Tool Rail (matching ReticPro) */
.vn-rail-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 6px 3px;
  border-radius: 9px;
  font-size: 9.5px;
  font-weight: 700;
  line-height: 1.1;
  transition: background-color 0.14s ease, color 0.14s ease;
  cursor: pointer;
}

/* Mobile-Friendly Compact Overrides (< 640px) */
@media (max-width: 639px) {
  .vn-rail-btn {
    padding: 4px 2px;
    gap: 1px;
    font-size: 8.5px;
    border-radius: 7px;
  }
  .vn-rail-btn svg {
    width: 14px;
    height: 14px;
  }
  .leaflet-bottom.leaflet-left .leaflet-control-zoom {
    margin-bottom: 24px !important;
    margin-left: 8px !important;
  }
  .leaflet-control-zoom a {
    width: 28px !important;
    height: 28px !important;
    line-height: 26px !important;
    font-size: 16px !important;
  }
  .leaflet-control-attribution {
    font-size: 8.5px !important;
    padding: 1px 5px !important;
    max-width: 100vw;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .leaflet-popup-content {
    margin: 10px 12px !important;
    max-width: calc(100vw - 56px) !important;
  }
}

/* Compact Zoom-Aware Glass Pipe Badges (ReticPro Flagship Style) */
.vn-pipe-label-marker {
  background: transparent !important;
  border: none !important;
  pointer-events: none !important;
  overflow: visible !important;
}

.vn-pipe-pill {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  width: max-content;
  white-space: nowrap;
  transform: translate(-50%, -50%);
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.94), rgba(6, 11, 24, 0.95));
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(148, 163, 184, 0.38);
  border-radius: 7px;
  padding: 2.5px 7px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  font-weight: 700;
  line-height: 1.25;
  color: #f8fafc;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.72), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  pointer-events: none;
}

.vn-pipe-pill-top {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  letter-spacing: -0.01em;
}

.vn-pipe-pill-sub {
  font-size: 8.2px;
  font-weight: 700;
  letter-spacing: 0.01em;
  opacity: 0.95;
}

/* Halo & Concentric Glow Nodes (ReticPro Flagship Style) */
.vn-node-ring {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 800;
  border-radius: 9999px;
  box-shadow: 0 0 0 2px rgba(2, 6, 23, 0.88), 0 3px 10px rgba(0, 0, 0, 0.72);
  transition: transform 0.14s ease, box-shadow 0.14s ease;
}

.vn-node-ring:hover {
  transform: scale(1.22);
}

.vn-halo-amber {
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.38), 0 0 0 7px rgba(245, 158, 11, 0.16), 0 0 16px rgba(245, 158, 11, 0.65), 0 2px 8px rgba(0, 0, 0, 0.8);
}

.vn-halo-sky {
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.38), 0 0 0 7px rgba(56, 189, 248, 0.15), 0 0 16px rgba(56, 189, 248, 0.6), 0 2px 8px rgba(0, 0, 0, 0.8);
}

.vn-halo-rose {
  box-shadow: 0 0 0 3px rgba(244, 63, 94, 0.42), 0 0 0 7px rgba(244, 63, 94, 0.18), 0 0 14px rgba(244, 63, 94, 0.7), 0 2px 8px rgba(0, 0, 0, 0.8);
}

.vn-halo-purple {
  box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.4), 0 0 0 7px rgba(168, 85, 247, 0.16), 0 0 14px rgba(168, 85, 247, 0.6), 0 2px 8px rgba(0, 0, 0, 0.8);
}

/* Animated Flow / Line Direction Chevrons (ReticPro style) */
.vn-flow-arrow-marker {
  background: transparent !important;
  border: none !important;
  pointer-events: none !important;
  overflow: visible !important;
}

.vn-flow-arrow-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.9));
}

@keyframes vnArrowGlide {
  0%, 100% { transform: translateX(-2px) scale(0.95); opacity: 0.8; }
  50%      { transform: translateX(2.4px) scale(1.07); opacity: 1; }
}

.vn-flow-arrow-svg {
  display: block;
  will-change: transform, opacity;
  animation: vnArrowGlide 1.25s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
  .vn-flow-arrow-svg { animation: none !important; }
}

/* Crisp Asset Point Icons (Valves, Hydrants, Pump Stations, Backflows, Reservoirs) */
.vn-asset-icon {
  background: transparent !important;
  border: none !important;
  overflow: visible !important;
}

.vn-asset-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 800;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.72);
  transition: transform 0.12s ease;
}

.vn-asset-badge:hover {
  transform: scale(1.22);
}

/* Dark Leaflet overrides */
.leaflet-container {
  background: #0b1120;
  font-family: 'Inter', system-ui, sans-serif;
}

.leaflet-popup-content-wrapper {
  background: #0f172a;
  color: #e2e8f0;
  border: 1px solid #334155;
  border-radius: 12px;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.58);
}

.leaflet-popup-tip {
  background: #0f172a;
  border: 1px solid #334155;
}

.leaflet-popup-close-button {
  color: #94a3b8 !important;
  padding: 6px 8px !important;
}

.leaflet-popup-close-button:hover {
  color: #ffffff !important;
}

.leaflet-control-zoom a {
  background: #0f172a !important;
  color: #e2e8f0 !important;
  border-color: #334155 !important;
}

.leaflet-control-zoom a:hover {
  background: #1e293b !important;
  color: #38bdf8 !important;
}

.leaflet-control-attribution {
  background: rgba(15, 23, 42, 0.9) !important;
  color: #cbd5e1 !important;
  border-top-left-radius: 8px;
  font-size: 10px !important;
  padding: 2px 8px !important;
}

.leaflet-control-attribution a {
  color: #38bdf8 !important;
}

.linz-hillshade-overlay {
  mix-blend-mode: multiply;
}

/* High-Contrast Sunlight Field Mode */
body.sunlight-mode {
  background: #f8fafc;
  color: #0f172a;
}

body.sunlight-mode header,
body.sunlight-mode aside,
body.sunlight-mode nav,
body.sunlight-mode .vn-surface {
  background: #ffffff !important;
  color: #0f172a !important;
  border-color: #cbd5e1 !important;
}

body.sunlight-mode .vn-card {
  background: #f1f5f9 !important;
  border-color: #cbd5e1 !important;
  color: #0f172a !important;
}

body.sunlight-mode .vn-card .bg-\[\#0b1120\],
body.sunlight-mode .vn-card .bg-slate-900\/80 {
  background: #ffffff !important;
  border-color: #cbd5e1 !important;
  color: #0f172a !important;
}

body.sunlight-mode .vn-card .bg-emerald-950\/70,
body.sunlight-mode .vn-card .bg-emerald-950\/60 {
  background: #ecfdf5 !important;
  border-color: #6ee7b7 !important;
  color: #065f46 !important;
}

body.sunlight-mode .vn-card .text-white:not(a):not(button),
body.sunlight-mode .vn-surface .text-white:not(a):not(button),
body.sunlight-mode .vn-card span.text-white,
body.sunlight-mode .vn-card div.text-white {
  color: #0f172a !important;
}

body.sunlight-mode .vn-card .text-sky-300:not(button),
body.sunlight-mode .vn-card .text-sky-200:not(button),
body.sunlight-mode .vn-surface .text-sky-200 {
  color: #0369a1 !important;
}

body.sunlight-mode .vn-card .text-emerald-300:not(button),
body.sunlight-mode .vn-card .text-emerald-200:not(button) {
  color: #047857 !important;
}

body.sunlight-mode .vn-card .text-orange-300:not(button),
body.sunlight-mode .vn-card .text-orange-200:not(button),
body.sunlight-mode .vn-card .text-amber-300:not(button),
body.sunlight-mode .vn-card .text-amber-200:not(button) {
  color: #b45309 !important;
}

body.sunlight-mode .vn-card .text-rose-400:not(button),
body.sunlight-mode .vn-card .text-rose-300:not(button) {
  color: #be123c !important;
}

body.sunlight-mode .vn-card .text-slate-200:not(button),
body.sunlight-mode .vn-card .text-slate-300:not(button),
body.sunlight-mode .vn-surface .text-slate-300 {
  color: #334155 !important;
}

body.sunlight-mode .vn-card .text-slate-400:not(button),
body.sunlight-mode .vn-muted {
  color: #475569 !important;
}

body.sunlight-mode .vn-title {
  color: #0f172a !important;
}

body.sunlight-mode input[type="text"],
body.sunlight-mode input[type="email"],
body.sunlight-mode input[type="url"],
body.sunlight-mode select {
  background: #ffffff !important;
  color: #0f172a !important;
  border-color: #94a3b8 !important;
}

body.sunlight-mode #vnToolRail button:not(.bg-sky-600),
body.sunlight-mode #vnTopControls button:not(.bg-indigo-600):not(.bg-sky-600) {
  color: #0f172a !important;
  background: #f1f5f9 !important;
  border-color: #cbd5e1 !important;
}

/* Collapsible Sidebar Layer Groups */
details.vn-layer-group > summary {
  list-style: none;
  cursor: pointer;
}
details.vn-layer-group > summary::-webkit-details-marker {
  display: none;
}
details.vn-layer-group > summary .vn-chev {
  display: inline-block;
  transition: transform 0.16s ease;
}
details.vn-layer-group[open] > summary .vn-chev {
  transform: rotate(90deg);
}

/* Clean A4 Print / PDF Output for Site Reconnaissance Brief */
@media print {
  @page { margin: 12mm; }
  html, body {
    height: auto !important;
    overflow: visible !important;
    background: #ffffff !important;
    color: #0f172a !important;
  }
  body > *:not(#vnSiteBriefModal) {
    display: none !important;
  }
  #vnSiteBriefModal {
    position: static !important;
    display: block !important;
    background: #ffffff !important;
    padding: 0 !important;
    inset: auto !important;
  }
  #vnSiteBriefModal > div {
    max-width: 100% !important;
    max-height: none !important;
    border: none !important;
    box-shadow: none !important;
    background: #ffffff !important;
    color: #0f172a !important;
  }
  #vnSiteBriefModal .vn-no-print {
    display: none !important;
  }
  #vnSiteBriefBody, #vnSiteBriefBody * {
    color: #0f172a !important;
    background: transparent !important;
    border-color: #cbd5e1 !important;
  }
}
