/* ==========================================================================
   AUTH UI (page-scoped)
   --------------------------------------------------------------------------
   Этот файл изолирует стили auth-страниц (login/register/reset/verify),
   чтобы не протекать в остальную систему.

   Ключевая идея:
   - визуальный язык синхронизирован с pages spaces/renters/rentCollection-fixed;
   - селекторы ограничены через .auth-scope;
   - layout одинаково устойчив на desktop/mobile.
   ========================================================================== */

.auth-scope {
  /* Локальные дизайн-токены auth-модуля:
     при необходимости быстро подменяем палитру без каскадных правок по всему файлу. */
  --auth-primary: #2563eb;
  --auth-primary-strong: #1d4ed8;
  --auth-primary-soft: #5b8def;
  --auth-text: #1f2a37;
  --auth-muted: #5f6b7a;
  --auth-border: #d7e1ee;
  --auth-surface: #ffffff;
  --auth-surface-soft: #f6f9fd;
  --auth-shadow: 0 12px 28px rgba(15, 23, 42, 0.12);
  max-width: 1120px;
  margin-left: auto;
  margin-right: auto;
  padding-bottom: 1.5rem;
}

/* ==========================================================================
   Общий каркас страницы
   ========================================================================== */

.auth-scope .auth-shell {
  /* Две колонки:
     - слева hero-интро;
     - справа карточка формы. */
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(420px, 1.2fr);
  gap: 1rem;
  align-items: stretch;
}

.auth-scope .auth-shell--single {
  /* Для reset/password/verify оставляем только карточку по центру. */
  grid-template-columns: minmax(320px, 560px);
  justify-content: center;
}

/* ==========================================================================
   Hero-блок (левая колонка на login)
   ========================================================================== */

