/* =========================================================
   NORTE VERDE — POPUP DE PREINSCRIPCIÓN FVH DESDE CERO
========================================================= */

.preinscripcion-helper {
  margin: 13px 0 0;
  color: #7f8b84;
  font-size: .77rem;
  line-height: 1.45;
  text-align: center;
}

.preinscripcion-open {
  border: 0;
  cursor: pointer;
}


/* =========================================================
   MODAL / BACKDROP
========================================================= */

body.preinscripcion-modal-open {
  overflow: hidden;
}

.preinscripcion-modal[hidden] {
  display: none;
}

.preinscripcion-modal {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: grid;
  place-items: center;
  padding: 28px;
}

.preinscripcion-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 24, 18, .72);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

.preinscripcion-dialog {
  position: relative;
  width: min(790px, 100%);
  max-height: calc(100dvh - 56px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.45);
  border-radius: 25px;
  outline: none;
  background: #fff;
  box-shadow: 0 35px 100px rgba(0,0,0,.33);
  animation: preModalIn .24s ease both;
}

@keyframes preModalIn {
  from {
    opacity: 0;
    transform: translateY(16px) scale(.985);
  }
  to {
    opacity: 1;
    transform: none;
  }
}


/* =========================================================
   CABECERA
========================================================= */

.preinscripcion-modal-header {
  position: relative;
  flex: 0 0 auto;
  padding: 27px 74px 20px 30px;
  background:
    radial-gradient(circle at 92% 8%, rgba(167,213,31,.16), transparent 34%),
    linear-gradient(135deg, #09271d, #10382a);
  color: #fff;
}

.preinscripcion-kicker {
  margin: 0 0 6px;
  color: #b8df3e;
  font-size: .68rem;
  font-weight: 900;
  letter-spacing: .13em;
  text-transform: uppercase;
}

.preinscripcion-modal-header h2 {
  margin: 0;
  color: #fff;
  font-size: clamp(1.65rem, 3vw, 2.25rem);
  line-height: 1.05;
  letter-spacing: -.035em;
}

.preinscripcion-modal-header p:last-child {
  max-width: 630px;
  margin: 9px 0 0;
  color: rgba(255,255,255,.70);
  font-size: .84rem;
  line-height: 1.55;
}

.preinscripcion-close {
  position: absolute;
  top: 20px;
  right: 21px;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 50%;
  background: rgba(255,255,255,.08);
  color: #fff;
  font-size: 1.75rem;
  line-height: 1;
  cursor: pointer;
  transition:
    background .2s ease,
    transform .2s ease;
}

.preinscripcion-close:hover {
  background: rgba(255,255,255,.15);
  transform: rotate(4deg);
}


/* =========================================================
   PROGRESO
========================================================= */

.preinscripcion-progress {
  flex: 0 0 auto;
  padding: 14px 30px 13px;
  border-bottom: 1px solid #e3e9e4;
  background: #fbfcfa;
}

.pre-progress-bar {
  width: 100%;
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8ede9;
}

.pre-progress-bar span {
  width: 25%;
  height: 100%;
  display: block;
  border-radius: inherit;
  background:
    linear-gradient(90deg, #8fbd16, #b0d92b);
  transition: width .25s ease;
}

.pre-progress-labels {
  margin-top: 8px;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  color: #7c8981;
  font-size: .69rem;
  font-weight: 750;
}

#preinscripcion-step-name {
  color: #506057;
}


/* =========================================================
   CUERPO
========================================================= */

.preinscripcion-modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 28px 30px 25px;
}

.preinscripcion-form {
  display: grid;
  gap: 18px;
}

.preinscripcion-step[hidden] {
  display: none;
}

.preinscripcion-step.is-active {
  animation: preStepIn .2s ease both;
}

