* {
  box-sizing: border-box;
}
body {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial,
    sans-serif;
  margin: 0;
  color: #222;
}
header {
  padding: 12px 16px;
  background: #111827;
  color: #fff;
}
main {
  padding: 12px 16px;
}
.controls .row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.controls input {
  padding: 6px 8px;
}
.controls .control-group {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 10px;
  background: #fff;
}
.controls .group-title {
  font-weight: 600;
  font-size: 13px;
  color: #374151;
  margin-bottom: 6px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(250px, 1fr) auto minmax(260px, 1fr);
  gap: 12px;
  margin-top: 8px;
  align-items: stretch;
}
/* Resizable canvas container */
.resizable-container {
  resize: both;
  overflow: auto;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  background: #fafafa;
  min-width: 300px;
  min-height: 200px;
  width: 800px;
  height: 500px;
}
#canvas {
  display: block;
  width: 100%;
  height: 100%;
}
.panel {
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 8px;
  background: #fff;
  overflow: auto;
}
pre {
  background: #f6f8fa;
  padding: 8px;
  border-radius: 6px;
  overflow: auto;
}
button {
  padding: 8px 12px;
  border: 1px solid #d1d5db;
  background: #111827;
  color: #fff;
  border-radius: 6px;
  cursor: pointer;
}
button:hover {
  opacity: 0.9;
}
label {
  display: flex;
  gap: 6px;
  align-items: center;
}

/* Special style for Compare button */
.btn-compare {
  background: #60a5fa; /* light blue */
  border-color: #3b82f6; /* complementary deeper blue */
  color: #111827; /* complements black theme */
}
.btn-compare:hover {
  opacity: 0.95;
}

/* Subtle highlight for selected algorithm button */
.algo-active {
  border-color: #60a5fa;
  box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.35) inset;
}

/* Modal styles */
.modal.hidden {
  display: none;
}
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 50;
}
.modal-card {
  width: 360px;
  max-width: 95vw;
  background: #fff;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
}
.modal-card.modal-wide {
  width: 900px;
  max-width: 98vw;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid #f3f4f6;
}
.icon-btn {
  background: transparent;
  border: none;
  color: #6b7280;
  font-size: 18px;
  cursor: pointer;
}
.modal-fields {
  padding: 12px 14px;
  display: grid;
  gap: 10px;
}
.modal-fields label {
  display: grid;
  gap: 6px;
  font-size: 14px;
}
.modal-fields input {
  padding: 8px 10px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid #f3f4f6;
}
.modal-error {
  color: #dc2626;
  padding: 0 14px 10px 14px;
  min-height: 18px;
  font-size: 13px;
}

/* Active mode highlight */
button.mode-active {
  background: #2563eb;
  border-color: #1d4ed8;
}

/* List styling */
ul.list {
  list-style: none;
  padding: 6px;
  margin: 0;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
}
ul.list li {
  padding: 6px 8px;
  border-bottom: 1px dashed #e5e7eb;
}
ul.list li:last-child {
  border-bottom: none;
}

/* Comparison grid */
.compare-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
  padding: 12px 14px;
}
.compare-card {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 10px;
  background: #f9fafb;
}
.compare-card h3 {
  margin: 0 0 8px 0;
}
.badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin: 6px 0;
}
.badge {
  font-size: 12px;
  background: #e5e7eb;
  color: #111827;
  padding: 2px 6px;
  border-radius: 999px;
}
code.inline {
  background: #eef2f7;
  padding: 2px 4px;
  border-radius: 4px;
}

/* Algorithm-specific badge styling */
.algorithm-badge {
  background: #3b82f6 !important;
  color: white !important;
  font-weight: bold;
}

.complexity-badge {
  background: #8b5cf6 !important;
  color: white !important;
  font-style: italic;
}

/* Docked comparison section */
.compare-dock.hidden {
  display: none;
}
.compare-dock {
  margin-top: 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
}
.compare-dock-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid #f3f4f6;
}

/* Samples panel (moved to left side) */
.samples-panel {
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 8px;
  background: #fff;
  overflow: auto;
  max-height: 600px;
}

.samples-panel .control-group {
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #f3f4f6;
}

.samples-panel .control-group:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.samples-panel .group-title {
  font-weight: 600;
  font-size: 13px;
  color: #374151;
  margin-bottom: 8px;
}

.sample-column {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sample-column button {
  padding: 6px 10px;
  font-size: 12px;
  text-align: left;
}

/* Algorithm results display */
.results-display {
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 10px;
  font-size: 12px;
  max-height: 200px;
  overflow-y: auto;
}

.help-text {
  color: #6b7280;
  font-style: italic;
  margin: 0;
}

.result-item {
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e5e7eb;
}

.result-item:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.result-title {
  font-weight: 600;
  color: #374151;
  margin-bottom: 4px;
}

.result-path {
  font-family: monospace;
  background: #eef2f7;
  padding: 2px 4px;
  border-radius: 3px;
  word-break: break-all;
}

.result-metrics {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.metric-badge {
  font-size: 10px;
  background: #e5e7eb;
  color: #111827;
  padding: 1px 4px;
  border-radius: 999px;
}
