/* ==========================================================================
   Ratio Legis — telas de autenticação (login, primeiro acesso, 2FA, bloqueio,
   acesso negado e usuário inválido).

   POR QUE ESTE ARQUIVO É GLOBAL (e não CSS isolado por componente):
   o CSS isolado do Blazor NÃO atravessa a fronteira de componentes — as regras
   escritas em `AccountLayout.razor.css` só alcançam o markup do próprio layout.
   Como o cartão e os campos vivem nas PÁGINAS, o "kit" precisa estar numa folha
   global. O escopo, aqui, é por convenção de nome: só as telas de autenticação
   usam as classes `.auth*` (todas com a moldura AccountLayout), e as regras
   vivem sempre dentro de `.auth-shell`.

   Os tokens de MARCA (--gold-500, --ivory, --line) vêm do landing.css. Os de
   SUPERFÍCIE CLARA (--surface, --surface-soft) vivem no panel.css, escopados em
   `body:has(.sidebar)`, que não existe aqui — por isso a moldura declara os seus.
   ========================================================================== */

.auth-shell {
  /* Superfícies claras do cartão (mesmos valores do painel). */
  --auth-surface: #ffffff;
  --auth-surface-soft: #fdfbf6;
  --auth-ink: #1f1d1a;
  --auth-ink-soft: #6f6a61;
  --auth-ink-mute: #5c574f;
  --auth-line: #e8e1d3;

  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: clamp(1.5rem, 5vw, 3rem);
  background-color: var(--ink-900, #08080a);
  background-image: radial-gradient(
    120% 80% at 85% -10%,
    rgba(201, 162, 39, 0.1),
    rgba(8, 8, 10, 0) 60%);
  color: var(--ivory, #f6f2e9);
  font-family: var(--font-body, 'Inter', system-ui, sans-serif);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* O login usa um grid de duas colunas dentro da moldura. */
.auth {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(2rem, 5vw, 5rem);
  align-items: center;
  width: 100%;
  max-width: 1180px;
  min-height: 100%;
}

@media (min-width: 992px) {
  .auth {
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  }
}

/* ==========================================================================
   Cartão
   ========================================================================== */

.auth__card {
  width: 100%;
  max-width: 460px;
  margin-inline: auto;
  padding: clamp(1.5rem, 4vw, 2.25rem);
  border: 1px solid var(--auth-line);
  border-radius: 10px;
  background-color: var(--auth-surface);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  color: var(--auth-ink);
}

.auth__card--wide {
  max-width: 500px;
}

.auth__brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1.5rem;
  color: var(--auth-ink);
  text-decoration: none;
}

.auth__brand:hover {
  color: var(--auth-ink);
}

/* O escudo da marca é um SVG inline (mesma linguagem dos ícones do menu):
   não depende de requisição de arquivo nem de resolução de caminho, que é
   justamente onde a marca quebrava nas telas de autenticação. */
.auth__brand-mark {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  color: var(--gold-500);
}

.auth__brand-name {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 600;
  line-height: 1;
}

.auth__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 600;
  line-height: 1.1;
  color: var(--auth-ink);
}

.auth__title--danger {
  color: #8f1e17;
}

.auth__lead {
  margin: 0.35rem 0 1.5rem;
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--auth-ink-soft);
}

.auth__step {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--auth-ink-soft);
}

/* ==========================================================================
   Campos
   ========================================================================== */

.auth__field {
  position: relative;
  margin-bottom: 1rem;
}

.auth__field .form-control {
  height: 3.6rem;
  padding: 1.4rem 0.9rem 0.5rem;
  border: 1px solid var(--auth-line);
  border-radius: 4px;
  background-color: var(--auth-surface-soft);
  color: var(--auth-ink);
  font-size: 0.95rem;
}

.auth__field .form-control::placeholder {
  color: var(--auth-ink-soft);
}

.auth__field .form-control:focus {
  border-color: var(--gold-500);
  background-color: var(--auth-surface);
  color: var(--auth-ink);
  box-shadow: 0 0 0 0.2rem rgba(201, 162, 39, 0.22);
}

/* Rótulo flutuante: sobe quando o campo recebe foco ou já tem valor. */
.auth__field .form-label {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 2;
  height: 100%;
  padding: 1rem 0.9rem;
  color: var(--auth-ink-soft);
  font-size: 0.95rem;
  pointer-events: none;
  transform-origin: 0 0;
  transition: transform 0.15s ease, color 0.15s ease;
}

.auth__field .form-control:focus ~ .form-label,
.auth__field .form-control:not(:placeholder-shown) ~ .form-label {
  transform: scale(0.78) translateY(-0.6rem);
  color: var(--gold-700);
}

/* ==========================================================================
   Mensagens
   ========================================================================== */

