@import url("../shared/form-input.css");

/* Токены из Figma: Вход ЛК (19:2444), mobile (19:2603) */
:root {
  --auth-bg: #ffffff;
  --auth-text: #000000;
  --auth-muted: #818181;
  --auth-label: #646464;
  --auth-input-bg: #f3f3f3;
  --cabinet-input-bg: #f3f3f3;
  --cabinet-input-inset: inset 0 2px 4px rgba(0, 0, 0, 0.25);
  --cabinet-plot-input-pill-radius: 9999px;
  --cabinet-text: #000000;
  --cabinet-label: #646464;
  --cabinet-green: #00bf86;
  --auth-cta: #d45656;
  --auth-link: #00bf86;
  --auth-shadow-card: 0 1px 4px rgba(0, 0, 0, 0.25);
  --auth-shadow-inset: inset 0 2px 4px rgba(0, 0, 0, 0.25);
  --auth-radius-card: 15px;
  --auth-radius-btn: 25px;
  --auth-radius-input: 9999px;
  --auth-hero-tint: #1d3a2d;
  --auth-phone-size: 1.375rem;
  --auth-email-size: 1.125rem;
  --auth-page-pad: clamp(1.25rem, 4.2vw, 3.125rem);
  /* Шапка / футер ↔ блок с фоном (Figma 19:2444 desktop, 19:2603 mobile) */
  --auth-header-pad-top-mobile: 1.3125rem;
  --auth-header-pad-top-desktop: 2.0625rem;
  --auth-gap-header-hero-mobile: 2.0625rem;
  --auth-gap-header-hero-desktop: 1.25rem;
  --auth-footer-pad-top-mobile: 0.9375rem;
  --auth-footer-pad-top-desktop: 2.375rem;
  --auth-footer-pad-bottom-mobile: 1.5rem;
  --auth-footer-pad-bottom-desktop: 1.8125rem;
}

body.auth-page {
  margin: 0;
  min-height: 100vh;
  background: var(--auth-bg);
  color: var(--auth-text);
}

body.auth-page .messages {
  position: fixed;
  top: 0.75rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  max-width: min(92vw, 28rem);
  width: 100%;
}

.auth {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: "Roboto", system-ui, -apple-system, sans-serif;
}

.auth__header {
  position: relative;
  z-index: 5;
  flex-shrink: 0;
  background: var(--auth-bg);
  width: 100%;
  margin-bottom: var(--auth-gap-header-hero-mobile);
}

@media (min-width: 900px) {
  .auth__header {
    margin-bottom: var(--auth-gap-header-hero-desktop);
  }
}

.auth__header-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  width: 100%;
  padding: var(--auth-header-pad-top-mobile) var(--auth-page-pad) 0;
  min-height: 48px;
  box-sizing: border-box;
}

.auth__header-left {
  min-width: 0;
}

@media (max-width: 899px) {
  .auth__header-left {
    display: none;
  }
}

@media (min-width: 900px) {
  .auth__header-inner {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    justify-content: initial;
    padding: var(--auth-header-pad-top-desktop) var(--auth-page-pad) 0;
    min-height: 56px;
  }

  .auth__header-left {
    justify-self: start;
  }

  .auth__brand {
    justify-self: center;
    grid-column: 2;
    grid-row: 1;
  }
}

.auth__contacts--header {
  display: none;
}

@media (min-width: 900px) {
  .auth__contacts--header {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    line-height: 1.25;
  }
}

.auth__brand {
  display: flex;
  align-items: center;
  line-height: 0;
}

.auth__brand img {
  display: block;
  width: clamp(120px, 40vw, 150px);
  height: auto;
}

.auth__phone a,
.auth__contacts .auth__phone a {
  color: var(--auth-text);
  text-decoration: none;
  font-weight: 400;
  font-size: var(--auth-phone-size);
}

.auth__email a,
.auth__contacts .auth__email a {
  color: var(--auth-text);
  text-decoration: underline;
  text-underline-offset: 2px;
  font-weight: 400;
  font-size: var(--auth-email-size);
}

