/* These pages load the same #ansbuy-palette block in <head> that index.html
   uses, so this file deliberately re-declares NONE of --brand/--surface/--text
   /--line: the auth pages inherit index.html's exact colours in both themes.
   Only the --auth-* aliases that older rules here still reference are mapped
   onto that palette. */
:root {
  --auth-accent: var(--brand);
  --auth-accent-hover: var(--brand-strong);
}

body.auth-page {
  --auth-accent: var(--brand);
  --auth-accent-hover: var(--brand-strong);
  --auth-hero-accent: var(--brand);
  --auth-hero-text: var(--text);
  --auth-hero-muted: var(--text-muted);
  --auth-hero-line: var(--line);
  min-height: 100vh;
  overflow-x: hidden;
  /* index.html sets type in Montserrat; these pages were on Inter. */
  font-family: 'Montserrat', Arial, sans-serif;
  /* Photo backdrop, with --page underneath as the colour it loads over. */
  background-color: var(--page) !important;
  background-image: url('whitelogin.jpg') !important;
  background-repeat: no-repeat !important;
  background-position: center center !important;
  background-size: cover !important;
  background-attachment: fixed !important;
  color: var(--text);
}

body.auth-page.dark-theme {
  background-color: var(--page) !important;
  background-image: url('darklogin.png') !important;
  color: var(--text);
}

.auth-page .neo-bg,
.auth-page .bg-lines {
  display: none !important;
}

/* The gear sits in the card's own top-right corner, inset by the card padding,
   rather than floating over the page. */
.auth-page .auth-card .floating-controls {
  position: absolute;
  top: clamp(26px, 3vw, 38px);
  right: clamp(26px, 3vw, 38px);
  z-index: 30;
}

.auth-page .floating-controls > .header-right {
  display: none;
}

/* Same control as index.html's header gear (#mobileSupportBtn): 42x42, 9px
   padding, 12px radius, --surface on a --line border. */
.auth-settings-trigger {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.auth-settings-trigger:hover {
  border-color: var(--brand-border);
  background: var(--brand-soft);
  color: var(--brand);
}

.auth-settings-trigger:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

/* The iconsax #setting glyph is a filled shape — index.html paints it with
   fill and no stroke. Stroking it as well is what read as a bolder icon. */
.auth-settings-trigger svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
  stroke: none;
}

.auth-settings-panel {
  position: absolute;
  top: 56px;
  right: 0;
  display: none;
  width: 320px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  color: var(--text);
}

.auth-page.dark-theme .auth-settings-panel {
  border-color: var(--line);
  background: var(--surface);
  color: var(--text);
}

.auth-settings-panel.active {
  display: block;
}

.auth-settings-panel h2 {
  margin: 0 0 18px;
  font-size: 20px;
}

.auth-settings-group {
  margin-bottom: 18px;
}

.auth-settings-group h3 {
  margin: 0 0 9px;
  color: var(--text-muted);
  font-size: 13px;
}

.auth-page.dark-theme .auth-settings-group h3 {
  color: var(--text-muted);
}

.auth-settings-languages {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.auth-settings-language,
.auth-settings-theme-button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text-muted);
  font-weight: 600;
  cursor: pointer;
}

.auth-page.dark-theme .auth-settings-language,
.auth-page.dark-theme .auth-settings-theme-button {
  border-color: var(--line);
  background: var(--surface-muted);
  color: var(--text-muted);
}

.auth-settings-language:hover,
.auth-settings-language.active,
.auth-settings-theme-button:hover,
.auth-settings-theme-button.active {
  border-color: var(--brand);
  background: var(--brand);
  color: var(--on-brand);
}

