/* ==========================================================================
   StormView — global styles
   Tailwind handles the bulk of styling; this file holds a few primitives that
   are awkward to express as utility classes (scrollbars, video object-fit,
   skeleton shimmer, Mapbox GL theming).
   ========================================================================== */

:root {
  color-scheme: light dark;
}

html {
  scroll-behavior: smooth;
  scrollbar-gutter: stable;
  overflow-x: clip;
}

body {
  overflow-x: clip;
}

/* --- Skeleton shimmer for loading states ------------------------------- */
.skeleton {
  position: relative;
  overflow: hidden;
  background: rgba(148, 163, 184, 0.18);
}
.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(
    90deg,
    transparent,
    rgba(148, 163, 184, 0.25),
    transparent
  );
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer {
  100% {
    transform: translateX(100%);
  }
}

/* --- Video fills its card -------------------------------------------------- */
.camera-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #0b1120;
}

/* --- Camera cards ---------------------------------------------------------- */
.camera-card__viewer {
  isolation: isolate;
}

.camera-card__viewer--inactive {
  background: linear-gradient(165deg, #0f172a 0%, #020617 100%);
}

.camera-video--hidden {
  opacity: 0;
  pointer-events: none;
  /* Keep visibility so the media pipeline can buffer/decode while connecting. */
}

/* --- Stream state overlays (connecting / offline) ------------------------ */
.camera-state-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: linear-gradient(
    165deg,
    rgb(15 23 42 / 0.96) 0%,
    rgb(2 6 23 / 0.98) 100%
  );
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  text-align: center;
  transition: opacity 300ms ease;
}

.camera-state-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.625rem;
  max-width: 16rem;
}

.camera-state-panel__spinner {
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 9999px;
  background: rgb(255 255 255 / 0.05);
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.08);
}

.camera-state-panel__icon {
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 9999px;
  background: rgb(244 63 94 / 0.12);
  box-shadow: inset 0 0 0 1px rgb(244 63 94 / 0.22);
}

.camera-state-panel__title {
  margin: 0;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: rgb(248 250 252);
}

.camera-state-panel__subtitle {
  margin: 0;
  font-size: 0.6875rem;
  line-height: 1.45;
  color: rgb(148 163 184);
}

.camera-state-panel__retry {
  pointer-events: auto;
  margin-top: 0.375rem;
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  border-radius: 0.5rem;
  padding: 0.375rem 0.75rem;
  font-size: 0.6875rem;
  font-weight: 600;
  color: rgb(248 250 252);
  background: rgb(255 255 255 / 0.08);
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.12);
  transition: background 150ms ease;
}

.camera-state-panel__retry:hover {
  background: rgb(255 255 255 / 0.14);
}

.camera-state-spinner {
  width: 1.375rem;
  height: 1.375rem;
  border-radius: 9999px;
  border: 2px solid rgb(255 255 255 / 0.2);
  border-top-color: rgb(251 191 36);
  animation: camera-state-spin 0.75s linear infinite;
}

@keyframes camera-state-spin {
  to {
    transform: rotate(360deg);
  }
}

.camera-thumb-stack {
  position: absolute;
  inset: 0;
  overflow: hidden;
  isolation: isolate;
}

.camera-img {
  color: transparent;
  font-size: 0;
  text-indent: 100%;
  overflow: hidden;
}

.camera-thumb-layer {
  position: absolute;
  inset: 0;
  height: 100%;
  width: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 450ms ease-in-out;
  will-change: opacity;
}

.camera-thumb-layer--visible {
  opacity: 1;
  z-index: 1;
}

.camera-thumb-layer--top {
  z-index: 2;
}

.camera-card__body {
  min-height: 0;
}

.camera-card.camera-card--reordering {
  transition: transform 380ms cubic-bezier(0.2, 0.8, 0.2, 1) !important;
  will-change: transform;
  z-index: 2;
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  .camera-card.camera-card--reordering {
    transition: none;
  }
}

/* Camera Card Warning Banner Scroll on Hover */
.alert-text-container {
  overflow: hidden;
  position: relative;
  flex: 1;
  display: flex;
  justify-content: flex-start; /* Avoid centering overflow off-bounds */
  align-items: center;
  padding-left: 4px; /* Ensure a clean safety gap from the Font Awesome icon */
}

.alert-text-container.alert-scroll-needed {
  --alert-edge-fade: 6px;
  -webkit-mask-image: linear-gradient(
    to right,
    transparent 0,
    #000 var(--alert-edge-fade),
    #000 calc(100% - var(--alert-edge-fade)),
    transparent 100%
  );
  mask-image: linear-gradient(
    to right,
    transparent 0,
    #000 var(--alert-edge-fade),
    #000 calc(100% - var(--alert-edge-fade)),
    transparent 100%
  );
}

.alert-scroll-text {
  white-space: nowrap;
  display: inline-block;
  transform: translateX(0);
  width: max-content;
  /* margin auto centers text if it fits, but snaps safely to left if it overflows */
  margin-left: auto;
  margin-right: auto;
}

/* Only animate when text overflows its container */
body.alert-scroll-all .alert-scroll-needed .alert-scroll-text {
  animation: alert-scroll-text-loop 7.5s ease-in-out infinite;
}

body:not(.alert-scroll-all)
  .camera-card:hover
  .alert-scroll-needed
  .alert-scroll-text {
  animation: alert-scroll-text-loop 7.5s ease-in-out infinite;
}

