/* ===== Base Reset ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
  background-color: #121212;
  color: #ffffff;
  min-height: 100vh;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ===== Header ===== */
header {
  margin-bottom: 1rem;
  text-align: center;
}

h1 {
  font-size: 2rem;
  color: #00bcd4;
}

/* ===== Control Panel ===== */
.controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
  background: #1e1e1e;
  padding: 1rem;
  border-radius: 10px;
  margin-bottom: 1.5rem;
  width: 100%;
  max-width: 1000px;
}

.input-group, .select-group, .button-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-width: 200px;
}

select, input[type="text"], input[type="number"] {
  padding: 0.5rem;
  border-radius: 8px;
  border: none;
  background-color: #2c2c2c;
  color: white;
  font-size: 1rem;
}

button {
  padding: 0.6rem 1rem;
  background-color: #00bcd4;
  border: none;
  color: white;
  border-radius: 8px;
  cursor: pointer;
  font-weight: bold;
  transition: background-color 0.3s ease;
  font-size: 1rem;
}

button:hover, button:focus {
  background-color: #0097a7;
  outline: none;
}

/* ===== Visualizer Section ===== */
.visualizer-container {
  width: 100%;
  max-width: 1000px;
  margin-bottom: 1rem;
  text-align: center;
}

.bars-container {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 12px;
  height: 300px;
  margin-top: 1rem;
  overflow-x: auto;
  padding-bottom: 60px;
  position: relative;
  min-height: 340px;
}

.bar-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  min-width: 30px;
}

.bar {
  width: 30px;
  background-color: #00bcd4;
  border-radius: 5px;
  position: relative;
  transition: all 0.3s ease;
}

.bar-length {
  color: #fff;
  font-size: 0.8rem; 
  margin-bottom: 5px;
  position: absolute;
  bottom: 100%; /* Above the bar */
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
}

.bar.highlight-compare {
  background-color: #ffeb3b;
  box-shadow: 0 0 8px #ffeb3b;
  z-index: 2;
}

.bar.highlight-swap {
  background-color: #ff9800;
  box-shadow: 0 0 8px #ff9800;
  z-index: 3;
}

.bar.highlight-found {
  background-color: #4caf50 !important; /* green */
  box-shadow: 0 0 10px #4caf50 !important;
  color: white;
  font-weight: bold;
  cursor: default;
}

/* Step Notification */
#stepNotify {
  position: relative;
  color: #ffc107;
  font-style: italic;
  font-size: 1rem;
  padding: 6px 10px;
  background: #222;
  user-select: none;
  min-height: 1.5em;
  overflow-x: auto;
  white-space: nowrap;
  border-top: 1px solid #444;
  margin-top: 10px;
}

/* Code and Complexity Output */
.code-output-section {
  background: #1e1e1e;
  padding: 1rem;
  border-radius: 10px;
  width: 100%;
  max-width: 1000px;
  font-size: 1rem;
  user-select: text;
  margin: 40px 0;
}

.code-output {
  background-color: #2b2b2b;
  padding: 1rem;
  white-space: pre-wrap;
  border-radius: 8px;
  color: #90caf9;
  font-family: 'Courier New', Courier, monospace;
  margin-top: 1rem;
  overflow-x: auto;
  max-height: 250px;
}

.complexity-output {
  margin-top: 1rem;
  color: #4caf50;
  font-weight: bold;
  white-space: pre-wrap;
}

/* Array Display */
.array-display {
  margin-top: 1rem;
  background: #1e1e1e;
  padding: 1rem;
  border-radius: 8px;
  font-family: 'Courier New', Courier, monospace;
  color: #90caf9;
  white-space: pre-wrap;
}

@media (max-width: 600px) {
  body {
    padding: 0.5rem;
  }
  h1 {
    font-size: 1.5rem;
  }
  button {
    font-size: 0.95rem;
    padding: 0.5rem;
  }
  .bars-container {
    height: 200px;
    gap: 6px;
    padding-bottom: 50px;
    min-height: 220px;
  }
  .bar {
    width: 20px;
  }
}