/* ===================================================================
   SHAN SHAN BAO — CAMERA HUB PRO v5.5 (DARK LUXURY AI VISION NVR)
   Inspired by UniFi Protect AI Key, Frigate+, Google Nest Gemini Home Brief
   Desktop Widescreen + iPhone 16 Pro Max Safari/PWA Safe-Area Ready
   =================================================================== */

#viewHa.nvr-theater-active {
  max-width: 100vw !important;
  padding-left: 0.5rem !important;
  padding-right: 0.5rem !important;
}

.nvr-shell {
  background: linear-gradient(145deg, #090D16 0%, #0F172A 55%, #131C31 100%);
  border: 1px solid rgba(212, 163, 115, 0.22);
  border-radius: 1.75rem;
  box-shadow: 0 24px 60px -15px rgba(9, 13, 22, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  color: #F8FAFC;
  position: relative;
}

.nvr-shell.nvr-wall-fullscreen {
  position: fixed !important;
  inset: 0 !important;
  z-index: 60 !important;
  border-radius: 0 !important;
  border: none !important;
  width: 100vw !important;
  height: 100dvh !important;
  overflow-y: auto !important;
  padding-top: max(0.75rem, env(safe-area-inset-top)) !important;
  padding-bottom: max(1rem, env(safe-area-inset-bottom)) !important;
}

.nvr-glass-bar {
  background: rgba(15, 23, 42, 0.78);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(148, 163, 184, 0.14);
}

.nvr-pill-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  padding: 0.42rem 0.75rem;
  border-radius: 0.85rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: #CBD5E1;
  background: rgba(30, 41, 59, 0.75);
  border: 1px solid rgba(148, 163, 184, 0.16);
  transition: all 0.18s ease;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.nvr-pill-btn:hover {
  background: rgba(51, 65, 85, 0.9);
  color: #FFFFFF;
  border-color: rgba(245, 158, 11, 0.38);
}

.nvr-pill-btn:active {
  transform: scale(0.96);
}

.nvr-pill-btn.active {
  background: linear-gradient(135deg, #C58940 0%, #9A6324 100%);
  color: #FFFBEB;
  border-color: rgba(251, 191, 36, 0.55);
  box-shadow: 0 4px 14px rgba(197, 137, 64, 0.32);
}

.nvr-pill-btn.active-cyan {
  background: linear-gradient(135deg, #0891B2 0%, #0E7490 100%);
  color: #ECFEFF;
  border-color: rgba(34, 211, 238, 0.5);
  box-shadow: 0 4px 14px rgba(6, 182, 212, 0.28);
}

/* ===================================================================
   MULTI-LAYOUT CAMERA MATRIX (2x2 Grid, 1+3 Spotlight, 1x1 Focus)
   =================================================================== */

.nvr-camera-matrix {
  display: grid;
  gap: 0.85rem;
  width: 100%;
}

/* Mode 0: Equal Responsive Auto Grid (Chia deu tat ca / Chi Online) */
.nvr-camera-matrix.layout-equal {
  grid-template-columns: 1fr;
}
@media (min-width: 640px) {
  .nvr-camera-matrix.layout-equal {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (min-width: 1024px) {
  .nvr-camera-matrix.layout-equal {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .nvr-camera-matrix.layout-equal[data-visible-count="1"] {
    grid-template-columns: 1fr;
  }
  .nvr-camera-matrix.layout-equal[data-visible-count="2"],
  .nvr-camera-matrix.layout-equal[data-visible-count="3"],
  .nvr-camera-matrix.layout-equal[data-visible-count="4"] {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .nvr-camera-matrix.layout-equal[data-visible-count="5"],
  .nvr-camera-matrix.layout-equal[data-visible-count="6"],
  .nvr-camera-matrix.layout-equal[data-visible-count="7"],
  .nvr-camera-matrix.layout-equal[data-visible-count="8"],
  .nvr-camera-matrix.layout-equal[data-visible-count="9"] {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* Mode 1: 2x2 Balanced Grid */
.nvr-camera-matrix.layout-2x2 {
  grid-template-columns: 1fr;
}
@media (min-width: 768px) {
  .nvr-camera-matrix.layout-2x2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Mode 2: 1+3 UniFi Protect Spotlight */
.nvr-camera-matrix.layout-spotlight {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.nvr-camera-matrix.layout-spotlight .nvr-cam-tile.is-spotlight-hero {
  grid-column: 1 / -1;
  order: -1;
}
@media (min-width: 1024px) {
  .nvr-camera-matrix.layout-spotlight {
    grid-template-columns: 2.35fr 1fr;
    grid-auto-rows: minmax(0, 1fr);
    align-items: stretch;
  }
  .nvr-camera-matrix.layout-spotlight .nvr-cam-tile.is-spotlight-hero {
    grid-column: 1 / 2;
    grid-row: 1 / span 6;
    order: 0;
  }
  .nvr-camera-matrix.layout-spotlight .nvr-cam-tile:not(.is-spotlight-hero) {
    grid-column: 2 / 3;
  }
  .nvr-camera-matrix.layout-spotlight .nvr-cam-tile:not(.is-spotlight-hero) .nvr-tile-footer-extended {
    display: none;
  }
}

/* Mode 3: 1x1 Single Camera Focus */
.nvr-camera-matrix.layout-1x1 {
  grid-template-columns: 1fr;
}
.nvr-camera-matrix.layout-1x1 .nvr-cam-tile:not(.is-focus-active) {
  display: none !important;
}
.nvr-camera-matrix.layout-1x1 .nvr-cam-tile.is-focus-active .nvr-viewport {
  max-height: 75vh;
}

/* Hide offline option (in Online-only mode, hide all offline tiles consistently) */
.nvr-camera-matrix.hide-offline .nvr-cam-tile.is-cam-offline {
  display: none !important;
}

/* ===================================================================
   CAMERA TILE & VIEWPORT
   =================================================================== */

.nvr-cam-tile {
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 1.25rem;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  position: relative;
}

.nvr-cam-tile:hover {
  border-color: rgba(212, 163, 115, 0.42);
}

.nvr-cam-tile.is-spotlight-hero,
.nvr-cam-tile.is-focus-active {
  border-color: rgba(245, 158, 11, 0.55);
  box-shadow: 0 12px 34px -10px rgba(245, 158, 11, 0.18);
}

.nvr-viewport {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #05080F;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

.nvr-viewport.is-zoomed {
  touch-action: none;
  cursor: grab;
}
.nvr-viewport.is-zoomed:active {
  cursor: grabbing;
}

/* Single Camera Fullscreen Override (iOS Safari + Desktop Compatible) */
.nvr-viewport.is-cam-fullscreen {
  position: fixed !important;
  inset: 0 !important;
  z-index: 80 !important;
  width: 100vw !important;
  height: 100dvh !important;
  max-height: none !important;
  aspect-ratio: auto !important;
  border-radius: 0 !important;
  background: #000000 !important;
}

.nvr-transform-stage {
  width: 100%;
  height: 100%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  transform-origin: center center;
  will-change: transform;
  transition: transform 0.08s cubic-bezier(0.16, 1, 0.3, 1);
}

.nvr-poster-img,
.nvr-live-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
}

.nvr-live-video {
  opacity: 0;
  transition: opacity 0.22s ease;
}

.nvr-live-video.is-playing {
  opacity: 1;
}

/* Yoosee 3-Lens (1920x2160) De-Squeezed Single-Lens Modes (0% CPU) */
.nvr-stage-lens-main .nvr-live-video,
.nvr-stage-lens-main .nvr-poster-img {
  object-fit: fill !important;
  inset: auto !important;
  left: 0 !important;
  top: 0 !important;
  width: 100% !important;
  height: 200% !important;
}
.nvr-stage-lens-left .nvr-live-video,
.nvr-stage-lens-left .nvr-poster-img {
  object-fit: fill !important;
  inset: auto !important;
  left: 0 !important;
  top: -100% !important;
  width: 200% !important;
  height: 200% !important;
}
.nvr-stage-lens-right .nvr-live-video,
.nvr-stage-lens-right .nvr-poster-img {
  object-fit: fill !important;
  inset: auto !important;
  left: -100% !important;
  top: -100% !important;
  width: 200% !important;
  height: 200% !important;
}

.nvr-triple-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 4;
  cursor: pointer;
  background: #05080F;
}

.nvr-triple-lens-dock {
  position: absolute;
  left: 0.55rem;
  bottom: 0.5rem;
  z-index: 22;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.22rem;
  border-radius: 0.75rem;
  background: rgba(9, 13, 22, 0.86);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(16, 185, 129, 0.35);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.55);
}

.nvr-viewport.is-cam-fullscreen .nvr-triple-lens-dock {
  bottom: max(4.2rem, calc(env(safe-area-inset-bottom) + 3.6rem));
}

.nvr-triple-pill {
  padding: 0.2rem 0.48rem;
  border-radius: 0.55rem;
  font-size: 0.64rem;
  font-weight: 800;
  color: #CBD5E1;
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.14s ease;
  white-space: nowrap;
}

.nvr-triple-pill:hover {
  color: #FFFFFF;
  background: rgba(255, 255, 255, 0.1);
}

.nvr-triple-pill.is-active {
  color: #052E16;
  background: linear-gradient(135deg, #34D399, #10B981);
  border-color: rgba(167, 243, 208, 0.7);
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.35);
}

/* Image Enhancement Presets */
.nvr-filter-night {
  filter: brightness(1.42) contrast(1.18) saturate(1.12) !important;
}
.nvr-filter-hdr {
  filter: contrast(1.22) brightness(1.06) saturate(1.2) !important;
}
.nvr-filter-mono {
  filter: grayscale(1) contrast(1.32) brightness(1.15) !important;
}

/* ===================================================================
   HUD BADGES, FULLSCREEN EXIT, PTZ OVERLAY & MINIMAP
   =================================================================== */

.nvr-hud-top {
  position: absolute;
  top: 0.6rem;
  left: 0.6rem;
  right: 0.6rem;
  z-index: 20;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  pointer-events: none;
}

.nvr-viewport.is-cam-fullscreen .nvr-hud-top {
  top: max(0.85rem, env(safe-area-inset-top));
  left: max(0.85rem, env(safe-area-inset-left));
  right: max(0.85rem, env(safe-area-inset-right));
}

.nvr-live-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.28rem 0.6rem;
  border-radius: 0.65rem;
  background: rgba(9, 13, 22, 0.76);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: #F8FAFC;
  font-family: 'JetBrains Mono', Consolas, monospace;
}

.nvr-rec-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.28rem 0.6rem;
  border-radius: 9999px;
  background: rgba(220, 38, 38, 0.9);
  border: 1px solid rgba(254, 202, 202, 0.5);
  color: #FFFFFF;
  font-size: 0.66rem;
  font-weight: 900;
  font-family: 'JetBrains Mono', monospace;
  box-shadow: 0 0 16px rgba(239, 68, 68, 0.55);
  animation: nvrRecBlink 1.2s infinite ease-in-out;
}

@keyframes nvrRecBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.65; }
}

.nvr-fs-exit-btn {
  pointer-events: auto;
  display: none;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.95rem;
  border-radius: 9999px;
  background: rgba(225, 29, 72, 0.95);
  color: #FFFFFF;
  font-size: 0.76rem;
  font-weight: 900;
  border: 1.5px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.65);
  cursor: pointer;
}

.nvr-viewport.is-cam-fullscreen .nvr-fs-exit-btn {
  display: inline-flex !important;
}

/* Fullscreen Floating Bottom Dock */
.nvr-fs-bottom-dock {
  display: none;
  position: absolute;
  bottom: max(1.1rem, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 25;
  padding: 0.45rem 0.7rem;
  border-radius: 1.1rem;
  background: rgba(9, 13, 22, 0.84);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.16);
  gap: 0.4rem;
  align-items: center;
  max-width: 94vw;
  overflow-x: auto;
}

.nvr-viewport.is-cam-fullscreen .nvr-fs-bottom-dock {
  display: flex !important;
}

/* Optical 360 PTZ Overlay D-Pad */
.nvr-ptz-overlay {
  position: absolute;
  left: 0.75rem;
  bottom: 0.75rem;
  z-index: 24;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  background: rgba(9, 13, 22, 0.84);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: 1.1rem;
  padding: 0.55rem;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.55);
  touch-action: none;
}

.nvr-ptz-dpad {
  display: grid;
  grid-template-columns: repeat(3, 2.2rem);
  grid-template-rows: repeat(3, 2.2rem);
  gap: 0.22rem;
  align-items: center;
  justify-items: center;
}

.nvr-ptz-btn {
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 0.65rem;
  background: rgba(30, 41, 59, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.24);
  color: #F8FAFC;
  font-size: 0.78rem;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  touch-action: none;
  transition: background 0.14s ease, transform 0.1s ease;
}

.nvr-ptz-btn:hover {
  background: rgba(197, 137, 64, 0.85);
  border-color: #FBBF24;
}

.nvr-ptz-btn:active {
  transform: scale(0.9);
  background: #F59E0B;
  color: #090D16;
}

/* Digital Zoom Minimap Radar */
.nvr-minimap {
  position: absolute;
  right: 0.65rem;
  bottom: 0.65rem;
  z-index: 22;
  width: 92px;
  height: 54px;
  background: rgba(9, 13, 22, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 0.5rem;
  overflow: hidden;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
  cursor: pointer;
}

.nvr-minimap-rect {
  position: absolute;
  border: 1.5px solid #FBBF24;
  background: rgba(245, 158, 11, 0.22);
  border-radius: 2px;
  pointer-events: none;
}

/* Offline Diagnostic Overlay */
.nvr-offline-layer {
  position: absolute;
  inset: 0;
  z-index: 15;
  background: radial-gradient(circle at center, rgba(15, 23, 42, 0.92) 0%, rgba(5, 8, 15, 0.97) 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 1rem;
  gap: 0.45rem;
}

/* Auto-Tour Progress Line */
.nvr-patrol-bar {
  height: 3px;
  background: linear-gradient(90deg, #10B981, #06B6D4, #F59E0B);
  transition: width 0.25s linear;
}

/* Image Tuning Popover */
.nvr-tune-popover {
  position: absolute;
  right: 0.65rem;
  top: 2.6rem;
  z-index: 26;
  width: 215px;
  background: rgba(9, 13, 22, 0.93);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 1rem;
  padding: 0.65rem;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.65);
}

/* Snapshot Flash Effect */
.nvr-shutter-flash {
  position: absolute;
  inset: 0;
  background: #FFFFFF;
  opacity: 0;
  pointer-events: none;
  z-index: 30;
}
.nvr-shutter-flash.flash-now {
  animation: nvrFlashAnim 0.32s ease-out;
}
@keyframes nvrFlashAnim {
  0% { opacity: 0.82; }
  100% { opacity: 0; }
}

/* ===================================================================
   v5.5 AI VISION SUITE: BBOX HUD, MOTION RADAR, COMMAND BAR & SENTRY
   =================================================================== */

/* Prominent AI Trigger Button on Camera Tiles */
.nvr-ai-trigger-btn {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.24) 0%, rgba(6, 182, 212, 0.22) 100%) !important;
  border-color: rgba(251, 191, 36, 0.45) !important;
  color: #FEF3C7 !important;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.16);
}
.nvr-ai-trigger-btn:hover {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.42) 0%, rgba(6, 182, 212, 0.36) 100%) !important;
  border-color: rgba(251, 191, 36, 0.75) !important;
  color: #FFFFFF !important;
}
.nvr-ai-trigger-btn.is-loading {
  opacity: 0.85;
  pointer-events: none;
  animation: nvrAiPulse 1.1s infinite ease-in-out;
}
@keyframes nvrAiPulse {
  0%, 100% { box-shadow: 0 0 8px rgba(245, 158, 11, 0.3); }
  50% { box-shadow: 0 0 18px rgba(34, 211, 238, 0.65); }
}

/* Motion Radar Active Glow on Tile & Badge */
.nvr-cam-tile.has-motion {
  border-color: rgba(34, 211, 238, 0.68) !important;
  box-shadow: 0 0 24px -6px rgba(6, 182, 212, 0.35);
}

.nvr-motion-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.24rem 0.52rem;
  border-radius: 0.6rem;
  background: rgba(8, 145, 178, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(103, 232, 249, 0.55);
  color: #ECFEFF;
  font-size: 0.64rem;
  font-weight: 900;
  font-family: 'JetBrains Mono', Consolas, monospace;
  box-shadow: 0 0 12px rgba(6, 182, 212, 0.45);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.nvr-motion-bars {
  display: inline-flex;
  align-items: flex-end;
  gap: 1.5px;
  height: 9px;
}
.nvr-motion-bars span {
  width: 2px;
  background: #67E8F9;
  border-radius: 1px;
  animation: nvrMotionWave 0.65s infinite ease-in-out alternate;
}
.nvr-motion-bars span:nth-child(1) { height: 4px; animation-delay: 0s; }
.nvr-motion-bars span:nth-child(2) { height: 9px; animation-delay: 0.15s; }
.nvr-motion-bars span:nth-child(3) { height: 6px; animation-delay: 0.3s; }
@keyframes nvrMotionWave {
  0% { transform: scaleY(0.45); }
  100% { transform: scaleY(1); }
}

/* AI Laser Scan Line Overlay (shown during /api/camera/ai/analyze) */
.nvr-ai-scan-line {
  position: absolute;
  inset: 0;
  z-index: 19;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(6, 182, 212, 0.06) 0%, rgba(245, 158, 11, 0.08) 100%);
  overflow: hidden;
}
.nvr-ai-scan-line::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent 0%, #22D3EE 25%, #FBBF24 50%, #22D3EE 75%, transparent 100%);
  box-shadow: 0 0 18px 4px rgba(34, 211, 238, 0.65);
  animation: nvrScanSweep 1.35s infinite ease-in-out;
}
@keyframes nvrScanSweep {
  0% { top: 4%; }
  50% { top: 94%; }
  100% { top: 4%; }
}

/* Bounding-Box SVG Layer */
.nvr-ai-bbox-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 18;
  pointer-events: none;
  overflow: visible;
}