@keyframes alert-scroll-text-loop {
  0% {
    transform: translateX(var(--alert-edge-fade, 6px));
    opacity: 1;
  }
  18% {
    /* Initial pause — inset past the left fade so the start reads crisp */
    transform: translateX(var(--alert-edge-fade, 6px));
    opacity: 1;
  }
  62% {
    /* Smoothly scroll left to reveal extra text */
    transform: translateX(-40%);
    opacity: 1;
  }
  72% {
    /* Pause at the end */
    transform: translateX(-40%);
    opacity: 1;
  }
  80% {
    /* Fade out at the end */
    transform: translateX(-40%);
    opacity: 0;
  }
  85% {
    /* Reset position while invisible */
    transform: translateX(var(--alert-edge-fade, 14px));
    opacity: 0;
  }
  100% {
    /* Fade back in at start */
    transform: translateX(var(--alert-edge-fade, 14px));
    opacity: 1;
  }
}

.camera-logo-overlay {
  transform: translateZ(0);
  object-fit: fill;
}

.camera-logo-guide {
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.08);
}

.camera-logo-resize-handle {
  touch-action: none;
}

.rebroadcast-notice {
  letter-spacing: 0.12em;
  z-index: 25;
}

/* Site-wide viewer announcements (admin-published) */
.announcement-slot.hidden {
  display: none;
}

.announcement-banner {
  border-bottom-width: 1px;
  border-bottom-style: solid;
  padding: 0.5rem 1rem;
  text-align: center;
  font-size: 12px;
  line-height: 1.25rem;
}

.announcement-banner__inner {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.announcement-banner__title {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.announcement-banner--rose {
  border-color: rgb(254 205 211);
  background: rgb(255 241 242 / 0.95);
  color: rgb(76 5 25);
}
.dark .announcement-banner--rose {
  border-color: rgb(136 19 55 / 0.6);
  background: rgb(76 5 25 / 0.42);
  color: rgb(255 228 230);
}
.announcement-banner--rose .announcement-banner__icon {
  color: rgb(225 29 72);
}
.dark .announcement-banner--rose .announcement-banner__icon {
  color: rgb(251 113 133);
}

.announcement-banner--amber {
  border-color: rgb(253 230 138);
  background: rgb(255 251 235 / 0.95);
  color: rgb(69 26 3);
}
.dark .announcement-banner--amber {
  border-color: rgb(146 64 14 / 0.6);
  background: rgb(69 26 3 / 0.42);
  color: rgb(254 243 199);
}
.announcement-banner--amber .announcement-banner__icon {
  color: rgb(217 119 6);
}
.dark .announcement-banner--amber .announcement-banner__icon {
  color: rgb(251 191 36);
}

.announcement-banner--sky {
  border-color: rgb(186 230 253);
  background: rgb(240 249 255 / 0.95);
  color: rgb(12 74 110);
}
.dark .announcement-banner--sky {
  border-color: rgb(3 105 161 / 0.55);
  background: rgb(8 47 73 / 0.42);
  color: rgb(224 242 254);
}
.announcement-banner--sky .announcement-banner__icon {
  color: rgb(2 132 199);
}
.dark .announcement-banner--sky .announcement-banner__icon {
  color: rgb(56 189 248);
}

.announcement-banner--blue {
  border-color: rgb(191 219 254);
  background: rgb(239 246 255 / 0.95);
  color: rgb(30 58 138);
}
.dark .announcement-banner--blue {
  border-color: rgb(29 78 216 / 0.55);
  background: rgb(23 37 84 / 0.42);
  color: rgb(219 234 254);
}
.announcement-banner--blue .announcement-banner__icon {
  color: rgb(37 99 235);
}
.dark .announcement-banner--blue .announcement-banner__icon {
  color: rgb(96 165 250);
}

.announcement-banner--emerald {
  border-color: rgb(167 243 208);
  background: rgb(236 253 245 / 0.95);
  color: rgb(6 78 59);
}
.dark .announcement-banner--emerald {
  border-color: rgb(4 120 87 / 0.55);
  background: rgb(6 46 34 / 0.42);
  color: rgb(209 250 229);
}
.announcement-banner--emerald .announcement-banner__icon {
  color: rgb(5 150 105);
}
.dark .announcement-banner--emerald .announcement-banner__icon {
  color: rgb(52 211 153);
}

.announcement-banner--violet {
  border-color: rgb(221 214 254);
  background: rgb(245 243 255 / 0.95);
  color: rgb(76 29 149);
}
.dark .announcement-banner--violet {
  border-color: rgb(109 40 217 / 0.55);
  background: rgb(46 16 101 / 0.42);
  color: rgb(237 233 254);
}
.announcement-banner--violet .announcement-banner__icon {
  color: rgb(124 58 237);
}
.dark .announcement-banner--violet .announcement-banner__icon {
  color: rgb(167 139 250);
}

.announcement-banner--slate {
  border-color: rgb(203 213 225);
  background: rgb(248 250 252 / 0.95);
  color: rgb(30 41 59);
}
.dark .announcement-banner--slate {
  border-color: rgb(71 85 105 / 0.6);
  background: rgb(15 23 42 / 0.55);
  color: rgb(226 232 240);
}
.announcement-banner--slate .announcement-banner__icon {
  color: rgb(100 116 139);
}
.dark .announcement-banner--slate .announcement-banner__icon {
  color: rgb(148 163 184);
}

/* Cursor-follow zoom — video stage only (not page / chrome) */
.map-radar-toggle--on {
  border-color: rgb(14 165 233 / 0.45);
  background: rgb(14 165 233 / 0.12);
  color: rgb(3 105 161);
}

.dark .map-radar-toggle--on {
  border-color: rgb(56 189 248 / 0.45);
  background: rgb(14 165 233 / 0.2);
  color: rgb(186 230 253);
}

.map-radar-slider {
  width: 6.5rem;
}

/* Radar reflectivity legend (flush above map when radar is on) */
.radar-legend {
  display: none;
  flex-shrink: 0;
  align-items: center;
  gap: 0.65rem 0.85rem;
  border-bottom: 1px solid rgb(226 232 240 / 0.75);
  background: rgb(255 255 255 / 0.72);
  padding: 0.35rem 0.7rem;
  backdrop-filter: blur(14px) saturate(1.15);
  -webkit-backdrop-filter: blur(14px) saturate(1.15);
}

.radar-legend.radar-legend--visible {
  display: flex;
}

.map-shell--radar-on .radar-legend {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}

.dark .radar-legend {
  border-bottom-color: rgb(51 65 85 / 0.65);
  background: rgb(15 23 42 / 0.72);
}

.radar-legend__item {
  display: flex;
  min-width: 0;
  flex: 1 1 0;
  align-items: center;
  gap: 0.35rem;
}

.radar-legend__label {
  flex-shrink: 0;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: rgb(100 116 139);
  white-space: nowrap;
}

.dark .radar-legend__label {
  color: rgb(148 163 184);
}

.radar-legend__bar-wrap {
  position: relative;
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
  border-radius: 9999px;
  box-shadow:
    inset 0 0 0 1px rgb(255 255 255 / 0.18),
    0 0 6px rgb(15 23 42 / 0.06);
}

.dark .radar-legend__bar-wrap {
  box-shadow:
    inset 0 0 0 1px rgb(255 255 255 / 0.08),
    0 0 8px rgb(0 0 0 / 0.22);
}

.radar-legend__bar {
  display: block;
  width: 100%;
  height: 0.42rem;
  border-radius: 9999px;
  transform: scaleY(1.15);
  transform-origin: center;
  opacity: 0.94;
}

.radar-legend__unit {
  flex-shrink: 0;
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: rgb(148 163 184 / 0.9);
}

.video-zoom-stage {
  z-index: 0;
}

.video-zoom-target {
  transform: scale(1);
  transform-origin: 50% 50%;
}

.video-zoom-target--resetting {
  transition: transform 150ms ease-out;
}

.video-zoom-controls {
  pointer-events: auto;
}

.video-zoom-toggle--on {
  border-color: rgb(14 165 233 / 0.45);
  background: rgb(14 165 233 / 0.12);
  color: rgb(3 105 161);
}

.dark .video-zoom-toggle--on {
  border-color: rgb(56 189 248 / 0.45);
  background: rgb(14 165 233 / 0.2);
  color: rgb(186 230 253);
}

.video-zoom-slider {
  --zoom-fill: 0%;
  -webkit-appearance: none;
  appearance: none;
  width: 7rem;
  height: 0.375rem;
  cursor: pointer;
  border-radius: 9999px;
  background: linear-gradient(
    to right,
    rgb(14 165 233) 0%,
    rgb(14 165 233) var(--zoom-fill),
    rgb(226 232 240) var(--zoom-fill),
    rgb(226 232 240) 100%
  );
  outline: none;
}

.dark .video-zoom-slider {
  background: linear-gradient(
    to right,
    rgb(56 189 248) 0%,
    rgb(56 189 248) var(--zoom-fill),
    rgb(51 65 85) var(--zoom-fill),
    rgb(51 65 85) 100%
  );
}

.video-zoom-slider:focus-visible {
  box-shadow: 0 0 0 3px rgb(14 165 233 / 0.28);
}

.video-zoom-slider::-webkit-slider-runnable-track {
  height: 0.375rem;
  border-radius: 9999px;
  background: transparent;
}

.video-zoom-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 0.875rem;
  height: 0.875rem;
  margin-top: -0.25rem;
  border-radius: 9999px;
  border: 2px solid rgb(14 165 233);
  background: #fff;
  box-shadow: 0 1px 2px rgb(15 23 42 / 0.18);
  transition:
    transform 120ms ease,
    box-shadow 120ms ease;
}

.dark .video-zoom-slider::-webkit-slider-thumb {
  border-color: rgb(56 189 248);
  background: rgb(15 23 42);
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.45);
}

