/* =============================================================
   auth.css — Sistema visual premium das telas de auth público
   Sprint 5.1 (revisado 28/Abr/2026 noite)

   Aplicado em: painel (login), esqueci_senha, novasenha, confirm_email.

   Layout:
   - Mobile (<1024px): card centralizado com sombra, fundo cinza claro
   - Desktop (>=1024px): split layout — painel preto à esquerda
     (logo branca + texto institucional + créditos), form à direita
     em fundo branco

   FIX bug Sprint 5.1 v1: tokens light fixos dentro de .auth-page para
   ignorar dark theme global default. Inputs ficaram invisíveis porque
   --color-border default (rgba branca) não contrastava com fundo branco.
   ============================================================= */

/* === Tokens light fixos (auth público sempre light, ignora toggle) === */
.auth-page {
  --color-bg-primary: #FFFFFF;
  --color-bg-elevated: #FAFAFA;
  --color-bg-surface: #FFFFFF;
  --color-text-primary: #000000;
  --color-text-on-light: #000000;
  --color-text-muted: rgba(0, 0, 0, 0.62);
  --color-text-subtle: rgba(0, 0, 0, 0.42);
  --color-border: rgba(0, 0, 0, 0.10);
  --color-border-strong: rgba(0, 0, 0, 0.20);
  --color-surface-hover: rgba(0, 0, 0, 0.04);
  --color-surface-active: rgba(0, 0, 0, 0.08);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08), 0 2px 4px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 24px 64px rgba(0, 0, 0, 0.10), 0 4px 16px rgba(0, 0, 0, 0.04);
}

/* === Layout principal === */
.auth-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr;
  background-color: #F5F5F7;
  color: var(--color-text-on-light);
  font-family: var(--font-family-base);
  font-size: var(--font-size-body);
  line-height: var(--line-height-normal);
}

/* === Brand panel (visível só em desktop) === */
.auth-brand {
  display: none;
}

/* === Form panel (sempre visível) === */
.auth-form-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6) var(--space-4);
  min-height: 100vh;
}

/* === Card === */
.auth-card {
  position: relative;
  width: 100%;
  max-width: 440px;
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
  background-color: #FFFFFF;
  border-radius: 16px;
  padding: var(--space-12) var(--space-8);
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.12), 0 6px 18px rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(0, 0, 0, 0.05);
  overflow: hidden;
  animation: auth-fade-in 0.5s cubic-bezier(0.25, 0.1, 0.25, 1);
}

/* fina faixa dourada no topo do card (mobile) */
.auth-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--color-accent-primary-dark, #8C6F3D), var(--color-accent-primary, #C9A961) 50%, var(--color-accent-primary-light, #E8D2A0));
}

@keyframes auth-fade-in {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* === Logo do card (aparece em mobile; some em desktop pra não duplicar com brand panel) === */
.auth-logo {
  display: block;
  width: 100%;
  max-width: 220px;
  height: auto;
  margin: 0 auto;
}

/* === Cabeçalho === */
.auth-header {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.auth-title {
  font-family: var(--font-family-bold), Helvetica, Arial, sans-serif;
  font-size: 28px;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0;
  color: #000000;
}

.auth-subtitle {
  font-size: 15px;
  color: rgba(0, 0, 0, 0.62);
  margin: 0;
  line-height: 1.5;
}

/* === Form === */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  margin: 0;
}

/* Form field */
.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-field label {
  font-family: var(--font-family-demi), Helvetica, Arial, sans-serif;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(0, 0, 0, 0.62);
}

.form-field input {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  background-color: #FAFAF7;
  color: #000000;
  border: 1px solid rgba(0, 0, 0, 0.10);
  border-radius: 12px;
  padding: 15px 16px;
  font-family: var(--font-family-base), Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  transition:
    border-color 200ms cubic-bezier(0.25, 0.1, 0.25, 1),
    box-shadow 200ms cubic-bezier(0.25, 0.1, 0.25, 1),
    background-color 200ms cubic-bezier(0.25, 0.1, 0.25, 1);
}

.form-field input::placeholder {
  color: rgba(0, 0, 0, 0.36);
}

.form-field input:hover:not(:disabled) {
  border-color: rgba(0, 0, 0, 0.22);
  background-color: #FFFFFF;
}

.form-field input:focus,
.form-field input:focus-visible {
  outline: none;
  border-color: var(--color-accent-primary);
  background-color: #FFFFFF;
  box-shadow: 0 0 0 3px rgba(201, 169, 97, 0.18);
}

.form-field input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background-color: rgba(0, 0, 0, 0.02);
}

