/* ───────────────────────────────────────────────────────────────────────────
   Live Dashboard — a self-contained animated "live operations monitor" that
   sits inside the Live Dashboards deck card in place of a video. Ticking KPIs,
   a scrolling line chart and pulsing bars sell the "live" feel. Driven by
   js/live-dash.js. Respects prefers-reduced-motion.
   ─────────────────────────────────────────────────────────────────────────── */

.live-dash {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: radial-gradient(130% 150% at 82% -12%, #1b2545 0%, #0b1020 55%, #060912 100%);
  color: #e8edf7;
  font-family: 'Space Grotesk', system-ui, sans-serif;
  padding: clamp(12px, 2.6vw, 26px) clamp(14px, 3vw, 30px);
  display: flex;
  flex-direction: column;
  gap: clamp(8px, 1.5vw, 16px);
  overflow: hidden;
}

/* faint technical grid in the background */
.live-dash::before {
  content: "";
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(120,150,220,.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(120,150,220,.06) 1px, transparent 1px);
  background-size: 34px 34px;
  pointer-events: none;
}

.ld-top { display: flex; align-items: center; justify-content: space-between; position: relative; z-index: 1; }
.ld-title { font-size: clamp(.72rem, 1.5vw, 1rem); font-weight: 600; letter-spacing: .02em; color: #cdd6ea; }
.ld-live { display: inline-flex; align-items: center; gap: 7px; font-size: clamp(.6rem, 1.2vw, .76rem); font-weight: 700; letter-spacing: .14em; color: #4ade80; }
.ld-live i {
  width: 8px; height: 8px; border-radius: 50%; background: #22c55e;
  box-shadow: 0 0 0 0 rgba(34,197,94,.7);
  animation: ld-pulse 1.8s infinite;
}
@keyframes ld-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(34,197,94,.65); }
  70%  { box-shadow: 0 0 0 7px rgba(34,197,94,0); }
  100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); }
}

.ld-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(8px, 1.6vw, 16px); position: relative; z-index: 1; }
.ld-kpi {
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(140,165,225,.14);
  border-radius: 12px;
  padding: clamp(7px, 1.4vw, 13px) clamp(9px, 1.6vw, 15px);
}
.ld-kpi-label { display: block; font-size: clamp(.52rem, 1.05vw, .66rem); text-transform: uppercase; letter-spacing: .1em; color: #8a97b8; }
.ld-kpi-val { display: block; margin-top: 3px; font-size: clamp(1rem, 2.6vw, 1.7rem); font-weight: 700; color: #fff; font-variant-numeric: tabular-nums; line-height: 1.05; }
.ld-kpi-val small { font-size: .5em; font-weight: 600; color: #9fb0d6; margin-left: 2px; }

.ld-chart { position: relative; z-index: 1; flex: 1; min-height: 0; }
.ld-chart svg { width: 100%; height: 100%; display: block; }
.ld-line {
  fill: none; stroke: url(#ld-grad); stroke-width: 2.4;
  stroke-linejoin: round; stroke-linecap: round;
  filter: drop-shadow(0 2px 6px rgba(80,140,255,.5));
}
.ld-area { fill: url(#ld-fill); }

.ld-bars { display: flex; align-items: flex-end; gap: clamp(3px, .8vw, 7px); height: clamp(16px, 4vw, 34px); position: relative; z-index: 1; }
.ld-bars span {
  flex: 1;
  background: linear-gradient(180deg, #5b8cff, #3b63d6);
  border-radius: 3px 3px 0 0;
  height: 30%;
  opacity: .88;
  animation: ld-bar 1.5s ease-in-out infinite;
}
@keyframes ld-bar { 0%, 100% { height: 24%; } 50% { height: 90%; } }

@media (max-width: 640px) {
  .live-dash { aspect-ratio: 4 / 5; justify-content: flex-start; }
}
@media (prefers-reduced-motion: reduce) {
  .ld-live i, .ld-bars span { animation: none !important; }
}
