/* =============================================================
   BreveIA — auth.css
   Estilos específicos das páginas de autenticação:
   /entrar, /cadastrar, /recuperar-senha
   ============================================================= */

/* ---------- LAYOUT GERAL ---------- */
.breveia-auth {
  min-height: calc(100vh - var(--header-h));
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--fundo);
}

/* Hero (lado esquerdo decorativo) */
.breveia-auth__hero {
  position: relative;
  background:
    radial-gradient(circle at 20% 30%, rgba(212,166,60,0.18), transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(59,130,246,0.10), transparent 50%),
    var(--azul);
  padding: var(--sp-12) var(--sp-10);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: #fff;
  overflow: hidden;
}

.breveia-auth__hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(
      45deg,
      transparent 0,
      transparent 60px,
      rgba(255,255,255,0.02) 60px,
      rgba(255,255,255,0.02) 61px
    );
  pointer-events: none;
}

.breveia-auth__hero-eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  color: var(--dourado);
  text-transform: uppercase;
  position: relative;
  z-index: 1;
}

.breveia-auth__hero-title {
  font-size: clamp(1.75rem, 3vw, 2.5rem);
  line-height: 1.15;
  font-weight: 800;
  letter-spacing: -0.025em;
  color: #fff;
  margin: var(--sp-4) 0 var(--sp-5);
  position: relative;
  z-index: 1;
}

.breveia-auth__hero-title-accent {
  color: var(--dourado);
}

.breveia-auth__hero-lead {
  font-size: 1rem;
  color: rgba(255, 255, 255, 0.75);
  line-height: 1.55;
  max-width: 420px;
  position: relative;
  z-index: 1;
}

.breveia-auth__hero-features {
  list-style: none;
  padding: 0;
  margin: var(--sp-8) 0 0;
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  position: relative;
  z-index: 1;
}
.breveia-auth__hero-features li {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  font-size: 14px;
  color: rgba(255, 255, 255, 0.85);
}
.breveia-auth__hero-features li::before {
  content: '';
  width: 18px; height: 18px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--dourado);
  /* checkmark via mask */
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='%23000' d='M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z'/></svg>") center / 12px no-repeat;
          mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='%23000' d='M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z'/></svg>") center / 12px no-repeat;
}

.breveia-auth__hero-meta {
  position: relative;
  z-index: 1;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.15em;
  color: rgba(255, 255, 255, 0.5);
}

/* Form (lado direito) */
.breveia-auth__form-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-12) var(--sp-8);
}

.breveia-auth__form {
  width: 100%;
  max-width: 420px;
}

.breveia-auth__title {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  margin-bottom: var(--sp-2);
  color: var(--azul);
}

.breveia-auth__subtitle {
  color: var(--texto-secundario);
  margin-bottom: var(--sp-6);
  font-size: 14px;
}

/* ---------- LINHAS UTILITÁRIAS DO FORM ---------- */
.breveia-auth__row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-3);
}

.breveia-auth__inline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: var(--sp-2) 0 var(--sp-5);
  font-size: 13px;
}
.breveia-auth__inline a { color: var(--azul); font-weight: 500; }
.breveia-auth__inline a:hover { color: var(--dourado); }

.breveia-auth__separator {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin: var(--sp-5) 0;
  color: var(--texto-secundario);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.breveia-auth__separator::before,
.breveia-auth__separator::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--borda-leve);
}

.breveia-auth__cta-secondary {
  text-align: center;
  margin-top: var(--sp-5);
  font-size: 14px;
  color: var(--texto-secundario);
}
.breveia-auth__cta-secondary a {
  font-weight: 600;
  color: var(--azul);
}

