/* Lead modal */

body.lead-modal-open {
  overflow: hidden;
}

.lead-modal {
  position: fixed;
  inset: 0;
  z-index: 520;
  display: grid;
  align-items: end;
  justify-items: end;
  width: 100%;
  height: calc(var(--lead-vh, 1vh) * 100);
  padding: 24px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 0.24s ease,
    visibility 0.24s ease;
}

.lead-modal.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.lead-modal__overlay {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(
      circle at 82% 82%,
      rgba(159, 122, 234, 0.2),
      transparent 34%
    ),
    rgba(24, 17, 36, 0.42);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.lead-modal__dialog {
  position: relative;
  z-index: 1;
  width: min(100%, 445px);
  max-height: min(720px, calc((var(--lead-vh, 1vh) * 100) - 48px));
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 28px;
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 30px;
  background:
    linear-gradient(
      145deg,
      rgba(255, 255, 255, 0.94),
      rgba(255, 255, 255, 0.78)
    ),
    linear-gradient(
      135deg,
      rgba(241, 234, 255, 0.96),
      rgba(233, 248, 255, 0.9)
    );
  box-shadow:
    0 28px 86px rgba(24, 17, 36, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
  transform: translate3d(20px, 28px, 0) scale(0.97);
  transition:
    transform 0.28s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.22s ease;
}

.lead-modal.is-open .lead-modal__dialog {
  transform: translate3d(0, 0, 0) scale(1);
}

.lead-modal__dialog::-webkit-scrollbar {
  width: 8px;
}

.lead-modal__dialog::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(91, 60, 164, 0.2);
}

.lead-modal__close {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--color-primary-dark);
  font-size: 1.6rem;
  line-height: 1;
  box-shadow: 0 12px 26px rgba(57, 38, 96, 0.1);
  transition:
    transform 0.18s ease,
    background 0.18s ease,
    box-shadow 0.18s ease;
}

.lead-modal__close:hover {
  transform: rotate(8deg) scale(1.04);
  background: #fff;
  box-shadow: 0 16px 34px rgba(57, 38, 96, 0.14);
}

.lead-modal__header {
  padding-right: 38px;
  margin-bottom: 22px;
}

.lead-modal__kicker {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 30px;
  margin-bottom: 12px;
  padding: 0 12px;
  border: 1px solid rgba(159, 122, 234, 0.2);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--color-primary-dark);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.lead-modal__header h2 {
  max-width: 340px;
  font-family: var(--font-title);
  font-size: clamp(2rem, 4vw, 2.85rem);
  line-height: 0.98;
  letter-spacing: -0.05em;
  color: #23172f;
}

.lead-modal__header p {
  max-width: 360px;
  margin-top: 12px;
  color: var(--color-muted);
  font-size: 0.95rem;
  line-height: 1.5;
}

.lead-modal__form {
  display: grid;
  gap: 14px;
}

.lead-modal__form .form-row {
  gap: 7px;
}

.lead-modal__form .form-row label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.lead-modal__form .form-row label span {
  color: rgba(110, 101, 125, 0.78);
  font-size: 0.76rem;
  font-weight: 750;
}

.lead-modal__form .form-row input,
.lead-modal__form .form-row textarea {
  background: rgba(255, 255, 255, 0.9);
}

.lead-modal__form .form-row input {
  height: 50px;
}

.lead-modal__form .form-row textarea {
  min-height: 104px;
  max-height: 180px;
}

.lead-modal__form .form-button {
  min-height: 52px;
  margin-top: 2px;
}

.lead-modal__form .form-status {
  min-height: 20px;
  color: var(--color-primary-dark);
  font-size: 0.88rem;
  font-weight: 750;
  text-align: center;
}

.lead-modal__form.is-sending {
  pointer-events: none;
}

.lead-modal__form.is-sending .form-button {
  opacity: 0.78;
}

.lead-modal__form input,
.lead-modal__form textarea {
  scroll-margin-bottom: 160px;
}

