/* ==========================================================================
   Multi-Step Form & Exit-Intent Popup
   LV Homes — Lead Generation Form Styles
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Multi-step form container & form-wrap override
   -------------------------------------------------------------------------- */

/* Override the white .hero__form-wrap to dark navy when multi-step form is inside */
.hero__form-wrap:has(.msf) {
  background: var(--color-primary);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
}

.hero__form-wrap:has(.msf) .hero__form-title {
  color: var(--color-white);
  font-family: var(--font-heading);
}

.hero__form-wrap:has(.msf) .hero__form-subtitle {
  color: rgba(255, 255, 255, 0.6);
}

.msf {
  overflow: hidden;
}

/* --------------------------------------------------------------------------
   2. Progress bar
   -------------------------------------------------------------------------- */
.msf__progress {
  position: relative;
  height: 4px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 2px;
  margin-bottom: 8px;
}

.msf__progress-fill {
  height: 100%;
  background: var(--color-accent);
  border-radius: 2px;
  transition: width 0.4s ease;
  width: 0%;
}

.msf__step-indicator {
  display: block;
  text-align: right;
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.5);
  font-family: var(--font-body);
  margin-top: 6px;
}

/* --------------------------------------------------------------------------
   3. Step transitions
   -------------------------------------------------------------------------- */
.msf__steps {
  display: flex;
  width: 400%;
  transition: transform 0.3s ease-out;
}

.msf__step {
  width: 25%;
  flex-shrink: 0;
  padding: 1.5rem 0;
}

/* --------------------------------------------------------------------------
   4. Step title
   -------------------------------------------------------------------------- */
.msf__step-title {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--color-white);
  text-align: center;
  margin: 0 0 16px;
}

/* --------------------------------------------------------------------------
   5. Card selectors
   -------------------------------------------------------------------------- */
.msf__cards {
  display: grid;
  gap: 10px;
}

.msf__cards--1col {
  grid-template-columns: 1fr;
}

.msf__cards--2col {
  grid-template-columns: 1fr 1fr;
}

.msf__card {
  background: rgba(255, 255, 255, 0.12);
  border: 1.5px solid rgba(255, 255, 255, 0.25);
  border-radius: 10px;
  padding: 14px 18px;
  color: var(--color-white);
  font-size: 0.9rem;
  font-weight: 500;
  font-family: var(--font-body);
  cursor: pointer;
  min-height: 52px;
  display: flex;
  align-items: center;
  transition: border-color 0.2s, background 0.2s;
  user-select: none;
  -webkit-user-select: none;
}

.msf__card:hover {
  border-color: var(--color-accent);
  background: rgba(212, 160, 23, 0.15);
}

.msf__card--selected {
  border-color: var(--color-accent);
  background: rgba(212, 160, 23, 0.20);
  box-shadow: 0 0 0 3px rgba(212, 160, 23, 0.20);
}

/* --------------------------------------------------------------------------
   6. Floating label inputs
   -------------------------------------------------------------------------- */
.msf__field {
  position: relative;
  margin-bottom: 14px;
}

.msf__field input,
.msf__field select,
.msf__field textarea {
  width: 100%;
  padding: 20px 14px 8px;
  background: rgba(255, 255, 255, 0.08);
  border: 1.5px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  color: var(--color-white);
  font-size: 1rem;
  font-family: var(--font-body);
  outline: none;
  transition: border-color 0.2s;
  box-sizing: border-box;
  -webkit-appearance: none;
  appearance: none;
}

.msf__field input:focus,
.msf__field select:focus,
.msf__field textarea:focus {
  border-color: var(--color-accent);
}

.msf__field label {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(255, 255, 255, 0.45);
  font-size: 0.88rem;
  font-family: var(--font-body);
  pointer-events: none;
  transition: all 0.2s;
}

.msf__field--active label {
  top: 8px;
  transform: translateY(0);
  font-size: 0.68rem;
  color: var(--color-accent);
}

.msf__field .checkmark {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-success);
  font-weight: 700;
  font-size: 1rem;
  pointer-events: none;
}

.msf__field--invalid input,
.msf__field--invalid select,
.msf__field--invalid textarea {
  border-color: #dc3545;
}

