/*
 * GodEye Tactical CCTV Surveillance Monitor & Matrix Styles
 * ALESA Student Pro compliant · Military Operations Room Aesthetics
 * [CHANGE 2026-09-16] what: CCTV surveillance monitor, AI bounding boxes, PTZ controls and multi-cam matrix · why: high-immersion urban perimeter surveillance · verify: monitor modal displays video with overlays
 */

/* ============================================================
   CCTV SURVEILLANCE MONITOR MODAL
   ============================================================ */
.cctv-monitor-modal {
  position: absolute;
  top: 75px;
  right: 25px;
  width: 480px;
  background: rgba(6, 14, 20, 0.92);
  border: 1px solid var(--color-primary);
  border-top: 3px solid var(--color-primary);
  border-radius: 6px;
  padding: 12px;
  backdrop-filter: blur(16px);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.85), 0 0 20px var(--color-primary-glow);
  z-index: 30;
  pointer-events: auto;
  display: none;
  animation: slide-in 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.cctv-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(0, 255, 157, 0.25);
  padding-bottom: 8px;
  margin-bottom: 10px;
}

.cctv-title-box {
  display: flex;
  flex-direction: column;
}

.cctv-live-tag {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  font-weight: bold;
  color: var(--color-alert);
  letter-spacing: 1px;
}

.cctv-live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-alert);
  box-shadow: 0 0 8px var(--color-alert);
  animation: blink 1s infinite;
}

.cctv-cam-name {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 1px;
}

.cctv-close {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  width: 24px;
  height: 24px;
  border-radius: 3px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
}

.cctv-close:hover {
  border-color: var(--color-alert);
  color: var(--color-alert);
}

/* Video Stage */
.cctv-video-stage {
  position: relative;
  width: 100%;
  height: 270px;
  background: #000;
  border: 1px solid rgba(0, 255, 157, 0.3);
  border-radius: 4px;
  overflow: hidden;
}

.cctv-iframe,
.cctv-video-stream {
  width: 100%;
  height: 100%;
  border: none;
  object-fit: cover;
  background: #000;
  pointer-events: auto;
  display: block;
}

/* Tactical HUD overlays inside video stage */
.cctv-hud-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%);
  background-size: 100% 3px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 10px;
  z-index: 5;
}

.cctv-top-telemetry {
  display: flex;
  justify-content: space-between;
  font-size: 9px;
  color: var(--color-primary);
  text-shadow: 0 0 5px #000;
  font-weight: bold;
}

.cctv-bottom-telemetry {
  display: flex;
  justify-content: space-between;
  font-size: 9px;
  color: var(--color-cyan);
  text-shadow: 0 0 5px #000;
}

/* ============================================================
   AI OBJECT DETECTION BOUNDING BOXES OVERLAY
   ============================================================ */
.ai-bounding-box {
  position: absolute;
  border: 1px solid var(--color-primary);
  background: rgba(0, 255, 157, 0.08);
  pointer-events: none;
  transition: all 0.4s ease;
}

.ai-box-tag {
  position: absolute;
  top: -16px;
  left: -1px;
  background: rgba(0, 255, 157, 0.85);
  color: #030608;
  font-size: 8px;
  font-weight: bold;
  padding: 1px 4px;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

/* Box 1: Vehicle */
.ai-box-vehicle {
  top: 45%;
  left: 35%;
  width: 90px;
  height: 60px;
  animation: ai-track-1 6s infinite alternate ease-in-out;
}

/* Box 2: Pedestrian / Human Target */
.ai-box-human {
  top: 60%;
  left: 70%;
  width: 35px;
  height: 65px;
  border-color: var(--color-amber);
  animation: ai-track-2 8s infinite alternate ease-in-out;
}
.ai-box-human .ai-box-tag {
  background: var(--color-amber);
  color: #000;
}

@keyframes ai-track-1 {
  0% { transform: translate(0, 0); }
  50% { transform: translate(25px, 8px) scale(1.05); }
  100% { transform: translate(50px, -5px) scale(0.95); }
}

@keyframes ai-track-2 {
  0% { transform: translate(0, 0); }
  100% { transform: translate(-30px, 10px); }
}

/* ============================================================
   PTZ CONTROLS & CAMERA TOOLS
   ============================================================ */
.cctv-controls-deck {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
  gap: 8px;
}

.ptz-btn-group {
  display: flex;
  gap: 4px;
}

.cctv-ctrl-btn {
  background: rgba(14, 25, 30, 0.8);
  border: 1px solid rgba(0, 255, 157, 0.3);
  border-radius: 3px;
  padding: 6px 10px;
  color: #c9e4db;
  font-family: var(--font-mono);
  font-size: 10px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 4px;
}

.cctv-ctrl-btn:hover {
  background: var(--color-primary);
  color: #030608;
  border-color: var(--color-primary);
  font-weight: bold;
}

/* Video Stage Sensor Filters */
.cctv-video-stage.filter-nvg iframe,
.cctv-video-stage.filter-nvg video {
  filter: sepia(100%) hue-rotate(80deg) saturate(380%) contrast(1.3) brightness(0.95);
}
.cctv-video-stage.filter-flir iframe,
.cctv-video-stage.filter-flir video {
  filter: invert(100%) hue-rotate(180deg) saturate(280%) contrast(1.6);
}
.cctv-video-stage.filter-bw iframe,
.cctv-video-stage.filter-bw video {
  filter: grayscale(100%) contrast(1.4) brightness(0.9);
}


/* ============================================================
   QUAD-VIEW MATRIX MODAL (4-CAM WALL)
   ============================================================ */
.cctv-matrix-modal {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 90vw;
  max-width: 1100px;
  height: 80vh;
  max-height: 700px;
  box-sizing: border-box;
  background: rgba(4, 10, 14, 0.95);
  border: 1px solid var(--color-primary);
  border-top: 4px solid var(--color-primary);
  border-radius: 6px;
  padding: 16px;
  backdrop-filter: blur(20px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.95), 0 0 30px var(--color-primary-glow);
  z-index: 40;
  pointer-events: auto;
  display: none;
  flex-direction: column;
  overflow: hidden;
}

.matrix-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  border-bottom: 1px solid rgba(0, 255, 157, 0.3);
  padding-bottom: 8px;
  flex-shrink: 0;
}

.matrix-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 2px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* [CHANGE 2026-09-21] what: enforce minmax(0, 1fr) and min-height 0 · why: prevent 4-channel live videos overflowing modal boundary · verify: inspect matrix modal in DOM */
.matrix-grid-4 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 12px;
  flex: 1;
  min-height: 0;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}

.matrix-cell {
  position: relative;
  background: #000;
  border: 1px solid rgba(0, 255, 157, 0.25);
  border-radius: 4px;
  overflow: hidden;
  min-height: 0;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.matrix-cell .matrix-feed {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.matrix-cell-label {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(0, 0, 0, 0.8);
  border: 1px solid var(--color-primary);
  color: var(--color-primary);
  font-size: 10px;
  font-weight: bold;
  padding: 2px 6px;
  z-index: 10;
  letter-spacing: 1px;
  pointer-events: none;
}

@media (max-width: 900px) {
  .cctv-monitor-modal {
    width: 320px;
  }
  .cctv-video-stage {
    height: 180px;
  }
}

@media (max-width: 768px) {
  .cctv-matrix-modal {
    width: 95vw;
    height: 85vh;
    max-height: none;
    padding: 10px;
  }
  .matrix-grid-4 {
    grid-template-columns: 1fr;
    grid-template-rows: repeat(4, minmax(0, 1fr));
    gap: 8px;
  }
}
