/* Область: auth (вход и регистрация).
   Правки под старый дизайн, без inline-стилей. */

/* ============================================================
   Модалка (AuthModals) — 1:1 с каркасом старого сайта.
   layout.css задаёт .field как grid с margin-bottom — внутри модалки
   возвращаем старый flex-контейнер: gap 5px, без внешних отступов.
   ============================================================ */
.pub-auth-modal .field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 0;
}

.pub-auth-modal .field-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--secondary);
}

.pub-auth-modal .form-grid {
  gap: 12px;
}

.pub-auth-modal [hidden] {
  display: none !important;
}

.pub-auth-modal .checkbox-row a {
  color: var(--accent);
  text-decoration: underline;
}

.pub-auth-modal .pub-auth-eye svg {
  display: block;
}

/* Существующий глазик не должен наезжать на текст в поле. */
.pub-auth-pw-row .input {
  padding-right: 44px;
}

/* Строка ссылок под кнопкой входа: на узком экране переносится, а не обрезается. */
.pub-auth-links {
  flex-wrap: wrap;
}

/* Блокировка скролла страницы, пока открыто окно. */
.modal-open {
  overflow: hidden;
}

/* Сетка города/округа в комбобоксе не должна растягивать панель за модалку. */
.pub-auth-modal .combo-panel {
  max-height: 240px;
}

/* ============================================================
   Страницы-фолбэки /login и /register (если JS выключен или
   пользователь открыл ссылку напрямую). Визуально повторяют модалку.
   ============================================================ */
/* Ширина колонки = ширина старой модалки + боковые отступы страницы. */
.auth-page-inner {
  max-width: 452px;
  margin: 0 auto;
  padding: 40px 16px 80px;
}

.auth-page-inner.auth-page-inner--wide {
  max-width: 592px;
}

.auth-page-inner .auth-card {
  width: 100%;
}

.auth-page-card {
  padding: 18px;
}

.auth-page-title {
  margin: 0 0 12px;
  font-size: 17px;
  font-weight: 700;
}

.auth-page-sub {
  margin: 0;
  font-size: 14.5px;
  line-height: 1.42;
  color: var(--secondary);
}

.auth-page-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.auth-page-form .field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 0;
}

.auth-page-form .field-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--secondary);
}

.auth-page-form .field-error {
  min-height: var(--h-error);
  line-height: var(--h-error);
}

.auth-page-form .form-grid {
  gap: 12px;
}

.auth-page-form .pub-auth-links {
  flex-wrap: wrap;
}

.auth-page-form .checkbox-row a {
  color: var(--accent);
  text-decoration: underline;
}

.auth-page-form .pub-auth-eye {
  position: absolute;
  right: 4px;
}

.auth-page-form .pub-auth-eye svg {
  display: block;
}

/* Кнопка-глазик: удобная touch-цель на телефоне. */
.pub-auth-eye {
  min-width: 32px;
  min-height: 32px;
  z-index: 2;
}

@media (max-width: 640px) {
  .pub-auth-eye {
    min-width: 40px;
    min-height: 40px;
  }

  .pub-auth-pw-row .input {
    padding-right: 46px;
  }
}

.auth-page-tabs {
  margin-bottom: 12px;
}

.auth-page-tabs .tab-btn {
  text-decoration: none;
}

/* Готово/успех на странице регистрации */
.auth-page-done-title {
  font-size: 17px;
  font-weight: 700;
}

@media (max-width: 640px) {
  .auth-page-inner {
    padding: 16px 12px 20px;
  }

  .auth-page-inner.auth-page-inner--wide {
    padding: 16px 12px 20px;
  }

  .auth-page-card {
    padding: 12px;
  }

  .auth-page-title {
    font-size: 16px;
    margin-bottom: 8px;
  }

  .auth-page-sub {
    font-size: 13.5px;
    line-height: 1.35;
  }

  .auth-page-form {
    gap: 8px;
  }

  .auth-page-form .field {
    gap: 3px;
  }

  .auth-page-form .field-label {
    font-size: 11px;
    line-height: 1.2;
  }

  .auth-page-form .input,
  .auth-page-form .select,
  .auth-page-form .custom-select-trigger.select {
    min-height: 42px;
    padding-top: 8px;
    padding-bottom: 8px;
  }

  .auth-page-form .btn:not(.btn-sm):not(.btn-icon) {
    min-height: 42px;
    font-size: 13.5px;
  }

  .auth-page-form .form-grid {
    gap: 8px;
  }

  .auth-page-form .pub-auth-links {
    gap: 6px;
  }

  .auth-page-form .checkbox-row {
    font-size: 12.5px;
    line-height: 1.3;
  }
}

