/* Вход, регистрация, переезд со старого сайта. Токены — из shop.css. */

.auth-page { padding: 2rem 0 3.5rem; }

.auth-layout {
  display: grid;
  grid-template-columns: minmax(0, 480px) minmax(0, 1fr);
  gap: 1.5rem;
  max-width: 1060px;
  margin: 0 auto;
}
.auth-layout--solo { grid-template-columns: minmax(0, 540px); justify-content: center; }

.auth-card {
  background: var(--card, #fff);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 1.6rem 1.75rem 1.5rem;
  min-width: 0;
}

/* —— переключатель Вход / Регистрация —— */
.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 4px;
  border-radius: 999px;
  background: var(--mist);
  margin-bottom: 1.35rem;
}
.auth-tabs__tab {
  text-align: center;
  padding: 0.6rem 0.75rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--muted);
  transition: background 0.2s var(--ease), color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.auth-tabs__tab:hover { color: var(--ink); }
.auth-tabs__tab.is-on {
  background: var(--card, #fff);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(16, 22, 26, 0.08), 0 4px 14px rgba(16, 22, 26, 0.06);
}

.auth-head h1 {
  font-family: var(--font-display);
  font-size: 1.7rem;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin: 0 0 0.4rem;
}
.auth-head p { margin: 0; color: var(--muted); }
.auth-head__badge {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: var(--jade-soft);
  color: var(--jade-deep);
  margin-bottom: 0.9rem;
}
.auth-head__badge svg { width: 24px; height: 24px; }

/* —— подсказки и сообщения —— */
.auth-note,
.auth-alert,
.auth-saved__row {
  display: flex;
  gap: 0.7rem;
  align-items: flex-start;
  border-radius: 14px;
  padding: 0.8rem 0.95rem;
  font-size: 0.92rem;
  line-height: 1.45;
}
.auth-note svg,
.auth-alert svg,
.auth-saved__row svg { width: 20px; height: 20px; flex: 0 0 20px; margin-top: 1px; }
.auth-note { margin-top: 1.1rem; background: var(--jade-soft); }
.auth-note svg { color: var(--jade-deep); }
.auth-alert { margin-top: 1rem; }
.auth-alert--error { background: rgba(194, 59, 107, 0.09); color: #8f244a; }
.auth-alert--ok { background: var(--jade-soft); }
.auth-saved { display: grid; gap: 0.5rem; margin-top: 1.1rem; }
.auth-saved__row { background: var(--mist); }
.auth-saved__row svg { color: var(--jade-deep); }

/* —— поля —— */
.auth-form { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.05rem; margin-top: 1.2rem; }
.auth-form > *, .pf, .pw { min-width: 0; }
.auth-input { min-width: 0; }
.pf__label {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 0.9rem;
  font-weight: 600;
}
.pf__req { color: var(--berry); }
.auth-optional { font-weight: 400; color: var(--muted); font-size: 0.84rem; margin-left: 0.2rem; }
.auth-field__hint { margin: 0.35rem 0 0; font-size: 0.84rem; color: var(--muted); }

.auth-input,
.pf__box {
  width: 100%;
  min-height: 52px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: var(--input-bg, var(--snow));
  color: var(--ink);
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.auth-input { padding: 0 0.95rem; font-size: 1rem; outline: none; }
.auth-input:focus,
.pf__box:focus-within {
  border-color: var(--jade);
  box-shadow: 0 0 0 4px rgba(42, 157, 143, 0.15);
}
.auth-input::placeholder,
.pf__input::placeholder { color: var(--muted); opacity: 0.6; }

.auth-who {
  min-height: 52px;
  display: flex;
  align-items: center;
  padding: 0 0.95rem;
  border-radius: 14px;
  background: var(--mist);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

/* —— телефон со страной —— */
.pf__box { position: relative; display: flex; align-items: stretch; }
.pf__country {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0 0.6rem 0 0.85rem;
  border: 0;
  border-right: 1px solid var(--line);
  border-radius: 13px 0 0 13px;
  background: transparent;
  color: var(--ink);
  font-weight: 600;
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: background 0.15s var(--ease);
}
.pf__country:hover,
.pf.is-open .pf__country { background: var(--mist); }
.pf__country:focus-visible { outline: 2px solid var(--jade); outline-offset: -2px; }
.pf__chev { width: 12px; height: 12px; color: var(--muted); transition: transform 0.2s var(--ease); }
.pf.is-open .pf__chev { transform: rotate(180deg); }
.pf.is-email .pf__country { display: none; }
.pf__input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  padding: 0 0.95rem;
  color: var(--ink);
  font-size: 1.06rem;
  letter-spacing: 0.01em;
  font-variant-numeric: tabular-nums;
  outline: none;
}
.pf__ok {
  display: flex;
  align-items: center;
  padding-right: 0.85rem;
  color: var(--jade);
  opacity: 0;
  transform: scale(0.6);
  transition: opacity 0.2s var(--ease), transform 0.25s var(--ease);
  pointer-events: none;
}
.pf__ok svg { width: 20px; height: 20px; }
.pf.is-ok .pf__ok { opacity: 1; transform: none; }
.pf__hint {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0.4rem 0 0;
  font-size: 0.86rem;
  color: var(--muted);
}
.pf__hint:empty { display: none; }
.pf.is-invalid .pf__box { border-color: #c23b6b; box-shadow: 0 0 0 4px rgba(194, 59, 107, 0.12); }
.pf.is-invalid .pf__hint { color: #a3305a; }
.pf.is-invalid .pf__box { animation: pf-shake 0.32s var(--ease); }
@keyframes pf-shake {
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

.pf__menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 40;
  padding: 0.5rem;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  background: var(--card, #fff);
  box-shadow: 0 24px 48px rgba(16, 22, 26, 0.16);
}
.pf__search-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0 0.7rem;
  margin-bottom: 0.35rem;
  border-radius: 10px;
  background: var(--mist);
  color: var(--muted);
}
.pf__search-wrap svg { width: 18px; height: 18px; flex: 0 0 18px; }
.pf__search {
  flex: 1;
  min-width: 0;
  padding: 0.6rem 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 1rem;
  outline: none;
}
.pf__list { list-style: none; margin: 0; padding: 0; max-height: 300px; overflow-y: auto; overscroll-behavior: contain; }
.pf__opt {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.6rem 0.65rem;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  font-size: 0.96rem;
  text-align: left;
  cursor: pointer;
}
.pf__opt:hover,
.pf__opt:focus-visible { background: var(--mist); outline: none; }
.pf__opt.is-on { background: var(--jade-soft); font-weight: 600; }
.pf__opt-dial { margin-left: auto; color: var(--muted); font-size: 0.9rem; font-variant-numeric: tabular-nums; }
.pf__sep { height: 1px; margin: 0.35rem 0.4rem; background: var(--line); }
.pf__empty { padding: 0.75rem; color: var(--muted); font-size: 0.9rem; }

/* —— флаги (CSS, чтобы одинаково выглядели и на Windows) —— */
.flag {
  display: inline-block;
  width: 22px;
  height: 16px;
  flex: 0 0 22px;
  border-radius: 3px;
  background-color: #dfe7e5;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
}
.flag--sm { width: 18px; height: 13px; flex-basis: 18px; border-radius: 2px; }
.flag--ru { background: linear-gradient(#fff 33.3%, #0039a6 33.3% 66.6%, #d52b1e 66.6%); }
.flag--kz { background: radial-gradient(circle at 50% 46%, #fec50c 0 21%, transparent 23%), #00afca; }
.flag--by { background: linear-gradient(90deg, #fff 0 9%, #c8313e 9% 13%, transparent 13%), linear-gradient(#c8313e 66.6%, #4aa657 66.6%); }
.flag--ab {
  background:
    linear-gradient(#c8102e, #c8102e) 0 0 / 44% 57% no-repeat,
    repeating-linear-gradient(#00843d 0 14.28%, #fff 14.28% 28.57%);
}
.flag--am { background: linear-gradient(#d90012 33.3%, #0033a0 33.3% 66.6%, #f2a800 66.6%); }
.flag--az { background: radial-gradient(circle at 46% 50%, #fff 0 12%, transparent 13%), linear-gradient(#00b5e2 33.3%, #ef3340 33.3% 66.6%, #509e2f 66.6%); }
.flag--ge {
  background:
    linear-gradient(90deg, transparent 43%, #e8112d 43% 57%, transparent 57%),
    linear-gradient(transparent 40%, #e8112d 40% 60%, transparent 60%),
    #fff;
}
.flag--kg { background: radial-gradient(circle, #ffef00 0 24%, transparent 26%), #e8112d; }
.flag--md { background: radial-gradient(ellipse 14% 22% at 50% 50%, #a0742d 0 70%, transparent 75%), linear-gradient(90deg, #0046ae 33.3%, #ffd200 33.3% 66.6%, #cc092f 66.6%); }
.flag--tj { background: radial-gradient(circle, #f8c300 0 9%, transparent 11%), linear-gradient(#cc0000 28.5%, #fff 28.5% 71.5%, #006600 71.5%); }
.flag--tm { background: linear-gradient(90deg, #00843d 0 14%, #d22630 14% 34%, #00843d 34%); }
.flag--uz { background: linear-gradient(#0099b5 31%, #ce1126 31% 35%, #fff 35% 65%, #ce1126 65% 69%, #1eb53a 69%); }
.flag--ua { background: linear-gradient(#0057b7 50%, #ffd700 50%); }
.flag--zz {
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 22 16'%3E%3Cg fill='none' stroke='%232a9d8f' stroke-width='1.2'%3E%3Ccircle cx='11' cy='8' r='5.6'/%3E%3Cpath d='M5.4 8h11.2M11 2.4c1.9 2 1.9 9.2 0 11.2M11 2.4c-1.9 2-1.9 9.2 0 11.2'/%3E%3C/g%3E%3C/svg%3E") center / contain no-repeat,
    var(--jade-soft);
}

/* —— пароль —— */
.pw { position: relative; }
.pw .auth-input { padding-right: 3.1rem; }
.pw__toggle {
  position: absolute;
  top: 50%;
  right: 0.35rem;
  transform: translateY(-50%);
  width: 2.6rem;
  height: 2.6rem;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.pw__toggle:hover { background: var(--mist); color: var(--ink); }
.pw__toggle:focus-visible { outline: 2px solid var(--jade); outline-offset: -2px; }
.pw__toggle svg { width: 22px; height: 22px; }
.pw__eye-off,
.pw__toggle[aria-pressed="true"] .pw__eye { display: none; }
.pw__toggle[aria-pressed="true"] .pw__eye-off { display: block; }

/* —— согласие —— */
.auth-consent {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  font-size: 0.87rem;
  line-height: 1.45;
  color: var(--muted);
  cursor: pointer;
}
.auth-consent a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 2px; }
.auth-consent input { position: absolute; opacity: 0; width: 20px; height: 20px; margin: 0; }
.auth-consent__box {
  flex: 0 0 20px;
  height: 20px;
  margin-top: 1px;
  display: grid;
  place-items: center;
  border: 1.5px solid var(--line-strong);
  border-radius: 6px;
  background: var(--input-bg, #fff);
  color: #fff;
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease);
}
.auth-consent__box svg { width: 14px; height: 14px; opacity: 0; transition: opacity 0.15s var(--ease); }
.auth-consent input:checked + .auth-consent__box { background: var(--jade); border-color: var(--jade); }
.auth-consent input:checked + .auth-consent__box svg { opacity: 1; }
.auth-consent input:focus-visible + .auth-consent__box { box-shadow: 0 0 0 4px rgba(42, 157, 143, 0.2); }

.auth-submit { width: 100%; min-height: 52px; font-size: 1.02rem; margin-top: 0.2rem; }
.auth-row { display: flex; justify-content: flex-end; margin-top: -0.5rem; }
.auth-link { font-size: 0.9rem; font-weight: 600; color: var(--jade-deep); }
.auth-link:hover { text-decoration: underline; }
.auth-foot { margin: 1.2rem 0 0; text-align: center; font-size: 0.92rem; color: var(--muted); }
.auth-foot a { color: var(--jade-deep); font-weight: 600; }
.auth-foot a:hover { text-decoration: underline; }

/* —— правая колонка —— */
.auth-aside {
  position: relative;
  display: flex;
  align-items: flex-end;
  min-height: 540px;
  border-radius: 24px;
  overflow: hidden;
  color: #f4fffc;
  background:
    linear-gradient(170deg, rgba(16, 22, 26, 0.12) 0%, rgba(16, 22, 26, 0.55) 45%, rgba(12, 32, 30, 0.92) 100%),
    url("/static/hero-yarn.jpg") center / cover;
}
.auth-aside__inner { padding: 2rem; }
.auth-aside__kicker {
  margin: 0 0 0.5rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--mint);
}
.auth-aside h2 {
  margin: 0 0 1.2rem;
  font-family: var(--font-display);
  font-size: 1.6rem;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: #fff;
}
.auth-perks { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.85rem; }
.auth-perks li { display: flex; gap: 0.8rem; align-items: center; font-size: 0.95rem; line-height: 1.4; color: rgba(244, 255, 252, 0.86); }
.auth-perks strong { color: #fff; }
.auth-perks__ico {
  flex: 0 0 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(6px);
}
.auth-perks__ico svg { width: 20px; height: 20px; }

@media (max-width: 900px) {
  .auth-layout { grid-template-columns: minmax(0, 1fr); max-width: 540px; }
  .auth-aside { min-height: 0; }
  .auth-aside__inner { padding: 1.5rem; }
  .auth-aside h2 { font-size: 1.3rem; }
}
@media (max-width: 520px) {
  .auth-page { padding: 0.75rem 0 2.5rem; }
  .auth-card { padding: 1.15rem 1rem 1.25rem; border-radius: 20px; }
  .auth-head h1 { font-size: 1.45rem; }
  .pf__country { padding: 0 0.45rem 0 0.7rem; }
  .pf__input { padding: 0 0.75rem; }
  .pf__list { max-height: 50vh; }
}

/* —— тёмная тема —— */
html[data-theme="dark"] .auth-tabs__tab.is-on { background: rgba(255, 255, 255, 0.09); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4); }
html[data-theme="dark"] .pf__ok { color: var(--jade-deep); }
html[data-theme="dark"] .auth-alert--error { background: rgba(240, 110, 130, 0.12); color: #f59a90; }
html[data-theme="dark"] .pf.is-invalid .pf__hint { color: #f59a90; }
html[data-theme="dark"] .pf__menu { box-shadow: 0 24px 48px rgba(0, 0, 0, 0.5); }
html[data-theme="dark"] .flag { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14); }

@media (prefers-reduced-motion: reduce) {
  .pf.is-invalid .pf__box { animation: none; }
}