.auth-settings-theme {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.auth-settings-theme-button {
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-settings-theme-button svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.auth-settings-support {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border: 1px solid var(--auth-accent);
  border-radius: 11px;
  color: var(--auth-accent);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}

.auth-settings-support:hover {
  background: var(--brand);
  color: var(--on-brand);
}

/* Match the settings panel used on index.html. */
.auth-settings-panel,
.auth-page.dark-theme .auth-settings-panel {
  top: 58px;
  width: min(340px, calc(100vw - 24px));
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  color: var(--text);
}

.auth-settings-panel h2 {
  margin: 0 0 18px;
  color: var(--text);
  font-family: 'Montserrat', Arial, sans-serif;
  font-size: 19px;
  font-weight: 700;
}

.auth-settings-group {
  margin-bottom: 20px;
}

.auth-settings-group h3,
.auth-page.dark-theme .auth-settings-group h3 {
  margin: 0 0 10px;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 600;
}

.auth-settings-languages {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}

.auth-settings-language,
.auth-page.dark-theme .auth-settings-language {
  min-height: 0;
  padding: 10px 8px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text-muted);
  font-family: 'Montserrat', Arial, sans-serif;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
}

.auth-settings-language:hover {
  border: 0;
  background: transparent;
  color: var(--brand);
}

.auth-settings-language.active,
.auth-page.dark-theme .auth-settings-language.active {
  border: 0;
  background: var(--brand);
  color: var(--on-brand);
}

.auth-settings-theme {
  display: flex;
  gap: 6px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}

.auth-settings-theme-button,
.auth-page.dark-theme .auth-settings-theme-button {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  min-height: 0;
  padding: 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text-muted);
}

.auth-settings-theme-button:hover {
  border: 0;
  background: transparent;
  color: var(--brand);
}

.auth-settings-theme-button.active,
.auth-page.dark-theme .auth-settings-theme-button.active {
  border: 0;
  background: var(--brand-soft);
  color: var(--brand);
}

/* The iconsax moon/sun are filled paths. index.html forces `stroke: none` on
   them (see its .mobile-settings-option svg / #themeToggle svg rule) — adding a
   stroke here outlined them a second time and read as a bolder icon. */
.auth-settings-theme-button svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
  stroke: none;
}

.auth-settings-divider {
  height: 1px;
  margin: 4px 0 18px;
  border: 0;
  background: var(--line);
}

.auth-settings-support,
.auth-page.dark-theme .auth-settings-support {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 0;
  padding: 13px 18px;
  border: 1px solid var(--brand-border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--brand);
  font-family: 'Montserrat', Arial, sans-serif;
  font-size: 14px;
  font-weight: 600;
}

.auth-settings-support:hover {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand);
}

.auth-settings-support svg {
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  fill: none;
  stroke: currentColor;
}

/* Brand bar: same top-left lockup and geometry as the index.html header, so
   the logo sits in the identical spot when moving between the pages. */
.auth-page .auth-topbar {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 80px;
  padding: 14px clamp(28px, 5vw, 76px);
}

.auth-page .main-content {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(380px, 470px);
  align-items: center;
  /* Tighter than before so the left column — and with it the benefits row —
     gets more width. */
  gap: clamp(32px, 3.4vw, 66px);
  /* Full width, not a centred 1520px box: inside a centred box the horizontal
     padding is measured from the box edge, so past 1520px the copy drifted
     right while the full-width brand bar stayed put. The insets below are
     index.html's own .hero padding, so the copy starts on exactly the same
     left edge as the index hero at every width. */
  width: 100%;
  /* 80px brand bar + 75px footer, plus a couple of px so a page whose card
     fits the viewport doesn't grow a phantom scrollbar. */
  min-height: calc(100vh - 158px);
  padding: clamp(16px, 2.4vh, 34px) clamp(64px, 9vw, 170px) 42px;
}

.auth-page .auth-intro {
  display: flex;
  align-self: stretch;
  flex-direction: column;
  width: 100%;
  /* High enough that the column width itself is the limit, so the benefits row
     uses the whole left column; title and text keep their own max-widths. */
  max-width: 1200px;
  min-height: min(660px, calc(100vh - 226px));
  padding: 0 0 12px;
  color: var(--auth-hero-text);
}

