/* ═══════════════════════════════════════
   Agent Studio — Styles
   ═══════════════════════════════════════ */

:root {
  --studio-bg: #05070A;
  --studio-panel-bg: rgba(17, 24, 39, 0.4);
}

body {
  background-color: var(--studio-bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Top Bar ── */
.studio-topbar {
  display: flex;
  align-items: center;
  padding: 16px 32px;
  background: rgba(11, 15, 26, 0.8);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.studio-back {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  transition: color var(--transition);
}

.studio-back:hover {
  color: var(--text-primary);
}

.studio-logo {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-heading);
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--text-primary);
}

.studio-logo img {
  width: 32px;
  height: 32px;
  object-fit: cover;
  border-radius: 9px;
  box-shadow: 0 0 14px rgba(56, 189, 248, 0.25);
}

.studio-topbar-spacer {
  flex: 1;
}

/* ── Steps Nav ── */
.studio-steps-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 32px;
  background: var(--studio-bg);
}

.studio-step-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  opacity: 0.4;
  transition: all 0.3s ease;
  position: relative;
  z-index: 2;
}

.studio-step-tab.active {
  opacity: 1;
}

.studio-step-tab.completed {
  opacity: 0.8;
}

.studio-step-num {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.8rem;
  background: var(--bg-card);
  transition: all 0.3s ease;
}

.studio-step-tab.active .studio-step-num {
  border-color: var(--primary);
  color: var(--primary-light);
  box-shadow: 0 0 15px rgba(99, 102, 241, 0.3);
}

.studio-step-tab.completed .studio-step-num {
  border-color: var(--cta);
  background: var(--cta);
  color: #fff;
}

.studio-step-name {
  font-size: 0.75rem;
  font-family: var(--font-heading);
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
}

.studio-step-tab.active .studio-step-name {
  color: var(--text-primary);
}

.studio-step-connector {
  width: 100px;
  height: 2px;
  background: var(--border);
  margin: 0 20px;
  margin-bottom: 24px; /* Align with dots */
  transition: background 0.3s ease;
}

.studio-step-connector.completed {
  background: var(--cta);
}

/* ── Panels Loop ── */
.studio-panel {
  display: none;
  flex: 1;
  padding-bottom: 60px;
}

.studio-panel.active {
  display: block;
  animation: fade-in-up 0.5s ease;
}

.studio-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 32px;
}

.studio-heading {
  font-family: var(--font-heading);
  font-size: 2.2rem;
  margin-bottom: 16px;
}

.studio-desc {
  color: var(--text-secondary);
  font-size: 1.1rem;
  max-width: 700px;
  margin-bottom: 40px;
}

/* ── Step 1: Define Intent ── */
.studio-split {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 40px;
  align-items: start;
}

.studio-main {
  background: var(--studio-panel-bg);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 40px;
}

.studio-label {
  display: block;
  font-family: var(--font-heading);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.studio-input {
  width: 100%;
  padding: 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 1rem;
  outline: none;
  transition: all var(--transition);
}

.studio-input:focus {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.05);
}

.studio-textarea {
  min-height: 140px;
  resize: vertical;
}

.studio-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

.studio-form-group {
  margin-bottom: 24px;
}

.studio-select {
  width: 100%;
  padding: 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text-primary);
  font-family: var(--font-body);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394A3B8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  outline: none;
  cursor: pointer;
}

.studio-code-panel {
  background: #0D1117;
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  height: 520px;
  display: flex;
  flex-direction: column;
}

.studio-code-header {
  padding: 12px 20px;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: 'Exo 2', monospace;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.studio-code-badge {
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(99, 102, 241, 0.2);
  color: var(--primary-light);
}

.studio-code {
  flex: 1;
  padding: 20px;
  margin: 0;
  font-family: 'Exo 2', monospace;
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text-secondary);
  overflow: auto;
}

.studio-code-dim {
  opacity: 0.4;
}

