/* ============================================================================
   Wismify demo wizard — estilos standalone.
   Coherente con el wizard de partners.wismify.com:
     · fondo liquid-gradient WebGL2 monocromo
     · glass cards con bevel sutil
     · botón primary blanco (btn-solid)
     · animación slide entre pasos (sale hacia abajo / entra desde abajo)
     · step 4 redesign tipo radio-list (Gorgias-style)
     · modal de chat custom (no window.prompt)
   ============================================================================ */

:root {
  --dw-bg-deep: #000000;
  --dw-text: #f5f5f6;
  --dw-text-secondary: rgba(255,255,255,0.62);
  --dw-text-muted: rgba(255,255,255,0.42);
  --dw-border-soft: rgba(255,255,255,0.08);
  --dw-border-strong: rgba(255,255,255,0.18);
  --dw-danger: #ef4444;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  background: var(--dw-bg-deep);
  color: var(--dw-text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
body.is-modal-open { overflow: hidden; }

/* ────────────────────────── FONDO LIQUID ────────────────────────── */
.dw-bg {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  display: block;
  pointer-events: none;
}
/* Overlay semi-opaco encima del shader para que el contenido sea legible
   y el shader no compita visualmente con la card central. */
.dw-bg-overlay {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 35%, rgba(0,0,0,0.45) 0%, rgba(0,0,0,0.75) 60%, rgba(0,0,0,0.85) 100%);
}

/* ────────────────────────── HEADER ────────────────────────── */
.dw-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px 28px;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--dw-border-soft);
}
.dw-logo { display: inline-flex; align-items: center; text-decoration: none; }
.dw-logo img { height: 22px; }

.dw-progress {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 1 480px;
  margin: 0 auto;
}
.dw-progress-step {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--dw-text-muted);
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--dw-border-soft);
  transition: all 0.25s ease;
}
.dw-progress-step.is-active {
  color: #000;
  background: #fff;
  border-color: #fff;
}
.dw-progress-step.is-done {
  color: rgba(255,255,255,0.85);
  background: rgba(255,255,255,0.12);
  border-color: rgba(255,255,255,0.3);
}
.dw-progress-line {
  flex: 1;
  height: 1px;
  background: var(--dw-border-soft);
}

.dw-exit {
  color: var(--dw-text-muted);
  text-decoration: none;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, color 0.15s ease;
}
.dw-exit:hover {
  background: rgba(255,255,255,0.06);
  color: var(--dw-text);
}

/* ────────────────────────── MAIN ────────────────────────── */
.dw-main {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 56px 20px 80px;
  min-height: calc(100vh - 60px);
}

/* Stage = ventana fija que aloja el step actual. Posición relativa para
   que los pasos puedan animarse con position:absolute en transición. */
.dw-stage {
  position: relative;
  width: 100%;
  max-width: 640px;
}

/* ────────────────────────── CARDS / GLASS ────────────────────────── */
.dw-card {
  position: relative;
  width: 100%;
  padding: 40px 44px;
  border-radius: 18px;
  background:
    linear-gradient(135deg,
      rgba(255,255,255,0.05) 0%,
      rgba(255,255,255,0.015) 50%,
      rgba(255,255,255,0.04) 100%),
    rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.06),
    0 18px 50px rgba(0,0,0,0.45);
  color: rgba(255,255,255,0.92);
  isolation: isolate;
}
.dw-card--wide { max-width: none; }

/* Bevel sutil top-left + bottom-right (mismo lenguaje que partners glass-card) */
.dw-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg,
    rgba(255,255,255,0.5) 0%,
    rgba(255,255,255,0.05) 22%,
    rgba(255,255,255,0) 45%,
    rgba(255,255,255,0) 55%,
    rgba(255,255,255,0.05) 78%,
    rgba(255,255,255,0.4) 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

/* ────────────────────────── STEPS + ANIMACIÓN ──────────────────────────
   Solo el step activo es visible. La transición es:
     - El step saliente se desliza hacia abajo y se desvanece
     - El step entrante aparece desde abajo y sube a su sitio
   Lo coordina el JS añadiendo/quitando .is-leaving + cambiando .is-active. */
