/* ─────────────────────────────────────────────────────────
   Offer Engine — wizard UI styles
   ───────────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:       #09090f;
  --surface:  #111118;
  --surface2: #17171f;
  --border:   #1f1f30;
  --border2:  #2a2a40;
  --accent:   #7c5cfc;
  --accent-h: #9b7dff;
  --accent-d: #5a3dd4;
  --text:     #f0eeff;
  --text-2:   #a09dc0;
  --text-3:   #5a5878;
  --white:    #ffffff;
  --green:    #22c55e;
  --warn:     #f59e0b;
  --radius:   14px;
  --radius-s: 8px;
  --font:     'Inter', system-ui, -apple-system, sans-serif;
  --shadow:   0 4px 24px rgba(0,0,0,.45);
}

html, body { height: 100%; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 15px; line-height: 1.6; }

/* ═══ App shell ═══ */

.app {
  display: grid;
  height: 100dvh;
  overflow: hidden;
}

/* Wizard-only: single column */
.app[data-state="wizard"],
.app[data-state="generating"] {
  grid-template-columns: 1fr;
}
.app[data-state="wizard"]    .pane--preview,
.app[data-state="generating"] .pane--preview { display: none; }

/* Output: split */
.app[data-state="output"] {
  grid-template-columns: 400px 1fr;
}

@media (max-width: 860px) {
  .app[data-state="output"] {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    overflow-y: auto;
  }
  .app[data-state="output"] .pane--wizard {
    max-height: 50dvh;
    overflow-y: auto;
  }
  .app[data-state="output"] .pane--preview {
    min-height: 50dvh;
  }
}

/* ═══ Panes ═══ */

.pane {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.pane--wizard {
  background: var(--surface);
  border-right: 1px solid var(--border);
}

/* Wizard pane: when app is wizard/generating, center the content */
.app[data-state="wizard"]    .pane--wizard,
.app[data-state="generating"] .pane--wizard {
  align-items: center;
}

.pane--preview {
  background: var(--bg);
  position: relative;
  overflow: hidden;
}

/* ═══ Header ═══ */

.oe-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  width: 100%;
}

.oe-logo {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-weight: 700;
  font-size: .95rem;
  letter-spacing: -.01em;
  color: var(--text);
}

.oe-tag {
  font-size: .7rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--accent);
  background: rgba(124,92,252,.12);
  border: 1px solid rgba(124,92,252,.2);
  padding: .2rem .55rem;
  border-radius: 999px;
}

/* ═══ Step nav ═══ */

.steps {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 1.25rem 1.5rem .5rem;
  flex-shrink: 0;
  width: 100%;
  max-width: 540px;
}

.step {
  display: flex;
  align-items: center;
  gap: .4rem;
  background: none;
  border: none;
  cursor: default;
  padding: 0;
  color: var(--text-3);
  font-family: var(--font);
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .03em;
  pointer-events: none;
  white-space: nowrap;
}

.step__n {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--surface2);
  border: 1.5px solid var(--border2);
  font-size: .75rem;
  font-weight: 700;
  color: var(--text-3);
  flex-shrink: 0;
  transition: all .25s;
}

.step--active .step__n,
.step--done   .step__n {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--white);
}

.step--active .step__label,
.step--done   .step__label { color: var(--text); }

.step__line {
  flex: 1;
  height: 1.5px;
  background: var(--border2);
  margin: 0 .4rem;
  min-width: 16px;
}

/* ═══ Step panels ═══ */

.step-panel {
  flex: 1;
  display: flex;
  align-items: flex-start;
  overflow-y: auto;
  width: 100%;
}

.app[data-state="wizard"]    .step-panel,
.app[data-state="generating"] .step-panel {
  justify-content: center;
}

.step-panel__inner {
  width: 100%;
  max-width: 540px;
  padding: 2rem 1.5rem 2.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.step-panel__h {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -.025em;
  color: var(--text);
  line-height: 1.25;
}

.step-panel__sub {
  color: var(--text-2);
  font-size: .9rem;
  margin-top: -.6rem;
}

.hidden { display: none !important; }

/* ═══ Form fields ═══ */

.field {
  display: flex;
  flex-direction: column;
  gap: .45rem;
}

label {
  font-size: .82rem;
  font-weight: 600;
  color: var(--text-2);
  letter-spacing: .01em;
}

label .opt {
  font-weight: 400;
  color: var(--text-3);
}

input[type="text"],
textarea {
  background: var(--surface2);
  border: 1.5px solid var(--border2);
  border-radius: var(--radius-s);
  color: var(--text);
  font-family: var(--font);
  font-size: .9rem;
  line-height: 1.5;
  padding: .65rem .85rem;
  width: 100%;
  transition: border-color .2s;
  resize: vertical;
}

input[type="text"]:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: #1a1826;
}

input::placeholder,
textarea::placeholder { color: var(--text-3); }

/* ═══ Buttons ═══ */

.btn-next {
  align-self: flex-start;
  background: var(--accent);
  color: var(--white);
  border: none;
  border-radius: var(--radius-s);
  font-family: var(--font);
  font-size: .88rem;
  font-weight: 700;
  padding: .65rem 1.4rem;
  cursor: pointer;
  transition: background .2s, transform .1s;
  letter-spacing: .01em;
}

.btn-next:hover  { background: var(--accent-h); }
.btn-next:active { transform: scale(.98); }

.btn-row {
  display: flex;
  align-items: center;
  gap: .75rem;
}

