/* ==========================================
   AUTH.CSS — Страница входа и регистрации
   Итоговая версия
   ========================================== */

.auth-page {
  min-height: 100vh;
  display: flex;
  background: var(--bg-body);
}

/* ==========================================
   ЛЕВАЯ ЧАСТЬ — ДЕКОР
   ========================================== */
.auth-decor {
  flex: 1;
  background: linear-gradient(135deg, var(--primary), #e67e22, #f39c12);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 60px;
  color: #fff;
  position: relative;
  overflow: hidden;
}

.auth-decor::before {
  content: '';
  position: absolute;
  top: -20%;
  right: -20%;
  width: 500px;
  height: 500px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 50%;
}

.auth-decor::after {
  content: '';
  position: absolute;
  bottom: -15%;
  left: -10%;
  width: 400px;
  height: 400px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 50%;
}

.auth-decor__content {
  position: relative;
  z-index: 1;
  text-align: center;
  max-width: 420px;
}

.auth-decor__logo {
  font-size: 32px;
  font-weight: 800;
  margin-bottom: 24px;
}

.auth-decor__logo span {
  color: #fff;
}

.auth-decor h2 {
  font-size: 28px;
  font-weight: 800;
  margin-bottom: 16px;
  line-height: 1.3;
}

.auth-decor p {
  font-size: 15px;
  opacity: 0.9;
  line-height: 1.7;
  margin-bottom: 30px;
}

.auth-decor__features {
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth-decor__feature {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  font-weight: 600;
}

.auth-decor__feature i {
  width: 36px;
  height: 36px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

/* ==========================================
   ПРАВАЯ ЧАСТЬ — ФОРМА
   ========================================== */
.auth-form-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 40px;
  min-height: 100vh;
}

.auth-form-wrapper {
  width: 100%;
  max-width: 440px;
}

/* Мобильный логотип */
.auth-mobile-logo {
  display: none;
  text-align: center;
  margin-bottom: 24px;
}

.auth-mobile-logo a {
  font-size: 24px;
  font-weight: 800;
  text-decoration: none;
}

/* Заголовок формы */
.auth-form-header {
  margin-bottom: 28px;
}

.auth-form-header h1 {
  font-size: 28px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.auth-form-header p {
  font-size: 14px;
  color: var(--text-muted);
}

.auth-form-header p a {
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
}

.auth-form-header p a:hover {
  text-decoration: underline;
}

/* ==========================================
   ТАБЫ
   ========================================== */
.auth-tabs {
  display: flex;
  background: var(--bg-gray);
  border-radius: var(--radius-sm);
  padding: 4px;
  margin-bottom: 24px;
}

.auth-tab {
  flex: 1;
  padding: 10px;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  border-radius: 6px;
  transition: var(--transition-fast);
  border: none;
  background: transparent;
  cursor: pointer;
}

.auth-tab:hover {
  color: var(--text-secondary);
}

.auth-tab.active {
  background: var(--bg-white);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

/* ==========================================
   ФОРМЫ
   ========================================== */
.auth-form {
  display: none;
}

.auth-form.active {
  display: block;
  animation: authFadeIn 0.25s ease;
}

@keyframes authFadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==========================================
   ПОЛЯ ФОРМЫ
   ========================================== */
.auth-field {
  margin-bottom: 18px;
}

.auth-field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.auth-field label .required {
  color: var(--primary);
}

.auth-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.auth-input-wrap > i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-light);
  font-size: 14px;
  pointer-events: none;
  z-index: 1;
  transition: color 0.2s;
}

.auth-input {
  width: 100%;
  padding: 12px 14px 12px 42px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg-white);
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
  font-family: inherit;
}

.auth-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.08);
}

.auth-input:focus + i,
.auth-input-wrap:focus-within > i {
  color: var(--primary);
}

.auth-input.error {
  border-color: var(--primary);
}

.auth-input.success {
  border-color: var(--success);
}

/* Для полей с кнопкой "глаз" — отступ справа */
.auth-input-wrap .auth-input {
  padding-right: 44px;
}

