:root {
  --primary: #222222;
  --secondary: #444444;
  --error: #777777;
  --success: #333333;
  --background: #ffffff;
  --text: #000000;
  --border: #cccccc;
  --hover: #f5f5f5;
}

body {
  font-family: system-ui, -apple-system, sans-serif;
  max-width: 1200px;
  margin: 40px auto;
  padding: 0 20px;
  line-height: 1.6;
  color: var(--text);
  background-color: var(--background);
}

.container {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.input-group {
  display: flex;
  gap: 12px;
}

input {
  flex: 1;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 16px;
}

input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(34, 34, 34, 0.1);
}

button {
  padding: 12px 24px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 16px;
  cursor: pointer;
  transition: opacity 0.2s;
}

button:hover {
  opacity: 0.9;
  background: var(--secondary);
}

button:disabled {
  background: #999999;
  cursor: not-allowed;
}

.status {
  padding: 12px;
  border-radius: 6px;
  display: none;
}

.status.error {
  background: #f8f8f8;
  color: var(--error);
  border: 1px solid #eeeeee;
}

.status.success {
  background: #f8f8f8;
  color: var(--success);
  border: 1px solid #eeeeee;
}

.result {
  background: #f8f8f8;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 16px;
  white-space: pre-wrap;
  display: none;
  overflow-x: auto;
  max-height: 300px;
  overflow-y: auto;
}

.examples {
  color: #555555;
  font-size: 14px;
}

.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid #ffffff;
  border-radius: 50%;
  border-top-color: transparent;
  animation: spin 1s linear infinite;
  margin-right: 8px;
}

.toggle-view {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}

.test-controls {
  background: #f8f8f8;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 20px;
  margin-bottom: 20px;
}

.test-controls h3 {
  margin-top: 0;
  margin-bottom: 15px;
  font-size: 16px;
  font-weight: 600;
  color: var(--primary);
}

.links line {
  stroke: #999;
  stroke-opacity: 0.6;
}

.nodes circle {
  stroke: #69b3a2;
  stroke-width: 2px;
}

.node-molecule {
  pointer-events: none;
}

.tooltip {
  position: absolute;
  text-align: left;
  width: auto;
  padding: 10px;
  font: 12px sans-serif;
  background: lightsteelblue;
  border: 0px;
  border-radius: 8px;
  pointer-events: none;
  max-width: 200px;
}

.toggle-results {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}

.toggle-results button {
  padding: 8px 16px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  transition: opacity 0.2s;
}

.toggle-results button:hover {
  opacity: 0.9;
  background: var(--secondary);
}

.toggle-switch {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 12px;
}

.switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: 0.4s;
  border-radius: 24px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: 0.4s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--primary);
}

input:checked + .slider:before {
  transform: translateX(26px);
}

.toggle-label {
  font-size: 14px;
  color: #555555;
}

.download-btn {
  background: var(--primary);
  margin: 0 0 15px 0;
  display: block;
}

.download-btn:hover {
  opacity: 0.9;
  background: var(--secondary);
}

.pathway-number {
  text-align: center;
  font-size: 16px;
  font-weight: 500;
  color: var(--primary);
  margin: 20px auto;
  padding: 12px;
  background: #f8f8f8;
  border: 1px solid var(--border);
  border-radius: 6px;
  max-width: 300px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  position: relative;
  z-index: 1000;
}

.pathway-number strong {
  color: var(--primary);
  margin-right: 8px;
}

#current-pathway {
  font-weight: 600;
  color: #2196f3;
}

.model-select {
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  background-color: white;
  width: 200px;
}

.model-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(34, 34, 34, 0.1);
}

.pathway-control {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.steps-select {
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  background-color: white;
}

.steps-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(34, 34, 34, 0.1);
}

.rerun-btn {
  display: none;
  background: var(--primary);
  padding: 8px 16px;
  font-size: 14px;
}

.rerun-btn:hover {
  background: var(--secondary);
}

.rerun-btn:disabled {
  background: #999999;
  cursor: not-allowed;
}