/* Герой на всю ширину; форма по центру оставшейся высоты */
.auth__hero {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  width: 100%;
}

.auth__hero-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  background-color: var(--auth-hero-tint);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.auth__shell {
  position: relative;
  z-index: 3;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  box-sizing: border-box;
  padding: 1rem var(--auth-page-pad);
}

.auth__card {
  width: min(100%, 340px);
  background: var(--auth-bg);
  border-radius: var(--auth-radius-card);
  box-shadow: var(--auth-shadow-card);
  padding: 1.25rem 1rem 1.5rem;
  box-sizing: border-box;
}

@media (min-width: 900px) {
  .auth__card {
    width: min(100%, 468px);
    padding: 1.75rem 2rem 2rem;
  }
}

.auth__title {
  margin: 0 0 1rem;
  text-align: center;
  font-weight: 700;
  font-size: clamp(1.125rem, 3.5vw, 1.375rem);
  line-height: 1.2;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.auth__lead {
  margin: 0 0 1rem;
  text-align: center;
  font-weight: 300;
  font-size: 0.875rem;
  line-height: 1.45;
  color: var(--auth-muted);
}

.auth__recover-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

.auth__recover-stack .auth__recover {
  margin-top: 0;
}

.auth__form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.auth-field {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Подписи только для скринридеров — в макете только плейсхолдеры */
.auth-field > label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.auth-field .errorlist {
  margin: 0.25rem 0 0;
  padding: 0;
  list-style: none;
  font-size: 0.625rem;
  color: var(--auth-cta);
}

.auth__error {
  margin: 0;
  min-height: 0.75rem;
  font-size: 0.625rem;
  line-height: 1.2;
  color: var(--auth-cta);
}

.auth__submit {
  margin-top: 0.25rem;
  width: min(100%, 206px);
  align-self: center;
  border: 0;
  border-radius: var(--auth-radius-btn);
  background: var(--auth-cta);
  color: #ffffff;
  font-weight: 700;
  font-size: 1.125rem;
  line-height: 1.2;
  padding: 0.65rem 1rem;
  cursor: pointer;
  min-height: 45px;
}

.auth__submit:hover {
  filter: brightness(1.03);
}

.auth__submit:active {
  transform: translateY(1px);
}

.auth__recover {
  display: block;
  margin-top: 1rem;
  text-align: center;
  font-size: 0.875rem;
  color: var(--auth-link);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.auth__recover:hover {
  text-decoration-thickness: 2px;
}

.auth__footer {
  flex-shrink: 0;
  width: 100%;
  box-sizing: border-box;
  padding: var(--auth-footer-pad-top-mobile) var(--auth-page-pad)
    var(--auth-footer-pad-bottom-mobile);
}

@media (min-width: 900px) {
  .auth__footer {
    padding: var(--auth-footer-pad-top-desktop) var(--auth-page-pad)
      var(--auth-footer-pad-bottom-desktop);
  }
}

.auth__footer-row {
  display: flex;
  flex-wrap: wrap;
  flex-direction: row;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem 1rem;
  width: 100%;
  max-width: none;
}

.auth__copyright {
  margin: 0;
  flex: 1 1 10rem;
  min-width: 0;
  font-size: 0.75rem;
  line-height: 1.35;
  color: var(--auth-muted);
  white-space: pre-line;
  text-align: left;
}

@media (max-width: 399px) {
  .auth__contacts--footer {
    flex-basis: 100%;
    max-width: 100%;
  }
}

/* Телефон и email — две строки, оба по левому краю блока */
.auth__contacts--footer {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  flex: 0 0 auto;
  margin-left: auto;
  text-align: left;
}

@media (min-width: 600px) {
  .auth__contacts--footer {
    min-width: 0;
  }
}

.auth__contacts--footer .auth__phone,
.auth__contacts--footer .auth__email {
  text-align: left;
}
