/* analytics.css — Heatmap, time slider, flow diagram, comparison mode */

/* ── Time Slider ── */
.time-slider-wrap {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
  flex-shrink: 0;
}

.play-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--color-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--transition-fast);
}

.play-btn:hover {
  background: var(--color-primary-light);
}

#time-slider,
#time-slider-a,
#time-slider-b {
  flex: 1;
  height: 4px;
  accent-color: var(--color-primary);
  cursor: pointer;
}

.time-label {
  font-size: var(--font-size-sm);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--color-primary);
  min-width: 40px;
  text-align: right;
}

/* ── Heatmap Height Chain ── */
#heatmap-container {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

#heatmap-single {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

#heatmap-floor-plan,
#heatmap-floor-plan-a,
#heatmap-floor-plan-b {
  flex: 1;
  min-height: 0;
}

.heatmap-legend {
  flex-shrink: 0;
}

/* ── Heatmap Overlay ── */
.heatmap-overlay {
  pointer-events: none;
}

.heatmap-overlay rect {
  mix-blend-mode: multiply;
  transition: fill var(--transition-slow), fill-opacity var(--transition-slow);
}

/* ── Legend ── */
.heatmap-legend {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-top: var(--space-sm);
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
}

.legend-gradient {
  flex: 1;
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(to right, #4575b4, #91bfdb, #e0f3f8, #fee090, #fc8d59, #d73027);
}

.legend-label {
  flex-shrink: 0;
}

/* ── Compare Mode ── */
#heatmap-compare {
  display: flex;
  flex-direction: row;
  gap: var(--space-md);
  flex: 1;
  min-height: 0;
}

.compare-col {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.compare-col .time-slider-wrap {
  flex-shrink: 0;
}

.compare-col > div[id^="heatmap-floor-plan"] {
  flex: 1;
  min-height: 0;
}

.compare-col .time-label {
  font-size: var(--font-size-lg);
  font-weight: 700;
}

/* ── Flow Paths ── */
.flow-path {
  fill: none;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.75;
}

.flow-path-animated {
  stroke-dasharray: 10 6;
  animation: flow-dash 1.2s linear infinite;
}

@keyframes flow-dash {
  from { stroke-dashoffset: 0; }
  to { stroke-dashoffset: -48; }
}

.flow-path-bottleneck {
  stroke: var(--color-red) !important;
  opacity: 1;
  animation: flow-dash 0.6s linear infinite, pulse-path 1s infinite;
}

@keyframes pulse-path {
  0%, 100% { stroke-width: 3; }
  50% { stroke-width: 5; }
}

/* Dwell time badges */
.dwell-badge {
  font-family: var(--font-family);
  font-size: 8px;
  font-weight: 700;
  pointer-events: none;
  text-anchor: middle;
  dominant-baseline: middle;
}

.dwell-badge-bg {
  rx: 4;
  ry: 4;
}

.dwell-green { fill: var(--color-green); }
.dwell-yellow { fill: var(--color-yellow); }
.dwell-red { fill: var(--color-red); }

/* Bottleneck label */
.bottleneck-label {
  font-family: var(--font-family);
  font-size: 9px;
  font-weight: 700;
  fill: var(--color-red);
  pointer-events: none;
  text-anchor: middle;
  animation: blink 1.5s infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* Journey summary table */
.bottleneck-badge {
  display: inline-block;
  background: var(--color-red-bg);
  color: var(--color-red);
  border-radius: var(--border-radius-sm);
  padding: 1px 6px;
  font-size: var(--font-size-xs);
  font-weight: 600;
}

.no-bottleneck {
  color: var(--color-text-faint);
  font-size: var(--font-size-xs);
}