.auth-scope .auth-hero {
  border: 1px solid var(--auth-border);
  border-radius: 16px;
  background:
    radial-gradient(circle at 8% 12%, rgba(37, 99, 235, 0.16) 0, transparent 45%),
    linear-gradient(180deg, #ffffff 0%, #f7fbff 100%);
  box-shadow: var(--auth-shadow);
  padding: 1.2rem 1.3rem;
}

.auth-scope .auth-hero__eyebrow {
  /* Небольшой брендовый badge в верхней части intro-блока. */
  margin: 0 0 0.5rem;
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  border: 1px solid rgba(37, 99, 235, 0.24);
  background: rgba(37, 99, 235, 0.08);
  color: var(--auth-primary-strong);
  font-size: 0.82rem;
  font-weight: 700;
}

.auth-scope .auth-hero__title {
  margin: 0;
  font-size: clamp(1.25rem, 2.1vw, 1.7rem);
  line-height: 1.22;
  color: var(--auth-text);
  font-weight: 800;
}

.auth-scope .auth-hero__text {
  margin: 0.7rem 0 0;
  color: var(--auth-muted);
  font-size: 0.95rem;
  line-height: 1.55;
}

/* ==========================================================================
   Карточка формы
   ========================================================================== */

.auth-scope .auth-card {
  border: 1px solid var(--auth-border) !important;
  border-radius: 16px !important;
  background: var(--auth-surface) !important;
  box-shadow: var(--auth-shadow) !important;
  overflow: hidden;
}

.auth-scope .auth-card--narrow {
  width: 100%;
}

.auth-scope .auth-card__header {
  /* Верхняя зона карточки с градиентной подложкой и заголовком. */
  padding: 1rem 1.25rem;
  background: linear-gradient(180deg, #f7faff 0%, #eef5ff 100%);
  border-bottom: 1px solid var(--auth-border);
}

.auth-scope .auth-card__title {
  margin: 0;
  color: var(--auth-text);
  font-size: 1.28rem;
  line-height: 1.2;
  font-weight: 800;
}

.auth-scope .auth-card__subtitle {
  margin: 0.4rem 0 0;
  color: var(--auth-muted);
  font-size: 0.93rem;
  line-height: 1.45;
}

.auth-scope .auth-card__body {
  padding: 1rem 1.25rem 1.2rem;
}

/* ==========================================================================
   Flash-сообщения
   ========================================================================== */

.auth-scope .auth-message {
  margin: 0 0 0.75rem;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 0.58rem 0.72rem;
  font-size: 0.9rem;
  line-height: 1.3;
  font-weight: 600;
}

.auth-scope .auth-message--error {
  color: #b91c1c;
  background: #fff1f2;
  border-color: #fecdd3;
}

.auth-scope .auth-message--success {
  color: #166534;
  background: #f0fdf4;
  border-color: #bbf7d0;
}

.auth-scope .auth-message--info {
  color: #1e3a8a;
  background: #eff6ff;
  border-color: #bfdbfe;
}

/* ==========================================================================
   Вкладки (Materialize tabs)
   ========================================================================== */

.auth-scope .auth-tabs {
  margin: 0 0 0.9rem !important;
  border: 1px solid var(--auth-border);
  border-radius: 12px;
  background: var(--auth-surface-soft);
  overflow: hidden;
}

.auth-scope .auth-tabs .tab {
  line-height: 44px;
  height: 44px;
}

.auth-scope .auth-tabs .tab a {
  color: #3f536d !important;
  font-weight: 700;
  font-size: 0.9rem;
  text-transform: none;
}

.auth-scope .auth-tabs .tab a.active {
  color: #ffffff !important;
  background: linear-gradient(180deg, var(--auth-primary) 0%, var(--auth-primary-strong) 100%);
}

.auth-scope .auth-tabs .indicator {
  /* Стандартную полоску Materialize выключаем:
     активное состояние уже видно через фон вкладки. */
  display: none;
}

.auth-scope .auth-tab-panel {
  margin-top: 0.2rem;
}

/* ==========================================================================
   Формы и поля
   ========================================================================== */

.auth-scope .auth-form {
  display: grid;
  gap: 0.55rem;
}

.auth-scope .auth-form .input-field {
  margin: 0.32rem 0 0.1rem;
}

.auth-scope .auth-form .input-field input {
  margin-bottom: 0 !important;
  border: 1px solid #c8d6e8 !important;
  border-radius: 10px !important;
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.86);
  padding: 0.6rem 0.75rem !important;
  height: 44px !important;
  box-sizing: border-box;
}

.auth-scope .auth-form .input-field input:focus {
  border-color: #7ca1d9 !important;
  box-shadow: 0 0 0 0.16rem rgba(37, 99, 235, 0.13) !important;
}

.auth-scope .auth-form .input-field label {
  color: #60748f !important;
  padding-left: 0.35rem;
}

.auth-scope .auth-form .input-field label.active {
  /* Корректируем поведение label при focus/value,
     чтобы подпись не накладывалась на текст инпута. */
  transform: translateY(-14px) scale(0.8) !important;
}

/* ==========================================================================
   Нижняя зона форм (ссылки + CTA)
   ========================================================================== */

.auth-scope .auth-form__footer {
  margin-top: 0.15rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.auth-scope .auth-form__footer--single {
  justify-content: flex-end;
}

.auth-scope .auth-link {
  color: #1f4b8f;
  font-weight: 700;
  font-size: 0.9rem;
  text-decoration: none;
}

.auth-scope .auth-link:hover,
.auth-scope .auth-link:focus {
  text-decoration: underline;
}

.auth-scope .auth-btn {
  border-radius: 10px !important;
  min-height: 40px;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 0.86rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: none !important;
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.24) !important;
}

.auth-scope .auth-btn--primary {
  color: #ffffff !important;
  background: linear-gradient(180deg, var(--auth-primary) 0%, var(--auth-primary-strong) 100%) !important;
  border-color: var(--auth-primary-strong) !important;
}

.auth-scope .auth-btn--primary:hover,
.auth-scope .auth-btn--primary:focus {
  color: #ffffff !important;
  filter: saturate(1.05);
}

/* ==========================================================================
   QR-блок на verify-странице
   ========================================================================== */

.auth-scope .auth-qr-box {
  margin-bottom: 0.85rem;
  border: 1px solid #bfdbfe;
  background: #eff6ff;
  border-radius: 14px;
  padding: 0.85rem;
}

.auth-scope .auth-qr-box__title {
  margin: 0;
  color: #1e3a8a;
  font-size: 0.95rem;
  font-weight: 800;
}

.auth-scope .auth-qr-box__text {
  margin: 0.35rem 0 0.7rem;
  color: #1e40af;
  font-size: 0.88rem;
  line-height: 1.42;
}

.auth-scope .auth-qr-box__image {
  display: block;
  width: min(210px, 100%);
  margin: 0 auto;
  border-radius: 10px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
}

.auth-scope .auth-otp {
  /* Контейнер видимого OTP-блока в verify-форме.
     Важно: token отправляется через hidden input #token, а эти поля отвечают только за UX. */
  margin: 0.1rem 0 1rem;
}

.auth-scope .auth-otp__label {
  /* Отдельный label, не привязанный к Materialize-анимации плавающих label,
     потому что для 6 отдельных ячеек она визуально перегружает форму. */
  display: block;
  margin-bottom: 0.55rem;
  color: #1e3a8a;
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.auth-scope .auth-otp__inputs {
  /* Фиксированная сетка из шести ячеек под 6-значный код. */
  display: grid;
  grid-template-columns: repeat(6, minmax(44px, 52px));
  justify-content: center;
  gap: 0.45rem;
}

.auth-scope .auth-otp__digit {
  /* Одна ячейка кода:
     - крупная цифра;
     - четкая рамка;
     - предсказуемый размер под touch-ввод на mobile. */
  height: 56px;
  width: 100%;
  /* Явную границу + outline задаем с !important,
     чтобы Materialize-стили инпутов не "съедали" рамку. */
  border: 2px solid #6f97cf !important;
  border-bottom: 2px solid #6f97cf !important;
  border-radius: 12px;
  outline: 2px solid rgba(111, 151, 207, 0.45);
  outline-offset: 0;
  background: #ffffff;
  color: #0f172a;
  font-size: 1.22rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.01em;
  text-align: center;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
  box-sizing: border-box;
}

.auth-scope .auth-otp__digit:focus {
  border-color: #1f5fb3 !important;
  border-bottom-color: #1f5fb3 !important;
  outline: 2px solid rgba(31, 95, 179, 0.65);
  box-shadow: 0 0 0 4px rgba(96, 165, 250, 0.22);
  transform: translateY(-1px);
}

.auth-scope .auth-otp__hint {
  /* Короткая подсказка о поведении auto-advance. */
  margin: 0.5rem 0 0;
  color: #5b6f8d;
  font-size: 0.78rem;
  line-height: 1.42;
}

.auth-scope .auth-form--verify #token {
  /* Служебное hidden-поле для backend:
     визуально не участвует в интерфейсе, хранит собранный 6-значный token перед submit. */
}

/* ==========================================================================
   Адаптивность
   ========================================================================== */

@media (max-width: 992px) {
  .auth-scope .auth-shell {
    grid-template-columns: 1fr;
  }

  .auth-scope .auth-hero {
    /* По новому UX-требованию hero-блок "Безпечний вхід"
       на мобильных/планшетах показываем выше формы аккаунта. */
    order: 1;
  }

  .auth-scope .auth-card {
    /* Форму авторизации оставляем второй, чтобы порядок был стабильным
       даже если в будущем кто-то поменяет DOM-последовательность блоков. */
    order: 2;
  }
}

@media (max-width: 768px) {
  .auth-scope {
    padding: 0 0.2rem 1rem;
  }

  .auth-scope .auth-card__header,
  .auth-scope .auth-card__body,
  .auth-scope .auth-hero {
    padding-left: 0.95rem;
    padding-right: 0.95rem;
  }

  .auth-scope .auth-tabs .tab {
    line-height: 42px;
    height: 42px;
  }

  .auth-scope .auth-form__footer {
    /* На mobile кнопки и ссылки складываем в колонку
       для удобного tap-интерактива. */
    flex-direction: column;
    align-items: stretch;
  }

  .auth-scope .auth-form__footer--single {
    align-items: stretch;
  }

  .auth-scope .auth-btn {
    width: 100%;
  }

  .auth-scope .auth-otp__inputs {
    grid-template-columns: repeat(6, minmax(38px, 44px));
    gap: 0.32rem;
  }

  .auth-scope .auth-otp__digit {
    height: 52px;
    font-size: 1.08rem;
    border-radius: 10px;
  }
}
