/* dashboard.css — CrewTube pipeline dashboard styles */

/* ===== NAV ===== */
.dash-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10,10,15,0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
}
.dash-nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.dash-logo {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--fg);
  text-decoration: none;
  letter-spacing: -0.02em;
}
.dash-logo:hover { color: var(--accent-light); }
.dash-nav-tag {
  font-size: 0.75rem;
  color: var(--fg-dim);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 3px 10px;
}

/* ===== MAIN ===== */
.dash-main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 40px 24px 80px;
  display: flex;
  flex-direction: column;
  gap: 48px;
}

/* ===== TRIGGER PANEL ===== */
.trigger-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px;
}
.panel-title {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}
.panel-sub {
  color: var(--fg-muted);
  font-size: 0.95rem;
  margin-bottom: 28px;
}
.trigger-form {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.topic-input {
  flex: 1;
  min-width: 240px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 0.95rem;
  padding: 12px 16px;
  outline: none;
  transition: border-color 0.2s;
}
.topic-input:focus { border-color: var(--accent); }
.topic-input::placeholder { color: var(--fg-dim); }
.run-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 12px 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background 0.2s, transform 0.1s;
  white-space: nowrap;
}
.run-btn:hover { background: #7c6ef5; }
.run-btn:active { transform: scale(0.98); }
.run-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-icon { font-size: 0.8rem; }
.trigger-error {
  margin-top: 12px;
  color: var(--pink);
  font-size: 0.85rem;
}

/* ===== ACTIVE RUN ===== */
.active-section {
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.active-header {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.active-title {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 600;
}
.active-title span {
  color: var(--accent-light);
}

/* ===== BADGES ===== */
.run-badge, .stage-badge {
  font-size: 0.72rem;
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 100px;
}
.badge-pending  { background: var(--bg-elevated); color: var(--fg-dim); border: 1px solid var(--border); }
.badge-running  { background: rgba(108,92,231,0.15); color: var(--accent-light); border: 1px solid var(--accent-glow); }
.badge-completed{ background: rgba(0,230,118,0.1); color: var(--green); border: 1px solid rgba(0,230,118,0.3); }
.badge-failed   { background: rgba(245,0,87,0.1); color: var(--pink); border: 1px solid rgba(245,0,87,0.3); }

/* ===== STAGES GRID ===== */
.stages-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}
.stage-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  transition: border-color 0.3s;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.stage-card.is-running  { border-color: var(--accent); }
.stage-card.is-completed{ border-color: rgba(0,230,118,0.3); }
.stage-card.is-failed   { border-color: rgba(245,0,87,0.3); }

.stage-header {
  display: flex;
  align-items: center;
  gap: 10px;
}
.stage-icon { font-size: 1.1rem; }
.stage-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.95rem;
  flex: 1;
}
.stage-output {
  font-size: 0.82rem;
  color: var(--fg-muted);
  line-height: 1.6;
  max-height: 300px;
  overflow-y: auto;
}
.stage-waiting {
  color: var(--fg-dim);
  font-style: italic;
}
.stage-spinner {
  display: inline-block;
  animation: spin 1s linear infinite;
  margin-right: 6px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Stage output blocks */
.out-section { margin-bottom: 14px; }
.out-label {
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--fg-dim);
  margin-bottom: 6px;
}
.out-value { color: var(--fg); }
.out-list { list-style: none; padding: 0; }
.out-list li { padding: 3px 0; padding-left: 14px; position: relative; }
.out-list li::before { content: '›'; position: absolute; left: 0; color: var(--accent-light); }
.out-code {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 14px;
  white-space: pre-wrap;
  font-size: 0.8rem;
  color: var(--fg);
  max-height: 200px;
  overflow-y: auto;
}
.out-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.out-tag {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 2px 10px;
  font-size: 0.75rem;
  color: var(--fg-muted);
}
.stage-error {
  color: var(--pink);
  font-size: 0.82rem;
  background: rgba(245,0,87,0.05);
  border: 1px solid rgba(245,0,87,0.2);
  border-radius: 6px;
  padding: 10px;
}

/* ===== HISTORY ===== */
.history-section { display: flex; flex-direction: column; gap: 16px; }
.history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.section-title-sm {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
}
.refresh-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--fg-muted);
  border-radius: 8px;
  font-size: 0.82rem;
  padding: 6px 14px;
  cursor: pointer;
  font-family: var(--font-body);
  transition: border-color 0.2s, color 0.2s;
}
.refresh-btn:hover { border-color: var(--accent); color: var(--accent-light); }
.runs-list { display: flex; flex-direction: column; gap: 10px; }
.runs-empty {
  color: var(--fg-dim);
  font-size: 0.9rem;
  text-align: center;
  padding: 32px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.run-row {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  cursor: pointer;
  transition: border-color 0.2s;
}
.run-row:hover { border-color: rgba(108,92,231,0.4); }
.run-topic { flex: 1; font-size: 0.9rem; color: var(--fg); font-weight: 500; }
.run-meta {
  font-size: 0.78rem;
  color: var(--fg-dim);
  white-space: nowrap;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .stages-grid { grid-template-columns: 1fr; }
  .trigger-form { flex-direction: column; }
  .run-btn { width: 100%; justify-content: center; }
  .trigger-panel { padding: 28px 20px; }
}
