/* Inscripción: formulario de una columna en pasos numerados. Depende de layout.css y ui.css. */
.apply-head-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.5rem;
  margin-top: 1.25rem;
  color: var(--ui-on-dark);
}

.apply-head-meta span {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.apply-head-meta i {
  color: var(--portal-accent-soft);
}

.apply-head-meta__status::before {
  content: "";
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: #9ca3af;
}

.apply-head-meta__status--open {
  color: #fff;
  font-weight: 600;
}

.apply-head-meta__status--open::before {
  background: #4ade80;
  box-shadow: 0 0 0 4px rgba(74, 222, 128, 0.18);
}

.apply {
  padding-bottom: clamp(3rem, 6vw, 5rem);
}

.apply-layout {
  max-width: 860px;
  margin: 0 auto;
}

/* ---------- Selector de concurso ---------- */
.apply-picker {
  max-width: 720px;
  margin: clamp(2.5rem, 5vw, 4rem) auto 0;
}

.apply-picker .form-label {
  font-family: var(--portal-font-serif);
  font-size: 1.35rem;
}

.apply-picker__row {
  display: flex;
  gap: 0.75rem;
}

.apply-picker__row > :first-child,
.apply-picker__row .select2-container {
  flex: 1;
  min-width: 0;
}

.apply-picker__empty {
  margin: 1rem 0 0;
  color: var(--portal-muted);
}

.apply-switch {
  margin: 1.5rem 0 0;
  color: var(--portal-muted);
}

.apply-switch summary {
  display: inline-block;
  color: var(--portal-accent-strong);
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: rgba(31, 95, 174, 0.35);
  text-underline-offset: 0.3em;
}

.apply-switch[open] summary {
  margin-bottom: 0.75rem;
}

.apply-switch .form-select {
  min-height: 2.5rem;
}

/* ---------- Avisos ---------- */
.apply-callout {
  margin: 1.5rem 0 0;
  padding: 1rem 1.25rem;
  border-left: 3px solid var(--portal-accent);
  border-radius: 0.75rem;
  background: rgba(47, 127, 214, 0.08);
  color: var(--portal-ink);
}

.apply-callout strong {
  display: block;
  margin-bottom: 0.25rem;
}

.apply-callout--warn {
  border-left-color: #d97706;
  background: #fef3c7;
}

.apply-callout--ok {
  border-left-color: #16a34a;
  background: #dcfce7;
}

/* ---------- Pasos ---------- */
.apply-form {
  counter-reset: apply-stage;
}

.apply-stage {
  counter-increment: apply-stage;
  padding-block: 2.5rem;
  border-bottom: 1px solid var(--portal-line);
}

.apply-stage__title {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin: 0;
  color: var(--portal-ink);
  font-family: var(--portal-font-serif);
  font-size: 1.6rem;
  font-weight: 700;
}

/* La numeración se recalcula sola cuando el paso "Pareja" está oculto. */
.apply-stage__title::before {
  content: counter(apply-stage);
  display: grid;
  place-items: center;
  flex: none;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  background: var(--ui-night);
  color: #fff;
  font-family: var(--portal-font-sans);
  font-size: 1rem;
  font-weight: 700;
}

.apply-stage__hint {
  margin: 0.5rem 0 1.5rem;
  padding-left: 3.1rem;
  color: var(--portal-muted);
}

.apply-form .form-label {
  margin-bottom: 0.4rem;
  font-size: 0.925rem;
  font-weight: 600;
}

.apply-optional {
  color: var(--portal-muted);
  font-weight: 400;
}

.apply-form .form-control,
.apply-form .form-select {
  min-height: 3rem;
  border-color: #d5dde8;
  border-radius: 0.75rem;
  background-color: #fff;
}

.apply-lookup-btn {
  border: 1px solid #d5dde8;
  border-left: 0;
  border-radius: 0 0.75rem 0.75rem 0;
  background: var(--portal-bg);
  color: var(--portal-accent-strong);
  font-weight: 700;
}

.apply-lookup-btn:hover {
  background: var(--portal-accent-strong);
  color: #fff;
}

.apply-form .input-group > .form-control {
  border-radius: 0.75rem 0 0 0.75rem;
}

.apply-notice,
.apply-form .apply-inline-state {
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--portal-muted);
  font-size: 0.925rem;
}

.apply-form .apply-inline-state.is-ok {
  color: #1d7a3e;
}

.apply-form .apply-inline-state.is-warn {
  color: #b45309;
}

.apply-form .apply-inline-state.is-error {
  color: #b91c1c;
}

.apply-academy .select2-container {
  width: 100% !important;
}

.apply-academy-add {
  margin-top: 0.5rem;
  font-size: 0.925rem;
}

