/* ─── Авторизация (макет) ─── */

body[data-page="auth"] .header__cart,
body[data-page="auth"] > .header,
body[data-page="auth"] > .footer {
  display: none !important;
}

body[data-page="auth"] {
  padding-bottom: 0 !important;
}

.auth-body {
  min-height: 100vh;
  min-height: 100dvh;
  background: #080d18;
  color: var(--fg);
}

.auth-layout {
  display: grid;
  min-height: 100vh;
  min-height: 100dvh;
}

/* Hero — desktop */
.auth-hero {
  display: none;
  position: relative;
  overflow: hidden;
}

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

.auth-hero__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgb(8 13 24 / 35%) 0%, rgb(8 13 24 / 88%) 100%);
}

.auth-hero__logo {
  position: relative;
  z-index: 1;
  display: inline-block;
  margin: 40px;
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.75rem;
  font-weight: 600;
  color: #fff;
  letter-spacing: 0.06em;
}

.auth-hero__content {
  position: relative;
  z-index: 1;
  margin: auto 40px 56px;
  max-width: 460px;
}

.auth-hero__title {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(2rem, 3.5vw, 2.75rem);
  font-weight: 500;
  line-height: 1.12;
  margin: 0 0 20px;
  color: #fff;
}

.auth-hero__title em {
  font-style: italic;
  color: var(--gold);
}

.auth-hero__text {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.65;
  color: rgb(255 255 255 / 72%);
}

/* Shell */
.auth-shell {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  background: #080d18;
  overflow-x: hidden;
}

.auth-close {
  position: absolute;
  top: calc(16px + env(safe-area-inset-top, 0px));
  left: 16px;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  color: #fff;
  font-size: 1.5rem;
  line-height: 1;
  text-decoration: none;
}

.auth-view {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.auth-view[hidden] {
  display: none !important;
}

.auth-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  width: min(100%, 420px);
  margin: 0 auto;
  padding: 72px 24px 32px;
}

.auth-panel--register {
  padding-top: 24px;
}

/* Brand mobile */
.auth-brand--mobile {
  display: block;
  margin-bottom: 36px;
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-align: center;
  color: var(--gold);
  text-decoration: none;
}

/* Titles */
.auth-panel__title {
  margin: 0 0 10px;
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(2rem, 6vw, 2.5rem);
  font-weight: 500;
  line-height: 1.1;
  text-align: center;
}

.auth-panel__sub {
  margin: 0 0 32px;
  text-align: center;
  font-size: 0.88rem;
  color: var(--fg-muted);
  line-height: 1.5;
}

/* Tabs — desktop */
.auth-tabs--desktop {
  display: none;
  gap: 28px;
  margin-bottom: 36px;
  border-bottom: 1px solid var(--line);
}

.auth-tabs__btn {
  padding: 0 0 14px;
  border: none;
  background: none;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-muted);
  cursor: pointer;
  position: relative;
}

.auth-tabs__btn--active {
  color: var(--fg);
}

.auth-tabs__btn--active::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: var(--gold);
}

/* Fields */
.auth-form {
  display: grid;
  gap: 22px;
}

.auth-field__label {
  display: block;
  margin-bottom: 10px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fg-muted);
}

.auth-field__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.auth-field__row .auth-field__label {
  margin-bottom: 0;
}

.auth-field__link {
  border: none;
  background: none;
  padding: 0;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold);
  cursor: pointer;
}

.auth-field__input {
  width: 100%;
  padding: 14px 0;
  background: transparent;
  border: none;
  border-bottom: 1px solid rgb(255 255 255 / 18%);
  border-radius: 0;
  font-size: 0.95rem;
  color: var(--fg);
}

.auth-field__input::placeholder {
  color: var(--fg-subtle);
}

.auth-field__input:focus {
  outline: none;
  border-bottom-color: var(--gold);
}

.auth-field__password {
  position: relative;
}

.auth-field__password .auth-field__input {
  padding-right: 44px;
}

.auth-field__toggle {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  color: var(--fg-muted);
  cursor: pointer;
}

.auth-field__toggle svg {
  width: 20px;
  height: 20px;
}

/* Primary button */
.auth-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 16px 24px;
  border: none;
  border-radius: 4px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
}

.auth-btn--primary {
  background: var(--gold);
  color: #0b1121;
  box-shadow: 0 8px 28px rgb(157 224 195 / 28%);
}

.auth-btn--primary:hover {
  background: var(--gold-light);
  transform: translateY(-1px);
}

.auth-btn--next {
  margin-top: 8px;
}