.auth-page .auth-brand {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  gap: 0;
  color: var(--auth-hero-accent);
  text-decoration: none;
}

/* 76px wide art inside a 50px-tall box, exactly the .brand-logo-viewport /
   .brand-logo-new pair on index.html. */
.auth-page .auth-brand-mark {
  width: 76px;
  height: 50px;
  flex: 0 0 76px;
  background-color: currentColor;
  -webkit-mask: url('brand-logo-mark.png?v=1') center / contain no-repeat;
  mask: url('brand-logo-mark.png?v=1') center / contain no-repeat;
}

.auth-page .auth-brand-name {
  margin-left: -0.2em;
  font-family: 'Montserrat', 'Inter', Arial, sans-serif;
  font-size: 50px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.035em;
  transform: translateY(0.086em) scaleY(1.1);
  transform-origin: center;
  white-space: nowrap;
}

/* Sits below the top of the column but higher than a plain `auto` centre; the
   benefits row keeps its own auto margin, so it stays pinned to the bottom. */
.auth-page .auth-intro-copy {
  margin-top: clamp(20px, 16.7vh, 200px);
}

.auth-page .auth-intro-title {
  max-width: 610px;
  margin: 0 0 18px;
  color: inherit;
  font-size: clamp(36px, 3.1vw, 54px);
  line-height: 1.07;
  letter-spacing: -1.4px;
}

.auth-page .auth-intro-title span,
.auth-page .auth-intro-title strong {
  display: block;
}

.auth-page .auth-intro-title strong {
  color: var(--auth-hero-accent);
  font-weight: 750;
}

.auth-page .auth-intro-text {
  max-width: 560px;
  margin: 0;
  color: var(--auth-hero-muted);
  font-size: 15px;
  line-height: 1.5;
}

.auth-page .auth-intro-text span {
  display: block;
}

.auth-page .auth-benefits {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  margin-top: auto;
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
}

.auth-page.dark-theme .auth-benefits {
  border-color: var(--line);
  background: var(--surface);
}

.auth-page .auth-benefit {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  min-width: 0;
  margin: 0;
  color: var(--auth-hero-text);
}

.auth-page .auth-benefit + .auth-benefit {
  padding-left: 24px;
  border-left: 1px solid var(--line);
}

.auth-page .auth-benefit svg {
  width: 36px;
  height: 36px;
  color: var(--auth-hero-accent);
}

.auth-page .auth-benefit h3 {
  margin: 0 0 2px;
  color: inherit;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.2;
}

.auth-page .auth-benefit p {
  margin: 0;
  color: var(--auth-hero-muted);
  font-size: 13px;
  line-height: 1.45;
}

.auth-page .auth-container,
.auth-page-register .auth-container {
  width: 100%;
  min-width: 0;
  max-width: 470px;
  margin-left: auto;
  animation: none;
}

.auth-page-register .auth-container {
  max-width: 500px;
}

.auth-page .auth-card {
  width: 100%;
  max-width: 100%;
  padding: clamp(26px, 3vw, 38px);
  overflow: visible;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: none;
}

.auth-page.dark-theme .auth-card {
  border-color: var(--line);
  background: var(--surface);
}

.auth-page .auth-header {
  /* Keeps the title and subtitle clear of the gear in the corner. */
  padding-right: 54px;
  margin-bottom: 24px;
  text-align: left;
}

.auth-page .auth-title {
  margin-bottom: 7px;
  color: var(--text);
  font-size: 26px;
  line-height: 1.15;
}

.auth-page.dark-theme .auth-title {
  color: var(--text);
}

.auth-page .auth-subtitle {
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.45;
}

.auth-page.dark-theme .auth-subtitle {
  color: var(--text-muted);
}

.auth-page .form-group {
  margin-bottom: 16px;
}

