:root {
  --primary-color: #2563eb;
  --primary-hover: #1d4ed8;
  --background-color: #0f172a;
  --surface-color: #111827;
  --panel-color: #1f2937;
  --text-color: #e5e7eb;
  --text-muted: #9ca3af;
  --edge-color: #6b7280;

  --error-color: #ef4444;
}

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

body {
  font-family: 'Outfit', sans-serif;
  background: radial-gradient(circle at 20% 20%, rgba(37, 99, 235, 0.08), transparent 35%),
    radial-gradient(circle at 80% 0%, rgba(16, 185, 129, 0.08), transparent 25%),
    var(--background-color);
  color: var(--text-color);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  padding: 1.5rem;
}

.app-container {
  width: 100%;
  max-width: 1400px;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

h1 {
  font-size: 2.5rem;
  background: linear-gradient(90deg, #3b82f6, #22d3ee);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin: 0;
}

.tagline {
  color: var(--text-muted);
}

.controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  background: var(--surface-color);
  padding: 1.25rem;
  border-radius: 1rem;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.35);
}

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

.full-width {
  grid-column: 1 / -1;
}

label {
  font-size: 0.95rem;
  color: var(--text-muted);
}

input {
  padding: 0.75rem;
  border-radius: 0.5rem;
  border: 1px solid #1f2937;
  background: #0b1222;
  color: var(--text-color);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s;
  width: 100%;
  min-width: 0;
}

input:focus {
  border-color: var(--primary-color);
}

.edge-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.5rem;
}

.edge-controls-wrapper {
  display: flex;
  gap: 0.5rem;
}

.edge-left-column {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
}

#reset-btn {
  height: auto;
}

button {
  padding: 0.75rem 1.25rem;
  border-radius: 0.5rem;
  border: none;
  background: var(--primary-color);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

button:hover {
  background: var(--primary-hover);
}

button:active {
  transform: translateY(1px);
}

button.secondary {
  background: transparent;
  border: 1px solid var(--edge-color);
  color: var(--text-color);
}

.visualization-area {
  background: var(--surface-color);
  border-radius: 1rem;
  min-height: 520px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

#graph-container {
  position: relative;
  width: 100%;
  height: 560px;
}

.node {
  position: absolute;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #1f2937;
  border: 3px solid var(--edge-color);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35);
  transition: transform 0.2s, border-color 0.2s, background 0.2s;
}



.edge {
  position: absolute;
  height: 2px;
  background: var(--edge-color);
  transform-origin: 0 50%;
  opacity: 0.85;
}



.edge-weight {
  position: absolute;
  transform: translate(-50%, -50%);
  background: var(--surface-color);
  color: var(--text-color);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.85rem;
  border: 1px solid var(--edge-color);
  z-index: 5;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.info-panel {
  background: var(--panel-color);
  padding: 1.25rem;
  border-radius: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  border: 1px solid #1f2937;
}

#status-message {
  font-size: 1rem;
}

#status-message.error {
  color: var(--error-color);
}

.legend {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.legend-item {
  display: inline-block;
  width: 18px;
  height: 18px;
  border-radius: 6px;
  margin-right: 4px;
  vertical-align: middle;
  border: 2px solid transparent;
}



.legend-item.edge {
  background: var(--edge-color);
}

@media (max-width: 900px) {
  .controls {
    grid-template-columns: 1fr;
  }

  .edge-inputs {
    grid-template-columns: 1fr;
  }
}