.msf__field .msf__error {
  font-size: 0.75rem;
  color: #dc3545;
  margin-top: 4px;
  font-family: var(--font-body);
}

/* --------------------------------------------------------------------------
   7. Submit button
   -------------------------------------------------------------------------- */
.msf__submit {
  display: block;
  width: 100%;
  padding: 14px;
  background: #C8102E;
  color: var(--color-white);
  border: none;
  border-radius: 8px;
  font-weight: 700;
  font-size: 1rem;
  font-family: var(--font-heading);
  cursor: pointer;
  transition: background 0.2s;
  min-height: 48px;
}

.msf__submit:hover {
  background: #a00d24;
}

.msf__submit:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

/* --------------------------------------------------------------------------
   8. Back button
   -------------------------------------------------------------------------- */
.msf__back {
  display: block;
  margin: 12px auto 0;
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.4);
  font-size: 0.8rem;
  font-family: var(--font-body);
  cursor: pointer;
  transition: color 0.2s;
  padding: 8px 16px;
  min-height: 48px;
}

.msf__back:hover {
  color: rgba(255, 255, 255, 0.7);
}

/* --------------------------------------------------------------------------
   9. Privacy note
   -------------------------------------------------------------------------- */
.msf__privacy {
  text-align: center;
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.4);
  font-family: var(--font-body);
  margin-top: 10px;
  line-height: 1.4;
}

/* --------------------------------------------------------------------------
   10. Success state
   -------------------------------------------------------------------------- */
.msf__success {
  display: none;
  text-align: center;
  padding: 28px 16px;
}

.msf__success-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--color-success);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}

.msf__success-icon svg {
  width: 28px;
  height: 28px;
  color: var(--color-white);
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.msf__success-title {
  color: var(--color-white);
  font-size: 1.2rem;
  font-family: var(--font-heading);
  font-weight: 600;
  margin: 0 0 8px;
}

.msf__success-message {
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.85rem;
  font-family: var(--font-body);
  margin: 0 0 12px;
  line-height: 1.5;
}

.msf__success-license {
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.35);
  font-family: var(--font-body);
  margin-top: 8px;
  line-height: 1.4;
}

/* --------------------------------------------------------------------------
   11. Disqualification state
   -------------------------------------------------------------------------- */
.msf__disqualified {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  padding: 20px;
  text-align: center;
  animation: msfFadeIn 0.3s ease forwards;
}

.msf__disqualified-title {
  color: var(--color-accent);
  font-size: 1rem;
  font-family: var(--font-heading);
  font-weight: 600;
  margin: 0 0 10px;
}

.msf__disqualified-body {
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.8rem;
  font-family: var(--font-body);
  line-height: 1.5;
  margin: 0 0 16px;
}

.msf__disqualified-close {
  display: inline-block;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  color: var(--color-white);
  font-size: 0.82rem;
  font-family: var(--font-body);
  padding: 10px 24px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  min-height: 48px;
}

.msf__disqualified-close:hover {
  border-color: rgba(255, 255, 255, 0.4);
  background: rgba(255, 255, 255, 0.05);
}

/* --------------------------------------------------------------------------
   12. Exit-intent popup overlay
   -------------------------------------------------------------------------- */
.msf-popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 10000;
  display: none;
}

.msf-popup-overlay--active {
  display: flex;
  align-items: center;
  justify-content: center;
  animation: msfFadeIn 0.3s ease forwards;
}

.msf-popup-overlay--closing {
  animation: msfFadeOut 0.2s ease forwards;
}

/* --------------------------------------------------------------------------
   13. Popup modal
   -------------------------------------------------------------------------- */
.msf-popup {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
  border-radius: 16px;
  max-width: 480px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 28px 24px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.25);
  position: relative;
  animation: msfSlideUp 0.3s ease forwards;
}

.msf-popup-overlay--closing .msf-popup {
  animation: msfSlideDown 0.2s ease forwards;
}

/* --------------------------------------------------------------------------
   14. Popup close button
   -------------------------------------------------------------------------- */
