* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #f0f0f0 0%, #ffffff 100%);
  min-height: 100vh;
  padding: 20px;
  color: #333;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  background: white;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  overflow: hidden;
}

header {
  background: linear-gradient(135deg, #15161b 0%, #08050b 100%);
  color: white;
  padding: 30px;
  text-align: center;
}

h1 {
  font-size: 2.5em;
  margin-bottom: 10px;
  font-weight: 700;
}

.subtitle {
  opacity: 0.9;
  font-size: 1.1em;
}

.controls {
  padding: 25px 30px;
  background: #f8f9fa;
  border-bottom: 2px solid #e9ecef;
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  align-items: center;
  justify-content: center;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 150px;
}

.control-group label {
  font-weight: 600;
  font-size: 0.9em;
  color: #495057;
}

select,
button {
  padding: 10px 16px;
  border: 2px solid #dee2e6;
  border-radius: 8px;
  font-size: 1em;
  background: white;
  cursor: pointer;
  transition: all 0.3s;
}

select:focus,
button:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

button {
  font-weight: 600;
  color: white;
  border: none;
}

button:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(135deg, #2f2f2f 0%, #17022b 100%);
}

.btn-success {
  background: linear-gradient(135deg, #56ab2f 0%, #a8e063 100%);
}

.btn-warning {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.btn-secondary {
  background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

input[type="range"] {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: #dee2e6;
  outline: none;
  -webkit-appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #667eea;
  cursor: pointer;
  transition: all 0.3s;
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  background: #764ba2;
}

input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #667eea;
  cursor: pointer;
  border: none;
}

.slider-value {
  font-weight: 600;
  color: #667eea;
}

.stats {
  padding: 20px 30px;
  background: #fff;
  display: flex;
  justify-content: center;
  gap: 40px;
  flex-wrap: wrap;
  border-bottom: 2px solid #e9ecef;
}

.stat-item {
  text-align: center;
}

.stat-label {
  font-size: 0.9em;
  color: #6c757d;
  margin-bottom: 5px;
}

.stat-value {
  font-size: 1.8em;
  font-weight: 700;
  color: #667eea;
}

.visualization-area {
  padding: 40px 30px;
  min-height: 400px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 2px;
  background: #ffffff;
}

/* Base bars */
.bar {
  background-color: #4f46e5;
  /* Indigo */
  border-radius: 3px 3px 0 0;
  transition: height 0.25s ease, background-color 0.15s ease;
}

/* Comparing bars */
.bar.comparing {
  background-color: #f59e0b;
  /* Amber */
}

/* Swapping bars */
.bar.swapping {
  background-color: #ef4444;
  /* Red */
}

/* Sorted bars */
.bar.sorted {
  background-color: #22c55e;
  /* Green */
}

/* Pivot (Quick Sort) */
.bar.pivot {
  background-color: #0ea5e9;
  /* Sky blue */
}


footer {
  padding: 20px;
  text-align: center;
  background: #f8f9fa;
  color: #6c757d;
  font-size: 0.9em;
}

.action-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

@media (max-width: 768px) {
  h1 {
    font-size: 1.8em;
  }

  .controls {
    padding: 20px;
    gap: 15px;
  }

  .control-group {
    min-width: 120px;
  }

  .stats {
    gap: 20px;
  }

  .stat-value {
    font-size: 1.4em;
  }

  .visualization-area {
    padding: 30px 15px;
    min-height: 300px;
  }
}

.status-indicator {
  padding: 8px 16px;
  border-radius: 20px;
  font-weight: 600;
  font-size: 0.9em;
  display: inline-block;
}

.status-ready {
  background: #d4edda;
  color: #155724;
}

.status-running {
  background: #fff3cd;
  color: #856404;
}

.status-paused {
  background: #f8d7da;
  color: #721c24;
}

.status-complete {
  background: #d1ecf1;
  color: #0c5460;
}