/* Floating AI Insight Card inside Camera Viewport */
.nvr-ai-insight-card {
  position: absolute;
  left: 0.6rem;
  right: 0.6rem;
  bottom: 0.6rem;
  z-index: 23;
  max-width: 460px;
  max-height: 56%;
  overflow-y: auto;
  background: rgba(9, 13, 22, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(251, 191, 36, 0.36);
  border-radius: 1rem;
  padding: 0.65rem 0.78rem;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.68);
  pointer-events: auto;
  color: #F8FAFC;
  font-size: 0.74rem;
}
.nvr-viewport.is-cam-fullscreen .nvr-ai-insight-card {
  bottom: max(4.6rem, calc(env(safe-area-inset-bottom) + 3.8rem));
  left: max(0.85rem, env(safe-area-inset-left));
  max-width: 520px;
}

/* Contextual Zoom OCR Pill inside Viewport */
.nvr-zoom-ocr-pill {
  position: absolute;
  left: 0.65rem;
  bottom: 0.65rem;
  z-index: 22;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.42rem 0.72rem;
  border-radius: 0.75rem;
  background: linear-gradient(135deg, rgba(217, 119, 6, 0.92), rgba(8, 145, 178, 0.92));
  border: 1px solid rgba(253, 230, 138, 0.6);
  color: #FFFFFF;
  font-size: 0.7rem;
  font-weight: 800;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.55);
  cursor: pointer;
  pointer-events: auto;
}
.nvr-zoom-ocr-pill:hover {
  filter: brightness(1.1);
}

