/* ═══════════════════════════════════════════════════════════════════════════
   GateApp HUD — dark dashboard theme
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  --hud-bg:          #0f172a;   /* slate-900 */
  --hud-card:        #1e293b;   /* slate-800 */
  --hud-card-hover:  #263449;
  --hud-border:      rgba(255, 255, 255, 0.08);
  --hud-text:        #f1f5f9;
  --hud-muted:       #94a3b8;
  --accent-ok:       #10b981;
  --accent-pv:       #06b6d4;
  --accent-load:     #f59e0b;
  --accent-danger:   #ef4444;
}

body {
  background: var(--hud-bg);
  color: var(--hud-text);
  padding-bottom: 76px;          /* room for mobile bottom nav */
  min-height: 100vh;
}

.card {
  background: var(--hud-card);
  border: 1px solid var(--hud-border);
  border-radius: 14px;
}

.list-group-item {
  background: transparent;
  border-color: var(--hud-border);
  font-size: 0.88rem;
}

/* ── Header bar ─────────────────────────────────────────────────────────── */
.hud-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 4px 10px;
}
.hud-header h1 {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin: 0;
}
.hud-header h1 span { color: var(--accent-pv); }

.gate-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--hud-border);
  font-weight: 700;
  font-size: 0.9rem;
}
.gate-pill .value { font-size: inherit; }
.gate-pill::before {
  content: '';
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--hud-muted);
}
.gate-pill:has(.text-success)::before { background: var(--accent-ok);     box-shadow: 0 0 8px var(--accent-ok); }
.gate-pill:has(.text-danger)::before  { background: var(--accent-danger); }
.gate-pill:has(.text-warning)::before { background: var(--accent-load);   box-shadow: 0 0 8px var(--accent-load); }

/* ── View navigation ────────────────────────────────────────────────────── */
.hud-nav {
  display: flex;
  gap: 4px;
  background: var(--hud-card);
  border: 1px solid var(--hud-border);
  border-radius: 14px;
  padding: 5px;
  margin-bottom: 14px;
}
.hud-nav .nav-link {
  flex: 1;
  text-align: center;
  color: var(--hud-muted);
  border: none;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 9px 4px;
  white-space: nowrap;
}
.hud-nav .nav-link .nav-ico { display: block; font-size: 1.15rem; line-height: 1.2; }
.hud-nav .nav-link.active {
  background: rgba(6, 182, 212, 0.15);
  color: var(--hud-text);
}
.hud-nav .badge { font-size: 0.62rem; vertical-align: top; }

/* Mobile: pin nav to bottom like a native app */
@media (max-width: 767.98px) {
  .hud-nav {
    position: fixed;
    left: 8px; right: 8px; bottom: 8px;
    z-index: 1030;
    margin-bottom: 0;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(8px);
    background: rgba(30, 41, 59, 0.92);
  }
  .hud-nav .nav-link { font-size: 0.68rem; padding: 6px 2px; }
}
@media (min-width: 768px) {
  body { padding-bottom: 20px; }
}

/* ── Gate controls ──────────────────────────────────────────────────────── */
.gate-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.gate-controls .btn {
  padding: 16px 8px;
  font-size: 1rem;
  font-weight: 700;
  border-radius: 12px;
}
.gate-controls .btn-half { grid-column: span 1; }
.gate-controls .btn-full { grid-column: span 2; }
@media (min-width: 768px) {
  .gate-controls { grid-template-columns: repeat(4, 1fr); }
  .gate-controls .btn-full { grid-column: span 1; }
}

/* ── Status cards ───────────────────────────────────────────────────────── */
.card-status { text-align: center; padding: 0.9rem 0.4rem; }
.card-status .value  { font-size: 1.35rem; font-weight: 700; }
.card-status .label  { color: var(--hud-muted); font-size: 0.78rem; }