@keyframes preStepIn {
  from {
    opacity: 0;
    transform: translateX(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.pre-step-heading {
  margin-bottom: 20px;
}

.pre-step-number {
  margin: 0 0 4px;
  color: #8bad1d;
  font-size: .67rem;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.pre-step-heading h3 {
  margin: 0;
  color: #14231b;
  font-size: 1.42rem;
  line-height: 1.15;
  letter-spacing: -.03em;
}

.pre-step-heading > p:last-child {
  margin: 7px 0 0;
  color: #748078;
  font-size: .82rem;
  line-height: 1.5;
}


/* =========================================================
   FIELDSETS
========================================================= */

.preinscripcion-group {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.preinscripcion-group > legend {
  display: none;
}

.preinscripcion-grid {
  display: grid;
  gap: 15px;
}

.preinscripcion-grid.two {
  grid-template-columns: 1fr 1fr;
}

.preinscripcion-field {
  display: grid;
  gap: 7px;
}

.preinscripcion-field label,
.preinscripcion-question > p {
  margin: 0;
  color: #26362e;
  font-size: .83rem;
  font-weight: 780;
  line-height: 1.4;
}

.preinscripcion-field label em {
  color: #8fbd16;
  font-style: normal;
}

.preinscripcion-field input,
.preinscripcion-field select,
.preinscripcion-field textarea {
  width: 100%;
  min-height: 49px;
  padding: 11px 13px;
  border: 1px solid #d8e1da;
  border-radius: 11px;
  outline: none;
  background: #fff;
  color: #17271f;
  font: inherit;
  font-size: .89rem;
  transition:
    border-color .2s ease,
    box-shadow .2s ease;
}

.preinscripcion-field textarea {
  min-height: 105px;
  resize: vertical;
}

.preinscripcion-field input:focus,
.preinscripcion-field select:focus,
.preinscripcion-field textarea:focus {
  border-color: #2e97d4;
  box-shadow: 0 0 0 4px rgba(46,151,212,.09);
}

.preinscripcion-field small,
.preinscripcion-note {
  color: #87928c;
  font-size: .7rem;
  line-height: 1.4;
}

.preinscripcion-question {
  display: grid;
  gap: 11px;
}

.preinscripcion-question + .preinscripcion-question {
  margin-top: 23px;
}


/* =========================================================
   CHIPS / OPCIONES
========================================================= */

.choice-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.choice-chip,
.choice-card {
  position: relative;
  cursor: pointer;
}

.choice-chip input,
.choice-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.choice-chip span {
  min-height: 39px;
  padding: 8px 13px;
  display: inline-flex;
  align-items: center;
  border: 1px solid #d8e1da;
  border-radius: 999px;
  background: #fff;
  color: #4f5f56;
  font-size: .77rem;
  font-weight: 720;
  line-height: 1.25;
  transition:
    background .18s ease,
    border-color .18s ease,
    color .18s ease;
}

.choice-chip input:checked + span {
  border-color: #a5cc2f;
  background: #f0f7dd;
  color: #334418;
}

.choice-chip input:focus-visible + span,
.choice-card input:focus-visible + span {
  outline: 3px solid rgba(46,151,212,.25);
  outline-offset: 2px;
}

.choice-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.choice-card span {
  min-height: 57px;
  padding: 12px 13px;
  display: flex;
  align-items: center;
  border: 1px solid #d8e1da;
  border-radius: 11px;
  background: #fff;
  color: #4e5c55;
  font-size: .77rem;
  font-weight: 720;
  line-height: 1.35;
  transition:
    background .18s ease,
    border-color .18s ease,
    color .18s ease;
}

.choice-card input:checked + span {
  border-color: #a5cc2f;
  background: #f0f7dd;
  color: #334418;
}

.topics .choice-chip span {
  border-radius: 10px;
}

.otro-tema-field {
  margin-top: 17px;
}


/* =========================================================
   CONSENTIMIENTO
========================================================= */

.preinscripcion-consent {
  margin-top: 21px;
  padding: 16px 17px;
  border: 1px solid #d8e4d4;
  border-radius: 13px;
  background: #f4f8ea;
}

.preinscripcion-consent label {
  display: grid;
  grid-template-columns: 19px 1fr;
  gap: 10px;
  align-items: start;
  cursor: pointer;
}

.preinscripcion-consent input {
  width: 17px;
  height: 17px;
  margin-top: 2px;
  accent-color: #82ad08;
}

.preinscripcion-consent span {
  color: #48564e;
  font-size: .75rem;
  line-height: 1.55;
}


/* =========================================================
   ACCIONES
========================================================= */

.preinscripcion-actions {
  position: sticky;
  bottom: -25px;
  z-index: 5;
  margin: 6px -30px -25px;
  padding: 16px 30px 18px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  border-top: 1px solid #e2e8e3;
  background: rgba(255,255,255,.96);
  backdrop-filter: blur(10px);
}

.pre-step-back {
  min-height: 48px;
  margin-right: auto;
  padding: 0 5px;
  border: 0;
  background: transparent;
  color: #647269;
  font: inherit;
  font-size: .82rem;
  font-weight: 800;
  cursor: pointer;
}

.pre-step-next,
.preinscripcion-submit {
  min-width: 170px;
  border: 0;
  cursor: pointer;
}

.preinscripcion-submit[disabled] {
  opacity: .65;
  cursor: wait;
  transform: none;
}

.preinscripcion-legal {
  margin: 2px 0 0;
  color: #929b96;
  font-size: .67rem;
  line-height: 1.4;
  text-align: center;
}

.preinscripcion-status {
  padding: 12px 14px;
  border-radius: 10px;
  font-size: .78rem;
  line-height: 1.45;
}

.preinscripcion-status.is-error {
  border: 1px solid #efc9c4;
  background: #fff4f2;
  color: #8e3025;
}

.preinscripcion-status.is-info {
  border: 1px solid #cfe1ec;
  background: #f3f9fc;
  color: #315e78;
}


/* =========================================================
   SUCCESS
========================================================= */

.preinscripcion-success {
  max-width: 520px;
  margin: 25px auto;
  padding: 35px 30px;
  text-align: center;
}

.preinscripcion-success[hidden] {
  display: none;
}

.success-mark {
  width: 58px;
  height: 58px;
  margin: 0 auto 17px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #a7d51f;
  color: #22320e;
  font-size: 1.4rem;
  font-weight: 900;
}

.preinscripcion-success h3 {
  margin: 0;
  color: #14231b;
  font-size: 1.6rem;
  letter-spacing: -.03em;
}

.preinscripcion-success > p:not(.preinscripcion-kicker) {
  margin: 12px 0 22px;
  color: #6c7971;
  font-size: .9rem;
  line-height: 1.65;
}

.preinscripcion-success-close {
  min-width: 150px;
  border: 0;
  cursor: pointer;
}


/* =========================================================
   UTILIDADES
========================================================= */

.preinscripcion-hp {
  position: absolute !important;
  left: -10000px !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
}

.preinscripcion-security:empty {
  display: none;
}


/* =========================================================
   MOBILE — CASI PANTALLA COMPLETA
========================================================= */

@media (max-width: 620px) {

  .preinscripcion-modal {
    padding: 0;
    place-items: stretch;
  }

  .preinscripcion-dialog {
    width: 100%;
    height: 100dvh;
    max-height: 100dvh;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .preinscripcion-modal-header {
    padding: 19px 59px 15px 18px;
  }

  .preinscripcion-modal-header h2 {
    font-size: 1.55rem;
  }

  .preinscripcion-modal-header p:last-child {
    margin-top: 7px;
    font-size: .76rem;
    line-height: 1.42;
  }

  .preinscripcion-close {
    top: 14px;
    right: 13px;
    width: 39px;
    height: 39px;
  }

  .preinscripcion-progress {
    padding: 12px 18px 11px;
  }

  .preinscripcion-modal-body {
    padding: 22px 18px 18px;
  }

  .pre-step-heading {
    margin-bottom: 18px;
  }

  .pre-step-heading h3 {
    font-size: 1.3rem;
  }

  .preinscripcion-grid.two,
  .choice-cards {
    grid-template-columns: 1fr;
  }

  .choice-chip span {
    min-height: 41px;
    font-size: .76rem;
  }

  .choice-card span {
    min-height: 52px;
  }

  .preinscripcion-actions {
    bottom: -18px;
    margin: 8px -18px -18px;
    padding: 13px 18px calc(14px + env(safe-area-inset-bottom));
  }

  .pre-step-next,
  .preinscripcion-submit {
    width: auto;
    min-width: 0;
    flex: 1 1 auto;
    padding-inline: 17px;
  }

  .pre-step-back {
    flex: 0 0 auto;
    font-size: .76rem;
  }

}

@media (max-width: 390px) {

  .pre-progress-labels {
    gap: 8px;
    font-size: .64rem;
  }

  .pre-step-next,
  .preinscripcion-submit {
    font-size: .82rem;
  }

}


/* =========================================================
   FIX — BOTONES POR PASO
   El estilo global .course-btn define display:inline-flex,
   por eso el atributo hidden necesitaba una regla explícita.
========================================================= */

.pre-step-back[hidden],
.pre-step-next[hidden],
.preinscripcion-submit[hidden] {
  display: none !important;
}


/* =========================================================
   FIX — ESTADO FINAL DE PREINSCRIPCIÓN
   Cuando el JS aplica form.hidden = true, el formulario debe
   desaparecer por completo para mostrar sólo el agradecimiento.
========================================================= */

.preinscripcion-form[hidden] {
  display: none !important;
}