.video-zoom-slider:hover::-webkit-slider-thumb,
.video-zoom-slider:active::-webkit-slider-thumb {
  transform: scale(1.08);
  box-shadow: 0 0 0 4px rgb(14 165 233 / 0.18);
}

.video-zoom-slider::-moz-range-track {
  height: 0.375rem;
  border-radius: 9999px;
  background: transparent;
}

.video-zoom-slider::-moz-range-progress {
  height: 0.375rem;
  border-radius: 9999px;
  background: rgb(14 165 233);
}

.dark .video-zoom-slider::-moz-range-progress {
  background: rgb(56 189 248);
}

.video-zoom-slider::-moz-range-thumb {
  width: 0.875rem;
  height: 0.875rem;
  border-radius: 9999px;
  border: 2px solid rgb(14 165 233);
  background: #fff;
  box-shadow: 0 1px 2px rgb(15 23 42 / 0.18);
}

.dark .video-zoom-slider::-moz-range-thumb {
  border-color: rgb(56 189 248);
  background: rgb(15 23 42);
}

.a11y-reduce-motion .video-zoom-slider::-webkit-slider-thumb {
  transition: none;
}

.a11y-reduce-motion .video-zoom-target--resetting {
  transition: none;
}

/* Multi-panel admin viewer */
.multi-panel-viewer__body {
  display: flex;
  flex-direction: column;
}

.multi-panel-grid {
  display: grid;
  gap: 0.75rem;
  width: 100%;
  height: 100%;
  min-height: 0;
}

.multi-panel-grid--1 {
  grid-template-columns: 1fr;
  grid-template-rows: 1fr;
}

.multi-panel-grid--2 {
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr;
}

.multi-panel-grid--3 {
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
}

.multi-panel-grid--3 .multi-panel-slot:nth-child(3) {
  grid-column: 1 / -1;
}

.multi-panel-grid--4 {
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
}

.multi-panel-slot__body {
  min-height: 0;
}

.multi-panel-slot__body .multi-panel-viewer__video {
  aspect-ratio: auto;
  height: 100%;
}

.multi-panel-slot--empty {
  min-height: 12rem;
}