/* AI Quick Command Bar (Ask Camera AI + Home Brief) */
.nvr-ai-command-bar {
  background: linear-gradient(145deg, rgba(15, 23, 42, 0.95) 0%, rgba(17, 24, 39, 0.92) 55%, rgba(23, 37, 64, 0.85) 100%);
  border: 1px solid rgba(245, 158, 11, 0.28);
  border-radius: 1.35rem;
  box-shadow: 0 12px 34px -10px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.nvr-ai-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.42rem 0.75rem;
  min-height: 36px;
  border-radius: 9999px;
  background: rgba(30, 41, 59, 0.82);
  border: 1px solid rgba(148, 163, 184, 0.2);
  color: #E2E8F0;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.16s ease;
  white-space: nowrap;
}
.nvr-ai-chip:hover {
  background: rgba(245, 158, 11, 0.2);
  border-color: rgba(251, 191, 36, 0.5);
  color: #FEF3C7;
}
.nvr-ai-chip:active {
  transform: scale(0.97);
}

/* Luxury Toggle Switch (Smart Sentry 24/7) */
.nvr-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 46px;
  height: 26px;
  flex-shrink: 0;
  cursor: pointer;
}
.nvr-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.nvr-switch-track {
  position: absolute;
  inset: 0;
  border-radius: 9999px;
  background: rgba(51, 65, 85, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.3);
  transition: all 0.2s ease;
}
.nvr-switch-track::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 9999px;
  background: #F8FAFC;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  transition: transform 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}