.auth-page .form-label {
  margin-bottom: 7px;
  color: var(--text);
  font-size: 13px;
}

.auth-page.dark-theme .form-label {
  color: var(--text);
}

/* index.html's .search-box: --line border, --surface fill, --brand on focus. */
.auth-page .form-input {
  min-height: 50px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
  color: var(--text);
  box-shadow: none;
}

.auth-page.dark-theme .form-input {
  border-color: var(--line);
  background: var(--surface-muted);
  color: var(--text);
}

.auth-page .form-input::placeholder,
.auth-page.dark-theme .form-input::placeholder {
  color: var(--text-muted);
}

/* Turnstile оставляем как есть — со своими собственными углами.
   Кнопка Google выбивалась формой ('pill' в конфиге GSI), её радиус приводим
   к тому же, что у .form-input и .auth-btn. */
.auth-page #googleSignInContainer,
.auth-page #googleSignInContainer > div,
.auth-page #googleSignInContainer div[role="button"],
.auth-page #googleSignInContainer iframe {
  border-radius: 11px !important;
  overflow: hidden;
}

.auth-page .form-input:focus {
  border-color: var(--brand);
  box-shadow: none;
}

/* Primary button = index.html's .btn-register / .search-btn: --brand fill with
   --on-brand text (which is #04231a on the dark mint, not white). */
.auth-page .auth-btn {
  min-height: 50px;
  border: 1px solid var(--brand);
  border-radius: 11px;
  background: var(--brand);
  color: var(--on-brand);
  box-shadow: none;
}

.auth-page .auth-btn::before {
  display: none;
}

.auth-page .auth-btn:hover:not(:disabled) {
  border-color: var(--brand-strong);
  background: var(--brand-strong);
  box-shadow: none;
  transform: translateY(-1px);
}

.auth-page .auth-divider,
.auth-page.dark-theme .auth-divider {
  color: var(--text-muted);
}

.auth-page .auth-divider::before,
.auth-page .auth-divider::after,
.auth-page.dark-theme .auth-divider::before,
.auth-page.dark-theme .auth-divider::after {
  background: var(--line);
}

/* Как у чекбоксов корзины: не сплошная заливка, а мягкий брендовый фон
   с брендовой же птичкой. */
.auth-page .remember-label input[type="checkbox"]:checked + .custom-checkbox {
  border-color: var(--brand);
  background: rgba(var(--brand-rgb), 0.12);
}

.auth-page .remember-label input[type="checkbox"]:checked + .custom-checkbox::after {
  border-left-color: var(--brand);
  border-bottom-color: var(--brand);
}

.auth-page .remember-label {
  color: var(--text-muted);
}

.auth-page .password-toggle {
  color: var(--text-muted);
}

.auth-page .password-toggle:hover {
  color: var(--brand);
}

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

.auth-page .auth-footer a,
.auth-page .forgot-link {
  color: var(--brand);
}

.auth-page .auth-footer a:hover,
.auth-page .forgot-link:hover {
  color: var(--brand-strong);
}

.auth-page .footer {
  position: relative;
  z-index: 2;
  padding: 12px 24px 20px;
  background: transparent;
  border: 0;
}

/* These were hardcoded near-white for the old photo backdrop, which left them
   invisible on the light page. index.html's footer uses --text-muted. */
.auth-page .footer-links a,
.auth-page .footer-copy {
  color: var(--text-muted);
}

.auth-page .footer-links a:hover {
  color: var(--brand);
}

/* The intro column narrows as the index-hero insets grow, and three benefits
   abreast run out of room for their labels. Two stages: first shrink the row so
   it still fits three across at common laptop widths, then stack it. */