.rerun-btn .loading {
  width: 16px;
  height: 16px;
  border-width: 2px;
}

.controls-container {
  display: flex;
  flex-direction: column;
  gap: 24px;
  margin-bottom: 20px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}

@media (max-width: 768px) {
  .rerun-control {
    width: 100%;
  }
}

.section-title {
  font-size: 16px;
  font-weight: 600;
  color: #333;
  margin-bottom: 16px;
}

.pathway-section {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.rerun-section {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: space-between;
}

.rerun-control {
  display: flex;
  align-items: center;
  gap: 12px;
  width: calc(50% - 8px);
  min-width: 300px;
  margin-bottom: 15px;
}

.rerun-label {
  font-size: 14px;
  color: #333;
  min-width: 80px;
}

#graph {
  width: 100%;
  min-height: 600px;
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-top: 20px;
}

/* New styles for the polished UI */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  border-bottom: 2px solid var(--border);
  padding-bottom: 15px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 15px;
}

.header h1 {
  margin: 0;
  color: var(--primary);
}

.logo {
  height: 40px;
  display: flex;
  align-items: center;
}

.logo img {
  max-height: 40px;
  max-width: 120px;
  object-fit: contain;
}

.advanced-settings {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 15px;
  margin-bottom: 20px;
  background-color: #f9f9f9;
}

.settings-toggle {
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.settings-toggle:hover {
  color: var(--secondary);
}

.settings-content {
  margin-top: 15px;
  display: none;
}

.toggle-row {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
}

.json-toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: #f5f5f5;
  padding: 10px;
  border-radius: 6px;
  cursor: pointer;
  margin-bottom: 5px;
  font-weight: 600;
}

.json-toggle:hover {
  background-color: #f0f0f0;
}

.json-toggle-icon {
  font-weight: bold;
}

.arrow-down::after {
  content: "▼";
  font-size: 12px;
}

.arrow-up::after {
  content: "▲";
  font-size: 12px;
}

.instance-status {
  background-color: #f8f8f8;
  border-radius: 4px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-right: 10px;
  margin-bottom: 10px;
}

.status-indicator {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: inline-block;
}

.status-indicator.loading {
  border: 2px solid var(--primary);
  border-top-color: transparent;
  animation: spin 1s linear infinite;
}

.status-indicator.success {
  background-color: #28a745;
}

.status-indicator.error {
  background-color: #dc3545;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Styles for JSON Edit Modal */
.modal {
  display: none; /* Hidden by default */
  position: fixed; /* Stay in place */
  z-index: 1001; /* Sit on top */
  left: 0;
  top: 0;
  width: 100%; /* Full width */
  height: 100%; /* Full height */
  overflow: auto; /* Enable scroll if needed */
  background-color: rgba(0, 0, 0, 0.6); /* Black w/ opacity */
}

.modal-content {
  background-color: #fefefe;
  margin: 10% auto; /* 10% from the top and centered */
  padding: 25px;
  border: 1px solid #888;
  width: 70%; /* Could be more or less, depending on screen size */
  border-radius: 8px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
  position: relative; /* For positioning the close button */
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #eee;
  padding-bottom: 15px;
  margin-bottom: 15px;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.5em;
  color: var(--primary);
}

.close-btn {
  color: #aaa;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  border: none;
  background: none;
}

.close-btn:hover,
.close-btn:focus {
  color: black;
  text-decoration: none;
}

.modal-body textarea {
  width: 98%;
  height: 400px; /* Adjust as needed */
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: monospace;
  font-size: 14px;
  resize: vertical; /* Allow vertical resizing */
  margin-bottom: 15px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 15px;
  border-top: 1px solid #eee;
}

.modal-footer button {
  padding: 10px 20px;
  font-size: 14px;
}

.modal-footer .cancel-btn {
  background-color: #6c757d;
}
.modal-footer .cancel-btn:hover {
  background-color: #5a6268;
}

.modal-error {
  color: #dc3545;
  font-size: 14px;
  margin-top: 10px;
  display: none; /* Hidden by default */
}