.btn-back {
  background: none;
  border: 1.5px solid var(--border2);
  border-radius: var(--radius-s);
  color: var(--text-2);
  font-family: var(--font);
  font-size: .85rem;
  font-weight: 600;
  padding: .6rem 1rem;
  cursor: pointer;
  transition: border-color .2s, color .2s;
}

.btn-back:hover { border-color: var(--border2); color: var(--text); }

.btn-generate {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .6rem;
  background: linear-gradient(135deg, var(--accent) 0%, #5a3dd4 100%);
  color: var(--white);
  border: none;
  border-radius: var(--radius-s);
  font-family: var(--font);
  font-size: .95rem;
  font-weight: 700;
  padding: .8rem 1.5rem;
  cursor: pointer;
  transition: opacity .2s, transform .1s;
  letter-spacing: .01em;
  box-shadow: 0 4px 20px rgba(124,92,252,.35);
}

.btn-generate:hover  { opacity: .9; }
.btn-generate:active { transform: scale(.98); }

.btn-generate__icon { font-size: 1.1rem; }

/* ═══ Framework cards ═══ */

.framework-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .6rem;
}

.fw-card { cursor: pointer; }

.fw-card input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.fw-card__inner {
  display: flex;
  flex-direction: column;
  gap: .3rem;
  padding: .85rem 1rem;
  background: var(--surface2);
  border: 1.5px solid var(--border2);
  border-radius: var(--radius);
  transition: border-color .2s, background .2s;
}

.fw-card input:checked + .fw-card__inner {
  border-color: var(--accent);
  background: rgba(124,92,252,.08);
}

.fw-card:hover .fw-card__inner { border-color: var(--border2); background: #1a1826; }

.fw-card__icon {
  font-size: 1.1rem;
  display: block;
  margin-bottom: .15rem;
}

.fw-card strong {
  font-size: .85rem;
  color: var(--text);
  font-weight: 700;
}

.fw-card p {
  font-size: .75rem;
  color: var(--text-2);
  line-height: 1.4;
  margin: 0;
}

/* ═══ Loading ═══ */

.loading-panel {
  align-items: center;
  text-align: center;
  padding-top: 3rem;
  gap: 1.5rem;
}

.loader-ring {
  width: 48px;
  height: 48px;
  border: 3px solid var(--border2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .9s linear infinite;
  flex-shrink: 0;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loader-step {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  min-height: 1.6em;
}

.loader-sub {
  font-size: .85rem;
  color: var(--text-2);
  max-width: 320px;
}

/* ═══ Offer architecture output ═══ */

.arch-header {
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

.arch-badge {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--green);
  background: rgba(34,197,94,.1);
  border: 1px solid rgba(34,197,94,.2);
  padding: .2rem .6rem;
  border-radius: 999px;
  align-self: flex-start;
}

.arch-badge::before {
  content: '';
  display: block;
  width: 6px;
  height: 6px;
  background: var(--green);
  border-radius: 50%;
}

.arch-title {
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -.02em;
  color: var(--text);
}

.arch-reasoning {
  font-size: .85rem;
  color: var(--text-2);
  line-height: 1.55;
  border-left: 2px solid var(--accent);
  padding-left: .75rem;
}

/* Offer stack cards */
.arch-cards {
  display: flex;
  flex-direction: column;
  gap: .6rem;
}

.arch-card {
  background: var(--surface2);
  border: 1.5px solid var(--border2);
  border-radius: var(--radius);
  padding: .9rem 1rem;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: .3rem .75rem;
  align-items: start;
}

.arch-card__label {
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--text-3);
  grid-column: 1 / -1;
}

.arch-card--hero   { border-color: rgba(124,92,252,.4); }
.arch-card--bump   { border-color: rgba(245,158,11,.3); }
.arch-card--upsell { border-color: rgba(34,197,94,.25); }
.arch-card--cont   { border-color: rgba(99,179,237,.25); }

.arch-card__name {
  font-size: .9rem;
  font-weight: 700;
  color: var(--text);
  grid-column: 1;
  align-self: center;
}

.arch-card__price {
  font-size: .95rem;
  font-weight: 800;
  color: var(--accent);
  grid-column: 3;
  align-self: center;
  white-space: nowrap;
}

.arch-card--bump   .arch-card__price { color: var(--warn); }
.arch-card--upsell .arch-card__price { color: var(--green); }
.arch-card--cont   .arch-card__price { color: #63b3ed; }

.arch-card__desc {
  font-size: .78rem;
  color: var(--text-2);
  grid-column: 1 / 3;
  line-height: 1.4;
}

.arch-card__reason {
  font-size: .73rem;
  color: var(--text-3);
  grid-column: 1 / -1;
  font-style: italic;
  line-height: 1.35;
}

.btn-restart {
  background: none;
  border: 1.5px solid var(--border2);
  border-radius: var(--radius-s);
  color: var(--text-3);
  font-family: var(--font);
  font-size: .8rem;
  font-weight: 600;
  padding: .5rem .9rem;
  cursor: pointer;
  align-self: flex-start;
  transition: color .2s, border-color .2s;
  margin-top: .25rem;
}

.btn-restart:hover { color: var(--text-2); border-color: var(--border2); }

/* ═══ Preview pane ═══ */

.preview-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 1rem;
}

.preview-placeholder__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .75rem;
  color: var(--text-3);
  text-align: center;
  max-width: 260px;
  font-size: .88rem;
  line-height: 1.5;
}

#preview-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
  background: #fff;
}