/* ---------- CHECKBOX (REMEMBER + TERMOS) ---------- */
.breveia-checkbox {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-2);
  cursor: pointer;
  user-select: none;
  font-size: 13px;
  color: var(--texto-secundario);
  line-height: 1.4;
}
.breveia-checkbox input { display: none; }
.breveia-checkbox__mark {
  width: 18px; height: 18px;
  border: 1.5px solid var(--borda);
  border-radius: 4px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--superficie);
  transition: all var(--transition);
  margin-top: 1px;
}
.breveia-checkbox input:checked + .breveia-checkbox__mark {
  background: var(--azul);
  border-color: var(--azul);
}
.breveia-checkbox input:checked + .breveia-checkbox__mark::after {
  content: '';
  width: 10px; height: 10px;
  background: #fff;
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='%23000' d='M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z'/></svg>") center / contain no-repeat;
          mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='%23000' d='M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z'/></svg>") center / contain no-repeat;
}

/* ---------- FORÇA DA SENHA ---------- */
.password-strength {
  display: flex;
  gap: 4px;
  margin-top: var(--sp-2);
}
.password-strength__bar {
  flex: 1;
  height: 4px;
  background: var(--borda-leve);
  border-radius: var(--r-pill);
  transition: background var(--transition);
}
.password-strength--1 .password-strength__bar:nth-child(-n+1) { background: var(--vermelho); }
.password-strength--2 .password-strength__bar:nth-child(-n+2) { background: var(--laranja); }
.password-strength--3 .password-strength__bar:nth-child(-n+3) { background: var(--dourado); }
.password-strength--4 .password-strength__bar:nth-child(-n+4) { background: var(--verde); }
.password-strength__label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-top: var(--sp-1);
  color: var(--texto-secundario);
}

/* ---------- STEPPER (CADASTRO 3 PASSOS) ---------- */
.stepper {
  display: flex;
  align-items: center;
  margin-bottom: var(--sp-6);
  gap: var(--sp-2);
}
.stepper__item {
  flex: 1;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: 12px;
  font-weight: 600;
  color: var(--texto-secundario);
}
.stepper__num {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--borda-leve);
  color: var(--texto-secundario);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
  flex-shrink: 0;
  transition: all var(--transition);
}
.stepper__item.active .stepper__num {
  background: var(--azul);
  color: #fff;
}
.stepper__item.completed .stepper__num {
  background: var(--dourado);
  color: var(--azul-escuro);
}
.stepper__item.completed .stepper__num::after {
  content: '';
  width: 12px; height: 12px;
  background: var(--azul-escuro);
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='%23000' d='M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z'/></svg>") center / contain no-repeat;
          mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='%23000' d='M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z'/></svg>") center / contain no-repeat;
  position: absolute;
}
.stepper__item.completed .stepper__num { position: relative; }
.stepper__item.completed .stepper__num span { display: none; }

.stepper__label {
  white-space: nowrap;
}
.stepper__item.active .stepper__label,
.stepper__item.completed .stepper__label { color: var(--texto); }

.stepper__line {
  flex: 1;
  height: 2px;
  background: var(--borda-leve);
  border-radius: var(--r-pill);
}
.stepper__item.completed + .stepper__line { background: var(--dourado); }

/* Step panel (com transição) */
.step-panel {
  display: none;
  animation: step-fade-in 280ms ease-out;
}
.step-panel.active { display: block; }
@keyframes step-fade-in {
  from { opacity: 0; transform: translateX(8px); }
  to   { opacity: 1; transform: translateX(0); }
}

.step-actions {
  display: flex;
  gap: var(--sp-3);
  margin-top: var(--sp-6);
}
.step-actions .btn { flex: 1; }
.step-actions .btn--ghost { flex: 0 0 auto; }

/* ---------- ALERTAS DE FORMULÁRIO ---------- */
.form-alert {
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-md);
  font-size: 13px;
  margin-bottom: var(--sp-4);
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  line-height: 1.4;
}
.form-alert--error {
  background: var(--vermelho-claro);
  color: var(--vermelho-escuro);
  border-left: 3px solid var(--vermelho);
}
.form-alert--success {
  background: var(--verde-claro);
  color: var(--verde-escuro);
  border-left: 3px solid var(--verde);
}
.form-alert--info {
  background: var(--azul-fundo);
  color: var(--azul);
  border-left: 3px solid var(--azul-claro);
}

