.container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 60px); /* Viewport height minus top navbar */
  width: 100%;
  background: var(--bg-primary);
  overflow: hidden;
}

.header {
  padding: 1.5rem 2rem;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.title {
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.subtitle {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin: 0.25rem 0 0 0;
  flex: 1;
}

.refreshButton {
  padding: 0.5rem 1rem;
  background: var(--accent-color);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 500;
}

.refreshButton:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.flowContainer {
  flex: 1;
  width: 100%;
  min-height: 500px;
  position: relative;
  background: var(--bg-primary);
}

/* ReactFlow custom styling */
.flowContainer :global(.react-flow) {
  background: var(--bg-primary);
  width: 100%;
  height: 100%; /* Ensure React Flow fills the container */
}

.flowContainer :global(.react-flow__node) {
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 13px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  transition: all 0.2s;
}

.flowContainer :global(.react-flow__node:hover) {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.flowContainer :global(.react-flow__edge-path) {
  stroke-width: 2;
  stroke: var(--text-secondary);
}

.flowContainer :global(.react-flow__edge.animated .react-flow__edge-path) {
  stroke: var(--accent-color);
  stroke-width: 2.5;
}

.flowContainer :global(.react-flow__controls) {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.flowContainer :global(.react-flow__controls-button) {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
}

.flowContainer :global(.react-flow__controls-button:hover) {
  background: var(--bg-hover);
}

.flowContainer :global(.react-flow__minimap) {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
}

.flowContainer :global(.react-flow__background) {
  background: var(--bg-primary);
}

.flowContainer :global(.react-flow__attribution) {
  background: var(--bg-secondary);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 10px;
  color: var(--text-secondary);
}

/* Legend */
.legend {
  position: absolute;
  top: 80px;
  right: 20px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  max-width: 200px;
  z-index: 10;
}

.legend h3 {
  margin: 0 0 0.75rem 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
}

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

.legendItem {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.legendColor {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  flex-shrink: 0;
  border: 1px solid rgba(0, 0, 0, 0.2);
}

/* Loading state */
.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-secondary);
}

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--border-color);
  border-top-color: var(--accent-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 1rem;
}

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

.loading p {
  font-size: 1rem;
  margin: 0;
}

/* Error state */
.error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-secondary);
  padding: 2rem;
  text-align: center;
}

.errorIcon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.error p {
  font-size: 1rem;
  margin: 0 0 1.5rem 0;
  color: var(--text-primary);
}

.retryButton {
  padding: 0.75rem 1.5rem;
  background: var(--accent-color);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 500;
}

.retryButton:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .header {
    flex-direction: column;
    align-items: flex-start;
  }

  .legend {
    position: static;
    margin: 1rem;
    max-width: none;
  }

  .title {
    font-size: 1.5rem;
  }

  .subtitle {
    font-size: 0.85rem;
  }
}

