/* /explorer/assets/css/drift-analytics.css — D32e-impl-1
 *
 * Drift Analytics panel styling. The panel mounts inside the existing
 * Runtime Evidence letterbox (#gmap-evidence-tray); these rules style
 * the new content layout (series rail on the left, chart on the right,
 * polished header) without redesigning the tray shell.
 *
 * All colours route through tokens defined in tokens.css so dark theme
 * + future light theme both work.
 */

/* Panel grid layout — left rail + chart, with a header strip on top.
 * Mounted inside .gmap-evidence-tray-panel which is itself inside the
 * collapse-aware tray body, so heights are driven by the tray.
 */
.drift-analytics-panel {
  display: grid;
  grid-template-columns: 240px 1fr;
  grid-template-rows: auto 1fr;
  grid-template-areas:
    "header header"
    "list   chart";
  gap: 12px;
  height: 100%;
  min-height: 220px;
  color: var(--text-1, #e8ecf2);
}

.drift-analytics-header {
  grid-area: header;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 4px 0 4px;
}

.drift-analytics-title {
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-2, #c4ccd6);
}

.drift-analytics-subtitle {
  font-size: 12px;
  color: var(--text-3, #93a0b0);
}

.drift-analytics-severity-badge {
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 10px;
  letter-spacing: 0.04em;
  font-weight: 700;
  text-transform: uppercase;
}
.drift-analytics-severity-critical { background: var(--badge-bad,  #8a1f1f); color: #fff; }
.drift-analytics-severity-warning  { background: var(--badge-warn, #8a601f); color: #fff; }
.drift-analytics-severity-info     { background: var(--badge-info, #1c5278); color: #fff; }
.drift-analytics-severity-ok       { background: var(--badge-good, #1d6b3f); color: #fff; }
.drift-analytics-severity-unknown  { background: var(--badge-muted,#495163); color: #fff; }

.drift-analytics-demo-badge {
  margin-left: auto;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(255, 184, 107, 0.18);
  color: var(--badge-warn, #ffb86b);
  font-size: 10px;
  letter-spacing: 0.04em;
  font-weight: 700;
}

/* Series list rail.
 * The rail's compact rows match the existing right-rail tab style
 * (12px font, subtle dividers) so the new panel sits inside the
 * existing dark theme without bringing its own visual language.
 */
.drift-series-list {
  grid-area: list;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
  padding-right: 4px;
}
.drift-series-list-empty {
  font-size: 12px;
  color: var(--text-3, #93a0b0);
  font-style: italic;
  padding: 8px;
}

.drift-series-row {
  appearance: none;
  text-align: left;
  display: grid;
  grid-template-columns: 8px 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: var(--surface-2, rgba(20, 24, 32, 0.7));
  color: inherit;
  cursor: pointer;
  font: inherit;
  transition: background-color 100ms ease, border-color 100ms ease;
}
.drift-series-row:hover {
  background: var(--surface-3, rgba(255, 255, 255, 0.06));
}
.drift-series-row:focus-visible {
  outline: 2px solid var(--focus, #6da3ff);
  outline-offset: 1px;
}
.drift-series-row.is-selected {
  background: var(--surface-3, rgba(255, 255, 255, 0.10));
  border-color: var(--border-muted, rgba(255, 255, 255, 0.16));
}

.drift-series-row-sev {
  width: 6px;
  height: 36px;
  border-radius: 3px;
}
.drift-series-row-sev-critical { background: var(--badge-bad,  #ff7e9b); }
.drift-series-row-sev-warning  { background: var(--badge-warn, #ffb86b); }
.drift-series-row-sev-info     { background: var(--badge-info, #6da3ff); }
.drift-series-row-sev-ok       { background: var(--badge-good, #59d3a3); }
.drift-series-row-sev-unknown  { background: var(--badge-muted,#6b7383); }

.drift-series-row-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.drift-series-row-label {
  font-weight: 600;
  font-size: 12px;
  color: var(--text-1, #e8ecf2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.drift-series-row-meta {
  display: flex;
  gap: 6px;
  font-size: 11px;
  color: var(--text-3, #93a0b0);
}
.drift-series-row-anomaly-count {
  color: var(--badge-warn, #ffb86b);
}
.drift-series-row-demo {
  padding: 1px 4px;
  border-radius: 3px;
  background: rgba(255, 184, 107, 0.16);
  color: var(--badge-warn, #ffb86b);
  font-size: 10px;
  letter-spacing: 0.04em;
  font-weight: 700;
}
.drift-series-row-summary {
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  color: var(--text-2, #c4ccd6);
  align-self: start;
  margin-top: 2px;
}

/* Chart area. */
.drift-series-chart {
  grid-area: chart;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.drift-series-chart-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  font-size: 12px;
  color: var(--text-3, #93a0b0);
  font-style: italic;
}
.drift-series-chart-svg {
  width: 100%;
  height: 100%;
  background: var(--surface-2, rgba(20, 24, 32, 0.5));
  border-radius: 6px;
}
.drift-series-chart-bg {
  fill: transparent;
}
.drift-series-chart-grid {
  stroke: var(--border-muted, rgba(255, 255, 255, 0.06));
  stroke-width: 1;
  shape-rendering: crispEdges;
}
.drift-series-chart-axis-label {
  font-size: 9px;
  fill: var(--text-3, #93a0b0);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}
.drift-series-chart-actual {
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.drift-series-chart-baseline {
  fill: none;
  stroke: var(--text-3, #93a0b0);
  stroke-width: 1.2;
  stroke-dasharray: 4 4;
  opacity: 0.7;
}
.drift-series-chart-forecast {
  fill: none;
  stroke: var(--badge-info, #6da3ff);
  stroke-width: 1.2;
  stroke-dasharray: 2 4;
  opacity: 0.6;
}
.drift-series-chart-anomaly {
  fill: var(--badge-bad, #ff7e9b);
  stroke: var(--surface-2, #0d1117);
  stroke-width: 1.2;
}
.drift-series-chart-severity-critical .drift-series-chart-actual { stroke: var(--badge-bad,  #ff7e9b); }
.drift-series-chart-severity-warning  .drift-series-chart-actual { stroke: var(--badge-warn, #ffb86b); }
.drift-series-chart-severity-info     .drift-series-chart-actual { stroke: var(--badge-info, #6da3ff); }
.drift-series-chart-severity-ok       .drift-series-chart-actual { stroke: var(--badge-good, #59d3a3); }
.drift-series-chart-severity-unknown  .drift-series-chart-actual { stroke: var(--badge-muted,#6b7383); }

/* Narrow-viewport stack: rail above chart instead of beside it. */
@media (max-width: 920px) {
  .drift-analytics-panel {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto 1fr;
    grid-template-areas:
      "header"
      "list"
      "chart";
  }
  .drift-series-list {
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 4px;
  }
  .drift-series-row {
    min-width: 200px;
  }
}