.auth__validation {
  display: block;
  margin-top: 0.3rem;
  color: var(--danger, #d9737a);
  font-size: 0.82rem;
}

.auth__validation:empty {
  display: none;
}

/* A faixa de status do Identity. O texto é escuro de propósito: o cartão é
   claro, e herdar o marfim da moldura deixava a mensagem ilegível. */
.auth__card .alert {
  margin-bottom: 1.25rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--auth-line);
  border-left: 3px solid var(--auth-line);
  border-radius: 4px;
  background-color: var(--auth-surface-soft);
  color: var(--auth-ink);
  font-size: 0.88rem;
  line-height: 1.5;
}

.auth__card .alert-danger {
  border-color: #f0d5d2;
  border-left-color: var(--danger, #d9737a);
  background-color: #fdf1f0;
  color: #7d1a15;
}

.auth__card .alert-success {
  border-color: #d5e9dd;
  border-left-color: #1f7a4d;
  background-color: #eef7f1;
  color: #14563a;
}

.auth__card .alert-warning {
  border-color: #ece1bf;
  border-left-color: var(--gold-500);
  background-color: #fdf8e9;
  color: #6b5310;
}

/* ==========================================================================
   Lembrar-me e ação principal
   ========================================================================== */

.auth__remember {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin: 1.1rem 0 1.4rem;
  color: var(--auth-ink-mute);
  font-size: 0.9rem;
  cursor: pointer;
}

.auth__remember .form-check-input {
  flex: 0 0 auto;
  width: 1.05rem;
  height: 1.05rem;
  margin: 0;
  border: 1px solid var(--auth-line);
  background-color: var(--auth-surface);
}

.auth__remember .form-check-input:checked {
  border-color: var(--gold-500);
  background-color: var(--gold-500);
}

.auth__remember .form-check-input:focus {
  border-color: var(--gold-500);
  box-shadow: 0 0 0 0.2rem rgba(201, 162, 39, 0.22);
}

.auth__submit {
  width: 100%;
  padding: 0.8rem 1.2rem;
  border: 1px solid var(--gold-500);
  border-radius: 4px;
  background-color: var(--gold-500);
  color: var(--auth-ink);
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.auth__submit:hover,
.auth__submit:focus-visible {
  background-color: var(--gold-300);
  border-color: var(--gold-300);
  color: var(--auth-ink);
  transform: translateY(-1px);
}

.auth__submit:focus-visible {
  outline: 2px solid var(--gold-300);
  outline-offset: 2px;
}

/* ==========================================================================
   Apoio e navegação de saída
   ========================================================================== */

.auth__help {
  margin: 1.1rem 0 0;
  color: var(--auth-ink-soft);
  font-size: 0.85rem;
  line-height: 1.5;
}

.auth__help strong {
  color: var(--auth-ink);
  font-weight: 600;
}

.auth__help a {
  color: var(--gold-700);
  text-decoration: none;
}

.auth__help a:hover {
  color: var(--gold-500);
  text-decoration: underline;
}

.auth__links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.25rem;
  margin-top: 1.6rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--auth-line);
}

.auth__links a {
  color: var(--gold-700);
  font-size: 0.85rem;
  text-decoration: none;
}

.auth__links a:hover {
  color: var(--gold-500);
  text-decoration: underline;
}

/* Ação de saída apresentada como link (ex.: "entrar com outra conta"): precisa
   parecer link, mesmo sendo um POST com antiforgery. */
.auth__link-button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--gold-700);
  font-family: var(--font-body);
  font-size: 0.85rem;
  cursor: pointer;
}

.auth__link-button:hover,
.auth__link-button:focus-visible {
  color: var(--gold-500);
  text-decoration: underline;
}

/* ==========================================================================
   Painel de marca do login (esquerda, só em telas largas)
   ========================================================================== */

.auth__brand-col {
  display: none;
}

@media (min-width: 992px) {
  .auth__brand-col {
    display: block;
    padding-left: clamp(0rem, 3vw, 3rem);
    border-left: 1px solid var(--line);
  }
}

.auth__brand-logo {
  width: min(280px, 70%);
  height: auto;
}

.auth__brand-tagline {
  margin: 1.2rem 0 0;
  color: var(--ivory-dim, #b9b3a6);
  font-size: 1rem;
  line-height: 1.6;
}

.auth__brand-list {
  margin: 2rem 0 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line);
}

.auth__brand-list li {
  position: relative;
  padding: 1rem 0 1rem 1.6rem;
  border-bottom: 1px solid var(--line);
  color: var(--ivory, #f6f2e9);
  font-size: 0.95rem;
  line-height: 1.55;
}

.auth__brand-list li::before {
  content: "";
  position: absolute;
  top: 1.55rem;
  left: 0;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--gold-500);
}

/* ==========================================================================
   Telas estreitas
   ========================================================================== */

@media (max-width: 575.98px) {
  .auth-shell {
    align-items: flex-start;
    padding: 1.25rem 1rem 2.5rem;
  }

  .auth__card,
  .auth__card--wide {
    max-width: none;
    padding: 1.4rem 1.2rem;
  }

  .auth__title {
    font-size: 1.75rem;
  }
}