.dw-step {
  display: none;
  width: 100%;
}
.dw-step.is-active {
  display: block;
  animation: dwSlideUpIn 0.42s cubic-bezier(0.22, 1, 0.36, 1);
}
.dw-step.is-leaving {
  display: block;
  position: absolute;
  inset: 0;
  animation: dwSlideDownOut 0.32s cubic-bezier(0.55, 0, 0.7, 0.2) forwards;
  pointer-events: none;
}
@keyframes dwSlideUpIn {
  from { opacity: 0; transform: translateY(28px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes dwSlideDownOut {
  from { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(28px); }
}

/* ────────────────────────── TIPOGRAFÍA ────────────────────────── */
.dw-eyebrow {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.5);
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--dw-border-soft);
  border-radius: 999px;
  padding: 4px 12px;
  margin-bottom: 18px;
}
.dw-eyebrow--success {
  color: #ffffff;
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.18);
}
.dw-h1 {
  margin: 0 0 8px;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: #ffffff;
}
.dw-sub {
  margin: 0 0 28px;
  font-size: 14px;
  color: var(--dw-text-secondary);
  line-height: 1.55;
}

/* ────────────────────────── FORM (step 1) ────────────────────────── */
.dw-form { display: flex; flex-direction: column; gap: 18px; }
.dw-field { display: flex; flex-direction: column; gap: 7px; }
.dw-label {
  font-size: 12px;
  font-weight: 500;
  color: rgba(255,255,255,0.7);
  letter-spacing: 0.01em;
}
.dw-input {
  width: 100%;
  display: block;
  padding: 12px 14px;
  border-radius: 10px;
  font-family: inherit;
  font-size: 14px;
  color: rgba(255,255,255,0.95);
  background:
    linear-gradient(135deg,
      rgba(255,255,255,0.03) 0%,
      rgba(255,255,255,0.01) 50%,
      rgba(255,255,255,0.03) 100%),
    rgba(255,255,255,0.025);
  border: 1px solid var(--dw-border-soft);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
  outline: none;
  transition: border 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.dw-input::placeholder { color: rgba(255,255,255,0.28); }
.dw-input:hover { border-color: rgba(255,255,255,0.14); }
.dw-input:focus {
  border-color: rgba(255,255,255,0.32);
  background: rgba(255,255,255,0.05);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.06),
    0 0 0 3px rgba(255,255,255,0.06);
}
.dw-textarea {
  resize: vertical;
  min-height: 64px;
  font-family: inherit;
}

.dw-error {
  font-size: 12px;
  color: #fca5a5;
  background: rgba(239,68,68,0.08);
  border: 1px solid rgba(239,68,68,0.25);
  border-radius: 8px;
  padding: 8px 12px;
}

/* ────────────────────────── BOTONES ────────────────────────── */
.dw-actions {
  margin-top: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.dw-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 22px;
  border-radius: 10px;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 500;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}
.dw-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none !important;
}
/* Primary: blanco como btn-solid de partners */
.dw-btn--primary {
  background: #ffffff;
  color: #000000;
  border-color: rgba(255,255,255,0.92);
  box-shadow:
    0 6px 16px -6px rgba(0,0,0,0.6),
    inset 0 -1px 0 rgba(0,0,0,0.06);
}
.dw-btn--primary:hover:not(:disabled) {
  background: rgba(255,255,255,0.85);
  border-color: rgba(255,255,255,0.85);
  transform: translateY(-1px);
  box-shadow:
    0 10px 22px -6px rgba(0,0,0,0.7),
    inset 0 -1px 0 rgba(0,0,0,0.08);
}
.dw-btn--ghost {
  background: transparent;
  color: var(--dw-text-secondary);
  border-color: var(--dw-border-soft);
}
.dw-btn--ghost:hover {
  background: rgba(255,255,255,0.04);
  color: var(--dw-text);
  border-color: var(--dw-border-strong);
}

/* ────────────────────────── GRID DE CHOICES (steps 2, 3) ────────────────────────── */
.dw-grid {
  display: grid;
  gap: 10px;
}
.dw-grid--2col { grid-template-columns: repeat(2, 1fr); }
.dw-grid--3col { grid-template-columns: repeat(3, 1fr); }