@media (max-width: 1560px) {
  .auth-page .auth-benefits {
    padding: 12px 18px;
  }

  .auth-page .auth-benefit {
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 10px;
  }

  .auth-page .auth-benefit + .auth-benefit {
    padding-left: 16px;
  }

  .auth-page .auth-benefit svg {
    width: 32px;
    height: 32px;
  }

  .auth-page .auth-benefit h3 {
    font-size: 15px;
  }

  .auth-page .auth-benefit p {
    font-size: 12px;
  }
}

@media (max-width: 1220px) {
  .auth-page .auth-benefits {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
  }

  .auth-page .auth-benefit {
    gap: 14px;
    align-items: center;
  }

  .auth-page .auth-benefit + .auth-benefit {
    padding-top: 14px;
    padding-left: 0;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .auth-page .auth-benefit svg {
    width: 32px;
    height: 32px;
  }

  .auth-page .auth-benefit h3 {
    margin-bottom: 3px;
    font-size: 16px;
  }

  .auth-page .auth-benefit p {
    font-size: 13px;
  }
}

@media (max-width: 1000px) {
  .auth-page .main-content {
    grid-template-columns: minmax(0, 1fr) minmax(360px, 440px);
    gap: 32px;
    padding-right: 34px;
  }

  .auth-page .auth-intro-title {
    font-size: 34px;
  }
}

@media (max-width: 820px) {
  /* Keep the photo's subject in frame once the viewport goes narrow. */
  body.auth-page,
  body.auth-page.dark-theme {
    background-position: 38% center !important;
  }

  /* Logo keeps its top-left spot; the lockup scales the way index.html's
     mobile header scales it (50x32 box, 32px wordmark). */
  .auth-page .auth-topbar {
    min-height: 64px;
    padding: 9px 14px;
  }

  .auth-page .auth-brand-mark {
    width: 48px;
    height: 32px;
    flex: 0 0 48px;
  }

  .auth-page .auth-brand-name {
    font-size: 32px;
  }

  .auth-page .main-content {
    display: flex;
    justify-content: center;
    min-height: calc(100vh - 122px);
    padding: 18px 18px 34px;
  }

  .auth-page .auth-intro {
    display: none;
  }

  .auth-page .auth-container,
  .auth-page-register .auth-container {
    max-width: 520px;
    margin: auto;
  }

  .auth-page .auth-card {
    background: var(--surface);
  }

  .auth-page.dark-theme .auth-card {
    background: var(--surface);
  }
}

@media (max-width: 480px) {
  /* Follows the tighter card padding below. */
  .auth-page .auth-card .floating-controls {
    top: 20px;
    right: 18px;
  }

  .auth-settings-panel {
    width: min(320px, calc(100vw - 24px));
  }

  .auth-page .auth-topbar {
    padding: 8px 12px;
  }

  .auth-page .main-content {
    align-items: flex-start;
    padding: 12px 12px 24px;
  }

  .auth-page .auth-card {
    padding: 24px 18px;
    border-radius: 16px;
  }

  .auth-page .auth-title {
    font-size: 23px;
  }

  .auth-page .form-row {
    flex-wrap: wrap;
    gap: 10px;
  }

  /* Ссылки подвала в одну строку не помещаются уже на 360px и растягивали
     страницу горизонтально — переносим их. */
  .auth-page .footer-links {
    flex-wrap: wrap;
    gap: 16px;
  }

  .auth-page .footer {
    padding-bottom: 14px;
  }
}

/* Turnstile в режиме flexible не рисует виджет уже 300px. Внутри карточки
   при ширине экрана меньше ~362px остаётся меньше места, и капча вылезала
   за карточку — правый край с логотипом Cloudflare обрезался.
   Оставляем виджету честные 300px и ужимаем их трансформом. */
@media (max-width: 361px) {
  .auth-page .captcha-wrapper {
    overflow: hidden;
    min-height: 58px;
  }

  .auth-page #turnstile-container {
    width: 300px;
    transform: scale(0.86);
    transform-origin: center top;
  }

  .auth-page #turnstile-container > div {
    width: 300px !important;
    max-width: 300px !important;
  }
}