.nvr-switch input:checked + .nvr-switch-track {
  background: linear-gradient(135deg, #10B981 0%, #059669 100%);
  border-color: rgba(52, 211, 153, 0.65);
  box-shadow: 0 0 14px rgba(16, 185, 129, 0.4);
}
.nvr-switch input:checked + .nvr-switch-track::after {
  transform: translateX(20px);
}

/* AI Event Card & Lightbox Modal */
.nvr-ai-event-card {
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 1.15rem;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
  cursor: pointer;
}
.nvr-ai-event-card:hover {
  transform: translateY(-2px);
  border-color: rgba(251, 191, 36, 0.48);
  box-shadow: 0 12px 28px -8px rgba(0, 0, 0, 0.55);
}

.nvr-ai-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(5, 8, 15, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(0.75rem, env(safe-area-inset-top)) 0.75rem max(0.75rem, env(safe-area-inset-bottom));
}

/* Touch-Friendly Mobile Targets (>= 38px on iPhone 16 Pro Max) */
@media (max-width: 640px) {
  .nvr-pill-btn {
    min-height: 38px;
    padding: 0.45rem 0.72rem;
  }
  .nvr-ai-chip {
    min-height: 38px;
  }
  .nvr-ai-insight-card {
    max-height: 62%;
    font-size: 0.72rem;
  }
}
