/* ============================================================
   Capability cards — mini-dashboard layout
   Each expanded capability card hosts a full mini-dashboard:
   header (title + toggles) → body (main viz + sidebar with KPIs + list).
   All scoped under .products__capability-card-viz so the styles
   only apply to the mounted dashboards (not the collapsed cards).
   ============================================================ */

.products__capability-card-viz .cap-dash {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  font-family: 'Inter', 'Poppins', -apple-system, sans-serif;
  color: rgba(255, 255, 255, 0.92);
  padding: 16px 18px 14px;
  box-sizing: border-box;
  gap: 12px;
  pointer-events: auto;
}

/* ============================================================
   Card preview mode — chart-only, no chrome
   The dashboard inside the card shows only the chart as a live
   preview. Header, sidebar, footers are hidden (they appear
   only in the fullscreen overlay).
   ============================================================ */
.products__capability-card-viz .cap-dash {
  padding: 24px 26px 22px;
}

.products__capability-card-viz .cap-dash__header,
.products__capability-card-viz .cap-dash__sidebar,
.products__capability-card-viz .cap-dash__main-footer {
  display: none;
}

.products__capability-card-viz .cap-dash__body {
  flex: 1;
  min-height: 0;
}

.products__capability-card-viz .cap-dash__main {
  flex: 1;
  background: transparent;
  border: none;
  padding: 0;
}

.products__capability-card-viz .cap-dash__chart {
  width: 100%;
  height: 100%;
}

/* ============================================================
   1. HEADER — title (with live dot) + toggles
   ============================================================ */
.cap-dash__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
}

.cap-dash__title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.cap-dash__live-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 0 2px rgba(74, 222, 128, 0.22);
  animation: capDashLivePulse 2s ease-in-out infinite;
  flex-shrink: 0;
}

.cap-dash__live-dot--warn {
  background: #fbbf24;
  box-shadow: 0 0 0 2px rgba(251, 191, 36, 0.22);
}

@keyframes capDashLivePulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.6; transform: scale(0.85); }
}

.cap-dash__title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.78);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ----- Toggles ----- */
.cap-dash__toggles {
  display: inline-flex;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  padding: 2px;
  gap: 1px;
  flex-shrink: 0;
  /* backdrop-filter removed for perf — bg opacity handles it */
}

.cap-dash__toggle {
  appearance: none;
  background: transparent;
  border: none;
  font-family: inherit;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.62);
  padding: 5px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 200ms ease, color 200ms ease;
  white-space: nowrap;
}

.cap-dash__toggle:hover {
  color: rgba(255, 255, 255, 0.92);
}

.cap-dash__toggle.active {
  background: rgba(255, 255, 255, 0.92);
  color: #1a1a1a;
  font-weight: 600;
}

/* ============================================================
   2. BODY — main viz (left) + sidebar (right)
   ============================================================ */
.cap-dash__body {
  flex: 1;
  display: flex;
  gap: 14px;
  min-height: 0;
}

/* ---- Main column (chart area) ---- */
.cap-dash__main {
  flex: 1 1 62%;
  min-width: 0;
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
}

.cap-dash__chart {
  flex: 1;
  min-height: 0;
  width: 100%;
}

.cap-dash__main-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 9px;
  color: rgba(255, 255, 255, 0.45);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding-top: 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  margin-top: 4px;
  flex-shrink: 0;
}

/* ---- Sidebar (right column) ---- */
.cap-dash__sidebar {
  flex: 0 0 38%;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

/* ---- KPI tiles row ---- */
.cap-dash__kpis {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  flex-shrink: 0;
}

.cap-dash__kpi {
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.cap-dash__kpi-label {
  font-size: 8.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.50);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cap-dash__kpi-value {
  font-size: 16px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.96);
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
}

.cap-dash__kpi-trend {
  font-size: 9px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.55);
  margin-top: 1px;
  white-space: nowrap;
}

.cap-dash__kpi-trend--up   { color: #4ade80; }
.cap-dash__kpi-trend--down { color: #4ade80; }
.cap-dash__kpi-trend--warn { color: #fbbf24; }
.cap-dash__kpi-trend--bad  { color: #f87171; }

/* ---- Side list ---- */
.cap-dash__list {
  flex: 1;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  padding: 10px 12px 8px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.cap-dash__list-title {
  font-size: 8.5px;
  font-weight: 600;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.50);
  margin-bottom: 6px;
  flex-shrink: 0;
}

.cap-dash__list-items {
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
  min-height: 0;
}

.cap-dash__list-items::-webkit-scrollbar { width: 4px; }
.cap-dash__list-items::-webkit-scrollbar-track { background: transparent; }
.cap-dash__list-items::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.15); border-radius: 2px; }

.cap-dash__list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 0;
  font-size: 11px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.cap-dash__list-item:last-child {
  border-bottom: none;
}

.cap-dash__list-item-label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: rgba(255, 255, 255, 0.78);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.cap-dash__list-item-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.4);
  flex-shrink: 0;
}

.cap-dash__list-item-dot--ok { background: #4ade80; }
.cap-dash__list-item-dot--warn { background: #fbbf24; }
.cap-dash__list-item-dot--bad { background: #f87171; }

.cap-dash__list-item-value {
  font-size: 11px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.92);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ============================================================
   OVERLAY — fullscreen dashboard (mounted in cap-expanded-overlay)
   Different context from the in-card preview: full chrome visible,
   generous sizing, no absolute positioning.
   ============================================================ */
.cap-expanded-overlay__content .cap-dash {
  position: relative;
  height: 100%;
  display: flex;
  flex-direction: column;
  font-family: 'Inter', 'Poppins', -apple-system, sans-serif;
  color: rgba(255, 255, 255, 0.92);
  padding: 0;
  box-sizing: border-box;
  gap: 16px;
  pointer-events: auto;
}

.cap-expanded-overlay__content .cap-dash__header {
  display: flex;
}

.cap-expanded-overlay__content .cap-dash__sidebar {
  display: flex;
}

.cap-expanded-overlay__content .cap-dash__main-footer {
  display: flex;
}

.cap-expanded-overlay__content .cap-dash__body {
  flex: 1;
  min-height: 0;
}

.cap-expanded-overlay__content .cap-dash__main {
  flex: 1 1 65%;
}

.cap-expanded-overlay__content .cap-dash__chart {
  min-height: 300px;
}

.cap-expanded-overlay__content .cap-dash__sidebar {
  flex: 0 0 35%;
}

/* ---- Dashboard entry animations (staggered fade-up via JS class) ---- */
@keyframes dashElementReveal {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

.cap-expanded-overlay__content .cap-dash [data-dash-reveal] {
  opacity: 0;
}

.cap-expanded-overlay__content .cap-dash [data-dash-reveal].is-revealed {
  animation: dashElementReveal 0.55s cubic-bezier(0.35, 0, 0, 1) both;
}

/* ============================================================
   Mobile / responsive — stack vertically when too narrow
   ============================================================ */
@media (max-width: 900px) {
  .products__capability-card-viz .cap-dash {
    padding: 12px;
    gap: 8px;
  }
  .cap-dash__body {
    flex-direction: column;
    gap: 8px;
  }
  .cap-dash__main {
    flex: 1 1 55%;
  }
  .cap-dash__sidebar {
    flex: 0 0 auto;
  }
  .cap-dash__list {
    max-height: 80px;
  }
  .cap-dash__title {
    font-size: 10px;
  }
  .cap-dash__toggle {
    font-size: 9px;
    padding: 4px 8px;
  }
  .cap-dash__kpi-value {
    font-size: 13px;
  }
}
