.contact-popup {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.contact-popup[hidden] { display: none !important; }

.contact-popup__overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.contact-popup__card {
  position: relative;
  width: 100%;
  max-width: 540px;
  margin: 0 16px;
  padding: 32px 32px;
  border-radius: 20px;
  background: #11141f;
  border: 1px solid rgba(225, 241, 255, 0.08);
  box-shadow: 0 24px 80px -16px rgba(0, 0, 0, 0.6);
  color: #fff;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
}

.contact-popup__close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  border: 0;
  background: transparent;
  color: rgba(225, 241, 255, 0.6);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.15s ease, color 0.15s ease;
}

.contact-popup__close:hover {
  background: rgba(225, 241, 255, 0.06);
  color: #fff;
}

.contact-popup__title {
  margin: 0 0 8px;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.contact-popup__subtitle {
  margin: 0 0 20px;
  font-size: 14px;
  color: rgba(225, 241, 255, 0.65);
}

.contact-popup__tg-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  height: 48px;
  border-radius: 12px;
  background: rgba(225, 241, 255, 0.06);
  border: 1px solid rgba(225, 241, 255, 0.12);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  margin-bottom: 20px;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.contact-popup__tg-button:hover {
  background: rgba(225, 241, 255, 0.1);
  border-color: rgba(225, 241, 255, 0.2);
}

.contact-popup__tg-icon {
  width: 22px;
  height: 22px;
  display: block;
}

.contact-popup__divider {
  position: relative;
  text-align: center;
  margin: 0 0 16px;
  color: rgba(225, 241, 255, 0.4);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.contact-popup__divider::before,
.contact-popup__divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: calc(50% - 80px);
  height: 1px;
  background: rgba(225, 241, 255, 0.08);
}
.contact-popup__divider::before { left: 0; }
.contact-popup__divider::after  { right: 0; }
.contact-popup__divider span { padding: 0 8px; }

.contact-popup__form { display: flex; flex-direction: column; gap: 14px; }

.contact-popup__honeypot {
  position: absolute !important;
  left: -9999px !important;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.contact-popup__field { display: flex; flex-direction: column; gap: 6px; }

.contact-popup__field-row {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 12px;
}

@media (max-width: 520px) {
  .contact-popup__field-row { grid-template-columns: 1fr; }
}

.contact-popup__label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(225, 241, 255, 0.55);
}

.contact-popup__label-required { color: #EC285C; }

.contact-popup__input,
.contact-popup__textarea {
  width: 100%;
  padding: 12px 14px;
  background: rgba(225, 241, 255, 0.04);
  border: 1px solid rgba(225, 241, 255, 0.08);
  border-radius: 10px;
  color: #fff;
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.15s ease;
}

.contact-popup__input::placeholder,
.contact-popup__textarea::placeholder { color: rgba(225, 241, 255, 0.35); }

.contact-popup__input:focus,
.contact-popup__textarea:focus {
  outline: none;
  border-color: rgba(40, 148, 236, 0.5);
}

.contact-popup__textarea { min-height: 90px; resize: vertical; }

.contact-popup__consent {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 13px;
  line-height: 1.5;
  color: rgba(225, 241, 255, 0.7);
}

/* В buttons.css .checkbox имеет display:none — браузер не валидирует hidden поля,
   поэтому required не сработает. В попапе переводим в visually-hidden, чтобы
   нативная валидация (reportValidity на required) работала. */
.contact-popup .checkbox {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
  display: inline-block;
}

/* Кастомный чекбокс — повторяет паттерн с разводящей templates:
   квадрат — это .checkbox__label, тик подставляется через ::before в buttons.css */
.contact-popup__consent .checkbox + .checkbox__label {
  width: 18px;
  height: 18px;
  min-width: 18px;
  flex-shrink: 0;
  margin-top: 1px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.contact-popup__consent .checkbox__span {
  color: rgba(225, 241, 255, 0.7);
  font-size: 13px;
  line-height: 1.5;
}

.contact-popup__consent .checkbox__span a {
  color: rgba(40, 148, 236, 1);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.contact-popup__consent .checkbox__span a:hover {
  text-decoration: none;
}

.contact-popup__consent .checkbox__span-required {
  color: #EC285C;
}

.contact-popup__error {
  padding: 10px 12px;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 8px;
  color: rgb(252, 165, 165);
  font-size: 13px;
}
.contact-popup__error[hidden] { display: none; }

.contact-popup__submit {
  width: 100%;
  height: 46px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(90deg, #4F46E5, #2894EC);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 4px;
  transition: filter 0.15s ease;
}
.contact-popup__submit:hover { filter: brightness(1.1); }
.contact-popup__submit:disabled { opacity: 0.6; cursor: not-allowed; }

.contact-popup__success {
  text-align: center;
  padding: 12px 0;
}
.contact-popup__success[hidden] { display: none; }

.contact-popup__success-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: rgba(34, 197, 94, 0.15);
  color: rgb(74, 222, 128);
  font-size: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.contact-popup__success h3 { margin: 0 0 6px; font-size: 18px; font-weight: 600; }
.contact-popup__success p  { margin: 0; color: rgba(225, 241, 255, 0.65); font-size: 14px; }

/* Mobile: bottom-sheet */
@media (max-width: 768px) {
  .contact-popup { align-items: flex-end; }
  .contact-popup__card {
    margin: 0;
    max-width: 100%;
    max-height: 90vh;
    border-radius: 20px 20px 0 0;
    padding: 24px 20px 32px;
  }
}

/* Сброс для тех мест, где триггер попапа — <button> вместо <a>.
   Чтобы наследуемые шрифты не сбрасывались браузером, а курсор был pointer. */
button[data-popup="contact"] {
  font: inherit;
  cursor: pointer;
}
