/* ══════════════════════════════════════════════════
   CAMERAS TAB — Live Traffic Camera Map + Viewer
   ══════════════════════════════════════════════════ */

.cameras-header {
  padding: 12px 0 8px;
}
.cameras-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.cameras-badge {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.12em;
  color: var(--accent);
}
.cameras-count {
  font-family: var(--font-mono);
  font-size: 0.5rem;
  color: var(--muted);
}

.cameras-search-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.cameras-search {
  flex: 1;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 4px;
  padding: 6px 10px;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.2s;
}
.cameras-search:focus {
  border-color: var(--accent);
}
.cameras-search::placeholder {
  color: var(--muted);
}
.cameras-filters {
  display: flex;
  gap: 4px;
}
.cam-filter {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 4px;
  padding: 4px 8px;
  font-family: var(--font-mono);
  font-size: 0.5rem;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s;
}
.cam-filter:hover { border-color: var(--accent); color: var(--text-primary); }
.cam-filter.active {
  background: rgba(6,182,212,0.15);
  border-color: var(--accent);
  color: var(--accent);
}

/* Camera map (takes over main map area) */
.cameras-map {
  width: 100%;
  height: 100%;
}

/* Camera Viewer */
.camera-viewer {
  display: none;
  flex-direction: column;
  background: rgba(6,10,16,0.98);
  border: 1px solid rgba(6,182,212,0.2);
  border-radius: 6px;
  margin: 8px 0;
  overflow: hidden;
  animation: viewerSlide 0.3s ease;
}
@keyframes viewerSlide {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}
.viewer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.viewer-title {
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 600;
  color: #e0e6ef;
}
.viewer-close {
  background: rgba(255,255,255,0.06);
  border: none;
  color: var(--muted);
  width: 24px;
  height: 24px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.7rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.viewer-close:hover { background: rgba(239,68,68,0.2); color: var(--red); }

.viewer-body {
  position: relative;
  background: #000;
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cam-video {
  width: 100%;
  max-height: 360px;
  background: #000;
}
.cam-image {
  width: 100%;
  max-height: 360px;
  object-fit: contain;
  background: #000;
}
.cam-error {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.6rem;
  text-align: center;
  padding: 40px 20px;
}

.viewer-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-top: 1px solid rgba(255,255,255,0.06);
}
.viewer-road {
  font-family: var(--font-mono);
  font-size: 0.55rem;
  color: var(--accent);
}
.viewer-source {
  font-family: var(--font-mono);
  font-size: 0.5rem;
  color: var(--muted);
  text-transform: uppercase;
}

/* Camera List */
.cameras-list {
  max-height: 30vh;
  overflow-y: auto;
}
.cam-list-empty {
  text-align: center;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.55rem;
  padding: 20px;
}
.cam-list-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 6px;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  cursor: pointer;
  transition: background 0.15s;
}
.cam-list-item:hover { background: rgba(6,182,212,0.05); }
.cam-list-item:last-child { border-bottom: none; }

.cam-list-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.cam-list-dot.video { background: #22c55e; box-shadow: 0 0 6px rgba(34,197,94,0.4); }
.cam-list-dot.image { background: var(--accent); }

.cam-list-info { flex: 1; min-width: 0; }
.cam-list-name {
  font-family: var(--font-display);
  font-size: 0.65rem;
  color: #e0e6ef;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cam-list-road {
  font-family: var(--font-mono);
  font-size: 0.5rem;
  color: var(--muted);
}
.cam-list-badge {
  font-family: var(--font-mono);
  font-size: 0.45rem;
  padding: 2px 6px;
  border-radius: 3px;
  flex-shrink: 0;
}
.cam-list-item .cam-list-badge {
  background: rgba(34,197,94,0.1);
  color: #22c55e;
}

/* Maplibre cluster font fallback */
.cameras-map .maplibregl-canvas {
  font-family: var(--font-mono), monospace;
}

/* Mobile — Camera map must get explicit dimensions */
@media (max-width: 900px) {
  .cameras-map {
    width: 100% !important;
    height: 50vh !important;
    min-height: 300px !important;
  }
  .cam-video, .cam-image { max-height: 250px; }
  .cameras-list { max-height: 25vh; }
  .viewer-body { min-height: 150px; }
}
@media (max-width: 480px) {
  .cameras-map {
    height: 40vh !important;
    min-height: 250px !important;
  }
  .cameras-search-row { flex-direction: column; }
  .cameras-filters { width: 100%; justify-content: stretch; }
  .cam-filter { flex: 1; text-align: center; }
  .cam-video, .cam-image { max-height: 200px; }
}