@media (max-width: 768px) {
  .multi-panel-grid--2,
  .multi-panel-grid--3,
  .multi-panel-grid--4 {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
  }

  .multi-panel-grid--3 .multi-panel-slot:nth-child(3) {
    grid-column: auto;
  }

  .multi-panel-slot {
    min-height: 14rem;
  }
}

.camera-modal__viewer:fullscreen {
  width: 100vw;
  height: 100vh;
  max-width: none;
  aspect-ratio: auto;
  border-radius: 0;
}
.camera-modal__viewer:fullscreen .camera-video {
  height: 100%;
}
.camera-modal__viewer:fullscreen .rebroadcast-notice {
  z-index: 30;
}

/* Map alert legend — floating panel */
.map-alert-legend {
  top: 0;
  left: 0;
  pointer-events: auto;
  color: rgb(241 245 249 / 0.95);
  border: 1px solid rgb(148 163 184 / 0.22);
  background: rgb(30 41 59 / 0.38);
  backdrop-filter: blur(14px) saturate(1.1);
  -webkit-backdrop-filter: blur(14px) saturate(1.1);
  box-shadow: 0 8px 24px rgb(15 23 42 / 0.14);
}

.map-alert-legend:not(.map-alert-legend--radar-on) {
  border-top-left-radius: 0.75rem;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0.75rem;
  border-bottom-left-radius: 0;
}

.map-alert-legend.map-alert-legend--radar-on {
  border-top: none;
  border-left: none;
  border-top-left-radius: 0;
  border-top-right-radius: 0;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0.75rem;
}

.map-alert-legend .map-alerts-toggle {
  color: rgb(255 255 255 / 0.9);
}

.alert-legend-swatch {
  box-sizing: border-box;
  display: inline-grid;
  place-items: center;
  width: 0.875rem;
  height: 0.875rem;
  padding: 1px;
  border-radius: 0.2rem;
  border: 1.5px solid #000;
  background: transparent;
}

.alert-legend-swatch__inner {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 0.1rem;
  border: 1.25px solid #fff;
  background: #888;
  box-sizing: border-box;
}

.alert-legend-swatch--emphasis {
  width: 1rem;
  height: 1rem;
  border-width: 2px;
}

.alert-legend-swatch--emphasis .alert-legend-swatch__inner {
  border-width: 1.5px;
}

.status-pulse {
  position: relative;
}
.status-pulse::before {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 9999px;
  background: currentColor;
  opacity: 0.45;
  animation: ping 1.8s cubic-bezier(0, 0, 0.2, 1) infinite;
}
@keyframes ping {
  75%,
  100% {
    transform: scale(2);
    opacity: 0;
  }
}

/* --- Custom scrollbar ----------------------------------------------------- */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.5) transparent;
}
*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
*::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.45);
  border-radius: 9999px;
  border: 2px solid transparent;
  background-clip: content-box;
}
*::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 163, 184, 0.7);
  background-clip: content-box;
}

/* --- Navbar logo ---------------------------------------------------------- */
.nav-logo {
  display: block;
  flex-shrink: 0;
  height: 2rem; /* 32px on mobile */
  width: auto;
  max-width: 5.5rem;
  object-fit: contain;
  transform-origin: center center;
}
@media (min-width: 640px) {
  .nav-logo {
    height: 2.5rem;
    max-width: 11rem;
  }
}

/* Keep search usable beside the logo on narrow viewports */
.nav-top-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  width: 100%;
  max-width: 1800px;
  margin-inline: auto;
  padding: 0.625rem 0.75rem;
}
@media (min-width: 640px) {
  .nav-top-row {
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
  }
}
@media (min-width: 1024px) {
  .nav-top-row {
    padding-left: 2rem;
    padding-right: 2rem;
  }
}

.nav-brand-link {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 0.625rem;
  min-width: 0;
}

.nav-search-wrap {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  margin-left: auto;
}
@media (min-width: 640px) {
  .nav-search-wrap {
    max-width: 20rem;
  }
}