.dw-choice {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 16px 18px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  color: rgba(255,255,255,0.85);
  background: rgba(255,255,255,0.025);
  border: 1px solid var(--dw-border-soft);
  border-radius: 12px;
  cursor: pointer;
  text-align: left;
  transition: all 0.18s ease;
}
.dw-choice--center { justify-content: center; text-align: center; }
.dw-choice:hover {
  background: rgba(255,255,255,0.05);
  border-color: rgba(255,255,255,0.18);
  transform: translateY(-1px);
}
.dw-choice.is-selected {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.36);
  color: #ffffff;
}
.dw-choice--wide { grid-column: 1 / -1; }

.dw-choice-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  color: rgba(255,255,255,0.62);
  transition: color 0.2s ease;
}
.dw-choice-icon svg { width: 100%; height: 100%; stroke-width: 1.6; }
.dw-choice:hover .dw-choice-icon,
.dw-choice.is-selected .dw-choice-icon { color: #ffffff; }

.dw-otro-wrap {
  margin-top: 14px;
  padding: 16px;
  background: rgba(255,255,255,0.018);
  border: 1px solid var(--dw-border-soft);
  border-radius: 12px;
  animation: dwSlideUpIn 0.25s ease;
}

/* ────────────────────────── STEP 4: RADIO-LIST (estilo Gorgias) ──────────────────────────
   En vez de cards grandes 2x2, una lista vertical de filas tipo "form_radio-input is-radio-grid-el"
   con bullet a la izquierda, icono, título+desc y arrow a la derecha. */
.dw-radio-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.dw-radio-row {
  position: relative;
  display: grid;
  grid-template-columns: auto auto 1fr auto;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 18px 20px;
  background: rgba(255,255,255,0.028);
  border: 1px solid var(--dw-border-soft);
  border-radius: 12px;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  color: var(--dw-text);
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}
.dw-radio-row:hover {
  background: rgba(255,255,255,0.05);
  border-color: rgba(255,255,255,0.22);
  transform: translateY(-1px);
}
.dw-radio-row:disabled { opacity: 0.5; cursor: wait; transform: none; }
.dw-radio-row.is-active {
  border-color: rgba(255,255,255,0.4);
  background: rgba(255,255,255,0.06);
}

/* Bullet (radio dot). Estilo input radio nativo pero con ring */
.dw-radio-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,0.32);
  background: rgba(255,255,255,0.02);
  position: relative;
  flex-shrink: 0;
  transition: border-color 0.2s ease, background 0.2s ease;
}
.dw-radio-row:hover .dw-radio-dot { border-color: rgba(255,255,255,0.55); }
.dw-radio-row.is-active .dw-radio-dot { border-color: #ffffff; background: rgba(255,255,255,0.06); }
.dw-radio-row.is-active .dw-radio-dot::after {
  content: '';
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: #ffffff;
}

.dw-radio-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--dw-border-soft);
  color: rgba(255,255,255,0.78);
  flex-shrink: 0;
  transition: color 0.2s ease, background 0.2s ease;
}
.dw-radio-icon svg { width: 18px; height: 18px; }
.dw-radio-row:hover .dw-radio-icon { color: #ffffff; }

.dw-radio-body {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.dw-radio-title {
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: #ffffff;
  line-height: 1.3;
}
.dw-radio-desc {
  font-size: 12.5px;
  color: var(--dw-text-secondary);
  line-height: 1.5;
}
.dw-radio-arrow {
  color: rgba(255,255,255,0.3);
  transition: color 0.2s ease, transform 0.2s ease;
}
.dw-radio-row:hover .dw-radio-arrow {
  color: rgba(255,255,255,0.85);
  transform: translateX(2px);
}

/* ────────────────────────── MODAL CHAT ────────────────────────── */
.dw-chat-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.dw-chat-modal.is-open {
  display: flex;
  animation: dwFade 0.2s ease;
}
@keyframes dwFade { from { opacity: 0; } to { opacity: 1; } }

.dw-chat-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.dw-chat-panel {
  position: relative;
  width: 100%;
  max-width: 440px;
  max-height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
  background: #111316;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0,0,0,0.7);
  animation: dwChatPop 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes dwChatPop {
  from { opacity: 0; transform: translateY(20px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.dw-chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--dw-border-soft);
  background: rgba(255,255,255,0.025);
}
.dw-chat-avatar {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  color: #000000;
  flex-shrink: 0;
}
.dw-chat-meta { flex: 1; min-width: 0; }
.dw-chat-title {
  font-size: 13.5px;
  font-weight: 600;
  color: #ffffff;
  letter-spacing: -0.01em;
}
.dw-chat-sub {
  font-size: 11px;
  color: var(--dw-text-secondary);
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 5px;
}
.dw-chat-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 6px rgba(34,197,94,0.7);
}
.dw-chat-close {
  background: transparent;
  border: 1px solid var(--dw-border-soft);
  color: var(--dw-text-muted);
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}
.dw-chat-close:hover {
  background: rgba(255,255,255,0.06);
  color: var(--dw-text);
  border-color: var(--dw-border-strong);
}

.dw-chat-body {
  padding: 18px;
  overflow-y: auto;
  flex: 1;
}

.dw-chat-context {
  font-size: 11.5px;
  color: var(--dw-text-muted);
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--dw-border-soft);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 14px;
  line-height: 1.5;
}
.dw-chat-context strong { color: rgba(255,255,255,0.85); font-weight: 500; }

.dw-chat-thread { margin-bottom: 14px; }
.dw-chat-bubble {
  font-size: 13px;
  line-height: 1.5;
  padding: 10px 14px;
  border-radius: 14px;
  max-width: 85%;
}
.dw-chat-bubble--in {
  background: rgba(255,255,255,0.05);
  color: rgba(255,255,255,0.92);
  border-bottom-left-radius: 4px;
}

.dw-chat-form { display: flex; flex-direction: column; gap: 10px; }
.dw-chat-textarea {
  width: 100%;
  resize: none;
  padding: 12px 14px;
  border-radius: 10px;
  font-family: inherit;
  font-size: 14px;
  color: rgba(255,255,255,0.95);
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--dw-border-soft);
  outline: none;
  transition: border 0.15s ease, box-shadow 0.15s ease;
}
.dw-chat-textarea::placeholder { color: rgba(255,255,255,0.3); }
.dw-chat-textarea:focus {
  border-color: rgba(255,255,255,0.3);
  box-shadow: 0 0 0 3px rgba(255,255,255,0.05);
}
.dw-chat-error {
  font-size: 11.5px;
  color: #fca5a5;
}
.dw-chat-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.dw-chat-counter {
  font-size: 10.5px;
  color: var(--dw-text-muted);
  font-variant-numeric: tabular-nums;
}

.dw-chat-success {
  text-align: center;
  padding: 32px 12px;
  color: var(--dw-text);
  animation: dwSlideUpIn 0.3s ease;
}
.dw-chat-success svg { color: #ffffff; margin-bottom: 12px; }
.dw-chat-success h3 { margin: 0 0 6px; font-size: 17px; font-weight: 600; }
.dw-chat-success p { margin: 0; font-size: 13px; color: var(--dw-text-secondary); }

/* ────────────────────────── RESPONSIVE ────────────────────────── */
@media (max-width: 720px) {
  .dw-header { padding: 12px 16px; gap: 12px; }
  .dw-progress { flex-basis: auto; gap: 4px; }
  .dw-progress-step { width: 22px; height: 22px; font-size: 10px; }
  .dw-progress-line { min-width: 12px; }

  .dw-main { padding: 28px 14px 60px; }
  .dw-card { padding: 28px 22px; border-radius: 14px; }
  .dw-h1 { font-size: 22px; }

  .dw-grid--2col, .dw-grid--3col { grid-template-columns: 1fr; }

  .dw-choice { padding: 14px 16px; }
  .dw-actions { flex-direction: column-reverse; align-items: stretch; gap: 8px; }
  .dw-actions .dw-btn { width: 100%; }

  /* Radio rows en móvil: arrow desaparece, todo en una columna apilada */
  .dw-radio-row {
    grid-template-columns: auto auto 1fr;
    padding: 14px 16px;
    gap: 10px;
  }
  .dw-radio-arrow { display: none; }
  .dw-radio-title { font-size: 14px; }
  .dw-radio-desc { font-size: 12px; }

  .dw-chat-panel { max-width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .dw-step.is-active,
  .dw-step.is-leaving,
  .dw-otro-wrap,
  .dw-chat-modal.is-open,
  .dw-chat-panel,
  .dw-chat-success { animation: none; }
  .dw-choice, .dw-btn, .dw-radio-row { transition: none; }
}
