/* ============================================================
   ILLUXIS — AUTH (login + register)
   Единый файл: TOKENS + BASE + PAGE
   Методология: BEM
   ============================================================ */

:root {
  --bg: #070810;
  --bg-2: #0a0b14;
  --paper: #0e1019;
  --paper-2: #131624;

  --line: rgba(255, 255, 255, .07);
  --line-2: rgba(255, 255, 255, .12);
  --line-3: rgba(255, 255, 255, .20);

  --fg: #eef0f7;
  --fg-dim: #8f94a8;
  --fg-mute: #5a5f75;
  --fg-faint: #2c3040;

  --accent: #6366f1;
  --accent-2: #8b5cf6;
  --accent-3: #a5b4fc;
  --accent-soft: rgba(99, 102, 241, .14);
  --accent-line: rgba(99, 102, 241, .35);
  --accent-glow: rgba(99, 102, 241, .55);
  --grad: linear-gradient(135deg, #6366f1 0%, #8b5cf6 55%, #7c3aed 100%);

  --red: #f87171;
  --green: #34d399;
  --amber: #fbbf24;

  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --mono: 'JetBrains Mono', 'SF Mono', Menlo, Consolas, monospace;

  --fs-xs: 11.5px;
  --fs-sm: 13px;
  --fs-base: 14.5px;

  --r-sm: 8px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-pill: 999px;

  --ease: cubic-bezier(.4, 0, .2, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --dur: 240ms;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes riseBig {
  from {
    opacity: 0;
    transform: translateY(24px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes rotate {
  to {
    transform: rotate(360deg);
  }
}

@keyframes aurora1 {

  0%,
  100% {
    transform: translate(0, 0) scale(1);
    opacity: .9;
  }

  33% {
    transform: translate(4%, -3%) scale(1.15);
    opacity: 1;
  }

  66% {
    transform: translate(-3%, 4%) scale(1.08);
    opacity: .8;
  }
}

@keyframes aurora2 {

  0%,
  100% {
    transform: translate(0, 0) scale(1);
    opacity: .8;
  }

  50% {
    transform: translate(-5%, 5%) scale(1.2);
    opacity: 1;
  }
}

@keyframes shake {

  0%,
  100% {
    transform: translateX(0);
  }

  25% {
    transform: translateX(-5px);
  }

  75% {
    transform: translateX(5px);
  }
}

@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}

/* ============================================================
   BASE
   ============================================================ */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body,
h1,
h2,
h3,
p,
ul,
ol,
li {
  margin: 0;
  padding: 0;
}

ul,
ol {
  list-style: none;
}

html {
  -webkit-text-size-adjust: 100%;
}
[hidden] {
  display: none !important;
}
body {
  font-family: var(--font);
  font-size: var(--fs-base);
  line-height: 1.5;
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

body::before {
  content: '';
  position: fixed;
  inset: -25%;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 800px 600px at 30% 20%, rgba(99, 102, 241, .30), transparent 55%),
    radial-gradient(ellipse 700px 550px at 70% 35%, rgba(139, 92, 246, .22), transparent 55%),
    radial-gradient(ellipse 900px 700px at 50% 90%, rgba(79, 70, 229, .18), transparent 60%);
  animation: aurora1 22s var(--ease) infinite;
  filter: blur(20px);
}



img,
svg {
  display: block;
  max-width: 100%;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  background: none;
  border: none;
}

a {
  color: inherit;
  text-decoration: none;
}

h1,
h2 {
  font-family: var(--font);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.03em;
  color: var(--fg);
}

/* Кнопки */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 22px;
  border-radius: var(--r-md);
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  border: 1px solid transparent;
  transition:
    transform var(--dur) var(--ease),
    box-shadow var(--dur) var(--ease),
    background var(--dur) var(--ease);
}

.btn--block {
  display: flex;
  width: 100%;
}

.btn--lg {
  padding: 15px 24px;
  font-size: 15px;
  border-radius: 12px;
}

.btn--primary {
  background: var(--grad);
  color: #fff;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .25),
    inset 0 -1px 0 rgba(0, 0, 0, .15),
    0 1px 2px rgba(0, 0, 0, .4),
    0 6px 18px -6px rgba(99, 102, 241, .6);
}

.btn--primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .3),
    0 10px 26px -8px rgba(99, 102, 241, .75);
}

.btn--primary:active {
  transform: translateY(0);
}

.btn:disabled,
.btn--loading {
  opacity: .6;
  pointer-events: none;
  cursor: not-allowed;
}

.btn--loading::after {
  content: '';
  width: 13px;
  height: 13px;
  border: 2px solid rgba(255, 255, 255, .35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: rotate .7s linear infinite;
  margin-left: 4px;
}


.header__brand-mark {
  width: 180px;
  height: 60px;
  flex-shrink: 0;
  object-fit: cover;
}

/* ============================================================
   AUTH PAGE
   ============================================================ */

.auth {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
}

.auth__top {
  width: 100%;
  max-width: 520px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 20px;
  animation: rise .5s var(--ease-out) both;
}

.auth__brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 700;
  font-size: 15.5px;
  letter-spacing: -0.025em;
}

.auth__brand-mark {
  width: 180px;
  height: 40px;
  flex-shrink: 0;
  object-fit: cover;
  display: block;
}

@media (max-width: 768px){
  .auth__brand-mark {
      width: 140px;
    }
}


/* Панель формы */
.auth__panel {
  width: 100%;
  max-width: 520px;
  background: var(--paper);
  border: 1px solid var(--line-2);
  border-radius: var(--r-lg);
  padding: 28px 32px 24px;
  box-shadow:
    0 1px 2px rgba(0, 0, 0, .4),
    0 20px 56px -20px rgba(0, 0, 0, .7),
    0 0 0 1px rgba(99, 102, 241, .06);
  position: relative;
  animation: riseBig .55s var(--ease-out) .05s both;
}

.auth__head {
  text-align: center;
  margin-bottom: 22px;
}

.auth__title {
  font-size: 22px;
  line-height: 1.2;
  letter-spacing: -0.03em;
  font-weight: 600;
  margin-bottom: 6px;
}

.auth__subtitle {
  color: var(--fg-dim);
  font-size: 13.5px;
  line-height: 1.45;
  max-width: 40ch;
  margin: 0 auto;
}

/* Алерт */
.auth__alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  font-size: 13.5px;
  line-height: 1.45;
  margin-bottom: 16px;
  border: 1px solid;
  animation: rise .3s var(--ease-out) both;
}

.auth__alert--error {
  color: #fca5a5;
  background: rgba(248, 113, 113, .08);
  border-color: rgba(248, 113, 113, .28);
}

.auth__alert--success {
  color: #6ee7b7;
  background: rgba(52, 211, 153, .08);
  border-color: rgba(52, 211, 153, .28);
}

.auth__alert-icon {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  margin-top: 2px;
}

.auth__alert--error .auth__alert-icon {
  background: rgba(248, 113, 113, .2);
  color: #fca5a5;
}

.auth__alert--success .auth__alert-icon {
  background: rgba(52, 211, 153, .2);
  color: #6ee7b7;
}

/* Поля — компактнее */
.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
  position: relative;
}