.form-field--invalid input {
  border-color: #CE5B5B;
  background-color: rgba(206, 91, 91, 0.03);
}

/* Autofill */
.form-field input:-webkit-autofill {
  -webkit-box-shadow: 0 0 0 1000px #FFFFFF inset !important;
  -webkit-text-fill-color: #000000 !important;
  caret-color: #000000;
}

/* === Password input com toggle visibilidade === */
.password-input {
  position: relative;
}

.password-input input {
  padding-right: 48px;
}

.password-input__toggle {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  cursor: pointer;
  border-radius: var(--radius-sm);
  padding: 0;
  color: rgba(0, 0, 0, 0.45);
  transition: color 150ms ease, background 150ms ease;
}

.password-input__toggle:hover {
  color: rgba(0, 0, 0, 0.78);
  background: rgba(0, 0, 0, 0.04);
}

.password-input__toggle:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(174, 255, 0, 0.45);
}

.password-input__toggle i,
.password-input__toggle svg {
  width: 18px;
  height: 18px;
}

/* Mostra eye quando aria-pressed=false (senha oculta), eye-off quando true */
.password-input__toggle .password-input__icon-off { display: none; }
.password-input__toggle[aria-pressed="true"] .password-input__icon-on { display: none; }
.password-input__toggle[aria-pressed="true"] .password-input__icon-off { display: inline-flex; }

/* Dark context (telas internas via app-shell--data) */
.app-shell--data .password-input__toggle {
  color: var(--color-text-subtle);
}
.app-shell--data .password-input__toggle:hover {
  color: var(--color-text-primary);
  background: rgba(255, 255, 255, 0.06);
}

/* === Alertas === */
.auth-alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 10px;
  font-size: 14px;
  line-height: 1.5;
}

.auth-alert i,
.auth-alert svg {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  margin-top: 2px;
}

.auth-alert--error {
  background-color: rgba(206, 91, 91, 0.08);
  color: #8c2828;
  border: 1px solid rgba(206, 91, 91, 0.32);
}

.auth-alert--success {
  background-color: rgba(174, 255, 0, 0.10);
  color: #4a6e00;
  border: 1px solid rgba(174, 255, 0, 0.40);
}

.auth-alert--info {
  background-color: rgba(0, 0, 0, 0.04);
  color: #000000;
  border: 1px solid rgba(0, 0, 0, 0.10);
}

/* === Rodapé === */
.auth-footer {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding-top: var(--space-6);
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.auth-link {
  font-family: var(--font-family-base), Helvetica, Arial, sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: rgba(0, 0, 0, 0.72);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 8px;
  transition:
    color 200ms cubic-bezier(0.25, 0.1, 0.25, 1),
    background-color 200ms cubic-bezier(0.25, 0.1, 0.25, 1);
}

.auth-link i,
.auth-link svg {
  width: 16px;
  height: 16px;
}

.auth-link:hover {
  color: #000000;
  background-color: rgba(0, 0, 0, 0.04);
}

.auth-link:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(174, 255, 0, 0.30);
}

/* === Sobrescreve .btn--primary do globals.css quando dentro de .auth-page ===
   Em modo light, a borda dourada-escura fica meio invisível;
   subimos pra um border-radius mais consistente com o resto da UI. */