/* Divider */
.auth-divider {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 28px 0 20px;
  color: var(--fg-subtle);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.55rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line);
}

.auth-divider span {
  white-space: nowrap;
}

/* Social */
.auth-social {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.auth-social--register {
  grid-template-columns: 1fr 1fr;
  max-width: none;
  margin: 0;
}

.auth-social__btn--vk {
  border-color: #0077ff;
  color: #0077ff;
}

.auth-social__btn--vk:hover {
  background: rgba(0, 119, 255, 0.08);
  border-color: #0077ff;
}

.auth-social__btn--yandex {
  border-color: #fc3f1d;
  color: #fc3f1d;
}

.auth-social__btn--yandex:hover {
  background: rgba(252, 63, 29, 0.08);
  border-color: #fc3f1d;
}

.auth-social__btn:disabled {
  opacity: 0.6;
  cursor: wait;
}

.auth-social__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 13px 16px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--fg);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.auth-social__btn:hover {
  border-color: var(--gold);
  background: var(--gold-soft);
}

.auth-social__btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.auth-social__btn--icon {
  padding: 14px;
}

.auth-social__btn--icon svg {
  width: 22px;
  height: 22px;
}

/* Footer links */
.auth-footer {
  margin: 28px 0 0;
  text-align: center;
  font-size: 0.88rem;
  color: var(--fg-muted);
}

.auth-footer__link {
  border: none;
  background: none;
  padding: 0;
  color: var(--fg);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.auth-legal {
  margin: 24px 0 0;
  font-size: 0.72rem;
  line-height: 1.55;
  color: var(--fg-subtle);
  text-align: center;
}

.auth-legal a {
  color: var(--fg-muted);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.auth-demo {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  text-align: center;
  font-size: 0.72rem;
  color: var(--fg-subtle);
}

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

  .auth-panel {
    padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  }

  .auth-divider {
    margin: 24px 0 16px;
  }

  .auth-social {
    margin-bottom: 8px;
  }

  .auth-footer {
    margin-top: 20px;
  }
}

.auth-demo strong {
  color: var(--fg-muted);
}

.auth-form__error {
  padding: 12px 14px;
  background: rgb(220 80 80 / 10%);
  border: 1px solid rgb(220 80 80 / 30%);
  border-radius: 8px;
  color: #f0a0a0;
  font-size: 0.82rem;
  line-height: 1.4;
}

.auth-form__check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.78rem;
  color: var(--fg-muted);
  line-height: 1.45;
}

.auth-form__check input {
  margin-top: 3px;
  accent-color: var(--gold);
}

.auth-form__check a {
  color: var(--gold);
}

/* Register hero — mobile */
.auth-register-hero {
  position: relative;
  height: 240px;
  flex-shrink: 0;
  overflow: hidden;
}

.auth-register-hero img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.auth-register-hero__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgb(8 13 24 / 20%) 0%, #080d18 100%);
}

.auth-register-hero__back {
  position: absolute;
  top: calc(14px + env(safe-area-inset-top, 0px));
  left: 14px;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid rgb(255 255 255 / 20%);
  border-radius: 50%;
  background: rgb(0 0 0 / 35%);
  color: #fff;
  font-size: 1.1rem;
  cursor: pointer;
}

.auth-register-hero__content {
  position: absolute;
  left: 24px;
  right: 24px;
  bottom: 24px;
  z-index: 1;
}

.auth-register-hero__eyebrow {
  display: block;
  margin-bottom: 8px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
}

.auth-register-hero__title {
  margin: 0;
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.85rem;
  font-weight: 500;
  line-height: 1.15;
  color: #fff;
}

/* Steps */
.auth-steps {
  margin-bottom: 28px;
}

.auth-steps__bar {
  position: relative;
  height: 3px;
  margin-bottom: 10px;
  background: rgb(255 255 255 / 10%);
  border-radius: 999px;
  overflow: hidden;
}

.auth-steps__fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 33.33%;
  background: var(--gold);
  border-radius: 999px;
  transition: width 0.35s ease;
}

.auth-steps__fill[data-step="2"] {
  width: 66.66%;
}

.auth-steps__label {
  margin: 0;
  font-size: 0.78rem;
  color: var(--fg-muted);
}

/* Loyalty box */
.auth-loyalty {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}

.auth-loyalty input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.auth-loyalty__box {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: 0.75rem;
  color: transparent;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.auth-loyalty input:checked + .auth-loyalty__box {
  background: var(--gold);
  border-color: var(--gold);
  color: #0b1121;
}

.auth-loyalty__text {
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--fg-muted);
}

.auth-loyalty__text strong {
  display: block;
  margin-bottom: 2px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold);
}

