/*
 * Страницы входа, восстановления пароля и первого входа (`registration/*`), фирменный стиль QuartzPrice.
 *
 * Отдельный файл со своими значениями: страницы рендерит Django, бандл фронта сюда не подключается,
 * и тема админки тоже (сторож `accounts/tests/test_registration_theme_independence.py`). Значения те же,
 * что в основе интерфейса фронта (`qpcalc3_front/javascript/styles/tokens.css`). Все классы с приставкой
 * `auth-`, чтобы не пересечься с именами темы админки.
 */
:root {
  --auth-font: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
  --auth-plum: #73326E;
  --auth-plum-hover: #4F2049;
  --auth-plum-soft: #F5EDF4;
  --auth-action: #A240A8;
  --auth-action-hover: #8C3592;
  --auth-text: #000000;
  --auth-text-secondary: #3F3F3F;
  --auth-text-muted: #5F5F64;
  --auth-line-soft: #EDEDF1;
  --auth-field-border: #B3B3BC;
  --auth-danger: #B42318;
  --auth-danger-soft: #FDECEA;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: #FFFFFF;
}

body {
  color: var(--auth-text);
  font-family: var(--auth-font);
  font-size: 16px;
  line-height: 22px;
}

a {
  color: var(--auth-plum);
}

a:hover {
  color: var(--auth-plum-hover);
}

/* ------------------------------------------------------------------ раскладка */

.auth {
  display: flex;
  min-height: 100vh;
}

/* Слева картинка на всю высоту, обрезка как у background-size: cover. */
.auth__aside {
  position: relative;
  display: flex;
  flex: 0 0 54%;
  flex-direction: column;
  justify-content: space-between;
  gap: 48px;
  min-width: 0;
  padding: 48px 56px;
  overflow: hidden;
  background: #F2F0EE;
}

/* Обёртка <picture> выведена из колонки, иначе она занимает место и сдвигает логотип вниз. */
.auth__picture {
  position: absolute;
  inset: 0;
}

.auth__image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 50%;
}

/* Белый градиент снизу под заголовком и чуть сверху под логотипом. */
.auth__aside::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top,
    rgba(255, 255, 255, 0.96) 0%,
    rgba(255, 255, 255, 0.88) 28%,
    rgba(255, 255, 255, 0) 55%,
    rgba(255, 255, 255, 0) 82%,
    rgba(255, 255, 255, 0.7) 100%);
}

.auth__logo,
.auth__promo {
  position: relative;
  z-index: 1;
}

.auth__logo {
  align-self: flex-start;
  display: flex;
}

.auth__promo {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 600px;
}

.auth__headline {
  margin: 0;
  font-size: 44px;
  font-weight: 700;
  line-height: 52px;
}

.auth__lead {
  margin: 0;
  color: var(--auth-text-secondary);
  font-size: 20px;
  font-weight: 600;
  line-height: 30px;
}

.auth__accent {
  color: var(--auth-action);
}

.auth__site {
  align-self: flex-start;
  margin-top: 8px;
  font-size: 15px;
  font-weight: 500;
}

.auth__main {
  display: flex;
  flex: 1 1 480px;
  align-items: center;
  justify-content: center;
  min-width: 0;
  padding: 48px 32px;
}

.auth__panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
  max-width: 400px;
}

/* Знак логотипа над формой виден только на узком экране, где левой части нет. */
.auth__mark {
  display: none;
  margin-bottom: 16px;
}

/* ------------------------------------------------------------------ текст и поля */

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

.auth-title {
  margin: 0;
  font-size: 32px;
  font-weight: 700;
  line-height: 40px;
}

.auth-text {
  margin: 0;
  color: var(--auth-text-muted);
  font-size: 15px;
}

.auth-text_strong {
  color: var(--auth-text-secondary);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin: 0;
}

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

.auth-field__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.auth-label {
  color: var(--auth-text-secondary);
  font-size: 13px;
  font-weight: 600;
  line-height: 18px;
}

.auth-field__link {
  font-size: 14px;
  font-weight: 500;
}

.auth-input,
.auth-password {
  width: 100%;
  height: 44px;
  border: 1px solid var(--auth-field-border);
  border-radius: 0;
  background: #FFFFFF;
}

