:root {
  --primary-color: #2d5084;
  --accent-color: #ff6beb;
  --light-bg: #f8f9fa;
  --dark-text: #343a40;
  --light-text: #f8f9fa;
  --border-color: #dee2e6;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  margin: 0;
  padding: 0;
  color: var(--dark-text);
  background-color: var(--light-bg);
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

header {
  background-color: var(--primary-color);
  color: var(--light-text);
  padding: 0.4rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.logo {
  width: 50px;
  height: 50px;
  background-color: var(--light-text);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: var(--primary-color);
}

.title-container {
  display: flex;
  align-items: center;
}

.title-container h1 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: normal;
}

.big-letter {
  font-size: 1.2rem;
  font-weight: bold;
}

/* Replace the 'o' in Golem with robot icon */
.robot-icon {
  position: relative;
  font-size: 0;
}

.robot-icon::before {
  content: "\f544"; /* fa-robot unicode */
  font-family: "Font Awesome 5 Free";
  font-weight: 900;
  font-size: 0.7rem;
  position: relative;
  color: var(--light-text);
}

.title-container p {
  margin: 0.25rem 0 0;
  font-size: 0.9rem;
  opacity: 0.9;
}

.header-btn {
  margin: 0;
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
}

/* Examples dropdown in header */
.examples-dropdown {
  position: relative;
  display: inline-block;
}

.examples-btn {
  background-color: var(--primary-color);
  color: var(--light-text);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  cursor: pointer;
}

.examples-btn:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.examples-content {
  display: none;
  position: absolute;
  right: 0;
  background-color: white;
  min-width: 200px;
  box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
  z-index: 1;
  max-height: 300px;
  overflow-y: auto;
  border-radius: 4px;
}

.examples-dropdown:hover .examples-content {
  display: block;
}

.examples-content button {
  display: block;
  width: 100%;
  padding: 0.5rem 1rem;
  text-align: left;
  background-color: white;
  border: none;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  transition: background-color 0.2s;
}

.examples-content button:hover {
  background-color: var(--light-bg);
}

.examples-content button:last-child {
  border-bottom: none;
}

main {
  flex: 1;
  display: flex;
  overflow: hidden;
}

.split-pane {
  display: flex;
  width: 100%;
  height: 100%;
}

.pane {
  /* height: 100%;
  overflow: auto; */
  display: flex;
  flex-direction: column;
}

.left-pane {
  flex: 0.4;
  border-right: 1px solid var(--border-color);
  background-color: white;
}

.right-pane {
  flex: 0.6;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.resizer {
  width: 6px;
  background-color: var(--border-color);
  cursor: col-resize;
  transition: background-color 0.2s;
  flex-shrink: 0;
}

.resizer:hover, .resizer.resizing {
  background-color: var(--accent-color);
}

.code-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 1rem;
  overflow: hidden;
  min-width: 0;
}

.code-editor {
  width: 100%;
  flex: 1;
  font-family: monospace;
  padding: 1rem;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  resize: none;
  font-size: 0.75rem;
  line-height: 1.5;
  margin-bottom: 1rem;
  overflow: auto;
}

.optimize-btn {
  background-color: var(--accent-color);
  color: white;
  border: none;
  border-radius: 4px;
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
  transition: background-color 0.2s;
  align-self: center;
  display: inline-block;
  margin: 0 0.25rem;
  vertical-align: middle;
}

.optimize-btn:hover {
  background-color: #e05555;
}

.optimize-btn:disabled {
  background-color: #ccc;
  cursor: not-allowed;
}

/* Pulse animation for the optimize button */
@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.7);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(231, 76, 60, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(231, 76, 60, 0);
  }
}

.pulse-until-click {
  animation: pulse 1.5s infinite;
}

.stop-btn {
  background-color: #e74c3c;
  color: white;
  border: none;
  border-radius: 4px;
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
  transition: background-color 0.2s;
  align-self: center;
}

.stop-btn:hover {
  background-color: #c0392b;
}

.stop-btn:disabled {
  background-color: #ccc;
  cursor: not-allowed;
}

