:root {
  --main-bg: #e6f0fa;
  --main-accent: #368fd6;
  --main-accent-dark: #235d89;
  --main-text: #263241;
  --border-radius: 1.5rem;
  --shadow: 0 4px 28px rgba(54,143,214,0.10), 0 1.5px 4px rgba(54,143,214,0.07);
  --form-width: 420px;
}

/* --------- BASE --------- */
body, html {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  background: var(--main-bg);
  color: var(--main-text);
  font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
}

#contenedor-formulario {
  width: 100vw;
  display: flex;
  justify-content: center;
  align-items: center;
  /*background: var(--main-bg);*/
  transition: background 0.3s;
      flex-direction: column-reverse;
}

/* --------- WIZARD CONTAINER --------- */
.formulario-wizard {
  background: #fff;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  width: 90vw;
  max-width: 850px;
  min-height: 420px;
  display: flex;
  flex-direction: row;
  align-items: stretch;
}

/* --------- RESPONSIVE: móvil --------- */
@media (max-width: 900px) {
  .formulario-wizard {
    flex-direction: column;
    max-width: 100vw;
    min-height: unset;
    height: auto;
  }
}

/* --------- FORM STEP --------- */
.wizard-pregunta {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 2.2rem 2.5rem;
  min-width: 0;
  animation: fadeIn .6s;
}
@media (max-width: 600px) {
  .wizard-pregunta { padding: 1.2rem 0.5rem; }
}