.auth-input {
  padding: 0 12px;
  color: var(--auth-text);
  font-family: var(--auth-font);
  font-size: 16px;
}

.auth-input:focus {
  padding: 0 11px;
  border: 2px solid var(--auth-plum);
  outline: none;
}

/* Пароль: поле и кнопка «Показать» в одной рамке. */
.auth-password {
  display: flex;
  align-items: stretch;
}

.auth-password:focus-within {
  border: 2px solid var(--auth-plum);
}

.auth-password .auth-input {
  flex: 1 1 auto;
  min-width: 0;
  height: auto;
  border: 0;
}

.auth-password .auth-input:focus {
  padding: 0 12px;
  border: 0;
}

/* Рамка в фокусе толще на пиксель: отступ меньше на тот же пиксель, и текст не сдвигается. */
.auth-password:focus-within .auth-input {
  padding-left: 11px;
}

.auth-password__toggle {
  padding: 0 14px;
  border: 0;
  background: transparent;
  color: var(--auth-plum);
  font-family: var(--auth-font);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.auth-password__toggle:focus-visible {
  outline: 2px solid var(--auth-plum);
  outline-offset: -4px;
}

.auth-input_invalid,
.auth-password_invalid {
  border-color: var(--auth-danger);
}

.auth-field__hint,
.auth-field__error {
  font-size: 13px;
  line-height: 18px;
}

.auth-field__hint {
  color: var(--auth-text-muted);
}

.auth-field__error {
  margin: 0;
  color: var(--auth-danger);
}

.auth-notice {
  margin: 0;
  padding: 12px 14px;
  font-size: 15px;
  line-height: 22px;
}

.auth-notice_error {
  background: var(--auth-danger-soft);
  color: var(--auth-danger);
}

.auth-notice_tip {
  background: var(--auth-plum-soft);
  font-size: 14px;
  line-height: 20px;
}

/* ------------------------------------------------------------------ кнопки */

.auth-button {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 24px;
  border: 0;
  font-family: var(--auth-font);
  font-size: 16px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.auth-button:focus-visible {
  outline: 2px solid var(--auth-plum);
  outline-offset: 3px;
}

/* Главное действие экрана: орхидея с тенью, как на сайте. */
.auth-button_action {
  background: var(--auth-action);
  color: #FFFFFF;
  box-shadow: 3px 3px 0 var(--auth-plum);
}

.auth-button_action:hover {
  background: var(--auth-action-hover);
  color: #FFFFFF;
}

.auth-button_action:active {
  box-shadow: none;
  transform: translate(3px, 3px);
}

.auth-button_primary {
  background: var(--auth-plum);
  color: #FFFFFF;
}

.auth-button_primary:hover {
  background: var(--auth-plum-hover);
  color: #FFFFFF;
}

.auth-button_neutral {
  min-height: 44px;
  border: 1px solid var(--auth-field-border);
  background: #FFFFFF;
  color: var(--auth-text);
  font-size: 15px;
  font-weight: 500;
}

.auth-button_neutral:hover {
  border-color: var(--auth-text-muted);
  color: var(--auth-text);
}

.auth-footer {
  margin: 8px 0 0;
  padding-top: 20px;
  border-top: 1px solid var(--auth-line-soft);
  color: var(--auth-text-muted);
  font-size: 14px;
  line-height: 20px;
}

/* «Выйти» в подвале — кнопка POST-формы выхода с CSRF-токеном (quick 261029-eh8, IN-03): бэк выходит только по POST.
   Выглядит как ссылка подвала (цвет и наведение — правила `a` выше). */
.auth-footer__logout {
  appearance: none;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: var(--auth-plum);
  cursor: pointer;
}

.auth-footer__logout:hover {
  color: var(--auth-plum-hover);
}

/* ------------------------------------------------------------------ первый вход: документы */

.auth-documents {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.auth-documents a {
  font-weight: 500;
}

.auth-check {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 15px;
  line-height: 22px;
  cursor: pointer;
}

.auth-check input {
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  margin: 1px 0 0;
  accent-color: var(--auth-plum);
}

.auth-messages {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* ------------------------------------------------------------------ узкий экран */

@media (max-width: 900px) {
  .auth__aside {
    display: none;
  }

  .auth__mark {
    display: flex;
  }

  .auth__main {
    align-items: flex-start;
    padding: 32px 16px;
  }
}