.mermaid-container {
  flex: 1;
  overflow: auto;
  display: flex;
  justify-content: center;
  align-items: center;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background-color: white;
  min-width: 0;
  min-height: 300px;
  padding: 1rem;
  position: relative;
}

.mermaid {
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
}

.mermaid svg.mermaid-svg {
  max-width: 100%;
  max-height: 100%;
  width: auto !important;
  height: auto !important;
  object-fit: contain;
  display: block;
  margin: 0 auto;
}

/* Intersection marker styles */
.intersection-markers circle {
  stroke: none;
  pointer-events: none;
  transform-origin: center;
  transform-box: fill-box;
}

.edge-edge-marker {
  fill: red;
  opacity: 0.8;
}

.edge-node-marker {
  fill: blue;
  opacity: 0.8;
}

/* Ensure markers scale properly with zoom */
.intersection-markers {
  transform-origin: center;
  transform-box: fill-box;
  vector-effect: non-scaling-stroke;
}

/* Ensure the SVG container preserves aspect ratio */
.mermaid-container .mermaid {
  aspect-ratio: auto;
  min-height: 200px;
}

.optimization-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px;
  padding: 15px;
  background-color: #f5f5f5;
  border-top: 1px solid #ddd;
  overflow: auto;
  max-height: 40vh;
}

.stat-card {
  background-color: white;
  border-radius: 8px;
  padding: 15px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
}

.primary-score {
  grid-column: 1 / -1;
  background-color: #f0f8ff;
  transition: all 0.3s ease;
}

.primary-score.success {
  background-color: #e6ffe6;
  box-shadow: 0 0 15px rgba(0, 204, 102, 0.5);
}

.primary-score h3 {
  color: #0066cc;
  margin-bottom: 10px;
}

.score-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 5px;
  flex-wrap: wrap;
  gap: 10px;
}

.primary-score p {
  font-size: 18px;
  font-weight: bold;
  margin: 0;
  color: #0066cc;
}

.score-counters {
  display: flex;
  gap: 5px;
  font-size: 14px;
  color: #555;
  flex-wrap: wrap;
}

.score-counters span {
  background-color: rgba(0, 102, 204, 0.1);
  padding: 4px 4px;
  border-radius: 4px;
  white-space: nowrap;
}

.score-breakdown {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
  margin-top: 2px;
}

.score-item {
  background-color: #e6f2ff;
  padding: 12px;
  border-radius: 6px;
  font-size: 12px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  transition: all 0.2s ease;
}

.score-item:hover {
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.15);
  transform: translateY(-2px);
}

.score-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  padding-bottom: 5px;
  border-bottom: 1px solid rgba(0, 102, 204, 0.2);
}

.score-header span:last-child {
  font-weight: bold;
  color: #0066cc;
  display: flex;
  align-items: center;
  gap: 5px;
}

.score-header span:last-child span {
  display: inline-block;
}

.score-header span:last-child span + span {
  margin-left: 3px;
}

.score-plus {
  color: #999;
  margin: 0 3px;
  font-size: 10px;
  position: relative;
  top: -1px;
}

.score-label {
  font-weight: bold;
  color: #0066cc;
}

.score-details {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  font-size: 11px;
}

.detail-row span {
  white-space: nowrap;
}

.detail-row span + span {
  margin-left: 10px;
}

.weight-control {
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  min-width: 110px;
}

.weight-control label {
  font-size: 11px;
  color: #666;
}

.weight-control input {
  width: 60px;
  padding: 2px 4px;
  border: 1px solid #ccc;
  border-radius: 3px;
  font-size: 11px;
}

.optimization-progress {
  grid-column: 1 / -1;
}

.stat-card h3 {
  margin: 0 0 8px 0;
  font-size: 14px;
  color: #555;
}

.stat-details {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 13px;
}

.overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.dialog {
  background-color: white;
  border-radius: 8px;
  padding: 2rem;
  max-width: 400px;
  text-align: center;
}

.dialog h2 {
  margin-top: 0;
}

.intersection-dot {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.edge-edge {
  background: red;
}

.edge-node {
  background: blue;
} 