.nav-search-wrap input[type="search"] {
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

@keyframes nav-logo-bounce {
  0%,
  100% {
    transform: scale(1);
  }
  35% {
    transform: scale(0.94);
  }
  65% {
    transform: scale(1.03);
  }
}
.nav-logo--bounce {
  animation: nav-logo-bounce 180ms cubic-bezier(0.34, 1.4, 0.64, 1);
}
.stormview-map,
.mapbox-map {
  font-family: inherit;
  background: #0b1120;
}
.mapbox-map .mapboxgl-canvas {
  outline: none;
}

/* Mapbox GL navigation + attribution — glass panel on-map chrome */
.mapbox-map .mapboxgl-ctrl-top-right {
  top: 0.75rem;
  right: 0.75rem;
}

.mapbox-map .mapboxgl-ctrl.mapboxgl-ctrl-group {
  overflow: hidden;
  border: 1px solid rgb(148 163 184 / 0.22);
  border-radius: 0.75rem;
  background: rgb(30 41 59 / 0.38);
  box-shadow: 0 8px 24px rgb(15 23 42 / 0.14);
  backdrop-filter: blur(14px) saturate(1.1);
  -webkit-backdrop-filter: blur(14px) saturate(1.1);
}

.mapbox-map .mapboxgl-ctrl-group button {
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  color: rgb(255 255 255 / 0.92);
  cursor: pointer;
  transition:
    background 0.15s ease,
    opacity 0.15s ease;
}

.mapbox-map .mapboxgl-ctrl-group button + button {
  border-top: 1px solid rgb(148 163 184 / 0.15);
}

.mapbox-map .mapboxgl-ctrl-group button:hover:not(:disabled) {
  background: rgb(255 255 255 / 0.1);
}

.mapbox-map .mapboxgl-ctrl-group button:active:not(:disabled) {
  background: rgb(255 255 255 / 0.16);
}

.mapbox-map .mapboxgl-ctrl-group button:focus-visible {
  outline: 2px solid rgb(56 189 248 / 0.55);
  outline-offset: -2px;
  z-index: 1;
}

.mapbox-map .mapboxgl-ctrl-group button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.mapbox-map .mapboxgl-ctrl-group button .mapboxgl-ctrl-icon {
  filter: brightness(0) invert(1);
  opacity: 0.92;
}

.mapbox-map .mapboxgl-ctrl-bottom-right {
  right: 0.5rem;
  bottom: 0.5rem;
}

.mapbox-map .mapboxgl-ctrl-attrib {
  max-width: min(18rem, calc(100% - 1rem));
  border: 1px solid rgb(148 163 184 / 0.18);
  border-radius: 0.5rem;
  background: rgb(30 41 59 / 0.55);
  padding: 0.2rem 0.45rem;
  color: rgb(255 255 255 / 0.65);
  font-size: 0.625rem;
  line-height: 1.35;
  backdrop-filter: blur(10px) saturate(1.05);
  -webkit-backdrop-filter: blur(10px) saturate(1.05);
}

.mapbox-map .mapboxgl-ctrl-attrib a {
  color: rgb(186 230 253 / 0.9);
  text-decoration: none;
}

.mapbox-map .mapboxgl-ctrl-attrib a:hover {
  color: rgb(224 242 254);
  text-decoration: underline;
}

.mapbox-map .mapboxgl-ctrl-attrib-button {
  filter: brightness(0) invert(1);
  opacity: 0.7;
}

.mapbox-map .mapboxgl-ctrl-attrib-button:hover {
  opacity: 0.95;
  background-color: rgb(255 255 255 / 0.08);
}

/* --- Custom selects & checkboxes ------------------------------------------ */
.sv-select {
  appearance: none;
  -webkit-appearance: none;
  display: block;
  width: 100%;
  min-height: 2.5rem;
  padding: 0.5rem 2.25rem 0.5rem 0.75rem;
  border: 1px solid rgb(203 213 225);
  border-radius: 0.625rem;
  background-color: rgb(255 255 255);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%2364748b' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.75' d='m6 8 4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.6rem center;
  background-size: 1rem 1rem;
  color: rgb(15 23 42);
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.25;
  cursor: pointer;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    background-color 0.15s ease;
}

.dark .sv-select {
  border-color: rgb(51 65 85);
  background-color: rgb(15 23 42);
  color: rgb(241 245 249);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%2394a3b8' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.75' d='m6 8 4 4 4-4'/%3E%3C/svg%3E");
}

.sv-select:hover:not(:disabled) {
  border-color: rgb(148 163 184);
}

.dark .sv-select:hover:not(:disabled) {
  border-color: rgb(100 116 139);
}

.sv-select:focus-visible {
  outline: none;
  border-color: rgb(59 130 246);
  box-shadow: 0 0 0 3px rgb(59 130 246 / 0.22);
}

.dark .sv-select:focus-visible {
  border-color: rgb(96 165 250);
  box-shadow: 0 0 0 3px rgb(59 130 246 / 0.28);
}

.sv-select:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.sv-select--sm {
  min-height: 2.125rem;
  padding: 0.375rem 2rem 0.375rem 0.625rem;
  font-size: 0.75rem;
  border-radius: 0.5rem;
}

.sv-select--compact {
  width: auto;
  max-width: 10rem;
  min-height: 2rem;
  padding: 0.35rem 1.85rem 0.35rem 0.55rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 0.5rem;
}

.sv-select--on-dark {
  border-color: rgb(51 65 85);
  background-color: rgb(30 41 59);
  color: rgb(226 232 240);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%2394a3b8' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.75' d='m6 8 4 4 4-4'/%3E%3C/svg%3E");
}

.sv-select--on-dark:hover:not(:disabled) {
  border-color: rgb(100 116 139);
  background-color: rgb(51 65 85);
}

.sv-checkbox {
  appearance: none;
  -webkit-appearance: none;
  display: inline-grid;
  place-items: center;
  width: 1.125rem;
  height: 1.125rem;
  margin: 0;
  flex-shrink: 0;
  border: 1.5px solid rgb(148 163 184);
  border-radius: 0.375rem;
  background: rgb(255 255 255);
  cursor: pointer;
  transition:
    border-color 0.15s ease,
    background-color 0.15s ease,
    box-shadow 0.15s ease;
}

.dark .sv-checkbox {
  border-color: rgb(71 85 105);
  background: rgb(15 23 42);
}

.sv-checkbox:hover:not(:disabled) {
  border-color: rgb(100 116 139);
}

.sv-checkbox:focus-visible {
  outline: none;
  border-color: rgb(59 130 246);
  box-shadow: 0 0 0 3px rgb(59 130 246 / 0.22);
}

.dark .sv-checkbox:focus-visible {
  border-color: rgb(96 165 250);
  box-shadow: 0 0 0 3px rgb(59 130 246 / 0.28);
}

.sv-checkbox:checked {
  border-color: rgb(37 99 235);
  background-color: rgb(37 99 235);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='M3.5 8.2 6.4 11l6.1-6.5' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 0.8rem 0.8rem;
}

.dark .sv-checkbox:checked {
  border-color: rgb(59 130 246);
  background-color: rgb(59 130 246);
}

.sv-checkbox:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.sv-check-row {
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
  padding: 0.625rem 0.75rem;
  border: 1px solid rgb(226 232 240);
  border-radius: 0.75rem;
  background: rgb(248 250 252 / 0.85);
  color: rgb(51 65 85);
  font-size: 0.75rem;
  line-height: 1.45;
  cursor: pointer;
  transition:
    border-color 0.15s ease,
    background-color 0.15s ease;
}

.dark .sv-check-row {
  border-color: rgb(51 65 85);
  background: rgb(15 23 42 / 0.45);
  color: rgb(203 213 225);
}

.sv-check-row:hover {
  border-color: rgb(203 213 225);
  background: rgb(241 245 249);
}

.dark .sv-check-row:hover {
  border-color: rgb(71 85 105);
  background: rgb(30 41 59 / 0.65);
}

.sv-check-row .sv-checkbox {
  margin-top: 0.1rem;
}

.a11y-larger-targets .sv-checkbox {
  width: 1.375rem;
  height: 1.375rem;
}

.a11y-larger-targets .sv-select {
  min-height: 2.75rem;
}

.a11y-larger-targets .sv-select--sm,
.a11y-larger-targets .sv-select--compact {
  min-height: 2.75rem;
}

/* Camera marker pins */
.cam-marker {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 9999px;
  border: 2px solid #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
  font-size: 13px;
  color: #fff;
  cursor: pointer;
  transition:
    box-shadow 0.15s ease,
    background 0.15s ease,
    opacity 0.15s ease,
    filter 0.15s ease;
}
.cam-marker i {
  line-height: 1;
  font-size: 14px;
}
.cam-marker .fa-solid,
.cam-popup-category .fa-solid,
.cat-chip .fa-solid {
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  display: inline-block;
  font-style: normal;
  -webkit-font-smoothing: antialiased;
}
.cam-marker--offline {
  opacity: 0.55;
  filter: grayscale(1);
  border-color: rgb(255 255 255 / 0.65);
}
.cam-marker--offline:hover {
  opacity: 0.72;
}
.cam-marker:hover {
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.48);
}