.auth-page .btn--primary {
  position: relative;
  overflow: hidden;
  font-size: 16px;
  padding: 15px 24px;
  border-radius: 12px;
  letter-spacing: 0.01em;
  gap: 8px;
  /* dourado com leve brilho + sombra dourada */
  background: linear-gradient(135deg, var(--color-accent-primary-light, #E8D2A0), var(--color-accent-primary) 45%, var(--color-accent-primary-dark, #8C6F3D));
  border: none;
  color: #1a1408;
  box-shadow: 0 6px 18px rgba(201, 169, 97, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  transition: box-shadow 200ms ease, transform 200ms ease, filter 200ms ease;
}

/* reflexo diagonal que atravessa o botao no hover (shine de cartao metalico) */
.auth-page .btn--primary::after {
  content: '';
  position: absolute;
  top: 0;
  left: -70%;
  width: 45%;
  height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.5), transparent);
  transform: skewX(-18deg);
  transition: left 0.6s cubic-bezier(0.25, 0.1, 0.25, 1);
  pointer-events: none;
}

.auth-page .btn--primary > * {
  position: relative;
  z-index: 1;
}

.auth-page .btn--primary:hover:not([disabled]) {
  filter: brightness(1.04);
  box-shadow: 0 10px 26px rgba(201, 169, 97, 0.40), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  transform: translateY(-1px);
}

.auth-page .btn--primary:hover:not([disabled])::after {
  left: 130%;
}

.auth-page .btn--primary:active:not([disabled]) {
  transform: translateY(0);
  box-shadow: 0 4px 12px rgba(201, 169, 97, 0.30);
}

.auth-page .btn i,
.auth-page .btn svg {
  width: 18px;
  height: 18px;
  transition: transform 200ms cubic-bezier(0.25, 0.1, 0.25, 1);
}

.auth-page .btn:hover:not([disabled]) i,
.auth-page .btn:hover:not([disabled]) svg {
  transform: translateX(2px);
}

/* ==============================================================
   DESKTOP PREMIUM (>= 1024px) — Split Layout
   ============================================================== */
@media (min-width: 1024px) {
  .auth-page {
    grid-template-columns: 5fr 6fr;
    height: 100vh;           /* trava exatamente na viewport */
    max-height: 100vh;
    overflow: hidden;        /* seguro: conteudo e' centralizado e compacto */
  }

  /* cada painel ocupa a viewport inteira, conteudo centrado dentro */
  .auth-brand,
  .auth-form-wrap {
    height: 100vh;
    min-height: 0;
  }

  /* === Brand panel (esquerda — preto premium) === */
  .auth-brand {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 26px;
    padding: 40px 56px;
    color: #FFFFFF;
    position: relative;
    overflow: hidden;
    /* fundo premium: preto quente + halos dourados + vinheta de profundidade */
    background:
      radial-gradient(130% 110% at 100% 0%, rgba(201, 169, 97, 0.18) 0%, rgba(201, 169, 97, 0) 48%),
      radial-gradient(115% 120% at 8% 92%, rgba(201, 169, 97, 0.09) 0%, rgba(201, 169, 97, 0) 44%),
      radial-gradient(100% 100% at 50% 50%, transparent 55%, rgba(0, 0, 0, 0.55) 100%),
      linear-gradient(158deg, #14110c 0%, #000000 50%, #0a0906 100%);
    /* costura dourada sutil na divisa com o form */
    box-shadow: inset -1px 0 0 rgba(201, 169, 97, 0.20);
  }

  /* Logo fixo no topo, footer fixo na base — o conteudo central nunca corta */
  .auth-brand__logo {
    position: absolute;
    top: 40px;
    left: 56px;
  }
  .auth-brand__footer { position: absolute; bottom: 40px; left: 56px; z-index: 1; }

  /* Monogram N como marca d'agua sutil (mesma linguagem do card do perfil) */
  .auth-brand__watermark {
    position: absolute;
    right: -80px;
    bottom: -70px;
    height: 400px;
    width: auto;
    opacity: 0.04;
    pointer-events: none;
    z-index: 0;
  }

  /* Aura dourada que "respira" devagar (movimento sutil = vida premium) */
  .auth-brand__aura {
    position: absolute;
    top: -18%;
    right: -12%;
    width: 620px;
    height: 620px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(201, 169, 97, 0.16) 0%, rgba(201, 169, 97, 0) 62%);
    pointer-events: none;
    z-index: 0;
    animation: auth-aura 9s ease-in-out infinite;
  }
  @keyframes auth-aura {
    0%, 100% { opacity: 0.65; transform: scale(1); }
    50%      { opacity: 1;    transform: scale(1.08); }
  }

  /* Grão fino sobre o preto — acabamento de material (tira o "digital chapado") */
  .auth-brand::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    opacity: 0.05;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  }

  @media (prefers-reduced-motion: reduce) {
    .auth-brand__aura { animation: none; }
  }

  /* Fina linha dourada no topo do painel */
  .auth-brand::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--color-accent-primary) 30%, var(--color-accent-primary-light, #E8D2A0) 50%, var(--color-accent-primary) 70%, transparent);
    opacity: 0.85;
    z-index: 2;
  }

  /* conteudo (logo/content/footer) acima das camadas decorativas (aura/grao/N).
     NAO usar `.auth-brand > *` (pegaria os decorativos e quebraria o absolute). */
  .auth-brand__logo {
    width: 168px;
    height: auto;
    display: block;
    z-index: 1;
    animation: auth-brand-in 0.7s 0.05s both cubic-bezier(0.2, 0.7, 0.2, 1);
  }

  .auth-brand__content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-width: 480px;
    animation: auth-brand-in 0.7s 0.16s both cubic-bezier(0.2, 0.7, 0.2, 1);
  }

  /* Sobrancelha dourada editorial acima do titulo */
  .auth-brand__eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-family-demi), Helvetica, Arial, sans-serif;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: var(--color-accent-primary);
  }
  .auth-brand__eyebrow::before {
    content: '';
    width: 26px;
    height: 1px;
    background: linear-gradient(90deg, var(--color-accent-primary), transparent);
  }

  .auth-brand__title {
    font-family: var(--font-family-bold), Helvetica, Arial, sans-serif;
    font-size: 32px;
    line-height: 1.1;
    letter-spacing: -0.02em;
    margin: 0;
    color: #FFFFFF;
  }

  .auth-brand__title-accent {
    /* gradiente dourado no texto de destaque */
    background: linear-gradient(92deg, var(--color-accent-primary), var(--color-accent-primary-light, #E8D2A0));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: var(--color-accent-primary);
  }

  .auth-brand__text {
    font-size: 15px;
    line-height: 1.55;
    color: rgba(255, 255, 255, 0.66);
    margin: 0;
    max-width: 400px;
  }

  /* Feature highlights — dá corpo e sofisticação ao painel */
  .auth-brand__features {
    list-style: none;
    margin: 4px 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  .auth-brand__feature {
    display: flex;
    align-items: center;
    gap: 13px;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.86);
    animation: auth-brand-in 0.6s both cubic-bezier(0.2, 0.7, 0.2, 1);
  }
  .auth-brand__feature:nth-child(1) { animation-delay: 0.30s; }
  .auth-brand__feature:nth-child(2) { animation-delay: 0.38s; }
  .auth-brand__feature:nth-child(3) { animation-delay: 0.46s; }

  .auth-brand__feature-icon {
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(140deg, rgba(232, 210, 160, 0.22), rgba(201, 169, 97, 0.06));
    border: 1px solid rgba(201, 169, 97, 0.32);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
    color: var(--color-accent-primary);
  }

  .auth-brand__feature-icon i,
  .auth-brand__feature-icon svg {
    width: 17px;
    height: 17px;
  }

  .auth-brand__footer {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 12.5px;
    color: rgba(255, 255, 255, 0.50);
    margin: 0;
    padding-top: 14px;
    animation: auth-brand-in 0.7s 0.28s both cubic-bezier(0.2, 0.7, 0.2, 1);
  }

  .auth-brand__separator {
    width: 1px;
    height: 14px;
    background-color: rgba(255, 255, 255, 0.20);
  }

  @keyframes auth-brand-in {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
  }

  /* === Form panel (direita — branco) === */
  .auth-form-wrap {
    background-color: #FFFFFF;
    padding: 56px;
  }

  /* Card no desktop fica "chapado" — sem borda/sombra duplicada */
  .auth-card {
    box-shadow: none;
    border: none;
    background-color: transparent;
    max-width: 480px;
    padding: 0;
    overflow: visible;
    animation: none;
  }
  .auth-card::before { display: none; }  /* faixa dourada só no card mobile */

  /* Logo do card some — fica só no brand panel */
  .auth-card .auth-logo {
    display: none;
  }

  /* Header alinhado à esquerda no desktop (fica mais editorial) */
  .auth-header {
    text-align: left;
    gap: var(--space-3);
  }

  .auth-title {
    font-size: 32px;
  }

  .auth-subtitle {
    font-size: 16px;
  }

  /* Footer alinhado à esquerda também */
  .auth-footer {
    text-align: left;
    align-items: flex-start;
  }

  .auth-link {
    align-self: flex-start;
    padding-left: 0;
    padding-right: 12px;
  }
}

/* === Tela ampla (>= 1440px) — extra breathing room === */
@media (min-width: 1440px) {
  .auth-brand {
    padding: 60px 72px;
  }

  .auth-brand__title {
    font-size: 38px;
  }

  .auth-form-wrap {
    padding: 72px;
  }
}