.apply-guardian {
  margin: 0.5rem 0 0;
  padding: 1.25rem;
  border: 1px solid #d5dde8;
  border-radius: 1rem;
  background: #fff;
}

.apply-guardian legend {
  float: none;
  width: auto;
  margin: 0 0 0.75rem;
  padding: 0;
  font-size: 1rem;
  font-weight: 700;
}

/* ---------- Resumen ---------- */
.apply-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 2rem;
  margin: 0 0 2rem;
  padding: 1.25rem 1.5rem;
  border-radius: 1rem;
  background: #fff;
}

.apply-summary__row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--portal-line);
}

.apply-summary__row dt {
  color: var(--portal-muted);
  font-weight: 400;
}

.apply-summary__row dd {
  margin: 0;
  color: var(--portal-ink);
  font-weight: 600;
  text-align: right;
}

.apply-summary__group {
  margin-top: 1rem;
}

.apply-summary__label {
  margin: 0 0 0.25rem;
  color: var(--portal-accent-strong);
  font-weight: 700;
}

.apply-summary .apply-summary-panel--disabled {
  opacity: 0.45;
}

/* ---------- Pago ---------- */
.apply-payment fieldset {
  margin: 0 0 1rem;
}

.apply-payment-opt-in label {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-height: 44px;
  cursor: pointer;
  font-weight: 600;
}

.apply-payment-opt-in input {
  width: 1.2rem;
  height: 1.2rem;
  flex: none;
}

.apply-payment-fields[hidden] {
  display: none;
}

.apply-pay-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.apply-pay-option {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 8rem;
  min-height: 3rem;
  padding: 0 1.25rem;
  border: 1px solid #d5dde8;
  border-radius: 0.85rem;
  background: #fff;
  font-weight: 700;
  cursor: pointer;
  transition: border-color var(--portal-dur-fast) var(--portal-ease), box-shadow var(--portal-dur-fast) var(--portal-ease);
}

.apply-pay-option input {
  accent-color: var(--portal-accent-strong);
  width: 1.1rem;
  height: 1.1rem;
}

.apply-pay-option:has(input:checked) {
  border-color: var(--portal-accent-strong);
  box-shadow: 0 0 0 3px rgba(31, 95, 174, 0.15);
}

.apply-pay-option:has(input:focus-visible) {
  box-shadow: var(--portal-focus);
}

.apply-payment-details {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin-bottom: 1.25rem;
  padding: 1rem;
  border-radius: 1rem;
  background: #fff;
}

/* El QR se muestra con su proporcion original y a buen tamano para poder escanearlo
   desde otro celular; al tocarlo se abre en tamano completo. */
.apply-payment-qr-wrap {
  flex: none;
  margin: 0;
  text-align: center;
}

.apply-payment-qr-wrap > a {
  display: block;
}

.apply-payment-qr {
  display: block;
  width: 260px;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
  border-radius: 0.75rem;
  image-rendering: -webkit-optimize-contrast;
}

.apply-payment-qr--receipt {
  width: 220px;
}

.apply-payment-qr-wrap figcaption {
  display: flex;
  justify-content: center;
  gap: 0.4rem;
  margin-top: 0.5rem;
  font-size: 0.875rem;
}

@media (max-width: 575.98px) {
  .apply-payment-details {
    flex-direction: column;
    align-items: stretch;
  }

  .apply-payment-qr {
    width: 100%;
    max-width: 320px;
  }
}

.apply-pay-amount {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 0.75rem;
  margin: 0 0 1rem;
  padding: 0.85rem 1rem;
  border-radius: 1rem;
  background: #fff;
}

.apply-pay-amount__label {
  color: var(--portal-muted);
  font-size: 0.875rem;
}

.apply-pay-amount__value {
  font-size: 1.5rem;
  line-height: 1.1;
}

.apply-pay-amount__note {
  color: var(--portal-muted);
  font-size: 0.875rem;
}

.apply-pay-amount[hidden],
.apply-summary__row[hidden] {
  display: none;
}

.apply-help {
  margin: 0.4rem 0 0;
  color: var(--portal-muted);
  font-size: 0.875rem;
}

.apply-optional {
  color: var(--portal-muted);
  font-weight: 400;
}

.apply-terms {
  margin-top: 1.75rem;
}

/* ---------- Acciones ---------- */
.apply-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 1.75rem;
  padding-top: 2rem;
}

.apply-actions .ui-btn {
  min-width: 15rem;
}

/* layout.css empuja el botón a la derecha; aquí la acción principal va primero. */
.apply-actions #applySubmitBtn {
  margin-left: 0;
}

.apply-modal {
  border: 0;
  border-radius: 1.25rem;
}