/* ==========================================
   КНОПКА ПОКАЗАТЬ / СКРЫТЬ ПАРОЛЬ
   ========================================== */
.auth-toggle-pass {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-light);
  font-size: 15px;
  cursor: pointer;
  padding: 4px;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.auth-toggle-pass:hover {
  color: var(--primary);
}

/* ==========================================
   ОШИБКИ ВАЛИДАЦИИ
   ========================================== */
.auth-field-error {
  font-size: 12px;
  color: var(--primary);
  margin-top: 4px;
  display: none;
}

.auth-field-error.visible {
  display: block;
}

/* ==========================================
   СЛОЖНОСТЬ ПАРОЛЯ
   ========================================== */
.password-strength {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

.password-strength__bar {
  flex: 1;
  height: 6px;
  background: #e2e8f0;
  border-radius: 3px;
  transition: background 0.3s ease;
}

.password-strength__bar.weak {
  background: #ef4444;
}

.password-strength__bar.medium {
  background: #f59e0b;
}

.password-strength__bar.good {
  background: #3b82f6;
}

.password-strength__bar.strong {
  background: #10b981;
}

.password-strength__text {
  font-size: 12px;
  font-weight: 600;
  margin-top: 4px;
  min-height: 18px;
}

.password-strength__text.weak {
  color: #ef4444;
}

.password-strength__text.medium {
  color: #f59e0b;
}

.password-strength__text.good {
  color: #3b82f6;
}

.password-strength__text.strong {
  color: #10b981;
}

/* ==========================================
   СОВПАДЕНИЕ ПАРОЛЕЙ
   ========================================== */
.password-match-text {
  font-size: 12px;
  font-weight: 600;
  margin-top: 6px;
  display: none;
  align-items: center;
  gap: 6px;
}

.password-match-text.match {
  display: flex;
  color: #10b981;
}

.password-match-text.mismatch {
  display: flex;
  color: #ef4444;
}

/* ==========================================
   ЧЕКБОКС СОГЛАСИЯ
   ========================================== */
.auth-checkbox {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 8px 0 18px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}

.auth-checkbox input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 0;
  height: 0;
}

/* Кастомный квадрат */
.auth-checkbox__box {
  width: 18px;
  height: 18px;
  min-width: 18px;
  margin-top: 1px;
  border: 2px solid var(--border);
  border-radius: 4px;
  background: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.auth-checkbox input[type="checkbox"]:checked + .auth-checkbox__box {
  background: var(--primary);
  border-color: var(--primary);
}

.auth-checkbox input[type="checkbox"]:checked + .auth-checkbox__box::after {
  content: '';
  width: 5px;
  height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) translateY(-1px);
}

.auth-checkbox input[type="checkbox"]:focus-visible + .auth-checkbox__box {
  box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.15);
}

.auth-checkbox__text {
  display: block;
  flex: 1;
  min-width: 0;
  white-space: normal;
  word-break: normal;
  overflow-wrap: break-word;
}

.auth-checkbox__text a {
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.auth-checkbox__text a:hover {
  text-decoration: underline;
}

.auth-checkbox--terms {
  align-items: flex-start;
}

/* Старый вариант (если где-то остался) */
.auth-checkbox input[type="checkbox"]:not(+ .auth-checkbox__box) {
  position: static;
  opacity: 1;
  pointer-events: auto;
  width: 18px;
  height: 18px;
  min-width: 18px;
  margin-top: 1px;
  accent-color: var(--primary);
  cursor: pointer;
  flex-shrink: 0;
}

/* ==========================================
   СТРОКА «ЗАПОМНИТЬ / ЗАБЫЛИ ПАРОЛЬ»
   ========================================== */
.auth-forgot-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
  gap: 12px;
  flex-wrap: wrap;
}

.auth-forgot-row .auth-checkbox {
  margin: 0;
  align-items: center;
}

