/* ── merge-sort.css ── local styles for the Merge Sort visualizer ── */

/* ── page shell ── */
body {
  flex-direction: column;
  padding: 20px;
  gap: 16px;
  min-height: 100vh;
  display: flex;
  align-items: stretch;
  justify-content: flex-start;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

h2 {
  text-align: center;
  color: white;
  font-size: 28px;
  text-shadow: 2px 2px 4px rgba(0,0,0,.2);
  margin-bottom: 2px;
}

.subtitle {
  text-align: center;
  color: rgba(255,255,255,.6);
  font-size: 13px;
  margin-bottom: 8px;
}

/* ── two-column layout ── */
.layout {
  display: flex;
  gap: 20px;
  flex: 1;
  align-items: stretch;
  min-height: 0;
}

/* ── sidebar ── */
.controls {
  flex: 0 0 250px;
  background: rgba(255,255,255,.95);
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 8px 16px rgba(0,0,0,.3);
  display: flex;
  flex-direction: column;
  gap: 0;
}

.control-group {
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 2px solid #e5e7eb;
}
.control-group:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}
.control-group h3 {
  color: #6b21a8;
  margin-bottom: 10px;
  font-size: 15px;
}

label {
  display: block;
  color: #4b5563;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 6px;
}

input[type="range"] {
  width: 100%;
  accent-color: #8b5cf6;
  cursor: pointer;
  margin-bottom: 4px;
}

.range-val {
  font-size: 12px;
  color: #6b21a8;
  font-weight: 700;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}
.checkbox-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #60a5fa;
  cursor: pointer;
}
.checkbox-row label {
  margin-bottom: 0;
  cursor: pointer;
}

/* ── stats box ── */
.stats {
  background: #ede9fe;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 12px;
  color: #6b21a8;
  line-height: 1.9;
}
.stats span { font-weight: 700; }

/* ── button group ── */
.btn-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.btn-group button {
  width: 100%;
  padding: 10px;
  border: none;
  border-radius: 6px;
  color: white;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
  box-shadow: 0 2px 4px rgba(0,0,0,.2);
}
.btn-group button:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0,0,0,.25);
}
.btn-group button:disabled { opacity: .5; cursor: not-allowed; }

#btn-reset   { background: #a78bfa; }
#btn-reset:hover:not(:disabled)   { background: #8b5cf6; }
#btn-shuffle { background: #06b6d4; }
#btn-shuffle:hover:not(:disabled) { background: #0891b2; }
#btn-solve   { background: #3b82f6; }
#btn-solve:hover:not(:disabled)   { background: #2563eb; }
#btn-prev    { background: #6366f1; }
#btn-prev:hover:not(:disabled)    { background: #4f46e5; }
#btn-next    { background: #3b82f6; }
#btn-next:hover:not(:disabled)    { background: #2563eb; }

/* ── visualizer canvas area ── */
#visualizer {
  flex: 1;
  background: white;
  border: 3px solid #a78bfa;
  border-radius: 10px;
  box-shadow: 0 8px 16px rgba(0,0,0,.3);
  position: relative;
  overflow: hidden;
  min-height: 460px;
  min-width: 0;
}
#visualizer canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* ── legend ── */
.legend {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}
.legend-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  background: rgba(0,0,0,.25);
  border-radius: 8px;
  padding: 8px 12px;
  min-width: 130px;
}
.dot {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex-shrink: 0;
  margin-top: 2px;
}
.legend-text    { display: flex; flex-direction: column; }
.legend-label   { font-size: 12px; font-weight: 700; color: rgba(255,255,255,.95); line-height: 1.3; }
.legend-desc    { font-size: 11px; color: rgba(255,255,255,.6); line-height: 1.3; margin-top: 1px; }

/* legend dot colours */
.dot-unsorted   { background: #8b5cf6; }
.dot-splitting  { background: #f59e0b; }
.dot-comparing  { background: #60a5fa; }
.dot-merging    { background: #f97316; }
.dot-sorted     { background: #22c55e; }