/* --------- CARLA IA --------- */
.wizard-ia {
  flex: 0 0 345px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 2.2rem 2.2rem 2.2rem 1.6rem;
  min-width: 260px;
  max-width: 370px;
  background: linear-gradient(180deg, #eaf5ff 65%, #e1ebf8 100%);
  border-left: 1.5px solid #d0e5f9;
  box-sizing: border-box;
  height: auto;
}

/* --------- RESPONSIVE IA --------- */
@media (max-width: 900px) {
  .wizard-ia {
    border-left: none;
    border-top: 1.5px solid #d0e5f9;
    max-width: 100vw;
    min-width: 0;
    width: 100%;
    padding: 1.2rem 1rem 1.2rem 1rem;
    background: linear-gradient(180deg, #eaf5ff 80%, #e1ebf8 100%);
    max-height: 115px;
    overflow-y: auto;
    margin-bottom: .5rem;
  }
}

/* IA Header */
.ia-header {
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--main-accent-dark);
  margin-bottom: 1.1rem;
  letter-spacing: .2px;
  display: flex;
  align-items: center;
  gap: .5rem;
  line-height: 1.15;
}

/* IA Content: scroll vertical si es muy largo */
.ia-content {
  font-size: 1.09rem;
  color: var(--main-text);
  background: none !important;
  border-radius: 0;
  padding: 0;
  margin: 0;
  box-shadow: none;
  width: 100%;
  box-sizing: border-box;
  scrollbar-width: thin;
  scrollbar-color: #aac8e8 #eaf5ff;
  line-height: 1.7;
  word-break: break-word;
  flex: 1 1 auto;
  overflow-y: auto;
  min-height: 36px;
}
@media (max-width: 900px) {
  .ia-content {
    max-height: 70px;
    min-height: 28px;
    font-size: 1.03rem;
  }
}
.ia-content p {
  margin: 0 0 1.05em 0;
  line-height: 1.7;
  font-size: 1.07rem;
}
.ia-content br {
  display: block;
  margin-top: .55em;
  content: "";
}
.ia-content p:last-child { margin-bottom: 0; }

/* --------- PREGUNTAS Y CAMPOS --------- */
.wizard-step-label {
  font-size: 1.4rem;
  font-weight: 600;
  margin-bottom: 2.3rem;
  color: var(--main-text);
  letter-spacing: -.5px;
}

.campo-form input[type="text"],
.campo-form input[type="number"],
.campo-form input[type="email"],
.campo-form select,
.campo-form textarea {
  width: 80%;
  padding: .8rem 1rem;
  margin-bottom: 1.3rem;
  border-radius: .9rem;
  border: 1.5px solid #c5daea;
  font-size: 1.08rem;
  box-shadow: 0 2px 6px rgba(54,143,214,0.07);
  background: #f8fbff;
  color: var(--main-text);
  transition: border .2s;
}
.campo-form input:focus,
.campo-form select:focus,
.campo-form textarea:focus {
  outline: none;
  border-color: var(--main-accent);
}

.campo-form label input[type="radio"],
.campo-form label input[type="checkbox"] {
  margin-right: 7px;
  accent-color: var(--main-accent);
}
.campo-form label {
  margin-right: 1.7rem;
  font-size: 1.09rem;
  cursor: pointer;
}

/* --------- NAV Y BOTONES --------- */
.wizard-nav {
  display: flex;
  flex-direction: row;
  justify-content: flex-end;
  gap: 1rem;
}

.wizard-nav button {
  background: var(--main-accent);
  color: #fff;
  font-weight: 600;
  border: none;
  border-radius: 1rem;
  padding: 0.72rem 2.4rem;
  font-size: 1.1rem;
  margin-top: 1.2rem;
  cursor: pointer;
  box-shadow: 0 1px 6px rgba(54,143,214,0.08);
  transition: background .2s;
}
.wizard-nav button:disabled {
  opacity: .57;
  cursor: not-allowed;
}
.wizard-nav button:hover:not(:disabled) {
  background: var(--main-accent-dark);
}

/* --------- PROGRESO --------- */
.wizard-progress {
  margin-top: 1.2rem;
  width: 100%;
  height: 8px;
  background: #e4effa;
  border-radius: 8px;
  overflow: hidden;
}
.wizard-progress-bar {
  height: 100%;
  background: var(--main-accent);
  transition: width .3s;
}

/* --------- MENSAJES --------- */
.msg-ok, .msg-error {
  margin: 2rem auto 1rem auto;
  border-radius: 1rem;
  padding: 1.2rem 1.5rem;
  font-size: 1.15rem;
  width: 80%;
  box-sizing: border-box;
  text-align: center;
}
.msg-ok { background: #e2ffe9; color: #249657; border: 1.5px solid #84e7af;}
.msg-error { background: #ffe2e2; color: #d62a42; border: 1.5px solid #fab6bc;}

/* --------- ANIMACION --------- */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(18px);}
  to   { opacity: 1; transform: none;}
}
@media (max-width: 600px) {
  .formulario-wizard {
    flex-direction: column !important;
    max-width: 100vw;
    min-width: 0;
    border-radius: 1rem;
    box-shadow: 0 2px 12px rgba(54,143,214,0.12);
    padding-bottom: 0;
  }

  .wizard-pregunta {
    padding: 1.2rem 0.7rem 1rem 0.7rem;
    min-width: 0;
  }

  .wizard-ia {
    width: 100%;
    min-width: 0;
    border-radius: 0 0 1rem 1rem;
    border-top: 1.5px solid #d0e5f9;
    border-left: none;
    padding: 0.85rem 0.6rem 0.85rem 0.9rem;
    margin-bottom: .2rem;
    background: linear-gradient(180deg, #eaf5ff 75%, #e1ebf8 100%);
    max-height: 240px;
    overflow-y: auto;
    position: static;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
  }

  .ia-header {
    font-size: 1.13rem;
    margin-bottom: .5rem;
  }

  .ia-content {
    font-size: 1.02rem;
    max-height: 165px;
    min-height: 36px;
    overflow-y: auto;
    width: 100%;
  }

  .wizard-step-label {
    font-size: 1.05rem;
    margin-bottom: 1rem;
  }

  .campo-form label,
  .campo-form input,
  .campo-form select,
  .campo-form textarea {
    font-size: 1.03rem;
  }

  .wizard-nav {
    flex-direction: column;
    gap: 0.6rem;
    margin-top: 1rem;
  }
  .wizard-nav button {
    width: 100%;
    padding: 1rem 0;
    font-size: 1.07rem;
    border-radius: 0.9rem;
    margin: 0;
  }
  .wizard-progress {
    margin-top: 0.9rem;
  }
  .msg-ok, .msg-error {
    width: 97%;
    padding: 1rem 0.3rem;
    font-size: 0.97rem;
  }

  .campo-form label {
    display: inline-flex;
    align-items: center;
    margin-bottom: 0.4em;
    margin-right: 1.1em;
    font-size: 1.01rem;
  }
  .campo-form input[type="radio"], .campo-form input[type="checkbox"] {
    margin-right: 0.45em;
  }
  .campo-form{
    display: flex;
  }
}

/* --------------------
   CAMPOS CONDICIONALES
--------------------- */
.campo-form[style*="display: none"] {
  display: none !important;
}


.campo-form {
  transition: opacity 0.2s, height 0.2s, margin 0.2s, padding 0.2s;
}
.campo-form[style*="display: none"] {
  opacity: 0 !important;
  pointer-events: none !important;
  height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  display: block !important;
}

