/* ============================================================
   Wanted Property Request — Wizard steps, controls e estados.
   Stepper visual fica em ``wizard_stepper.css`` (split por limite).
   Reusa tokens --gf-* de static/css/base/_tokens.css.
   ============================================================ */

.wizard-steps {
  position: relative;
}

.wizard-step {
  /* default: visível (graceful degrade sem JS) */
  display: block;
}

.js-enabled .wizard-step {
  display: none;
  animation: wizard-fadeIn 0.3s ease;
}

.js-enabled .wizard-step.is-active {
  display: block;
}

/* No-JS fallback: hide stepper + step nav (no-op sem JS) e força submit visível
   apesar do attribute hidden setado para o caminho com JS. */
html:not(.js-enabled) .wanted-request-wizard [data-stepper],
html:not(.js-enabled) .wanted-request-wizard .wizard-controls__prev,
html:not(.js-enabled) .wanted-request-wizard .wizard-controls__next {
  display: none;
}

html:not(.js-enabled) .wanted-request-wizard .wizard-controls__submit[hidden] {
  display: inline-flex;
}

@keyframes wizard-fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.wizard-step__header {
  max-width: 56ch;
}

.wizard-step__eyebrow {
  letter-spacing: 0.06em;
}

.wizard-step__title:focus {
  outline: none;
}

/* Header sticky tem ~80px; garantir que o titulo do step nao fique atras
   do header quando o JS rola para o inicio do passo (scrollIntoView). */
.wizard-step,
.wizard-step__title,
.wizard-step__header {
  scroll-margin-top: 96px;
}

/* Cards internos das etapas precisam do mesmo padding que tinham na pagina
   single-page legacy. O seletor .property-preferences exigia wrapper externo
   que o wizard nao tem mais — replicamos aqui com escopo no wizard. */
.wanted-request-wizard .property-preferences-card,
.wanted-request-wizard .property-highlights__card,
.wanted-request-wizard .property-destinations__card,
.wanted-request-wizard .contact-card {
  padding: var(--gf-card-padding);
}

@media (max-width: 991.98px) {
  .wanted-request-wizard .property-preferences-card,
  .wanted-request-wizard .property-highlights__card,
  .wanted-request-wizard .property-destinations__card,
  .wanted-request-wizard .contact-card {
    padding: var(--gf-card-padding-sm);
  }
}

/* -- Controls (Avançar / Voltar / Enviar) ---------------- */
.wizard-controls {
  margin-top: 1.5rem;
  align-items: stretch;
}

.wizard-controls .gf-btn {
  min-width: 160px;
}

.wizard-controls__submit {
  position: relative;
}

.wizard-controls__submit.is-loading .wizard-controls__submit-label {
  visibility: hidden;
}

.wizard-controls__submit-spinner {
  display: none;
  position: absolute;
  inset: 0;
  margin: auto;
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 50%;
  border: 0.2rem solid rgba(255, 255, 255, 0.4);
  border-top-color: var(--gf-color-primary-contrast, #fff);
  animation: wizard-spinner 0.8s linear infinite;
}

.wizard-controls__submit.is-loading .wizard-controls__submit-spinner {
  display: block;
}

@keyframes wizard-spinner {
  to { transform: rotate(360deg); }
}

/* -- Captcha block --------------------------------------- */
.wizard-captcha {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
}

/* -- Outline button variant ------------------------------ */
.gf-btn-outline {
  background-color: transparent;
  color: var(--gf-color-primary);
  border: 1.5px solid var(--gf-color-primary);
}

.gf-btn-outline:hover:not(:disabled) {
  background-color: var(--gf-color-primary-soft);
}

.gf-btn-outline:focus-visible {
  outline: 3px solid var(--gf-color-focus-ring);
  outline-offset: 2px;
}

/* -- Mobile-first responsive (<= 575.98px) --------------- */
@media (max-width: 575.98px) {
  /* P1 (2026-05-27): voltar para position:sticky em vez de position:fixed.
     Sticky se auto-comporta: gruda no bottom do viewport enquanto ha
     conteudo do form para rolar, e "solta" naturalmente ao chegar no
     fim do form (sem flicker com o footer). Sem necessidade de
     IntersectionObserver/JS sentinel.

     Para o sticky funcionar, o ``.wanted-request-wizard`` precisa ser
     o ancestral com altura — definido em ``.wanted-request-page`` que
     ja contem todo o form. */
  .wizard-controls {
    position: sticky;
    bottom: 0;
    left: 0;
    right: 0;
    /* z-index < 50: o site-header (``.site-header-tw``, sticky z-50) e seus
       seletores (avatar-hub / unidade de area, tambem z-50) precisam ficar por
       cima da action bar. Acima do conteudo do form; o gf-select__panel (z 40)
       e o drawer de unidade (z 1049/1050) seguem por cima quando abertos. */
    z-index: 30;
    background: var(--gf-field-bg, #ffffff);
    padding: 0.85rem 1rem;
    padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
    margin: 1.5rem -1rem 0;
    box-shadow: 0 -8px 24px -16px rgba(15, 23, 42, 0.35);
    border-top: 1px solid rgba(15, 23, 42, 0.08);
    flex-direction: row;
    gap: 0.75rem;
  }

  .wizard-controls .gf-btn {
    flex: 1 1 0;
    min-width: 0;
  }

  .wizard-controls__prev[hidden] {
    display: none !important;
  }

  /* M12/P4 — nao deixar o submit quebrar em 2 linhas. Em conjunto com
     ``d-sm-none`` (Bootstrap utility) o template ja troca o label longo
     "Enviar solicitação" por "Enviar" no mobile. Aqui so garantimos
     que o conjunto fique compacto. */
  .wizard-controls .gf-btn-lg {
    font-size: 0.95rem;
    padding-left: 0.65rem;
    padding-right: 0.65rem;
  }

  .wizard-controls__next > span,
  .wizard-controls__prev > span {
    white-space: nowrap;
  }

  /* Sticky no longer needs page-level padding; conteudo flui natural. */
  .wanted-request-page {
    padding-bottom: 0;
  }
}

/* -- Reduced motion -------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .js-enabled .wizard-step,
  .wizard-controls__submit-spinner {
    animation: none;
  }
}

/* -- Print ----------------------------------------------- */
@media print {
  .wizard-controls {
    display: none !important;
  }
  .wizard-step,
  .js-enabled .wizard-step {
    display: block !important;
  }
}
