/*
 * Экраны авторизации: вход, регистрация, восстановление и сброс пароля.
 * Подключается только на этих страницах (см. includes/header.php, переменная $authPage).
 * Значения сняты с макета: Montserrat, градиент кнопки #1565C0 → #F4BE2C,
 * орнамент assets/img/auth-ornament.svg слева и зеркально справа.
 *
 * Токены объявлены на .auth-page, чтобы не конфликтовать со старыми переменными
 * остальных страниц. Когда дойдём до остальных экранов — поднимем их в :root.
 */

.auth-page{
  --auth-navy:   #14213d;   /* заголовки, текст в полях */
  --auth-muted:  #8794ad;   /* подписи, плейсхолдеры, рамки полей */
  --auth-blue:   #1565c0;   /* ссылки, фокус, выбранный чекбокс */
  --auth-gold:   #f4be2c;
  --auth-gradient: linear-gradient(90deg, #1565C0 0%, #F4BE2C 100%);
  --auth-error:  #c0392b;
  --auth-error-bg: #fdeeee;
  --auth-ok:     #1b7a4b;
  --auth-ok-bg:  #e8f6ee;
  --auth-info-bg:#eaf2fb;

  margin: 0;
  background: #fff;
  color: var(--auth-navy);
  font-family: 'Montserrat', -apple-system, 'Segoe UI', Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Орнамент по бокам ---------- */
/* Файл 390×900, слева непрозрачный → справа прозрачный; повторяется по вертикали без шва (период 900px). */
.auth-page::before,
.auth-page::after{
  content: '';
  position: fixed;
  top: 0; bottom: 0;
  width: min(390px, 27vw);
  background: url('../img/auth-ornament.svg') repeat-y left top / 100% auto;
  pointer-events: none;
  z-index: 0;
}
.auth-page::before{ left: 0; }
.auth-page::after{ right: 0; transform: scaleX(-1); }

/* ---------- Каркас ---------- */
.auth-wrap{
  position: relative;
  z-index: 1;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  box-sizing: border-box;
}

.auth-box{
  width: 100%;
  max-width: 488px;
  box-sizing: border-box;
  background: #fff;
  border-radius: 24px;
  padding: 32px;
  box-shadow: 0 6px 24px rgba(21, 101, 192, .16);
}

/* ---------- Логотип и заголовок ---------- */
.auth-logo{
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  color: var(--auth-navy);
}
.auth-logo img{ width: 40px; height: 40px; display: block; }
.auth-logo span{
  font-weight: 800;
  font-size: 20px;
  line-height: 1;
  letter-spacing: .02em;
  text-transform: uppercase;
}

.auth-title{
  margin: 8px 0 0;
  text-align: center;
  font-family: inherit;
  font-weight: 800;
  font-size: 26px;
  line-height: 1.2;
  letter-spacing: .01em;
  text-transform: uppercase;
  color: var(--auth-navy);
  text-wrap: balance;
}
.auth-text{
  margin: 13px 0 0;
  text-align: center;
  font-size: 14px;
  line-height: 1.5;
  font-weight: 500;
  color: var(--auth-muted);
}

.auth-form{ margin-top: 16px; }

/* ---------- Поля ---------- */
.auth-field{ margin-bottom: 14px; }
.auth-field label{
  display: block;
  margin-bottom: 10px;
  font-size: 14px;
  line-height: 17px;
  font-weight: 600;
  color: var(--auth-muted);
}
.auth-input{
  display: block;
  width: 100%;
  height: 48px;
  box-sizing: border-box;
  padding: 0 13px;
  border: 1px solid var(--auth-muted);
  border-radius: 12px;
  background: #fff;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  color: var(--auth-navy);
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.auth-input::placeholder{ color: var(--auth-muted); opacity: 1; }
.auth-input:focus{
  border-color: var(--auth-blue);
  box-shadow: 0 0 0 3px rgba(21, 101, 192, .15);
}
.auth-input.is-invalid{ border-color: var(--auth-error); }

.auth-hint{
  margin-top: 8px;
  font-size: 12px;
  line-height: 1.4;
  font-weight: 500;
  color: var(--auth-muted);
}

/* ---------- Чекбокс ---------- */
.auth-check{
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1.4;
  font-weight: 500;
  color: var(--auth-navy);
  user-select: none;
}
.auth-check input{
  position: absolute;
  opacity: 0;
  width: 20px; height: 20px;
  margin: 0;
  cursor: pointer;
}
.auth-check .box{
  position: relative;
  flex: 0 0 20px;
  width: 20px; height: 20px;
  box-sizing: border-box;
  border: 1.5px solid var(--auth-muted);
  border-radius: 6px;
  background: #fff;
  transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease;
}
/* галочка в выбранном состоянии */
.auth-check .box::after{
  content: '';
  position: absolute;
  left: 6px; top: 2px;
  width: 5px; height: 10px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) scale(0);
  transition: transform .12s ease;
}
.auth-check input:checked + .box{
  background: var(--auth-blue);
  border-color: var(--auth-blue);
}
.auth-check input:checked + .box::after{ transform: rotate(45deg) scale(1); }
.auth-check input:focus-visible + .box{ box-shadow: 0 0 0 3px rgba(21, 101, 192, .25); }

/* согласие при регистрации — мелкий серо-голубой текст в две строки */
.auth-check.is-consent{
  display: flex;
  margin-top: 8px;
  font-size: 13px;
  line-height: 20px;
  color: var(--auth-muted);
}

/* «Запомнить меня» + «Забыли пароль?» по центру одной строкой */
.auth-row{
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 12px;
  margin-top: 24px;
}

/* ---------- Ссылки ---------- */
.auth-link{
  font-size: 14px;
  line-height: 1.4;
  font-weight: 600;
  color: var(--auth-blue);
  text-decoration: none;
}
.auth-link:hover{ text-decoration: underline; }
.auth-link-block{ display: block; width: fit-content; margin-top: 8px; }

/* ---------- Кнопка ---------- */
.auth-btn{
  display: block;
  width: 100%;
  height: 48px;
  margin-top: 24px;
  padding: 0 24px;
  border: 0;
  border-radius: 999px;
  background: var(--auth-gradient);
  color: #fff;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: filter .15s ease, box-shadow .15s ease, transform .05s ease;
}
.auth-btn:hover{ filter: brightness(1.06); box-shadow: 0 6px 16px rgba(21, 101, 192, .28); }
.auth-btn:active{ transform: translateY(1px); }
.auth-btn:focus-visible{ outline: 3px solid rgba(21, 101, 192, .35); outline-offset: 2px; }

/* переход между входом и регистрацией (в макете не нарисован — добавлен, чтобы не было тупика) */
.auth-switch{
  margin: 18px 0 0;
  text-align: center;
  font-size: 14px;
  line-height: 1.5;
  font-weight: 500;
  color: var(--auth-muted);
}
.auth-switch a{ color: var(--auth-blue); font-weight: 600; text-decoration: none; }
.auth-switch a:hover{ text-decoration: underline; }

/* ---------- Сообщения ---------- */
.auth-alert{
  margin: 16px 0 0;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.5;
  font-weight: 500;
  background: var(--auth-info-bg);
  color: var(--auth-navy);
  word-break: break-word;
}
.auth-alert + .auth-alert{ margin-top: 8px; }
.auth-alert.is-error{ background: var(--auth-error-bg); color: var(--auth-error); }
.auth-alert.is-success{ background: var(--auth-ok-bg); color: var(--auth-ok); }
.auth-alert a{ color: var(--auth-blue); font-weight: 600; }
.auth-alert + .auth-form{ margin-top: 16px; }

/* ---------- Адаптив ---------- */
@media (max-width: 900px){
  .auth-page::before,
  .auth-page::after{ width: 30vw; }
}

@media (max-width: 520px){
  .auth-page::before,
  .auth-page::after{ width: 38vw; opacity: .8; }
  .auth-wrap{ padding: 16px 12px; align-items: flex-start; }
  .auth-box{ padding: 24px 20px; border-radius: 20px; margin: 8px 0; }
  .auth-title{ font-size: 22px; }
  .auth-logo img{ width: 36px; height: 36px; }
  .auth-logo span{ font-size: 18px; }
  .auth-check.is-consent{ font-size: 12.5px; line-height: 18px; }
}

@media (max-width: 360px){
  .auth-box{ padding: 20px 16px; }
  .auth-title{ font-size: 20px; }
}

/* поля 16px на телефонах — иначе iOS приближает страницу при фокусе */
@media (max-width: 520px){
  .auth-input{ font-size: 16px; }
}

@media (prefers-reduced-motion: reduce){
  .auth-input, .auth-btn, .auth-check .box, .auth-check .box::after{ transition: none; }
}
