/* ══════════════════════════════════════════
   visualizer.css — Sorting bars visualization
══════════════════════════════════════════ */

/* ─── Bars Container ─── */
.bars-container {
  flex: 1;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 2px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-5) var(--space-3);
  overflow: hidden;
  position: relative;
  min-height: 0;
}

/* Grid lines (decorative) */
.bars-container::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(
    0deg,
    transparent,
    transparent calc(25% - 1px),
    var(--border-faint) calc(25% - 1px),
    var(--border-faint) 25%
  );
  pointer-events: none;
  border-radius: inherit;
}

/* ─── Individual bar ─── */
.bar {
  flex: 1;
  min-width: 2px;
  max-width: 40px;
  background: var(--color-default);
  border-radius: 2px 2px 0 0;
  position: relative;
  transition: background-color var(--transition-fast);
  transform-origin: bottom center;
  will-change: background-color, transform;
}

.bar::after {
  content: attr(data-value);
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.55rem;
  color: var(--text-muted);
  white-space: nowrap;
  opacity: 0;
  transition: opacity var(--transition-fast);
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}

.bar:hover::after {
  opacity: 1;
}

/* ─── Bar states ─── */
.bar.state-comparing {
  background: var(--color-comparing) !important;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.4);
}

.bar.state-swapping {
  background: var(--color-swapping) !important;
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.5);
  animation: swapPulse 0.3s ease;
}

.bar.state-sorted {
  background: var(--color-sorted) !important;
  box-shadow: 0 0 8px rgba(0, 210, 150, 0.3);
}

.bar.state-pivot {
  background: var(--color-pivot) !important;
  box-shadow: 0 0 12px rgba(139, 92, 246, 0.5);
}

.bar.state-done {
  background: var(--color-done) !important;
}

/* ─── Completed state (cascade animation) ─── */
.bars-container.sorted-done .bar {
  background: var(--color-sorted);
  animation: doneWave 0.5s ease forwards;
}