/* ── Forecast strip ─────────────────────────────────────────────────────── */
#forecast-container {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 6px;
  scrollbar-width: thin;
}
#forecast-container .forecast-card {
  flex: 1 0 110px;
  min-width: 110px;
}
.forecast-card .day    { font-weight: 700; }
.forecast-card .icon i { font-size: 1.7rem; color: var(--accent-pv); }
.forecast-card .temps  { font-weight: 600; font-size: 0.9rem; }
.forecast-card .precip { font-size: 0.82rem; color: var(--accent-pv); }
.forecast-card .precip i { margin-right: 4px; }
.text-critical { color: var(--accent-danger) !important; }

/* ── Cameras ────────────────────────────────────────────────────────────── */
#cameras-container img.card-img-top {
  border-radius: 14px 14px 0 0;
  background: #000;
  min-height: 120px;
}

/* ── Logs ───────────────────────────────────────────────────────────────── */
.log-scroll { max-height: 46vh; overflow-y: auto; }

/* ── Detection cards ────────────────────────────────────────────────────── */
.detection-card {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 10px;
  border-bottom: 1px solid var(--hud-border);
  background: var(--hud-card);
}
.detection-card:last-child { border-bottom: none; }
.detection-card:hover { background: var(--hud-card-hover); }

.detection-thumb {
  width: 120px; min-width: 120px; height: 75px;
  object-fit: cover;
  border-radius: 8px;
  background: #0b1120;
  cursor: pointer;
  transition: opacity 0.15s;
}
.detection-thumb:hover { opacity: 0.85; }
.detection-thumb-placeholder {
  width: 120px; min-width: 120px; height: 75px;
  border-radius: 8px;
  background: #0b1120;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem;
}
.detection-meta { flex: 1; }
.detection-meta .cam-label { font-weight: 600; font-size: 0.95rem; }
.detection-meta .det-time  { font-size: 0.8rem; color: var(--hud-muted); }
.detection-meta .det-score { font-size: 0.82rem; }
.detection-meta .det-plate { font-size: 0.85rem; font-weight: 600; color: var(--accent-pv); }

#detection-gallery {
  border: 1px solid var(--hud-border);
  border-radius: 10px;
  overflow: hidden;
}

/* Vehicle detection pulse badge */
@keyframes pulse-badge {
  0%   { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.7); }
  70%  { box-shadow: 0 0 0 8px rgba(245, 158, 11, 0); }
  100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
}
.btn-vehicle-pulse { animation: pulse-badge 1.2s ease-out 3; }

/* ── Vehicle modal ──────────────────────────────────────────────────────── */
#vehicle-modal .modal-body { padding: 0; max-height: 65vh; overflow-y: auto; }
#vehicle-modal .detection-card { padding: 14px 16px; }

/* ── Lightbox ───────────────────────────────────────────────────────────── */
#lightbox-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.92);
  z-index: 9999;
  align-items: center; justify-content: center;
  flex-direction: column;
}
#lightbox-overlay.active { display: flex; }
#lightbox-img {
  max-width: 90vw; max-height: 82vh;
  border-radius: 8px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
  cursor: zoom-out;
}
#lightbox-counter { color: rgba(255,255,255,0.7); font-size: 0.85rem; margin-top: 10px; letter-spacing: 0.05em; }
.lightbox-nav {
  position: fixed; top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.15);
  border: none; color: #fff;
  font-size: 2rem;
  width: 52px; height: 52px;
  border-radius: 50%;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  z-index: 10000;
  transition: background 0.15s;
  backdrop-filter: blur(4px);
}
.lightbox-nav:hover { background: rgba(255,255,255,0.3); }
#lightbox-prev { left: 16px; }
#lightbox-next { right: 16px; }
.lightbox-nav.hidden { display: none; }

/* ── Settings dropdown ──────────────────────────────────────────────────── */
#settings-dropdown .dropdown-menu {
  background: var(--hud-card);
  border: 1px solid var(--hud-border);
}

/* ── Misc ───────────────────────────────────────────────────────────────── */
#countdown-display { font-size: 0.85rem; }
.text-hud-muted { color: var(--hud-muted) !important; }