.form-alert__icon {
  flex-shrink: 0;
  margin-top: 1px;
}

/* ---------- MULTI-SELECT (CHIPS) ---------- */
.chips-select {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}
.chip-select {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--borda);
  border-radius: var(--r-pill);
  font-size: 13px;
  font-weight: 500;
  color: var(--texto-secundario);
  background: var(--superficie);
  cursor: pointer;
  transition: all var(--transition);
  user-select: none;
}
.chip-select:hover {
  border-color: var(--azul-claro);
  color: var(--azul);
}
.chip-select input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.chip-select.active,
.chip-select:has(input:checked) {
  background: var(--azul-fundo);
  border-color: var(--azul-claro);
  color: var(--azul);
  font-weight: 600;
}

/* ---------- LOADING (botão durante submit) ---------- */
.btn--loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}
.btn--loading::after {
  content: '';
  position: absolute;
  width: 16px; height: 16px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: btn-spin 600ms linear infinite;
  color: #fff;
}
@keyframes btn-spin { to { transform: rotate(360deg); } }

/* ---------- RESPONSIVO ---------- */
@media (max-width: 900px) {
  .breveia-auth { grid-template-columns: 1fr; }
  .breveia-auth__hero {
    padding: var(--sp-8) var(--sp-6);
    min-height: 280px;
  }
  .breveia-auth__hero-features { display: none; }
  .breveia-auth__hero-meta { display: none; }
}

@media (max-width: 480px) {
  .breveia-auth__row { grid-template-columns: 1fr; }
  .stepper__label { display: none; }
}

/* ============================================================
   TYPEWRITER ANIMADO (Nível 2 — login + cadastro)
   Palavra-chave dentro do título troca ciclicamente, com efeito
   de digitação + pequeno glitch no momento da troca.
   Respeita prefers-reduced-motion.
   ============================================================ */

.breveia-typewriter {
  display: inline-flex;
  align-items: baseline;
  position: relative;
  vertical-align: baseline;
  white-space: nowrap;
}

.breveia-typewriter__text {
  display: inline-block;
  color: var(--dourado);
  background: linear-gradient(135deg, var(--dourado) 0%, var(--dourado-claro) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: inherit;
  letter-spacing: -0.02em;
  position: relative;
  min-width: 0.5em;
  /* contém o "saltinho" entre palavras de tamanhos muito diferentes */
  transition: filter 120ms ease;
}

/* Glitch sutil no momento da troca de palavra */
.breveia-typewriter__text.is-glitch {
  animation: tw-glitch 220ms steps(2, end);
}

@keyframes tw-glitch {
  0%   { transform: translate(0,0);   filter: blur(0); opacity: 1; }
  20%  { transform: translate(1px,-1px); filter: blur(0.4px); opacity: 0.85; }
  40%  { transform: translate(-1px,1px); filter: blur(0); opacity: 0.65; }
  60%  { transform: translate(1px,0);  filter: blur(0.5px); opacity: 0.85; }
  100% { transform: translate(0,0);   filter: blur(0); opacity: 1; }
}

.breveia-typewriter__caret {
  display: inline-block;
  margin-left: 2px;
  width: 2px;
  font-weight: 100;
  color: var(--dourado);
  animation: tw-caret 1s steps(2, end) infinite;
  -webkit-text-fill-color: var(--dourado);
}

@keyframes tw-caret {
  0%, 50%   { opacity: 1; }
  51%, 100% { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .breveia-typewriter__text { animation: none !important; transition: none !important; }
  .breveia-typewriter__caret { animation: none; opacity: 1; }
}
