/* ═══════════════════════════════════════════════════════════
   SORT VISUALIZER — style.css
   ═══════════════════════════════════════════════════════════ */

html {
  user-select: none;
}

.sort-page {
  min-height: 100vh;
  padding: 5.5rem 1.5rem 3rem;
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* ── Titre ── */
.sort-header { text-align: center; }
.sort-title {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 700;
  letter-spacing: -0.03em;
}
.sort-subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-top: 0.4rem;
}

/* ── Contrôles ── */
.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  align-items: flex-end;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.control-group--actions {
  flex-direction: row;
  align-items: center;
  margin-left: auto;
  gap: 0.6rem;
}

.control-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

/* Boutons algo */
.algo-buttons,
.order-buttons {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.algo-btn,
.order-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 500;
  padding: 0.35rem 0.75rem;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.algo-btn:hover,
.order-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.algo-btn.is-active,
.order-btn.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #0A0A0A;
  font-weight: 600;
}

/* Slider */
.slider {
  -webkit-appearance: none;
  appearance: none;
  width: 160px;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  outline: none;
  cursor: pointer;
}
.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  transition: transform var(--transition);
}
.slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

/* ── Stats ── */
.sort-stats {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.stat-item {
  flex: 1;
  min-width: 120px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.stat-label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.stat-val {
  font-family: var(--font-mono);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--accent);
}

/* ── Canvas ── */
.canvas-wrapper {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  width: 100%;
}

#sortCanvas {
  display: block;
  width: 100%;
  height: 380px;
}

/* ── Info algo ── */
.algo-info {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.algo-info__title {
  font-size: 1rem;
  font-weight: 700;
}

.algo-info__desc {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.algo-info__complexity {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.complexity-badge {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.2rem 0.6rem;
}

.complexity-badge strong {
  color: var(--accent);
}

/* ── Responsive ── */
@media (max-width: 700px) {
  .control-group--actions {
    margin-left: 0;
    width: 100%;
  }
  .btn { flex: 1; justify-content: center; }
}