.auth-register-step[hidden] {
  display: none !important;
}

.auth-panel__title--register-desktop,
.auth-panel__sub--register-desktop {
  display: none;
}

/* ─── Desktop ─── */
@media (min-width: 900px) {
  .auth-layout {
    grid-template-columns: 1fr 1fr;
  }

  .auth-hero {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
  }

  .auth-close,
  .auth-brand--mobile,
  .auth-footer--mobile,
  .auth-register-hero {
    display: none;
  }

  .auth-shell {
    align-items: center;
    justify-content: center;
    padding: 48px;
    background: #0a0f1b;
  }

  .auth-view {
    width: 100%;
    max-width: 460px;
  }

  .auth-view--register {
    max-width: 480px;
  }

  .auth-panel {
    width: 100%;
    margin: 0;
    padding: 0;
  }

  .auth-panel__title,
  .auth-panel__sub {
    text-align: left;
  }

  .auth-panel__title {
    font-size: 2.25rem;
    margin-bottom: 8px;
  }

  .auth-panel__sub {
    margin-bottom: 32px;
    font-size: 0.9rem;
  }

  .auth-tabs--desktop {
    display: flex;
  }

  .auth-legal--desktop {
    text-align: left;
  }

  .auth-demo {
    text-align: left;
  }

  .auth-panel__title--register-desktop,
  .auth-panel__sub--register-desktop {
    display: block;
    text-align: left;
  }

  .auth-panel__title--register-desktop {
    font-size: 2.25rem;
    margin-bottom: 8px;
  }

  .auth-panel__sub--register-desktop {
    margin-bottom: 28px;
    font-size: 0.9rem;
  }

  /* Desktop: hide mobile step UI, show all register fields */
  .auth-steps {
    display: none;
  }

  .auth-register-step#registerStep1,
  .auth-register-step#registerStep2 {
    display: grid !important;
    gap: 22px;
  }

  .auth-btn--next {
    display: none;
  }

  .auth-divider--register {
    display: none;
  }

  .auth-social--register {
    display: none;
  }

  .auth-view--login .auth-panel__title::before,
  .auth-view--register .auth-panel__title {
    content: none;
  }

  .auth-field__input {
    padding: 14px 16px;
    background: var(--bg-input);
    border: 1px solid var(--line);
    border-radius: 8px;
  }

  .auth-field__input:focus {
    border-color: var(--gold);
  }

  .auth-field__password .auth-field__input {
    padding-right: 48px;
  }
}

@media (max-width: 899px) {
  .auth-tabs--desktop,
  .auth-legal--desktop {
    display: none;
  }

  .auth-view--login {
    justify-content: center;
  }

  .auth-view--login .auth-panel {
    padding-top: 56px;
    padding-bottom: 40px;
  }

  .auth-view--register .auth-panel__title,
  .auth-view--register .auth-panel__sub {
    display: none;
  }

  .auth-divider:not(.auth-divider--register) {
    margin-top: 32px;
  }

  /* On mobile login view, hide register-only elements */
  .auth-view--login .auth-steps,
  .auth-view--login .auth-register-hero {
    display: none;
  }
}

/* Profile edit modal (used in cabinet) */
.account-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 20px;
}

.account-modal[hidden] {
  display: none !important;
}

.account-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgb(0 0 0 / 65%);
  backdrop-filter: blur(4px);
}

.account-modal__dialog {
  position: relative;
  width: min(100%, 480px);
  max-height: 90vh;
  overflow-y: auto;
  padding: 28px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 16px;
}

.account-modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.account-modal__head h2 {
  margin: 0;
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.5rem;
  font-weight: 500;
}

.account-modal__close {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: var(--fg-muted);
  font-size: 1.25rem;
  cursor: pointer;
}

.account-modal__close:hover {
  border-color: var(--gold);
  color: var(--gold);
}

.account-modal .auth-form {
  gap: 14px;
}

.account-modal .auth-field__input {
  padding: 12px 14px;
  background: var(--bg-input);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.account-modal__actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 8px;
}

.profile-edit-avatar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.profile-edit-avatar__preview {
  width: 96px;
  height: 96px;
  border-radius: 16px;
  overflow: hidden;
  border: 2px solid var(--gold);
  background: var(--bg-input);
}

.profile-edit-avatar__preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-edit-avatar__fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--gold);
}

.profile-edit-avatar__controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.profile-edit-avatar__pick {
  cursor: pointer;
}

.profile-edit-avatar__hint {
  margin: 0;
  font-size: 0.72rem;
  color: var(--fg-subtle);
  text-align: center;
}