.studio-code .keyword { color: #FF7B72; }
.studio-code .string { color: #A5D6FF; }
.studio-code .comment { color: #8B949E; }
.studio-code .property { color: #D2A8FF; }

.studio-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 40px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
}

/* ── Step 2: Training ── */
.train-grid {
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  gap: 32px;
}

.train-controls {
  background: var(--studio-panel-bg);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 32px;
}

.train-metrics {
  background: var(--studio-panel-bg);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.metrics-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.metric-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
}

.metric-label {
  font-family: var(--font-heading);
  font-size: 0.65rem;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.metric-value {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.metric-bar {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 2px;
  overflow: hidden;
}

.metric-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--primary);
  transition: width 0.3s ease;
}

.accuracy-bar { background: var(--cta); }
.loss-bar { background: #FF7B72; }

.train-log {
  flex: 1;
  background: #0D1117;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  font-family: 'Exo 2', monospace;
  font-size: 0.8rem;
  color: var(--text-secondary);
  height: 200px;
  overflow-y: auto;
}

.train-log-entry {
  margin-bottom: 6px;
  animation: fade-in-up 0.3s ease;
}

.train-log-entry.dim { opacity: 0.5; }
.train-log-entry.success { color: var(--cta); }

/* ── Step 3: Deployment ── */
.deploy-chain-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
}

.deploy-config-card {
  background: var(--studio-panel-bg);
  border: 1px solid var(--border);
  border-radius: 24px;
  overflow: hidden;
}

.deploy-config-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-heading);
  font-size: 0.9rem;
  color: var(--text-primary);
}

.deploy-config-body {
  padding: 24px;
}

.deploy-config-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 16px;
}

.deploy-config-key {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.deploy-config-val {
  color: var(--text-primary);
  font-weight: 500;
}

.deploy-progress-panel {
  background: var(--studio-panel-bg);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 32px;
  display: flex;
  flex-direction: column;
}

.deploy-progress-panel-title {
  font-family: var(--font-heading);
  font-size: 0.9rem;
  margin-bottom: 24px;
}

.deploy-chain-progress {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-bottom: 24px;
}

.chain-step {
  display: flex;
  gap: 16px;
  opacity: 0.3;
  transition: all 0.4s ease;
}

.chain-step.active {
  opacity: 1;
}

.chain-step.completed {
  opacity: 1;
}

.chain-step-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,0.03);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  flex-shrink: 0;
}

.chain-step.active .chain-step-icon {
  color: var(--primary);
  background: rgba(99, 102, 241, 0.1);
}

.chain-step.completed .chain-step-icon {
  color: var(--cta);
  background: rgba(16, 185, 129, 0.1);
}

.chain-step-title {
  font-weight: 600;
  font-size: 0.95rem;
}

.chain-step-detail {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.chain-overall-bar {
  width: 100%;
  height: 6px;
  background: rgba(255,255,255,0.05);
  border-radius: 3px;
  overflow: hidden;
}

.chain-overall-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--primary), var(--cta));
  transition: width 0.5s ease;
}

/* ── Step 4: Monitor ── */
.monitor-status-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 32px;
  background: rgba(16, 185, 129, 0.05);
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: 16px;
  margin-bottom: 32px;
}

.monitor-live-dot {
  width: 12px;
  height: 12px;
  background: var(--cta);
  border-radius: 50%;
  animation: pulse-glow 2s infinite;
}

.monitor-status-text {
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--text-primary);
}

.monitor-address {
  font-family: 'Exo 2', monospace;
  color: var(--cta);
  opacity: 0.8;
  font-size: 0.9rem;
}

.monitor-stats {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}

.monitor-stat {
  background: var(--studio-panel-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  text-align: center;
}

.monitor-stat-value {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.monitor-stat-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  color: var(--text-muted);
}

.monitor-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 32px;
}

.monitor-log-panel, .monitor-evolution-panel {
  background: var(--studio-panel-bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  overflow: hidden;
  height: 400px;
  display: flex;
  flex-direction: column;
}

.monitor-panel-header {
  padding: 16px 24px;
  background: rgba(255,255,255,0.02);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-heading);
  font-size: 0.8rem;
  color: var(--text-primary);
}

.monitor-log {
  flex: 1;
  padding: 20px;
  font-family: 'Exo 2', monospace;
  font-size: 0.85rem;
  color: var(--text-secondary);
  overflow-y: auto;
  line-height: 1.6;
}

.evolution-entries {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
}

.evolution-card {
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  animation: fade-in-up 0.4s ease forwards;
}

.evo-time {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.evo-msg {
  font-size: 0.85rem;
  color: var(--text-primary);
}

.evo-meta {
  margin-top: 8px;
  font-size: 0.75rem;
  color: var(--cta);
}

@media (max-width: 1024px) {
  .studio-split, .train-grid, .deploy-chain-grid, .monitor-grid {
    grid-template-columns: 1fr;
  }
  .monitor-stats {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 768px) {
  .studio-steps-nav {
    display: none;
  }
  .monitor-stats {
    grid-template-columns: repeat(2, 1fr);
  }
}
