/* Pipeline Page Styles */

.pipeline-wrap {
  max-width: 900px;
  margin: 0 auto;
  padding: 48px 24px 80px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.step-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
}

.step-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.step-num {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--bg);
  font-family: 'DM Serif Display', serif;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.step-header h2 {
  font-family: 'DM Serif Display', serif;
  font-size: 24px;
  color: var(--fg);
}

/* Niche Grid */
.niche-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.niche-loading {
  color: var(--fg-muted);
  font-size: 14px;
  padding: 16px 0;
}

.niche-chip {
  background: rgba(201, 168, 76, 0.08);
  border: 1px solid var(--accent-dim);
  border-radius: 8px;
  padding: 12px 16px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
  text-align: left;
}

.niche-chip:hover {
  background: rgba(201, 168, 76, 0.15);
  border-color: var(--accent);
  transform: translateY(-1px);
}

.niche-chip.selected {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg);
}

.niche-chip .chip-name {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
}

.niche-chip .chip-desc {
  font-size: 12px;
  opacity: 0.7;
  line-height: 1.4;
}

/* Custom Niche Input */
.custom-niche-row {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
}

.niche-input {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--fg);
  font-size: 14px;
  font-family: 'DM Sans', sans-serif;
  padding: 12px 16px;
  outline: none;
  transition: border-color 0.15s;
}

.niche-input:focus {
  border-color: var(--accent);
}

.niche-input::placeholder {
  color: var(--fg-muted);
}

/* Buttons */
.btn-primary {
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: 8px;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 600;
  padding: 12px 20px;
  cursor: pointer;
  transition: opacity 0.15s;
  white-space: nowrap;
}

.btn-primary:hover { opacity: 0.85; }

.btn-generate {
  width: 100%;
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: 10px;
  font-family: 'DM Sans', sans-serif;
  font-size: 16px;
  font-weight: 600;
  padding: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: opacity 0.15s, transform 0.1s;
}

.btn-generate:hover:not(:disabled) { opacity: 0.88; transform: translateY(-1px); }
.btn-generate:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.btn-secondary {
  background: rgba(240, 237, 232, 0.06);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  padding: 10px 20px;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-secondary:hover { background: rgba(240, 237, 232, 0.12); }

/* Spinner */
.spin {
  animation: spin 0.8s linear infinite;
}

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

.hidden { display: none !important; }

/* Output Section */
.output-niche-label {
  font-size: 13px;
  color: var(--fg-muted);
  margin-bottom: 20px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.output-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

@media (max-width: 640px) {
  .output-grid { grid-template-columns: 1fr; }
}

.output-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.output-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.output-badge {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  padding: 4px 10px;
  border-radius: 4px;
}

.output-badge.youtube { background: rgba(255,0,0,0.15); color: #ff6b6b; }
.output-badge.tweet   { background: rgba(29,155,240,0.15); color: #5dadec; }

.btn-copy {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--fg-muted);
  font-size: 12px;
  padding: 4px 10px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.btn-copy:hover { color: var(--fg); border-color: var(--fg-muted); }
.btn-copy.copied { color: #4caf50; border-color: #4caf50; }

.output-body {
  padding: 20px 16px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--fg);
  max-height: 420px;
  overflow-y: auto;
}

.tweet-body {
  font-size: 14px;
  color: #c8e6ff;
  line-height: 1.6;
}

.output-body::-webkit-scrollbar { width: 4px; }
.output-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* Monetization Bar */
.monetization-bar {
  border-top: 1px solid var(--border);
  padding: 12px 16px;
  background: rgba(201, 168, 76, 0.04);
}

.monetize-label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg-muted);
  margin-bottom: 8px;
}

.affiliate-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.affiliate-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--fg-muted);
}

.affiliate-item .af-badge {
  background: rgba(201, 168, 76, 0.2);
  color: var(--accent);
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 3px;
  letter-spacing: 0.03em;
}

.affiliate-item a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.affiliate-item a:hover { text-decoration: underline; }

.no-affiliate {
  font-size: 12px;
  color: var(--fg-muted);
  font-style: italic;
}

.output-actions {
  display: flex;
  gap: 12px;
}

/* Error Banner */
.error-banner {
  background: rgba(255, 80, 80, 0.12);
  border: 1px solid rgba(255, 80, 80, 0.3);
  border-radius: 8px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 14px;
  color: #ff8080;
}

.error-close {
  background: none;
  border: none;
  color: #ff8080;
  font-size: 18px;
  cursor: pointer;
  padding: 0 4px;
}

/* Visual cue highlights */
.visual-cue {
  color: #7dd3fc;
  font-style: italic;
}

/* ── Generate Video CTA ──────────────────────────────────────────────── */

.video-cta-row {
  margin: 24px 0 8px;
}

.btn-generate-video {
  width: 100%;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  border: 1px solid var(--accent);
  color: var(--accent);
  border-radius: 10px;
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  font-weight: 600;
  padding: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
  box-shadow: 0 0 0 0 rgba(201, 168, 76, 0);
}

.btn-generate-video:hover:not(:disabled) {
  background: linear-gradient(135deg, #1f2346 0%, #1a2850 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 24px rgba(201, 168, 76, 0.2);
}

.btn-generate-video:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* ── Video Progress Pipeline ─────────────────────────────────────────── */

.video-progress-wrap {
  padding: 8px 0 24px;
}

.pipeline-stages {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

@media (max-width: 640px) {
  .pipeline-stages {
    grid-template-columns: repeat(3, 1fr);
  }
}

.pipeline-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  opacity: 0.45;
  transition: opacity 0.3s;
}

.pipeline-stage.done,
.pipeline-stage.active {
  opacity: 1;
}

.stage-icon {
  font-size: 22px;
  line-height: 1;
}

.stage-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--fg-muted);
  text-align: center;
}

.pipeline-stage.done .stage-label {
  color: var(--accent);
}

.stage-bar {
  width: 100%;
  height: 4px;
  background: rgba(255,255,255,0.08);
  border-radius: 2px;
  overflow: hidden;
}

.stage-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.4s ease;
}

.pipeline-stage.done .stage-fill {
  background: #4caf50;
}

.progress-status-text {
  text-align: center;
  font-size: 13px;
  color: var(--fg-muted);
  font-style: italic;
  min-height: 20px;
}

/* ── Video Player ─────────────────────────────────────────────────────── */

.video-player-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 8px 0;
}

#video-player {
  width: 100%;
  max-width: 360px;
  aspect-ratio: 9 / 16;
  border-radius: 16px;
  background: #000;
  display: block;
}

.video-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

.btn-download {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--accent);
  color: var(--bg);
  text-decoration: none;
  border-radius: 8px;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 600;
  padding: 10px 20px;
  transition: opacity 0.15s;
}

.btn-download:hover { opacity: 0.85; }

/* ── Video Error ──────────────────────────────────────────────────────── */

.video-error-wrap {
  background: rgba(255, 80, 80, 0.08);
  border: 1px solid rgba(255, 80, 80, 0.25);
  border-radius: 10px;
  padding: 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.video-error-msg {
  color: #ff8080;
  font-size: 14px;
}