/* ============================================
   Wizard Chrome — layout, progress, transitions
   ============================================ */

* { box-sizing: border-box; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  letter-spacing: -0.02em;
  margin: 0;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
  background: #fafafa;
  color: #111111;
}

/* -- Layout -------------------------------- */

.dsgen-layout {
  display: flex;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

.wizard-panel {
  width: 480px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: #fafafa;
  border-right: 1px solid #e5e7eb;
  overflow: hidden;
}

.preview-panel {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  background: #ffffff;
}

/* -- Wizard Header ------------------------- */

.wizard-header {
  padding: 32px 40px 0;
}

.wizard-eyebrow {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #6b7280;
  margin: 0 0 4px;
}

.wizard-title {
  font-size: 20px;
  font-weight: 600;
  color: #111111;
  margin: 0;
  line-height: 1.3;
}

/* -- Progress Indicator -------------------- */

.wizard-progress {
  padding: 24px 40px 0;
}

.progress-track {
  width: 100%;
}

.progress-dots {
  display: flex;
  align-items: center;
  gap: 0;
}

.progress-segment {
  flex: 1;
  height: 2px;
  background: #e5e7eb;
  transition: background 300ms ease;
}

.progress-segment.filled {
  background: #111111;
}

.progress-node {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #d1d5db;
  flex-shrink: 0;
  transition: all 200ms ease;
}

.progress-node.completed {
  background: #111111;
}

.progress-node.current {
  background: #111111;
  box-shadow: 0 0 0 3px rgba(17, 17, 17, 0.08);
}

.progress-node.upcoming {
  background: #d1d5db;
}

.progress-info {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 10px;
}

.progress-counter {
  font-size: 12px;
  color: #9ca3af;
  margin: 0;
}

.progress-step-label {
  font-size: 12px;
  font-weight: 500;
  color: #111111;
  margin: 0;
}

/* -- Step Container ------------------------ */

.wizard-steps {
  flex: 1;
  padding: 28px 40px;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
}

.wizard-step {
  width: 100%;
}

.wizard-step.step-hidden {
  display: none;
}

.wizard-step.step-visible {
  display: block;
}

.step-title {
  font-size: 22px;
  font-weight: 600;
  color: #111111;
  margin: 0 0 6px;
  line-height: 1.3;
  outline: none;
}

.step-description {
  font-size: 14px;
  font-weight: 400;
  color: #6b7280;
  margin: 0 0 24px;
  line-height: 1.5;
}

/* -- Form Fields --------------------------- */

.field-group {
  margin-bottom: 20px;
}

.field-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: #374151;
  margin-bottom: 6px;
}

.field-helper {
  font-size: 12px;
  color: #9ca3af;
  margin-top: 4px;
}

.field-error {
  font-size: 12px;
  color: #EF4444;
  margin-top: 4px;
}