/* ============================================================
   Капча подтверждения регистрации (client/js/components/captcha-modal.js).
   Окно переиспользуемое: открывается поверх auth-модалки, модалки
   регистрации на /business и страницы /register. Стили живут здесь,
   а не в public.css, чтобы не пересекаться с капчей отправки запросов.
   ============================================================ */
.pub-captcha-layer {
  /* Выше родительской модалки (.modal-layer — 200) и пикера категорий. */
  z-index: 260;
}

.pub-captcha-head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.pub-captcha-head > svg {
  flex: 0 0 auto;
  color: var(--accent);
}

.pub-captcha-head .modal-title {
  min-width: 0;
}

.pub-captcha-modal .modal-body {
  gap: 10px;
}

.pub-captcha-intro {
  line-height: 1.4;
}

.pub-captcha-modal .pub-captcha-arena {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 88px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface-2);
  overflow: hidden;
}

.pub-captcha-modal .pub-captcha-image {
  display: block;
  width: 100%;
  max-width: 360px;
  height: auto;
  border-radius: 8px;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
}

.pub-captcha-modal .pub-captcha-loading {
  font-size: 13px;
  color: var(--secondary);
}

.pub-captcha-modal .pub-captcha-attempts:not(:empty) {
  font-size: 13px;
  color: var(--warning);
}

.pub-captcha-modal .field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 0;
}

.pub-captcha-modal .field-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--secondary);
}

.pub-captcha-modal .pub-captcha-input {
  font-size: 18px;
  letter-spacing: 0.14em;
  text-align: center;
  text-transform: uppercase;
}

.pub-captcha-modal .pub-captcha-input::placeholder {
  text-transform: none;
  letter-spacing: normal;
}

.pub-captcha-modal .pub-captcha-error {
  min-height: var(--h-modal-error, 22px);
  font-size: 13px;
  line-height: 1.35;
  color: var(--danger);
}

.pub-captcha-modal .pub-captcha-actions {
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 2px;
}

.pub-captcha-modal .pub-captcha-actions .btn svg {
  display: block;
}

.pub-captcha-modal .pub-captcha-actions .btn-primary {
  min-width: 130px;
}