.cam-location-marker {
  display: grid;
  place-items: center;
  min-width: 34px;
  height: 34px;
  padding: 0 10px;
  border-radius: 9999px;
  border: 2px solid #fff;
  background: #0f172a;
  color: #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  transition:
    box-shadow 0.15s ease,
    background 0.15s ease;
}
.cam-location-marker:hover {
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
  background: #2563eb;
}

/* Popup animation keyframes — opacity-only to avoid GPU-scale blur/aliasing */
@keyframes popup-entrance {
  0% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}

@keyframes popup-exit {
  0% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

@keyframes tip-entrance {
  0% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}

@keyframes tip-exit {
  0% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

/* Mapbox popup styling */
.mapboxgl-popup {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
.mapboxgl-popup-content {
  padding: 16px;
  border-radius: 16px;
  font-family: inherit;
  background: #ffffff;
  color: #0f172a;
  box-shadow:
    0 10px 25px -5px rgba(0, 0, 0, 0.1),
    0 8px 10px -6px rgba(0, 0, 0, 0.1);
  border: 1px solid #e2e8f0;
  animation: popup-entrance 0.16s ease-out both;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: geometricPrecision;
}
.mapboxgl-popup-content.popup-exit {
  animation: popup-exit 0.12s ease-in both;
}
.dark .mapboxgl-popup-content {
  background: #1e293b;
  color: #f1f5f9;
  border-color: #334155;
  box-shadow:
    0 10px 25px -5px rgba(0, 0, 0, 0.3),
    0 8px 10px -6px rgba(0, 0, 0, 0.3);
}

.mapboxgl-popup-tip {
  animation: tip-entrance 0.22s ease forwards;
}
.mapboxgl-popup-tip.popup-exit {
  animation: tip-exit 0.15s ease forwards;
}

/* Custom styled Close Button to prevent bleeding and provide sleek roundness */
.mapboxgl-popup-content .mapboxgl-popup-close-button {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: none;
  background: #f1f5f9;
  color: #475569;
  font-size: 14px;
  line-height: 1;
  font-weight: 400;
  cursor: pointer;
  transition: all 0.12s ease;
  padding: 0 0 2px 0; /* Center the default '×' character vertically */
  z-index: 10;
}
.mapboxgl-popup-content .mapboxgl-popup-close-button:hover {
  background: #e2e8f0;
  color: #0f172a;
}
.dark .mapboxgl-popup-content .mapboxgl-popup-close-button {
  background: #334155;
  color: #cbd5e1;
}
.dark .mapboxgl-popup-content .mapboxgl-popup-close-button:hover {
  background: #475569;
  color: #f1f5f9;
}

/* Custom styled Tip borders to match light and dark theme background */
.mapboxgl-popup-anchor-top .mapboxgl-popup-tip {
  border-bottom-color: #ffffff;
}
.mapboxgl-popup-anchor-bottom .mapboxgl-popup-tip {
  border-top-color: #ffffff;
}
.mapboxgl-popup-anchor-left .mapboxgl-popup-tip {
  border-right-color: #ffffff;
}
.mapboxgl-popup-anchor-right .mapboxgl-popup-tip {
  border-left-color: #ffffff;
}

.dark .mapboxgl-popup-anchor-top .mapboxgl-popup-tip {
  border-bottom-color: #1e293b;
}
.dark .mapboxgl-popup-anchor-bottom .mapboxgl-popup-tip {
  border-top-color: #1e293b;
}
.dark .mapboxgl-popup-anchor-left .mapboxgl-popup-tip {
  border-right-color: #1e293b;
}
.dark .mapboxgl-popup-anchor-right .mapboxgl-popup-tip {
  border-left-color: #1e293b;
}

/* Alert / camera popups — clip content to rounded corners */
.mapboxgl-popup-content:has(.alert-popup),
.mapboxgl-popup-content:has(.alert-choice-popup) {
  padding: 0;
  overflow: hidden;
  border-radius: 16px;
}
.mapboxgl-popup-content:has(.cam-popup) {
  overflow: hidden;
  border-radius: 16px;
}

/* ── Alert popup layout ─────────────────────────────────────────────────── */
.alert-popup {
  font-family: inherit;
  min-width: 248px;
}
.alert-popup-accent {
  height: 4px;
  width: 100%;
}
.alert-popup-body {
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Header */
.alert-popup-header {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.alert-popup-title {
  font-size: 14px;
  font-weight: 800;
  line-height: 1.3;
  color: #0f172a;
  letter-spacing: -0.01em;
  padding-right: 24px; /* Prevent text clashing with close button */
}
.dark .alert-popup-title {
  color: #f1f5f9;
}
.alert-popup-expires {
  font-size: 11px;
  font-weight: 500;
  color: #64748b;
}
.dark .alert-popup-expires {
  color: #94a3b8;
}

/* Threat rows */
.alert-popup-section {
  display: flex;
  flex-direction: column;
  gap: 0;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #e2e8f0;
}
.dark .alert-popup-section {
  border-color: #334155;
}
.alert-popup-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 10px;
  background: #f8fafc;
}
.dark .alert-popup-row {
  background: #1e293b;
}
.alert-popup-row + .alert-popup-row {
  border-top: 1px solid #e2e8f0;
}
.dark .alert-popup-row + .alert-popup-row {
  border-top-color: #334155;
}
.alert-popup-row-label {
  font-size: 11px;
  font-weight: 500;
  color: #64748b;
  white-space: nowrap;
}
.dark .alert-popup-row-label {
  color: #94a3b8;
}
.alert-popup-row-value {
  font-size: 11px;
  font-weight: 700;
  color: #0f172a;
  text-align: right;
}
.dark .alert-popup-row-value {
  color: #f1f5f9;
}

/* Camera carousel */
.alert-popup-cameras {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid #e2e8f0;
}
.dark .alert-popup-cameras {
  border-top-color: #334155;
}
.alert-popup-cam-nav {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 8px;
}
.alert-popup-cam-set-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #94a3b8;
  line-height: 1.1;
}
.dark .alert-popup-cam-set-title {
  color: #64748b;
}
.alert-popup-cam-name {
  margin-top: 2px;
  font-size: 12px;
  font-weight: 700;
  color: #0f172a;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dark .alert-popup-cam-name {
  color: #f1f5f9;
}
.alert-popup-cam-count {
  font-size: 10px;
  font-weight: 700;
  color: #94a3b8;
  min-width: 28px;
  text-align: center;
}
.alert-popup-nav-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: #f1f5f9;
  color: #475569;
  border: none;
  cursor: pointer;
  transition: background 0.12s;
}
.alert-popup-nav-btn:hover {
  background: #e2e8f0;
}
.dark .alert-popup-nav-btn {
  background: #334155;
  color: #cbd5e1;
}
.dark .alert-popup-nav-btn:hover {
  background: #475569;
}
.alert-popup-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
  border-radius: 8px;
  overflow: hidden;
  background: #020617;
  border: 1px solid #e2e8f0;
}
.dark .alert-popup-thumb {
  border-color: #334155;
}
.alert-popup-play-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 7px 0;
  border-radius: 8px;
  background: #2563eb;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition:
    background 0.12s,
    transform 0.1s;
}
.alert-popup-play-btn:hover {
  background: #1d4ed8;
}
.alert-popup-play-btn:active {
  transform: scale(0.97);
}