.msf-popup__close {
  position: absolute;
  top: 12px;
  right: 16px;
  width: 36px;
  height: 36px;
  min-width: 44px;
  min-height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: var(--color-white);
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  padding: 0;
  line-height: 1;
}

.msf-popup__close:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* --------------------------------------------------------------------------
   15. Popup headline
   -------------------------------------------------------------------------- */
.msf-popup__headline {
  text-align: center;
  color: var(--color-white);
  font-size: 1.15rem;
  font-family: var(--font-heading);
  font-weight: 600;
  line-height: 1.3;
  margin: 0 0 4px;
}

.msf-popup__headline--gold {
  color: var(--color-accent);
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.msf-popup__subtext {
  text-align: center;
  color: rgba(255, 255, 255, 0.65);
  font-size: 0.82rem;
  font-family: var(--font-body);
  margin: 8px 0 20px;
  line-height: 1.4;
}

/* --------------------------------------------------------------------------
   16. Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 575.98px) {
  .msf__cards--2col {
    grid-template-columns: 1fr;
  }

  .msf-popup {
    width: calc(100% - 24px);
    max-width: none;
    max-height: calc(100vh - 24px);
    margin: 12px;
    border-radius: 12px;
    padding: 24px 16px;
  }

  .msf__step {
    padding: 1rem 0;
  }

  .msf__step-title {
    font-size: 0.95rem;
  }

  .msf__card {
    min-height: 48px;
    padding: 12px 16px;
  }

  .msf__submit {
    min-height: 48px;
  }

  .msf__back {
    min-height: 48px;
  }
}

/* Ensure 16px font on all inputs to prevent iOS zoom */
.msf__field input,
.msf__field select,
.msf__field textarea {
  font-size: 1rem;
}

/* --------------------------------------------------------------------------
   17. Reduced motion
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .msf__progress-fill {
    transition: none;
  }

  .msf__steps {
    transition: none;
  }

  .msf__card {
    transition: none;
  }

  .msf__field input,
  .msf__field select,
  .msf__field textarea {
    transition: none;
  }

  .msf__field label {
    transition: none;
  }

  .msf__submit {
    transition: none;
  }

  .msf__back {
    transition: none;
  }

  .msf-popup__close {
    transition: none;
  }

  .msf__disqualified-close {
    transition: none;
  }

  .msf-popup-overlay--active {
    animation: none;
  }

  .msf-popup-overlay--closing {
    animation: none;
  }

  .msf-popup {
    animation: none;
  }

  .msf-popup-overlay--closing .msf-popup {
    animation: none;
  }

  .msf__disqualified {
    animation: none;
  }
}

/* --------------------------------------------------------------------------
   18. Keyframe animations
   -------------------------------------------------------------------------- */
@keyframes msfFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes msfFadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

@keyframes msfSlideUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes msfSlideDown {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(30px);
  }
}

/* --------------------------------------------------------------------------
   19. Standalone form page
   -------------------------------------------------------------------------- */
.msf-standalone-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background:
    url('../LV%20Homes_Gold%20Gradient%20Tiles.svg') center / cover no-repeat,
    linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
  background-blend-mode: soft-light;
  padding: 24px;
}

.msf-standalone__logo {
  display: block;
  max-width: 160px;
  height: auto;
  margin: 0 auto 12px;
}

.msf-standalone__phone {
  display: block;
  text-align: center;
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.85rem;
  font-family: var(--font-body);
  text-decoration: none;
  margin-bottom: 24px;
  transition: color 0.2s;
}

.msf-standalone__phone:hover {
  color: var(--color-white);
}

.msf-standalone-card {
  max-width: 480px;
  width: 100%;
  background: var(--color-primary);
  border-radius: 16px;
  padding: 28px 24px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
}

.msf-standalone__title {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--color-white);
  text-align: center;
  margin: 0 0 4px;
}

.msf-standalone__subtitle {
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.6);
  text-align: center;
  margin: 0 0 20px;
}

@media (max-width: 575.98px) {
  .msf-standalone-page {
    padding: 16px;
  }

  .msf-standalone-card {
    padding: 24px 16px;
    border-radius: 12px;
  }
}