.auth-forgot-link {
  font-size: 13px;
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.auth-forgot-link:hover {
  text-decoration: underline;
}

/* ==========================================
   КНОПКА ОТПРАВКИ
   ========================================== */
.auth-submit {
  width: 100%;
  padding: 14px;
  background: var(--primary);
  color: #fff;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 20px;
  transition: var(--transition);
  border: none;
  cursor: pointer;
  font-family: inherit;
}

.auth-submit:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(231, 76, 60, 0.3);
}

.auth-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.auth-submit .spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: authSpin 0.6s linear infinite;
  display: none;
}

.auth-submit.loading .spinner {
  display: block;
}

.auth-submit.loading .btn-text {
  display: none;
}

@keyframes authSpin {
  to {
    transform: rotate(360deg);
  }
}

/* ==========================================
   РАЗДЕЛИТЕЛЬ
   ========================================== */
.auth-divider {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.auth-divider span {
  font-size: 12px;
  color: var(--text-light);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ==========================================
   СОЦСЕТИ
   ========================================== */
.auth-social {
  display: flex;
  gap: 10px;
  margin-bottom: 24px;
}

.auth-social-btn {
  flex: 1;
  padding: 12px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: var(--transition-fast);
  background: var(--bg-white);
  cursor: pointer;
  font-family: inherit;
}

.auth-social-btn:hover {
  border-color: var(--text-light);
  background: var(--bg-gray);
}

.auth-social-btn.google i {
  color: #ea4335;
  font-size: 18px;
}

.auth-social-btn.vk i {
  color: #0077ff;
  font-size: 18px;
}

.auth-social-btn.yandex i {
  color: #fc3f1d;
  font-size: 18px;
}

/* ==========================================
   ВЫБОР РОЛИ
   ========================================== */
.auth-role-selector {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 18px;
}

.auth-role-option {
  position: relative;
}

.auth-role-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.auth-role-option label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 12px;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition-fast);
  text-align: center;
  margin: 0;
}

.auth-role-option label:hover {
  border-color: var(--text-light);
}

.auth-role-option input:checked + label {
  border-color: var(--primary);
  background: var(--primary-light);
}

.auth-role-option label i {
  font-size: 24px;
  color: var(--text-muted);
}

.auth-role-option input:checked + label i {
  color: var(--primary);
}

.auth-role-option label strong {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

.auth-role-option label span {
  font-size: 11px;
  color: var(--text-muted);
}

/* ==========================================
   ГЛОБАЛЬНОЕ СООБЩЕНИЕ
   ========================================== */
.auth-message {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 18px;
  display: none;
  align-items: center;
  gap: 8px;
}

.auth-message.visible {
  display: flex;
}

.auth-message.success {
  background: #e8f5e9;
  color: #2e7d32;
  border: 1px solid #a5d6a7;
}

.auth-message.error {
  background: var(--primary-light);
  color: var(--primary-dark);
  border: 1px solid #f5c6cb;
}

/* ==========================================
   ССЫЛКА «НА ГЛАВНУЮ»
   ========================================== */
.auth-back {
  text-align: center;
  margin-top: 16px;
}

.auth-back a {
  font-size: 13px;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
}

.auth-back a:hover {
  color: var(--primary);
}

/* ==========================================
   ВОССТАНОВЛЕНИЕ ПАРОЛЯ
   ========================================== */
.auth-recovery {
  display: none;
}

.auth-recovery.active {
  display: block;
  animation: authFadeIn 0.25s ease;
}

.auth-recovery__icon {
  width: 72px;
  height: 72px;
  background: var(--primary-light);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  font-size: 30px;
  color: var(--primary);
}

/* ==========================================
   АДАПТИВ
   ========================================== */
@media (max-width: 900px) {
  .auth-decor {
    display: none;
  }

  .auth-mobile-logo {
    display: block;
  }

  .auth-form-section {
    padding: 24px;
  }
}

@media (max-width: 480px) {
  .auth-form-wrapper {
    max-width: 100%;
  }

  .auth-form-header h1 {
    font-size: 24px;
  }

  .auth-social {
    flex-direction: column;
  }

  .auth-role-selector {
    grid-template-columns: 1fr;
  }

  .auth-forgot-row {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 380px) {
  .auth-checkbox__text a {
    white-space: normal;
  }
}