/* project-setup-wizard.css
   Project Setup Wizard — layout and component styles.
   Uses only CSS variables defined in style.css / theme system.
   No external libraries, no Tailwind.
*/

/* ─── Container ──────────────────────────────────────────────────────────────── */

.wizard-container {
  max-width: 720px;
  margin: 0 auto;
  padding: var(--space-6, 24px) var(--space-4, 16px) var(--space-8, 32px);
}

/* ─── Header bar ─────────────────────────────────────────────────────────────── */

.wizard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4, 16px);
  margin-bottom: var(--space-6, 24px);
  flex-wrap: wrap;
}

.wizard-header-left {
  display: flex;
  align-items: center;
  gap: var(--space-3, 12px);
}

.wizard-title {
  font-size: 20px;
  font-weight: 600;
  margin: 0;
  color: var(--text-color, #1e293b);
  line-height: 1.2;
}

.wizard-subtitle {
  font-size: 13px;
  color: var(--text-secondary, #64748b);
  margin: 2px 0 0;
}

/* ─── Step indicator dots ────────────────────────────────────────────────────── */

.wizard-steps-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.wizard-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--border-color, #e2e8f0);
  transition: background 0.2s ease, transform 0.2s ease;
  cursor: default;
}

.wizard-dot.active {
  background: var(--primary-color, var(--accent-500, #6366f1));
  transform: scale(1.3);
}

.wizard-dot.completed {
  background: var(--primary-color-60, color-mix(in srgb, var(--primary-color, #6366f1) 60%, transparent));
}

/* ─── Step card ──────────────────────────────────────────────────────────────── */

.wizard-step {
  background: var(--card-bg, var(--surface, #fff));
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 12px;
  padding: var(--space-6, 24px);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

.wizard-step-heading {
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 8px;
  color: var(--text-color, #1e293b);
}

.wizard-step-description {
  font-size: 14px;
  color: var(--text-secondary, #64748b);
  margin: 0 0 24px;
  line-height: 1.6;
}

/* ─── Step 1 — Page rows ─────────────────────────────────────────────────────── */

.wizard-page-rows {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

/* .wizard-page-row and .wizard-title-input / .wizard-remove-btn base rules
   are now defined in the "Page card" section below (after the blueprint insight
   banner). The new rules provide a card-style layout with section chip previews.
   These placeholder rules are intentionally empty to avoid overriding the
   new definitions lower in the file. */

.wizard-add-btn {
  background: none;
  border: 1px dashed var(--border-color, #e2e8f0);
  border-radius: 6px;
  padding: 8px 14px;
  font-size: 13px;
  color: var(--primary-color, #6366f1);
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, border-color 0.15s;
  width: 100%;
  text-align: left;
  margin-bottom: 24px;
}

.wizard-add-btn:hover {
  background: color-mix(in srgb, var(--primary-color, #6366f1) 5%, transparent);
  border-color: var(--primary-color, #6366f1);
}

/* ─── Step actions row ──────────────────────────────────────────────────────── */

.wizard-step-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  margin-top: 24px;
}

.wizard-step-actions--complete {
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.wizard-cta-btn {
  min-width: 180px;
}

/* ─── Step 2 — Upload zone ──────────────────────────────────────────────────── */

.wizard-upload-zone {
  border: 2px dashed var(--border-color, #e2e8f0);
  border-radius: 10px;
  min-height: 160px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 28px 20px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  text-align: center;
  background: var(--bg-subtle, #f8fafc);
  margin-bottom: 20px;
}

.wizard-upload-zone:hover,
.wizard-upload-zone:focus {
  border-color: var(--primary-color, #6366f1);
  background: color-mix(in srgb, var(--primary-color, #6366f1) 3%, var(--bg-subtle, #f8fafc));
  outline: none;
}

.wizard-upload-zone.drag-over {
  border-color: var(--primary-color, #6366f1);
  background: color-mix(in srgb, var(--primary-color, #6366f1) 6%, var(--bg-subtle, #f8fafc));
}

.wizard-upload-zone-icon {
  font-size: 32px;
  color: var(--text-secondary, #64748b);
}

.wizard-upload-zone-text {
  font-size: 14px;
  color: var(--text-secondary, #64748b);
  margin: 0;
}

.wizard-upload-zone-hint {
  font-size: 12px;
  color: var(--text-muted, #94a3b8);
  margin: 0;
}

/* ─── Upload progress items (mirrors .upload-progress-item) ─────────────────── */

.wizard-upload-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 4px;
}

.wizard-progress-item {
  padding: 10px 12px;
  background: var(--bg-subtle, #f8fafc);
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 6px;
}

.wizard-progress-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.wizard-filename-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-color, #1e293b);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 280px;
}

.wizard-pct-label {
  font-size: 12px;
  color: var(--text-secondary, #64748b);
  min-width: 36px;
  text-align: right;
  flex-shrink: 0;
}

.wizard-bar-track {
  height: 4px;
  background: var(--border-color, #e2e8f0);
  border-radius: 2px;
  overflow: hidden;
}

.wizard-bar-fill {
  height: 100%;
  background: var(--primary-color, #6366f1);
  border-radius: 2px;
  transition: width 0.2s ease;
  width: 0%;
}

/* ─── Skip + secondary links ─────────────────────────────────────────────────── */

.wizard-skip-link,
.wizard-secondary-link {
  font-size: 13px;
  color: var(--text-secondary, #64748b);
  text-decoration: underline;
  text-decoration-color: transparent;
  transition: color 0.15s, text-decoration-color 0.15s;
  cursor: pointer;
}

.wizard-skip-link:hover,
.wizard-secondary-link:hover {
  color: var(--text-color, #1e293b);
  text-decoration-color: currentColor;
}

/* ─── Step 3 — Generating ───────────────────────────────────────────────────── */

.wizard-step--generating {
  text-align: center;
  padding: var(--space-8, 32px) var(--space-6, 24px);
}

.wizard-generating-icon {
  font-size: 36px;
  color: var(--primary-color, #6366f1);
  margin-bottom: 16px;
}

.wizard-gen-status-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-top: 28px;
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 8px;
  overflow: hidden;
  text-align: left;
}

.wizard-gen-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  gap: 12px;
  border-bottom: 1px solid var(--border-color, #e2e8f0);
  background: var(--card-bg, #fff);
}

.wizard-gen-item:last-child {
  border-bottom: none;
}

.wizard-gen-item-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-color, #1e293b);
}

.wizard-gen-item-status {
  font-size: 13px;
  font-weight: 500;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.wizard-gen-status--queued {
  color: var(--text-muted, #94a3b8);
}

.wizard-gen-status--creating {
  color: var(--primary-color, #6366f1);
}

.wizard-gen-status--done {
  color: #10b981;
}

.wizard-gen-status--failed {
  color: var(--text-error, #ef4444);
}

.wizard-retry-btn {
  font-size: 12px;
  padding: 3px 10px;
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 4px;
  background: transparent;
  color: var(--primary-color, #6366f1);
  cursor: pointer;
  font-family: inherit;
  font-weight: 500;
  transition: background 0.15s;
}

.wizard-retry-btn:hover:not(:disabled) {
  background: color-mix(in srgb, var(--primary-color, #6366f1) 8%, transparent);
}

.wizard-retry-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ─── Step 4 — Complete ─────────────────────────────────────────────────────── */

.wizard-step--complete {
  text-align: center;
  padding: var(--space-8, 32px) var(--space-6, 24px);
}

.wizard-success-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: color-mix(in srgb, #10b981 12%, transparent);
  color: #10b981;
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
}

.wizard-success-list {
  list-style: none;
  padding: 0;
  margin: 24px 0;
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 8px;
  overflow: hidden;
  text-align: left;
}

.wizard-success-item {
  border-bottom: 1px solid var(--border-color, #e2e8f0);
}

.wizard-success-item:last-child {
  border-bottom: none;
}

.wizard-success-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 16px;
  gap: 12px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-color, #1e293b);
  text-decoration: none;
  transition: background 0.15s;
  background: var(--card-bg, #fff);
}

.wizard-success-link:hover {
  background: var(--bg-hover, var(--bg-subtle, #f8fafc));
  color: var(--primary-color, #6366f1);
}

.wizard-success-link i {
  color: var(--text-muted, #94a3b8);
  font-size: 12px;
  transition: color 0.15s, transform 0.15s;
}

.wizard-success-link:hover i {
  color: var(--primary-color, #6366f1);
  transform: translateX(2px);
}

/* ─── Upgrade gate ───────────────────────────────────────────────────────────── */

.wizard-upgrade-gate {
  text-align: center;
  padding: var(--space-8, 32px) var(--space-6, 24px);
}

.wizard-lock-icon {
  font-size: 40px;
  margin-bottom: 16px;
  display: block;
}

/* ─── Blueprint loading state ───────────────────────────────────────────────── */

.wizard-blueprint-loading {
  text-align: center;
  padding: var(--space-10, 40px) var(--space-6, 24px) var(--space-8, 32px);
}

.wizard-blueprint-loading-icon {
  font-size: 40px;
  color: var(--primary-color, #6366f1);
  margin-bottom: 20px;
  display: block;
  animation: wizard-brain-pulse 1.6s ease-in-out infinite;
}

@keyframes wizard-brain-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.6; transform: scale(0.92); }
}

.wizard-blueprint-hint {
  font-size: 12px;
  color: var(--text-muted, #94a3b8);
  margin: 8px 0 0;
}

/* ─── Blueprint insight banner ──────────────────────────────────────────────── */

.wizard-blueprint-insight {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: color-mix(in srgb, #f59e0b 8%, var(--card-bg, #fff));
  border: 1px solid color-mix(in srgb, #f59e0b 30%, transparent);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 20px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-color, #1e293b);
}

.wizard-blueprint-insight i {
  color: #f59e0b;
  font-size: 15px;
  flex-shrink: 0;
  margin-top: 1px;
}

/* ─── Page card (Step 1 with AI blueprint) ──────────────────────────────────── */

.wizard-page-row {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 8px;
  overflow: hidden;
  background: var(--card-bg, #fff);
  transition: border-color 0.15s;
}

.wizard-page-row:focus-within {
  border-color: var(--primary-color, #6366f1);
}

.wizard-page-row-header {
  display: flex;
  align-items: center;
  gap: 0;
}

/* When page row is a simple flat row (added blank pages), ensure same styling */
.wizard-page-row > .wizard-title-input:only-child,
.wizard-page-row-header .wizard-title-input {
  flex: 1;
  padding: 10px 12px;
  font-size: 14px;
  border: none;
  border-right: 1px solid var(--border-color, #e2e8f0);
  background: transparent;
  color: var(--text-color, #1e293b);
  transition: background 0.15s;
  outline: none;
  font-family: inherit;
  border-radius: 0;
}

.wizard-page-row-header .wizard-title-input:focus {
  background: color-mix(in srgb, var(--primary-color, #6366f1) 2%, var(--card-bg, #fff));
}

.wizard-page-row-header .wizard-remove-btn {
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  color: var(--text-secondary, #64748b);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: background 0.15s, color 0.15s;
}

.wizard-page-row-header .wizard-remove-btn:hover {
  background: var(--accent-50, #fef2f2);
  color: var(--text-error, #ef4444);
}

.wizard-page-purpose {
  font-size: 12px;
  font-style: italic;
  color: var(--text-muted, #94a3b8);
  padding: 4px 12px 0;
  margin: 0;
  line-height: 1.5;
}

/* ─── Section chip previews ─────────────────────────────────────────────────── */

.wizard-section-preview {
  padding: 8px 12px 10px;
  border-top: 1px solid var(--border-color, #e2e8f0);
  background: var(--bg-subtle, #f8fafc);
}

.wizard-section-chips {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.wizard-section-chip {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary, #64748b);
  background: var(--card-bg, #fff);
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 4px;
  padding: 3px 7px;
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.wizard-section-chip i {
  font-size: 10px;
  color: var(--text-muted, #94a3b8);
}

/* ─── Responsive ─────────────────────────────────────────────────────────────── */

@media (max-width: 600px) {
  .wizard-container {
    padding: 16px 12px 24px;
  }

  .wizard-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .wizard-steps-indicator {
    align-self: flex-end;
  }

  .wizard-step {
    padding: 18px 16px;
  }

  .wizard-step-actions {
    flex-wrap: wrap;
    justify-content: stretch;
  }

  .wizard-step-actions .button-primary,
  .wizard-step-actions .button-secondary {
    width: 100%;
    text-align: center;
    justify-content: center;
  }

  .wizard-cta-btn {
    min-width: unset;
    width: 100%;
  }

  .wizard-filename-label {
    max-width: 180px;
  }
}