.alert-popup-details-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 7px 0;
  border-radius: 8px;
  background: #f1f5f9;
  color: #0f172a;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid #cbd5e1;
  cursor: pointer;
  transition:
    background 0.12s,
    border-color 0.12s,
    transform 0.1s;
}
.alert-popup-details-btn:hover {
  background: #e2e8f0;
  border-color: #94a3b8;
}
.alert-popup-details-btn:active {
  transform: scale(0.97);
}
.dark .alert-popup-details-btn {
  background: #1e293b;
  color: #f1f5f9;
  border-color: #334155;
}
.dark .alert-popup-details-btn:hover {
  background: #334155;
  border-color: #475569;
}

.alert-raw-text {
  margin: 0;
  height: min(62vh, 36rem);
  overflow: auto;
  overscroll-behavior: contain;
  border-radius: 0.75rem;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  padding: 1rem 1.1rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.8rem;
  line-height: 1.55;
  color: #0f172a;
  white-space: pre-wrap;
  word-break: break-word;
  user-select: text;
}

.dark .alert-raw-text {
  border-color: #334155;
  background: #0f172a;
  color: #f1f5f9;
}

/* Multi-alert selection popup */
.alert-choice-popup {
  min-width: 250px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 16px 16px;
}
.alert-choice-popup__title {
  font-size: 13px;
  font-weight: 800;
  color: #0f172a;
  padding-right: 24px;
}
.dark .alert-choice-popup__title {
  color: #f1f5f9;
}
.alert-choice-popup__subtitle {
  font-size: 11px;
  color: #64748b;
}
.dark .alert-choice-popup__subtitle {
  color: #94a3b8;
}
.alert-choice-popup__list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.alert-choice-popup__item {
  width: 100%;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #f8fafc;
  color: #0f172a;
  padding: 8px 10px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  text-align: left;
  transition:
    background 0.14s ease,
    border-color 0.14s ease;
}
.alert-choice-popup__item:hover,
.alert-choice-popup__item:focus-visible {
  background: #eef2ff;
  border-color: #bfdbfe;
}
.dark .alert-choice-popup__item {
  background: #0f172a;
  border-color: #334155;
  color: #f8fafc;
}
.dark .alert-choice-popup__item:hover,
.dark .alert-choice-popup__item:focus-visible {
  background: #172554;
  border-color: #334155;
}
.alert-choice-popup__dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  margin-top: 3px;
  flex-shrink: 0;
  box-shadow: 0 0 0 1px rgb(15 23 42 / 0.12);
}
.alert-choice-popup__meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.alert-choice-popup__name {
  font-size: 12px;
  font-weight: 700;
  line-height: 1.25;
}
.alert-choice-popup__expires {
  font-size: 10px;
  color: #64748b;
}
.dark .alert-choice-popup__expires {
  color: #94a3b8;
}

