:root {
  --bg-primary: #0a0a0a;
  --bg-secondary: #111111;
  --bg-elevated: #1a1a1a;
  --bg-card: rgba(255, 255, 255, 0.03);
  --bg-card-hover: rgba(255, 255, 255, 0.06);

  --border-color: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(255, 255, 255, 0.15);

  --text-primary: #ffffff;
  --text-secondary: rgba(255, 255, 255, 0.7);
  --text-tertiary: rgba(255, 255, 255, 0.5);

  --accent-blue: #0078D4;
  --accent-blue-light: #50A8E8;
  --accent-blue-glow: rgba(0, 120, 212, 0.3);

  --success: #00ff88;
  --warning: #ffaa00;
  --error: #EF4444;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
    'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
    sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Agent pulse animation when ACTIVE */
@keyframes pulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(0, 120, 212, 0.4);
  }
  50% {
    box-shadow: 0 0 0 15px rgba(0, 120, 212, 0);
  }
}

/* Agent processing spinner */
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Particle flow along path */
@keyframes flowParticle {
  0% {
    offset-distance: 0%;
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  90% {
    opacity: 1;
  }
  100% {
    offset-distance: 100%;
    opacity: 0;
  }
}

/* Typing effect */
@keyframes typing {
  from { width: 0; }
  to { width: 100%; }
}

@keyframes blink-caret {
  from, to { border-color: transparent; }
  50% { border-color: var(--accent-blue); }
}

/* Fade in */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInFast {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Scale in */
@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Glow effect for active agents */
.agent-active {
  animation: pulse 2s infinite;
  border-color: var(--accent-blue) !important;
  box-shadow: 0 0 20px rgba(0, 120, 212, 0.5);
}

/* Processing state */
.agent-processing {
  position: relative;
}

.agent-processing .spinner {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 24px;
  height: 24px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--accent-blue);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* Complete state */
.agent-complete {
  border-color: var(--success) !important;
  box-shadow: 0 0 15px rgba(0, 255, 136, 0.3);
}

/* Error state */
.agent-error {
  border-color: var(--error) !important;
  box-shadow: 0 0 15px rgba(239, 68, 68, 0.3);
}

/* Inactive state */
.agent-inactive {
  opacity: 0.4;
  border-color: rgba(255, 255, 255, 0.1) !important;
}

/* SVG Connections */
.connection-line {
  stroke: var(--border-color);
  stroke-width: 2;
  fill: none;
  transition: stroke 0.3s ease;
}

.connection-line.active {
  stroke: var(--accent-blue);
  stroke-width: 3;
  filter: drop-shadow(0 0 8px var(--accent-blue-glow));
}

/* Particle animation */
.particle {
  r: 4;
  fill: var(--accent-blue);
  filter: drop-shadow(0 0 4px var(--accent-blue));
  animation: flowParticle 2s ease-in-out infinite;
}

/* Cards and panels */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  transition: all 0.3s ease;
}

.card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
}

/* Buttons */
.btn {
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  font-weight: 500;
  transition: all 0.2s ease;
  cursor: pointer;
  border: none;
  outline: none;
}

.btn-primary {
  background: var(--accent-blue);
  color: white;
}

.btn-primary:hover {
  background: var(--accent-blue-light);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 120, 212, 0.3);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
  color: var(--text-primary);
}

/* Input fields */
.input {
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  color: var(--text-primary);
  width: 100%;
  transition: all 0.2s ease;
  outline: none;
}

.input:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px var(--accent-blue-glow);
}

.input::placeholder {
  color: var(--text-tertiary);
}

/* Modal backdrop */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(4px);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeInFast 0.2s ease;
}

.modal-content {
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  max-width: 800px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  animation: scaleIn 0.3s ease;
}

/* Agent message badge */
.agent-message {
  position: absolute;
  bottom: -30px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-elevated);
  border: 1px solid var(--accent-blue);
  border-radius: 6px;
  padding: 0.25rem 0.75rem;
  font-size: 0.7rem;
  white-space: nowrap;
  color: var(--accent-blue);
  animation: fadeIn 0.3s ease;
  z-index: 10;
}

/* SQL code block */
.sql-code {
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1rem;
  font-family: 'Courier New', monospace;
  font-size: 0.875rem;
  color: var(--accent-blue-light);
  overflow-x: auto;
  white-space: pre-wrap;
  word-wrap: break-word;
}

/* Metric cards */
.metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1rem;
}

.metric-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--accent-blue);
  font-variant-numeric: tabular-nums;
}

.metric-label {
  font-size: 0.875rem;
  color: var(--text-tertiary);
  margin-top: 0.25rem;
}

/* Agent collaboration indicator */
.collaboration-line {
  stroke: var(--warning);
  stroke-width: 2;
  stroke-dasharray: 5, 5;
  animation: dash 1s linear infinite;
}

@keyframes dash {
  to {
    stroke-dashoffset: -10;
  }
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
  background: var(--bg-elevated);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* Responsive Design */
@media (min-width: 1024px) {
  .architecture-viz {
    flex-direction: column;
  }

  .agent {
    min-width: 100px;
    min-height: 100px;
  }

  .agent-icon {
    font-size: 2rem;
  }

  .agent-label {
    font-size: 0.875rem;
  }
}

@media (min-width: 768px) and (max-width: 1023px) {
  .architecture-viz {
    flex-direction: column;
  }

  .panels {
    flex-direction: row;
  }

  .agent {
    min-width: 80px;
    min-height: 80px;
  }

  .agent-icon {
    font-size: 1.75rem;
  }

  .agent-label {
    font-size: 0.75rem;
  }
}

@media (max-width: 767px) {
  .architecture-viz {
    flex-direction: column;
  }

  .panels {
    flex-direction: column;
  }

  .agent {
    min-width: 70px;
    min-height: 70px;
  }

  .agent-icon {
    font-size: 1.5rem;
  }

  .agent-label {
    font-size: 0.7rem;
  }

  .modal-content {
    width: 95%;
  }

  .metric-value {
    font-size: 1.5rem;
  }

  .btn {
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
  }
}

/* Animation utilities */
.fade-in {
  animation: fadeIn 0.5s ease;
}

.scale-in {
  animation: scaleIn 0.3s ease;
}

/* Text utilities */
.text-gradient {
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-blue-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Divider */
.divider {
  height: 1px;
  background: var(--border-color);
  margin: 1rem 0;
}

/* Accuracy indicator */
.accuracy-bar {
  width: 100%;
  height: 6px;
  background: var(--bg-elevated);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 0.5rem;
}

.accuracy-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--warning), var(--accent-blue), var(--success));
  transition: width 0.5s ease;
}

/* Chart preview */
.chart-preview {
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1rem;
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
}
