/* =========================================
   Lead Modal (Popup Form)
   - Desktop: canto inferior direito + overlay leve
   - Mobile: card no topo (sem risco com teclado) + overlay no resto
   ========================================= */

.lead-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
}

.lead-modal.is-open {
  display: block;
}

.lead-modal__overlay {
  position: absolute;
  inset: 0;
  background: rgba(11, 18, 32, 0.34);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

/* CARD DO MODAL (DESKTOP) */
.lead-modal__dialog {
  position: fixed;
  right: 18px;
  bottom: 18px;
  width: min(400px, calc(100% - 36px));
  border-radius: 20px;
  overflow: hidden;
  background: var(--g-brand, linear-gradient(90deg, rgba(68, 109, 255, 0.95), rgba(255, 78, 140, 0.95)));
  color: #fff;
  box-shadow: 0 26px 80px rgba(11, 18, 32, 0.28);
  outline: none;
  max-height: calc(100vh - 36px);
  display: flex;
  flex-direction: column;
}

.lead-modal__dialog::before {
  content: none;
}

.lead-modal__close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 40px;
  height: 40px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(11, 18, 32, 0.18);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: rgba(255, 255, 255, 0.96);
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0;
  line-height: 1;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
  box-shadow: 0 10px 26px rgba(11, 18, 32, 0.18);
}

.lead-modal__close::before,
.lead-modal__close::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 2px;
  background: rgba(255, 255, 255, 0.92);
  border-radius: 999px;
  transform-origin: center;
}

.lead-modal__close::before { transform: rotate(45deg); }
.lead-modal__close::after  { transform: rotate(-45deg); }

.lead-modal__close:hover {
  transform: translateY(-1px);
  background: rgba(11, 18, 32, 0.26);
  border-color: rgba(255, 255, 255, 0.30);
}

.lead-modal__close:active {
  transform: translateY(0);
}

.lead-modal__head {
  padding: 20px 20px 12px;
}

.lead-modal__title {
  margin: 0;
  color: rgba(255, 255, 255, 0.88);
  font-size: clamp(20px, 2.1vw, 28px);
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.lead-modal__desc {
  margin: 10px 0 0;
  color: rgba(255, 255, 255, 0.88);
  font-size: 14px;
  line-height: 1.55;
}

.lead-modal__form {
  padding: 12px 20px 20px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.lead-modal__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.lead-field { display: block; }

.lead-field input {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.20);
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  border-radius: 12px;
  padding: 13px 13px;
  font-size: 14px;
  outline: none;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.lead-field input::placeholder {
  color: rgba(255, 255, 255, 0.86);
}

.lead-field input:focus {
  border-color: rgba(255, 255, 255, 0.44);
  background: rgba(255, 255, 255, 0.20);
  transform: translateY(-1px);
}

.lead-modal__submit {
  width: 100%;
  margin-top: 14px;
  border: 0;
  cursor: pointer;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.96);
  color: #0b1220;
  padding: 13px 18px;
  font-weight: 800;
  letter-spacing: -0.01em;
  transition: transform 160ms ease, filter 160ms ease;
}

.lead-modal__submit:hover {
  transform: translateY(-2px);
  filter: brightness(0.98);
}

.lead-modal.is-open .lead-modal__dialog {
  animation: leadModalIn 220ms ease both;
}

@keyframes leadModalIn {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

html.is-modal-open,
body.is-modal-open {
  overflow: hidden;
}

/* =========================
   MOBILE: card no topo (mantém desktop intacto)
   ========================= */
@media (max-width: 560px) {
  .lead-modal__overlay {
    background: rgba(11, 18, 32, 0.38);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
  }

  .lead-modal__dialog {
    left: 14px;
    right: 14px;
    top: 14px;
    bottom: auto;

    width: auto;
    height: auto;

    border-radius: 18px;

    max-height: calc(var(--lead-vvh, 100vh) - 28px);
    overflow: hidden;
    display: flex;
    flex-direction: column;

    transform: none;
    transition: none;
  }

  .lead-modal__head {
    padding: 16px 16px 10px;
  }

  .lead-modal__form {
    padding: 10px 16px 16px;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
  }

  .lead-modal__close {
    top: 10px;
    right: 10px;
    width: 38px;
    height: 38px;
  }

  .lead-modal__close::before,
  .lead-modal__close::after {
    width: 16px;
  }
}