.field__label {
  font-size: 12.5px;
  color: var(--fg-dim);
  font-weight: 500;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding-left: 2px;
}

.field__hint {
  font-size: 11px;
  color: var(--fg-mute);
  font-family: var(--mono);
  font-weight: 400;
}

.field__wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.field__icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--fg-mute);
  pointer-events: none;
  transition: color var(--dur) var(--ease);
}

.field__wrap:focus-within .field__icon {
  color: var(--accent-2);
}

.field__input,
.field__select {
  width: 100%;
  padding: 11px 14px 11px 38px;
  background: var(--paper-2);
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  font-size: 14px;
  color: var(--fg);
  transition:
    border-color var(--dur) var(--ease),
    background var(--dur) var(--ease),
    box-shadow var(--dur) var(--ease);
}

.field__input:focus,
.field__select:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--paper);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

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

.field__input--error,
.field__select--error {
  border-color: rgba(248, 113, 113, .55);
  box-shadow: 0 0 0 3px rgba(248, 113, 113, .12);
  animation: shake .3s var(--ease);
}

.field__error {
  font-size: 12px;
  color: var(--red);
  line-height: 1.35;
  padding-left: 2px;
  display: none;
}

.field__error:not(:empty) {
  display: block;
}

.field__select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--fg-dim) 50%),
    linear-gradient(135deg, var(--fg-dim) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 50%,
    calc(100% - 13px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 38px;
  cursor: pointer;
}

.field__select option {
  background: var(--paper-2);
  color: var(--fg);
}

/* Toggle пароля */
.field__toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--fg-mute);
  transition: color var(--dur) var(--ease), background var(--dur) var(--ease);
}