.alert-popup-camera-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 2px;
}
.alert-popup-camera-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #64748b;
}
.dark .alert-popup-camera-status {
  color: #94a3b8;
}
.alert-popup-camera-status::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 9999px;
  background: currentColor;
  opacity: 0.9;
}
.alert-popup-camera-index {
  font-size: 10px;
  font-weight: 700;
  color: #94a3b8;
}
.dark .alert-popup-camera-index {
  color: #64748b;
}
.cam-popup-title {
  font-weight: 800;
  font-size: 14px;
  line-height: 1.3;
  margin-bottom: 4px;
  color: #0f172a;
  letter-spacing: -0.01em;
  padding-right: 22px; /* Prevent text clashing with close button */
}
.dark .cam-popup-title {
  color: #f1f5f9;
}
.cam-popup-location {
  font-size: 11px;
  font-weight: 500;
  color: #64748b;
  margin-bottom: 8px;
  line-height: 1.4;
}
.dark .cam-popup-location {
  color: #94a3b8;
}
.cam-popup-category {
  font-size: 11px;
  font-weight: 600;
  color: #475569;
  margin-bottom: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.dark .cam-popup-category {
  color: #cbd5e1;
}
.cam-popup-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  margin-bottom: 12px;
  padding: 5px 10px;
  border-radius: 6px;
}
.cam-popup-status--offline {
  background: rgb(244 63 94 / 0.12);
  color: #e11d48;
}
.dark .cam-popup-status--offline {
  background: rgb(244 63 94 / 0.18);
  color: #fb7185;
}
.cam-popup-actions {
  display: flex;
  gap: 8px;
}
.cam-popup-btn {
  cursor: pointer;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 700;
  border: none;
  transition:
    background 0.12s,
    transform 0.1s;
}
.cam-popup-btn:active {
  transform: scale(0.97);
}
.cam-popup-btn-primary {
  flex: 1;
  background: #2563eb;
  color: #fff;
}
.cam-popup-btn-primary:hover {
  background: #1d4ed8;
}
.cam-popup-btn-secondary {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #475569;
}
.cam-popup-btn-secondary:hover {
  background: #e2e8f0;
  color: #0f172a;
}
.dark .cam-popup-btn-secondary {
  background: #334155;
  border-color: #475569;
  color: #cbd5e1;
}
.dark .cam-popup-btn-secondary:hover {
  background: #475569;
  color: #f1f5f9;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

/* Accessibility: stronger focus visibility (always on) */
:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 3px solid rgb(37 99 235 / 0.85);
  outline-offset: 2px;
  box-shadow: 0 0 0 2px rgb(255 255 255 / 0.65);
}
.dark :where(a, button, input, select, textarea, [tabindex]):focus-visible {
  box-shadow: 0 0 0 2px rgb(15 23 42 / 0.95);
}

/* Accessibility: font scaling */
.a11y-font-larger {
  font-size: 17px;
}
.a11y-font-largest {
  font-size: 19px;
}

/* Accessibility: high contrast mode */
.a11y-high-contrast body {
  background: #020617 !important;
  color: #f8fafc !important;
}
.a11y-high-contrast
  :is(
    header,
    section,
    article,
    nav,
    aside,
    [role="dialog"],
    .camera-card,
    .multi-panel-slot,
    .mapboxgl-popup-content,
    .cam-popup,
    .alert-popup
  ) {
  border-color: #94a3b8 !important;
}
.a11y-high-contrast
  :is(
    .text-slate-400,
    .text-slate-500,
    .text-slate-600,
    .dark .text-slate-300,
    .dark .text-slate-400
  ) {
  color: #e2e8f0 !important;
}
.a11y-high-contrast
  :is(.bg-white, .bg-slate-50, .dark .bg-slate-900, .dark .bg-slate-800) {
  background-color: #0f172a !important;
}

/* Accessibility: reduced motion */
.a11y-reduce-motion *,
.a11y-reduce-motion *::before,
.a11y-reduce-motion *::after {
  animation-duration: 0.001ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.001ms !important;
  scroll-behavior: auto !important;
}

/* Accessibility: dyslexia-friendly font option */
.a11y-dyslexia-font body {
  font-family:
    "OpenDyslexic", "Atkinson Hyperlegible", "Verdana", "Arial", sans-serif !important;
}

/* Accessibility: text spacing */
.a11y-text-spacing {
  letter-spacing: 0.02em;
  word-spacing: 0.08em;
  line-height: 1.75;
}
.a11y-text-spacing p,
.a11y-text-spacing li,
.a11y-text-spacing label,
.a11y-text-spacing span,
.a11y-text-spacing div {
  line-height: 1.75 !important;
}

/* Accessibility: larger click targets */
.a11y-larger-targets
  :is(button, [role="button"], a, input, select, textarea, summary) {
  min-height: 44px;
}

/* Mobile dashboard responsiveness */
@media (max-width: 640px) {
  #navbar .announcement-banner__inner {
    flex-wrap: wrap;
    max-width: 100%;
    padding-inline: 0;
  }

  #navbar .announcement-banner {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
    font-size: 11px;
  }

  #view {
    padding-left: 0.75rem !important;
    padding-right: 0.75rem !important;
    padding-top: 0.75rem !important;
    padding-bottom: 4rem !important;
  }

  .camera-card {
    border-radius: 0.875rem;
  }

  .camera-card__body {
    padding: 0.75rem;
    gap: 0.5rem;
  }

  .camera-card__topbar {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
    padding-top: 0.5rem;
  }

  .camera-card__chip {
    min-height: 36px;
  }

  .cam-popup-actions {
    flex-wrap: wrap;
  }

  .cam-popup-btn {
    min-height: 40px;
    width: 100%;
    justify-content: center;
  }

  .alert-popup-play-btn,
  .alert-popup-details-btn,
  .alert-popup-nav-btn {
    min-height: 40px;
  }

  .mapboxgl-popup-content {
    max-width: min(94vw, 330px) !important;
  }
}