/* ---------- Responsive ---------- */
@media (max-width: 767.98px) {
  .apply-summary {
    grid-template-columns: 1fr;
  }

  .apply-stage__hint {
    padding-left: 0;
  }
}

@media (max-width: 575.98px) {
  .apply-picker__row {
    flex-direction: column;
  }

  .apply-actions .ui-btn {
    width: 100%;
  }

  .apply-payment-details {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ---------- Wizard (portal-apply-wizard.js) ---------- */
.apply [hidden] {
  display: none !important;
}

.apply-progress {
  position: sticky;
  top: calc(var(--portal-header-h) - 0.5rem);
  z-index: 5;
  margin: 1.5rem 0 0;
  padding: 1rem 0 0.75rem;
  background: var(--portal-bg);
  scroll-margin-top: var(--portal-header-h);
}

.apply-progress__count {
  margin: 0 0 0.6rem;
  color: var(--portal-muted);
  font-size: 0.925rem;
  font-weight: 600;
}

.apply-progress__bar {
  height: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: #dbe3ee;
}

.apply-progress__bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--portal-accent), var(--portal-accent-strong));
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform var(--portal-dur-slow) var(--portal-ease);
}

.apply-progress__steps {
  display: flex;
  gap: 0.25rem 1.5rem;
  margin: 0.75rem 0 0;
  padding: 0;
  list-style: none;
}

.apply-progress__steps button {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.25rem 0;
  border: 0;
  background: none;
  color: var(--portal-muted);
  font-size: 0.9rem;
  font-weight: 600;
}

.apply-progress__steps button::before {
  content: "";
  width: 0.6rem;
  height: 0.6rem;
  border: 2px solid currentColor;
  border-radius: 50%;
}

.apply-progress__steps .is-done button {
  color: var(--portal-accent-strong);
  cursor: pointer;
}

.apply-progress__steps .is-done button::before {
  border-color: var(--portal-accent-strong);
  background: var(--portal-accent-strong);
}

.apply-progress__steps .is-done button:hover {
  text-decoration: underline;
  text-underline-offset: 0.25em;
}

.apply-progress__steps .is-current button {
  color: var(--portal-ink);
}

.apply-progress__steps .is-current button::before {
  border-color: var(--portal-accent-strong);
  box-shadow: 0 0 0 3px rgba(31, 95, 174, 0.2);
}

.apply-progress__steps button:disabled {
  cursor: default;
  opacity: 1;
}

.apply-form.is-wizard .apply-stage {
  border-bottom: 0;
  padding-bottom: 1rem;
}

.apply-form.is-wizard .apply-stage:not(.is-current) {
  display: none;
}

.apply-form.is-wizard .apply-stage.is-current {
  animation: applyStageIn var(--portal-dur-base) var(--portal-ease);
}

@keyframes applyStageIn {
  from {
    opacity: 0;
    transform: translateX(12px);
  }
}

.apply-form.is-wizard .apply-stage__title::before {
  content: attr(data-step);
}

.apply-stage__title:focus {
  outline: none;
}

.apply-form.is-wizard .apply-actions {
  justify-content: flex-start;
  border-top: 1px solid var(--portal-line);
  padding-top: 1.5rem;
}

.apply-form.is-wizard .apply-actions .apply-actions__next,
.apply-form.is-wizard .apply-actions #applySubmitBtn {
  margin-left: auto;
}

/* Errores en selects con Select2 */
.apply-form .is-invalid + .select2-container .select2-selection {
  border-color: #dc3545;
}

@media (max-width: 767.98px) {
  .apply-progress__steps {
    display: none;
  }

  /* En móvil las acciones quedan siempre a mano, pegadas abajo. */
  .apply-form.is-wizard .apply-actions {
    position: sticky;
    bottom: 0;
    z-index: 5;
    margin-inline: -1rem;
    padding: 0.85rem 1rem calc(0.85rem + env(safe-area-inset-bottom));
    background: rgba(242, 246, 251, 0.96);
    backdrop-filter: blur(6px);
    box-shadow: 0 -10px 24px -18px rgba(11, 31, 58, 0.5);
  }

  .apply-form.is-wizard .apply-actions .ui-btn {
    width: auto;
    min-width: 0;
    flex: 1;
  }

  .apply-form.is-wizard .apply-actions__draft {
    display: none;
  }

  /* Los botones flotantes (WhatsApp, volver arriba) suben para no tapar "Continuar". */
  .portal-layout:has(.apply-form.is-wizard) .portal-whatsapp {
    bottom: 5.75rem;
  }

  .portal-layout:has(.apply-form.is-wizard) .portal-back-top {
    bottom: 9.5rem;
  }
}