.field__toggle:hover {
  color: var(--fg);
  background: rgba(255, 255, 255, .05);
}

.field__input--password {
  padding-right: 42px;
}

/* Пароль + подтверждение — в одну строку на десктопе */
.auth__row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 520px) {
  .auth__row {
    grid-template-columns: 1fr;
    gap: 0;
  }
}

/* Индикатор сложности пароля */
.pw-strength {
  display: flex;
  gap: 3px;
  margin-top: 4px;
  padding-left: 2px;
}

.pw-strength__bar {
  height: 2.5px;
  flex: 1;
  background: var(--line-2);
  border-radius: 2px;
  transition: background var(--dur) var(--ease);
}

.pw-strength--weak .pw-strength__bar:nth-child(1) {
  background: #f87171;
}

.pw-strength--fair .pw-strength__bar:nth-child(-n+2) {
  background: var(--amber);
}

.pw-strength--good .pw-strength__bar:nth-child(-n+3) {
  background: #60a5fa;
}

.pw-strength--strong .pw-strength__bar {
  background: var(--green);
}

.pw-strength__label {
  font-size: 11px;
  color: var(--fg-mute);
  font-family: var(--mono);
  margin-top: 3px;
  padding-left: 2px;
  line-height: 1.2;
}

/* Строка «запомнить + забыли» */
.auth__row-inline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 6px 0 16px;
  font-size: 13.5px;
}

.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  color: var(--fg-dim);
  user-select: none;
}

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

.checkbox__box {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: 1.5px solid var(--line-3);
  background: var(--paper-2);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
  flex-shrink: 0;
}

.checkbox__box::after {
  content: '';
  width: 9px;
  height: 5px;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(-45deg) scale(0);
  transform-origin: center;
  transition: transform var(--dur) var(--ease-out);
  margin-top: -2px;
}

.checkbox input:checked+.checkbox__box {
  background: var(--accent);
  border-color: var(--accent);
}

.checkbox input:checked+.checkbox__box::after {
  transform: rotate(-45deg) scale(1);
}

.checkbox input:focus-visible+.checkbox__box {
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.auth__forgot {
  color: var(--fg-dim);
  font-size: 13.5px;
  transition: color var(--dur) var(--ease);
}

.auth__forgot:hover {
  color: var(--accent-3);
}

/* Terms под кнопкой */
.auth__terms {
  font-size: 12px;
  color: var(--fg-mute);
  text-align: center;
  line-height: 1.5;
  margin-top: 14px;
}

.auth__terms a {
  color: var(--fg-dim);
  text-decoration: underline;
  text-decoration-color: var(--line-3);
  text-underline-offset: 2px;
  transition: color var(--dur) var(--ease), text-decoration-color var(--dur) var(--ease);
}

.auth__terms a:hover {
  color: var(--accent-3);
  text-decoration-color: var(--accent-2);
}

/* Футер под панелью */
.auth__bottom {
  width: 100%;
  max-width: 520px;
  text-align: center;
  font-size: 13px;
  color: var(--fg-mute);
  margin-top: 18px;
  animation: rise .5s var(--ease-out) .15s both;
}

.auth__bottom a {
  color: var(--accent-3);
  font-weight: 500;
  transition: color var(--dur) var(--ease);
}

.auth__bottom a:hover {
  color: var(--accent-2);
}

/* Мобильная адаптация */
@media (max-width: 520px) {
  .auth {
    padding: 20px 14px;
    justify-content: center;
    padding-top: 32px;
  }

  .auth__panel {
    padding: 22px 20px 18px;
    border-radius: var(--r-md);
  }

  .auth__title {
    font-size: 20px;
  }

  .auth__top {
    margin-bottom: 16px;
  }

  .auth__brand {
    font-size: 15px;
  }

  .auth__switch {
    font-size: 12.5px;
  }

  .auth__head {
    margin-bottom: 18px;
  }
}