/* Формы входа, регистрации и восстановления пароля в стиле сайта (css/page.css: .page-card, .page-input, .page-btn).
   Один файл на все формы:
   - подключается сам с шаблоном system.auth.forgotpasswd/flat (/login/?forgot_password=yes);
   - явно: system.auth.changepasswd/flat/template.php, /forgotpass/index.php, /register/index.php.
   Покрывает две разметки: битриксовую .bx-authform (flat-шаблоны, форма регистрации)
   и старую .auth__wrapper-block (main.auth.forgotpasswd/change_password_2022, смена пароля).
   Всё ограничено main.page, чтобы не задеть шаблон login_2022 и ЛК. */

/* ---------- Карточка формы ---------- */
main.page .bx-authform,
main.page .auth__wrapper-block {
  box-sizing: border-box;
  width: 100%;
  max-width: 480px;
  margin: 0 0 var(--page-section-gap, 64px);
  padding: 32px;
  border: 1px solid var(--page-border, #E3E3E3);
  border-radius: var(--page-radius, 20px);
  background: #fff;
  box-shadow: var(--page-shadow, 0 8px 24px rgba(16, 24, 40, .06));
  color: var(--page-ink, #313132);
  font-size: 15px;
  line-height: 1.5;
}
main.page .bx-authform *,
main.page .auth__wrapper-block * { box-sizing: border-box; }

/* обёртка страницы (/forgotpass/, /register/): убирает bootstrap-колонку и дубль заголовка */
main.page .auth-page { max-width: 480px; }
main.page .auth-page > .page-alert { margin-bottom: 16px; }
main.page .auth-page .auth__wrapper-title { display: none; } /* текст совпадает с h1 страницы */

/* ---------- Заголовки и пояснения ---------- */
main.page .bx-authform .bx-title,
main.page .auth__wrapper-block .auth__wrapper-title {
  margin: 0 0 8px;
  font-family: Inter, system-ui, sans-serif;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--page-ink, #313132);
}
main.page .bx-authform .bx-authform-content-container,
main.page .auth__wrapper-block .auth__wrapper-subtitle,
main.page .auth__wrapper-block .auth__wrapper-user {
  margin: 0 0 20px;
  padding: 0;
  font-size: 15px;
  font-weight: 400;
  line-height: 1.5;
  color: var(--page-muted, #6B6B70);
}
main.page .bx-authform > p {
  margin: 12px 0 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--page-muted, #6B6B70);
}

/* ---------- Поля ---------- */
main.page .bx-authform .bx-authform-formgroup-container { margin-bottom: 20px; }
main.page .bx-authform .bx-authform-label-container,
main.page .auth__wrapper-block .auth__wrapper-form_input > label {
  position: static;
  max-width: none;
  margin: 0 0 8px;
  padding: 0;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.4;
  color: var(--page-ink, #313132);
}
main.page .bx-authform .starrequired,
main.page .bx-authform .bx-authform-starrequired { color: var(--page-danger, #E5484D); }
main.page .bx-authform .bx-authform-note-container,
main.page .bx-authform .bx-authform-description-container {
  padding: 8px 0 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--page-muted, #6B6B70);
}

main.page .auth__wrapper-block .auth__wrapper-form {
  width: 100%;
  margin: 0;
}
main.page .auth__wrapper-block .auth__wrapper-form_input {
  display: flex;
  flex-direction: column;
  margin-bottom: 20px;
}

main.page .bx-authform input[type="text"],
main.page .bx-authform input[type="email"],
main.page .bx-authform input[type="tel"],
main.page .bx-authform input[type="password"],
main.page .auth__wrapper-block .auth__wrapper-form_input input {
  display: block;
  width: 100%;
  height: auto;
  min-height: var(--page-control-height, 48px);
  margin: 0;
  padding: 11px 14px;
  border: 1px solid var(--page-border, #E3E3E3);
  border-radius: var(--page-radius-control, 8px);
  background: #fff;
  color: var(--page-ink, #313132);
  font: 400 16px/1.5 Inter, system-ui, sans-serif; /* 16px: iOS не увеличивает страницу при фокусе */
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color .15s, box-shadow .15s;
}
main.page .auth__wrapper-block .auth__wrapper-form_input input { padding-right: 48px; } /* место под «глаз» */
main.page .bx-authform input::placeholder,
main.page .auth__wrapper-block input::placeholder { color: #9A9EA6; }
main.page .bx-authform input[type="text"]:hover,
main.page .bx-authform input[type="email"]:hover,
main.page .bx-authform input[type="tel"]:hover,
main.page .bx-authform input[type="password"]:hover,
main.page .auth__wrapper-block .auth__wrapper-form_input input:hover { border-color: var(--page-border-hover, #C9C9CC); }
main.page .bx-authform input[type="text"]:focus,
main.page .bx-authform input[type="email"]:focus,
main.page .bx-authform input[type="tel"]:focus,
main.page .bx-authform input[type="password"]:focus,
main.page .auth__wrapper-block .auth__wrapper-form_input input:focus {
  border-color: var(--page-primary, #008AFF);
  box-shadow: 0 0 0 3px var(--page-primary-soft, #CCE8FF);
}
main.page .bx-authform input:disabled {
  background: var(--page-surface, #F6F7F8);
  color: var(--page-muted, #6B6B70);
}
main.page .bx-authform input.bx-empty-field,
main.page .bx-authform input[aria-invalid="true"] { border-color: var(--page-danger, #E5484D); }

/* кнопка «показать пароль» в старой разметке: по центру поля, а не всей обёртки с подписью */
main.page .auth__wrapper-block .auth__wrapper-form_btn {
  top: auto;
  bottom: 24px;
  right: 14px;
  transform: translateY(50%);
}

/* ---------- Чекбоксы (согласия, «Запомнить меня») ---------- */
main.page .bx-authform .bx-authform-consent { margin-bottom: 12px; }
main.page .bx-authform .bx-authform-consent label,
main.page .bx-authform .checkbox label {
  /* не flex: в подписи смешаны текст и ссылка, во flex они разъезжаются колонками */
  display: block;
  position: relative;
  min-height: 20px;
  margin: 0;
  padding-left: 32px;
  font-size: 14px;
  font-weight: 400;
  line-height: 20px;
  color: var(--page-ink, #313132);
  cursor: pointer;
}
main.page .bx-authform label input[type="checkbox"] {
  position: absolute;
  top: 0;
  left: 0;
  width: 20px;
  height: 20px;
  margin: 0;
  border: 1.5px solid #B9BCC2;
  border-radius: 6px;
  background: #fff no-repeat center / 12px 9px;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  transition: background-color .15s, border-color .15s, box-shadow .15s;
}
main.page .bx-authform input[type="checkbox"]:hover { border-color: var(--page-primary, #008AFF); }
main.page .bx-authform input[type="checkbox"]:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--page-primary-soft, #CCE8FF); }
main.page .bx-authform input[type="checkbox"]:checked {
  border-color: var(--page-primary, #008AFF);
  background-color: var(--page-primary, #008AFF);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='9' viewBox='0 0 12 9'%3E%3Cpath d='M1 4.5l3.5 3.5L11 1' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
main.page .bx-authform .bx-authform-consent + .bx-authform-formgroup-container:not(.bx-authform-consent) { margin-top: 24px; }

/* ---------- Кнопка ---------- */
main.page .bx-authform input[type="submit"],
main.page .bx-authform button[type="submit"],
main.page .auth__wrapper-block .auth__wrapper-form_submit input {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: auto;
  min-height: var(--page-control-height, 48px);
  margin: 0;
  padding: 0 24px;
  border: 1px solid transparent;
  border-radius: var(--page-radius-control, 8px);
  background: var(--page-primary, #008AFF);
  color: #fff;
  font: 600 16px/1.25 Inter, system-ui, sans-serif;
  cursor: pointer;
  opacity: 1;
  -webkit-appearance: none;
  appearance: none;
  transition: background-color .15s, box-shadow .15s;
}
main.page .bx-authform input[type="submit"]:hover,
main.page .bx-authform button[type="submit"]:hover,
main.page .auth__wrapper-block .auth__wrapper-form_submit input:hover {
  background: var(--page-primary-hover, #0070D6);
  color: #fff;
  opacity: 1;
}
main.page .bx-authform input[type="submit"]:focus-visible,
main.page .auth__wrapper-block .auth__wrapper-form_submit input:focus-visible {
  outline: 3px solid var(--page-primary-soft, #CCE8FF);
  outline-offset: 2px;
}
main.page .bx-authform input[type="submit"]:disabled { opacity: .55; cursor: not-allowed; }
main.page .auth__wrapper-block .auth__wrapper-form_submit { height: auto; margin: 8px 0 0; }
main.page .auth__wrapper-block .auth__wrapper-form_submit.auth-reset-password__next { margin-top: 8px; }

/* ---------- Ссылки под формой ---------- */
main.page .bx-authform a,
main.page .auth__wrapper-block a {
  color: var(--page-primary, #008AFF);
  text-decoration: underline;
  text-underline-offset: 2px;
}
main.page .bx-authform a:hover,
main.page .auth__wrapper-block a:hover { color: var(--page-primary-hover, #0070D6); }
main.page .bx-authform .bx-authform-link-container,
main.page .auth__wrapper-block .auth__wrapper-form_password,
main.page .auth__wrapper-block .auth__wrapper-form_create {
  margin: 16px 0 0;
  padding: 0;
  font-size: 14px;
  line-height: 1.5;
  text-align: center;
  color: var(--page-muted, #6B6B70);
}
main.page .bx-authform hr.bxe-light {
  margin: 24px 0;
  border: 0;
  border-top: 1px solid var(--page-border, #E3E3E3);
}

/* ---------- Сообщения ---------- */
main.page .bx-authform .alert,
main.page .auth-page .errortext,
main.page .auth-page .notetext {
  display: block;
  margin: 0 0 20px;
  padding: 14px 16px;
  border: 0;
  border-radius: var(--page-radius-sm, 12px);
  font-size: 15px;
  line-height: 1.5;
}
main.page .bx-authform .alert-danger,
main.page .auth-page .errortext { background: var(--page-danger-soft, #FDE8E8); color: #B42318; }
main.page .bx-authform .alert-success,
main.page .auth-page .notetext { background: var(--page-success-soft, #EEFAF0); color: #1E7A34; }
main.page .bx-authform .alert-warning { background: #FFF6E5; color: #8A5A00; }
main.page .bx-authform .bx-authform-formgroup-container .alert { margin: 10px 0 0; }
main.page .auth__wrapper-block .auth__wrapper-form_error {
  display: flex;
  gap: 6px;
  margin-top: 6px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--page-danger, #E5484D);
}

/* иллюстрация старой разметки в карточке лишняя */
main.page .auth__wrapper-block .auth__wrapper-img { display: none; }

@media (max-width: 767.98px) {
  main.page .bx-authform,
  main.page .auth__wrapper-block { padding: 20px; }
  main.page .bx-authform .bx-title,
  main.page .auth__wrapper-block .auth__wrapper-title { font-size: 20px; }
}
