/* Login popup — стилистика повторяет components/contact-popup.css.
   Структура HTML и классы не меняются (нужны для main-auth.js / qr-auth.js / index-script.js). */

.hidden { display: none !important; }

/* ====== Overlay ====== */
.popup {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.popup--active { display: flex; }

/* ====== Карточка ====== */
.popup__container {
  position: relative;
  width: 100%;
  max-width: 460px;
  margin: 0 16px;
  padding: 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;
}

.popup__close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  padding: 8px;
  cursor: pointer;
  opacity: 0.6;
  border-radius: 8px;
  transition: background 0.15s ease, opacity 0.15s ease;
}

.popup__close:hover {
  opacity: 1;
  background: rgba(225, 241, 255, 0.06);
}

/* ====== Сообщения ====== */
.popup__message {
  display: none;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 12px;
  text-align: center;
}

.popup__message--error {
  display: block;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: rgb(252, 165, 165);
}

.popup__message--success {
  display: block;
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: rgb(74, 222, 128);
}

/* ====== Форма ====== */
.login {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
  margin: 0;
  max-width: none;
}

.login__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.login__title {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: #fff;
  margin: 0;
}

.login__form-block { display: flex; flex-direction: column; gap: 16px; }

.login__fields { display: flex; flex-direction: column; gap: 16px; }

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

.login__field-code { display: none; }
.login__field-code--active {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.login__field-promo { display: none; }
.login__field-promo--active { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }

.login__label {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(225, 241, 255, 0.55);
}

/* Класс fs16 из header-локалей форсит 16px на .login__label у QR-блока;
   убираем перебивку, чтобы все лейблы в попапе оставались моноширинными. */
.popup .login__label.fs16 { font-size: 11px; }

.login__input,
.login__input--code {
  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;
}

.login__input::placeholder,
.login__input--code::placeholder { color: rgba(225, 241, 255, 0.35); }

.login__input:focus,
.login__input--code:focus {
  outline: none;
  border-color: rgba(40, 148, 236, 0.5);
}

/* Email + кнопка «Отправить код» — горизонтальная пара */
.login__code-container {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.login__code-container .login__input--code { flex: 1; min-width: 0; }

/* Серая кнопка «Отправить код» рядом с email */
.login__send-code {
  flex-shrink: 0;
  padding: 0 18px;
  height: auto;
  border: 1px solid rgba(225, 241, 255, 0.12);
  background: rgba(225, 241, 255, 0.06);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  border-radius: 10px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.login__send-code:hover {
  background: rgba(225, 241, 255, 0.1);
  border-color: rgba(225, 241, 255, 0.2);
}

.login__send-code:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Чекбоксы согласий — внешний контейнер */
.login__checkboxes { display: none; }
.login__checkboxes--active {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

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

/* Скрытый input через visually-hidden — для работы required-валидации.
   В buttons.css .checkbox имеет display:none; в скоупе попапа переопределяем. */
.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;
}

.login__checkbox .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;
}

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

.login__checkbox .checkbox__span-required { color: #EC285C; }

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

.login__link:hover { text-decoration: none; }

/* Кнопка отправки — основной градиент */
.login__button {
  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;
  transition: filter 0.15s ease;
}

.login__button:hover { filter: brightness(1.1); }

/* Кнопка «Войти через Яндекс» — серая */
.login__buttons-block { display: flex; flex-direction: column; gap: 14px; }

.login__yandex-container { display: flex; flex-direction: column; gap: 0; }

.login__telegram-container {
  margin-top: 12px;
}

.login__button--telegram {
  width: 100%;
  height: 46px;
  border: 1px solid rgba(84, 178, 255, 0.4);
  background: rgba(84, 178, 255, 0.1);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.login__button--telegram:hover {
  background: rgba(84, 178, 255, 0.18);
  border-color: rgba(84, 178, 255, 0.6);
}

/* Контейнер для SDK-кнопки Яндекса. Пуст, пока SDK не инициализирован.
   overflow:hidden + max-height — страховка от iframe Yandex SDK, который
   на узком вьюпорте (375px) раздувается до 150px и перекрывает соседнюю
   кнопку снизу. См. фикс от 2026-06-05. */
.login__yandex-mount {
  width: 100%;
  display: flex;
  justify-content: center;
  position: relative;
  overflow: hidden;
  max-height: 46px;
}
.login__yandex-mount:empty { display: none; }
.login__yandex-mount > * { width: 100% !important; }

/* Подпись о согласии под TG/Yandex блоком. По стилю — как .consent на /tg-login. */
.login__oauth-consent {
  margin: 4px 0 0;
  padding: 0;
  font-size: 12px;
  line-height: 1.4;
  text-align: center;
  color: rgba(225, 241, 255, 0.55);
}
.login__oauth-consent a {
  color: #fff;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.login__oauth-consent a:hover { opacity: 0.8; }

.login__button--yandex[hidden] { display: none !important; }

.login__button--yandex {
  width: 100%;
  height: 46px;
  border: 1px solid rgba(225, 241, 255, 0.12);
  background: rgba(225, 241, 255, 0.06);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.login__button--yandex:hover {
  background: rgba(225, 241, 255, 0.1);
  border-color: rgba(225, 241, 255, 0.2);
}

.login__button-icon { width: 20px; height: 20px; }

/* Разделитель «или» */
.login__divider-container { width: 100%; }

.login__divider {
  position: relative;
  text-align: center;
  color: rgba(225, 241, 255, 0.4);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.login__divider-line {
  flex: 1;
  height: 1px;
  background: rgba(225, 241, 255, 0.08);
}

.login__divider-text {
  color: rgba(225, 241, 255, 0.4);
  font-size: 12px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* Бан-таймер — красная плашка как у error */
#banTimer {
  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) !important;
  font-size: 13px;
  text-align: center;
  margin-bottom: 12px;
}

/* QR-блок */
.login__qr-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.qr__text-container {
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: center;
}

.qr__text {
  color: rgba(225, 241, 255, 0.55);
  font-size: 13px;
}

.qr {
  border-radius: 12px;
  background: #fff;
  padding: 8px;
}

.yaPersonalButton_m { height: 46px !important; }
.yaPersonalButtonText { color: black; }
.yaPreloadingSuggestBlock { height: 46px !important; }

/* ====== Адаптив ====== */
@media (max-width: 768px) {
  .popup__container {
    margin: 16px;
    padding: 24px 20px 28px;
    max-height: calc(100vh - 32px);
  }
  #qrContainer {
    display: none !important;
    width: 0;
    height: 0;
    margin: 0;
    padding: 0;
  }
}