@media (max-width: 760px) {
  .lead-modal {
    align-items: end;
    justify-items: center;
    padding: 10px 10px 0;
  }

  .lead-modal__overlay {
    background:
      linear-gradient(
        180deg,
        rgba(24, 17, 36, 0.22),
        rgba(24, 17, 36, 0.58)
      );
  }

  .lead-modal__dialog {
    width: 100%;
    max-height: calc((var(--lead-vh, 1vh) * 100) - 18px);
    padding: 24px 18px calc(20px + env(safe-area-inset-bottom));
    border-radius: 28px 28px 0 0;
    transform: translate3d(0, 34px, 0) scale(1);
  }

  .lead-modal__header {
    padding-right: 42px;
    margin-bottom: 18px;
  }

  .lead-modal__header h2 {
    max-width: 280px;
    font-size: clamp(1.85rem, 8vw, 2.45rem);
  }

  .lead-modal__header p {
    max-width: 330px;
    font-size: 0.9rem;
  }

  .lead-modal__close {
    top: 14px;
    right: 14px;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.86);
  }

  .lead-modal__form {
    gap: 12px;
  }

  .lead-modal__form .form-row input {
    height: 48px;
  }

  .lead-modal__form .form-row textarea {
    min-height: 92px;
  }

  .lead-modal__form .form-button {
    min-height: 50px;
  }
}

@media (max-width: 380px) {
  .lead-modal__dialog {
    padding-inline: 16px;
  }

  .lead-modal__header h2 {
    font-size: 1.78rem;
  }

  .lead-modal__header p {
    font-size: 0.86rem;
  }

  .lead-modal__form .form-row input {
    height: 46px;
  }

  .lead-modal__form .form-row textarea {
    min-height: 86px;
  }
}

@supports (height: 100dvh) {
  .lead-modal {
    height: 100dvh;
  }

  .lead-modal__dialog {
    max-height: calc(100dvh - 48px);
  }

  @media (max-width: 760px) {
    .lead-modal__dialog {
      max-height: calc(100dvh - 18px);
    }
  }
}

/* Lead popup */

.lead-popup {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 620;
  width: min(100% - 32px, 390px);
  padding: 18px 18px 18px 16px;
  border: 1px solid rgba(255, 255, 255, 0.76);
  border-radius: 24px;
  background:
    linear-gradient(
      145deg,
      rgba(255, 255, 255, 0.96),
      rgba(255, 255, 255, 0.84)
    ),
    linear-gradient(
      135deg,
      rgba(241, 234, 255, 0.98),
      rgba(233, 248, 255, 0.92)
    );
  box-shadow:
    0 24px 70px rgba(24, 17, 36, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.82);
  display: flex;
  align-items: flex-start;
  gap: 13px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translate3d(18px, 18px, 0) scale(0.96);
  transition:
    opacity 0.24s ease,
    visibility 0.24s ease,
    transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.lead-popup.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translate3d(0, 0, 0) scale(1);
}

.lead-popup__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--color-primary), var(--color-blue));
  color: #fff;
  font-weight: 900;
  box-shadow: 0 12px 28px rgba(91, 60, 164, 0.2);
}

.lead-popup__content {
  min-width: 0;
}

.lead-popup__title {
  display: block;
  color: #23172f;
  font-size: 0.98rem;
  font-weight: 900;
  line-height: 1.25;
}

.lead-popup__text {
  display: block;
  margin-top: 4px;
  color: var(--color-muted);
  font-size: 0.9rem;
  line-height: 1.42;
}

.lead-popup__loader {
  position: relative;
  display: block;
  width: 100%;
  height: 4px;
  margin-top: 12px;
  border-radius: 999px;
  background: rgba(91, 60, 164, 0.1);
  overflow: hidden;
}

.lead-popup__loader::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 42%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--color-primary), var(--color-blue));
  animation: leadPopupLoader 1.1s ease-in-out infinite;
}

@keyframes leadPopupLoader {
  0% {
    transform: translateX(-110%);
  }

  100% {
    transform: translateX(250%);
  }
}

@media (max-width: 760px) {
  .lead-popup {
    left: 12px;
    right: 12px;
    bottom: calc(14px + env(safe-area-inset-bottom));
    width: auto;
    border-radius: 22px;
    transform: translate3d(0, 18px, 0) scale(0.98);
  }
}