.pub-captcha-modal .pub-captcha-refresh {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

@media (max-width: 860px) {
  .pub-captcha-modal .modal-body {
    gap: 8px;
  }

  .pub-captcha-modal .field {
    gap: 3px;
  }

  .pub-captcha-modal .field-label {
    font-size: 11px;
    line-height: 1.2;
  }

  .pub-captcha-modal .input {
    min-height: 42px;
    font-size: 16px;
  }
}

@media (max-width: 480px) {
  .pub-captcha-modal .pub-captcha-arena {
    min-height: 76px;
    padding: 6px;
  }

  .pub-captcha-modal .pub-captcha-actions .btn-primary {
    flex: 1 1 auto;
    min-width: 0;
  }
}

/* ============================================================
   Мобильная модалка входа (пункт 9): компактно, без внутреннего
   скролла — влезает целиком на 360×640 и 390×844. Регистрация
   по-прежнему скроллится (её это не касается).
   ============================================================ */
@media (max-width: 860px) {
  .modal.pub-auth-modal--login {
    max-height: calc(var(--vvh, 100dvh) - env(safe-area-inset-top) - 12px);
  }

  /* Мобильная плотность (task-16, п.21): заголовки/подписи мельче, отступы
     минимальные, поля и кнопки — 42px (больше 40px и 16px шрифта для iOS). */
  .pub-auth-modal .modal-head {
    padding: 6px 12px 2px;
    min-height: 34px;
    gap: 6px;
  }

  .pub-auth-modal .modal-title {
    font-size: 14.5px;
    line-height: 1.25;
  }

  .pub-auth-modal .modal-body {
    gap: 7px;
  }

  .pub-auth-modal .field {
    gap: 2px;
  }

  .pub-auth-modal .field-label {
    font-size: 11px;
    line-height: 1.2;
  }

  .pub-auth-modal .form-grid {
    gap: 8px;
  }

  .pub-auth-modal .input {
    min-height: 42px;
    padding-top: 8px;
    padding-bottom: 8px;
    font-size: 16px;
  }

  .pub-auth-modal .checkbox-row {
    font-size: 12.5px;
    line-height: 1.3;
  }

  .pub-auth-modal .pub-auth-links {
    gap: 6px;
  }

  .pub-auth-modal .btn-primary,
  .pub-auth-modal .modal-submit-sticky {
    min-height: 42px;
  }

  /* Вход по-прежнему влезает целиком, просто компактнее. */
  .pub-auth-modal--login .modal-head {
    padding: 6px 12px 2px;
    min-height: 32px;
  }

  .pub-auth-modal--login .modal-title {
    font-size: 14.5px;
  }

  .pub-auth-modal--login .modal-close {
    width: 42px;
    height: 42px;
  }

  .pub-auth-modal--login .modal-body {
    padding: 0 12px 10px;
    gap: 6px;
    flex: 0 0 auto;
    overflow-y: visible;
    overscroll-behavior: auto;
  }

  .pub-auth-modal--login .field {
    gap: 2px;
  }

  .pub-auth-modal--login .field-label {
    font-size: 11px;
    line-height: 1.2;
  }

  .pub-auth-modal--login .input {
    min-height: 42px;
    padding-top: 8px;
    padding-bottom: 8px;
    font-size: 16px;
  }

  .pub-auth-modal--login .pub-auth-pw-row .input {
    padding-right: 44px;
  }

  .pub-auth-modal--login .field-error {
    min-height: 16px;
    font-size: 12px;
    line-height: 1.3;
  }

  .pub-auth-modal--login .modal-submit-sticky {
    min-height: 42px;
    padding-top: 7px;
    padding-bottom: 7px;
  }

  .pub-auth-modal--login .pub-auth-links {
    gap: 6px;
    margin-top: 0;
    justify-content: flex-start;
  }

  .pub-auth-modal--login .pub-auth-links .btn {
    min-height: 36px;
    padding-top: 6px;
    padding-bottom: 6px;
  }
}

/* Клавиатура открыта: вход поджимается ещё на пару строк, но остаётся сверху
   и по-прежнему без внутреннего скролла. Ссылки не прячем. */
@media (max-width: 860px) {
  body.keyboard-open .pub-auth-modal--login .modal-head {
    min-height: 28px;
    padding-top: 3px;
  }

  body.keyboard-open .pub-auth-modal--login .modal-body {
    gap: 5px;
    padding-bottom: 8px;
  }

  body.keyboard-open .pub-auth-modal--login .field {
    gap: 2px;
  }

  body.keyboard-open .pub-auth-modal--login .input {
    min-height: 42px;
    padding-top: 7px;
    padding-bottom: 7px;
  }

  body.keyboard-open .pub-auth-modal--login .field-error {
    min-height: 14px;
  }

  body.keyboard-open .pub-auth-modal--login .modal-submit-sticky {
    min-height: 42px;
  }

  body.keyboard-open .pub-auth-modal--login .pub-auth-links .btn {
    min-height: 32px;
    padding-top: 4px;
    padding-bottom: 4px;
  }
}

@media (max-width: 860px) and (max-height: 660px) {
  .pub-auth-modal--login .modal-head {
    min-height: 30px;
    padding-top: 6px;
  }

  .pub-auth-modal--login .modal-body {
    gap: 6px;
  }

  .pub-auth-modal--login .input {
    min-height: 42px;
  }
}

/* ============================================================
   Страница блокировки (/blocked): карточка по центру экрана.
   Используются существующие auth-card/auth-page-card/empty-state.
   ============================================================ */
.blocked-page {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  box-sizing: border-box;
}

.blocked-page .auth-card {
  width: 100%;
  max-width: 452px;
}