.field-input {
  width: 100%;
  height: 44px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 0 14px;
  font-size: 14px;
  font-family: inherit;
  letter-spacing: inherit;
  color: #111111;
  background: #ffffff;
  outline: none;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.field-input::placeholder {
  color: #d1d5db;
}

.field-input:hover {
  border-color: #d1d5db;
}

.field-input:focus {
  border-color: #111111;
  box-shadow: 0 0 0 3px rgba(17, 17, 17, 0.06);
}

.field-input.has-error {
  border-color: #EF4444;
  background: #FEF2F2;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.08);
}

.field-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='12' viewBox='0 0 12 12' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M3 4.5L6 7.5L9 4.5' stroke='%239ca3af' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

/* -- Card Selectors (mood, font) ----------- */

.card-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.card-grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

.card-option {
  position: relative;
  padding: 16px;
  border: 1.5px solid #e5e7eb;
  border-radius: 12px;
  background: #ffffff;
  cursor: pointer;
  transition: border-color 150ms ease, transform 150ms ease, box-shadow 150ms ease;
  outline: none;
}

.card-option:hover {
  border-color: #d1d5db;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.card-option:focus-visible {
  outline: 2px solid #111111;
  outline-offset: 2px;
}

.card-option.selected {
  border: 2px solid #111111;
}

.card-option.selected::after {
  content: '✓';
  position: absolute;
  top: 8px;
  right: 8px;
  width: 20px;
  height: 20px;
  background: #111111;
  color: #ffffff;
  border-radius: 50%;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-icon {
  font-size: 20px;
  color: #9ca3af;
  margin-bottom: 8px;
}

.card-title {
  font-size: 13px;
  font-weight: 600;
  color: #111111;
  margin-bottom: 8px;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.card-tag {
  font-size: 11px;
  font-weight: 500;
  color: #6b7280;
  background: #f3f4f6;
  border-radius: 4px;
  padding: 2px 8px;
}

/* Font card specific */
.font-card-label {
  font-size: 11px;
  font-weight: 500;
  color: #9ca3af;
  letter-spacing: 0;
}

/* -- Chip Multi-Select --------------------- */

.chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip-option {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border: 1.5px solid #e5e7eb;
  border-radius: 9999px;
  background: #ffffff;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: #374151;
  cursor: pointer;
  transition: all 150ms ease;
  outline: none;
  letter-spacing: inherit;
}

.chip-option:hover {
  border-color: #d1d5db;
  background: #f9fafb;
}

.chip-option:focus-visible {
  outline: 2px solid #111111;
  outline-offset: 2px;
}

.chip-option.selected {
  background: #111111;
  border-color: #111111;
  color: #ffffff;
}

/* -- Textarea ------------------------------ */

.field-textarea {
  width: 100%;
  min-height: 80px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 14px;
  font-family: inherit;
  letter-spacing: inherit;
  color: #111111;
  background: #ffffff;
  outline: none;
  resize: vertical;
  transition: border-color 150ms ease, box-shadow 150ms ease;
  line-height: 1.5;
}

.field-textarea::placeholder { color: #d1d5db; }
.field-textarea:hover { border-color: #d1d5db; }
.field-textarea:focus {
  border-color: #111111;
  box-shadow: 0 0 0 3px rgba(17, 17, 17, 0.06);
}

/* -- URL List Input ------------------------ */

.url-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.url-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.url-row .field-input {
  flex: 1;
}

.url-remove {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: #9ca3af;
  cursor: pointer;
  border-radius: 6px;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 150ms ease;
}

.url-remove:hover {
  background: #fee2e2;
  color: #EF4444;
}

.url-add {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 0;
  font-size: 13px;
  font-weight: 500;
  color: #6b7280;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  letter-spacing: inherit;
}

.url-add:hover { color: #111111; }

/* -- Results View -------------------------- */

.results-view {
  padding: 20px 0;
}

.results-icon {
  font-size: 32px;
  margin-bottom: 16px;
}

.results-title {
  font-size: 22px;
  font-weight: 600;
  color: #111111;
  margin: 0 0 12px;
  line-height: 1.3;
}

.results-subtitle {
  font-size: 14px;
  color: #6b7280;
  line-height: 1.6;
  margin: 0 0 32px;
}

.results-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.results-btn-primary {
  width: 100%;
  height: 48px;
  border-radius: 10px;
  background: #111111;
  color: #ffffff;
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: all 150ms ease;
  letter-spacing: inherit;
}

.results-btn-primary:hover {
  background: #374151;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.results-btn-secondary {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 48px;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  background: transparent;
  color: #374151;
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  transition: all 150ms ease;
}

.results-btn-secondary:hover {
  border-color: #111111;
  background: #fafafa;
}

.results-divider {
  width: 48px;
  height: 1px;
  background: #e5e7eb;
  margin: 32px 0;
}

.results-summary-title {
  font-size: 14px;
  font-weight: 600;
  color: #111111;
  margin: 0 0 12px;
}

.results-next-steps {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.results-next-steps li {
  font-size: 13px;
  color: #6b7280;
  padding-left: 20px;
  position: relative;
  line-height: 1.5;
}

.results-next-steps li::before {
  content: '—';
  position: absolute;
  left: 0;
  color: #d1d5db;
}

.results-start-over {
  margin-top: 32px;
  background: none;
  border: none;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: #9ca3af;
  cursor: pointer;
  padding: 0;
  letter-spacing: inherit;
}

.results-start-over:hover {
  color: #111111;
}

/* -- Navigation Buttons -------------------- */

.wizard-nav {
  padding: 20px 40px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  background: #fafafa;
  border-top: 1px solid #e5e7eb;
  flex-shrink: 0;
}

.wizard-prev,
.wizard-next {
  height: 44px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  letter-spacing: inherit;
  cursor: pointer;
  transition: all 150ms ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  outline: none;
}

.wizard-prev {
  padding: 0 24px;
  background: transparent;
  border: 1px solid #e5e7eb;
  color: #374151;
}

.wizard-prev:hover {
  background: #f9fafb;
  border-color: #d1d5db;
}

.wizard-prev:focus-visible {
  outline: 2px solid #111111;
  outline-offset: 2px;
}

.wizard-next {
  padding: 0 24px;
  background: #111111;
  border: none;
  color: #ffffff;
  flex: 1;
  max-width: 280px;
  margin-left: auto;
}

.wizard-next:hover {
  background: #374151;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.wizard-next:active {
  transform: translateY(0);
  box-shadow: none;
  background: #000000;
}

.wizard-next:focus-visible {
  outline: 2px solid #111111;
  outline-offset: 2px;
}

.next-icon {
  font-size: 16px;
}

.next-arrow {
  font-size: 16px;
}

/* -- Responsive ---------------------------- */

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

  .wizard-panel {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid #e5e7eb;
    height: 100%;
  }

  .preview-panel {
    display: none; /* Toggle via JS on mobile */
  }

  .preview-panel.mobile-visible {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 100;
    border-radius: 16px 16px 0 0;
    top: 15vh;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.12);
    animation: sheetUp 300ms cubic-bezier(0.16, 1, 0.3, 1);
  }

  .wizard-header { padding: 24px 20px 0; }
  .wizard-progress { padding: 20px 20px 0; }
  .wizard-steps { padding: 20px 20px; }
  .wizard-nav { padding: 16px 20px; }

  .card-grid { grid-template-columns: 1fr; }
  .card-grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@keyframes sheetUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

/* -- Reduced Motion ------------------------ */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
