/* ==========================================================================
   auth.css — visual compartilhado das telas de autenticação
   Usado por: login.html (entrar na área do cliente), recuperar.html (chave)
   Depende dos tokens de styles.css (--cyan, --z*, --grad, --ff-*).
   ========================================================================== */

/* ---------- Página ---------- */
.auth-page {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 132px 20px 72px;
}

.auth-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  background-image: radial-gradient(rgba(255,255,255,0.04) 1px, transparent 1px);
  background-size: 34px 34px;
  -webkit-mask-image: radial-gradient(ellipse 65% 55% at 50% 42%, #000 25%, transparent 75%);
  mask-image: radial-gradient(ellipse 65% 55% at 50% 42%, #000 25%, transparent 75%);
}
.auth-bg::before,
.auth-bg::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
}
.auth-bg::before {
  width: 540px; height: 540px;
  top: -190px; left: 50%;
  transform: translateX(-55%);
  background: radial-gradient(circle, rgba(103,246,255,0.18), transparent 70%);
}
.auth-bg::after {
  width: 580px; height: 580px;
  bottom: -260px; right: -140px;
  background: radial-gradient(circle, rgba(168,85,247,0.15), transparent 70%);
}

.auth-shell { position: relative; z-index: 1; width: 100%; max-width: 452px; }

/* ---------- Card ---------- */
.auth-card {
  position: relative;
  background: linear-gradient(180deg, rgba(255,255,255,0.045), rgba(255,255,255,0.012));
  border: 1px solid var(--z800);
  border-radius: 22px;
  padding: 34px 32px 30px;
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  box-shadow: 0 30px 70px -28px rgba(0,0,0,0.9), inset 0 1px 0 rgba(255,255,255,0.05);
  overflow: hidden;
}
/* fio de luz no topo do card */
.auth-card::before {
  content: '';
  position: absolute;
  top: 0; left: 18%; right: 18%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(103,246,255,0.55), transparent);
}

/* ---------- Indicador de etapas ---------- */
.auth-steps { display: flex; justify-content: center; gap: 6px; margin-bottom: 26px; }
.auth-step {
  height: 3px; width: 26px;
  border-radius: 999px;
  background: var(--z800);
  transition: background 0.3s ease, width 0.3s ease;
}
.auth-step.is-active { width: 40px; background: var(--grad); }
.auth-step.is-done { background: rgba(103,246,255,0.42); }

/* ---------- Cabeçalho ---------- */
.auth-head { text-align: center; }
.auth-badge {
  width: 54px; height: 54px;
  margin: 0 auto 16px;
  border-radius: 17px;
  display: grid; place-items: center;
  color: var(--cyan);
  background: rgba(103,246,255,0.08);
  border: 1px solid rgba(103,246,255,0.20);
  box-shadow: 0 0 26px -6px rgba(103,246,255,0.35);
}
.auth-badge.is-danger {
  color: #F87171;
  background: rgba(239,68,68,0.08);
  border-color: rgba(239,68,68,0.22);
  box-shadow: 0 0 26px -6px rgba(239,68,68,0.3);
}
.auth-card h1 {
  font-size: clamp(21px, 2.6vw, 25px);
  line-height: 1.25;
  letter-spacing: -0.02em;
  margin: 0 0 8px;
}
.auth-sub {
  font-size: 14px;
  line-height: 1.6;
  color: var(--z400);
  margin: 0 auto;
  max-width: 34ch;
}

/* ---------- Formulário ---------- */
.auth-form { display: grid; gap: 14px; margin-top: 26px; text-align: left; }
.field { display: grid; gap: 8px; }
.field-label {
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--z500);
}
.input-wrap { position: relative; display: block; }
.input-icon {
  position: absolute;
  left: 15px; top: 50%;
  transform: translateY(-50%);
  color: var(--z500);
  pointer-events: none;
  transition: color 0.18s ease;
}
.input {
  width: 100%;
  height: 52px;
  box-sizing: border-box;
  padding: 0 15px 0 44px;
  background: rgba(10,10,15,0.55);
  border: 1px solid var(--z800);
  border-radius: 13px;
  color: var(--white);
  font-family: var(--ff-body);
  font-size: 15px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}
.input::placeholder { color: var(--z700); }
.input:focus {
  outline: none;
  background: rgba(10,10,15,0.85);
  border-color: rgba(103,246,255,0.55);
  box-shadow: 0 0 0 3px rgba(103,246,255,0.12);
}
.input:focus + .input-icon,
.input-wrap:focus-within .input-icon { color: var(--cyan); }
.field.has-error .input {
  border-color: rgba(239,68,68,0.5);
  box-shadow: 0 0 0 3px rgba(239,68,68,0.10);
}

/* ---------- Código de 6 dígitos (login) ---------- */
.otp { position: relative; }
.otp-input {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  z-index: 2;
  margin: 0; padding: 0; border: 0;
  background: transparent;
  color: transparent;
  caret-color: transparent;
  font-size: 16px; /* evita zoom no iOS */
  cursor: text;
  opacity: 0;
}
.otp-input:focus { outline: none; }
.otp-boxes { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.otp-box {
  height: 56px;
  display: grid; place-items: center;
  border: 1px solid var(--z800);
  border-radius: 13px;
  background: rgba(10,10,15,0.55);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 22px; font-weight: 600;
  color: var(--white);
  transition: border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}
.otp-box.is-filled {
  border-color: rgba(103,246,255,0.34);
  background: rgba(103,246,255,0.05);
  transform: translateY(-1px);
}
.otp.is-focused .otp-box.is-active {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(103,246,255,0.13);
}
.otp.is-focused .otp-box.is-active::after {
  content: '';
  width: 2px; height: 24px;
  background: var(--cyan);
  border-radius: 1px;
  animation: caret 1.1s steps(1) infinite;
}
@keyframes caret { 50% { opacity: 0; } }
.otp.has-error .otp-box { border-color: rgba(239,68,68,0.45); }
.otp.shake { animation: shake 0.34s ease; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  45% { transform: translateX(5px); }
  70% { transform: translateX(-3px); }
}

/* ---------- Botão principal ---------- */
.btn-cta {
  width: 100%;
  height: 52px;
  display: flex; align-items: center; justify-content: center; gap: 9px;
  border: none;
  border-radius: 13px;
  background: linear-gradient(135deg, #7CF9FF 0%, #55E8F7 55%, #3FD3EE 100%);
  color: #04171C;
  font-family: var(--ff-body);
  font-size: 15px; font-weight: 600;
  letter-spacing: -0.01em;
  text-decoration: none;
  cursor: pointer;
  box-sizing: border-box;
  box-shadow: 0 12px 32px -14px rgba(103,246,255,0.75);
  transition: transform 0.16s ease, box-shadow 0.2s ease, filter 0.2s ease, opacity 0.2s ease;
}
.btn-cta:hover:not(:disabled) {
  transform: translateY(-1px);
  filter: brightness(1.06);
  box-shadow: 0 18px 40px -14px rgba(103,246,255,0.9);
}
.btn-cta:active:not(:disabled) { transform: translateY(0); }
.btn-cta:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }
.btn-cta:disabled { opacity: 0.5; cursor: not-allowed; box-shadow: none; }

/* Botão secundário, mesmo formato do principal */
.btn-quiet {
  width: 100%;
  height: 48px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  box-sizing: border-box;
  border: 1px solid var(--z800);
  border-radius: 13px;
  background: rgba(255,255,255,0.035);
  color: var(--z300);
  font-family: var(--ff-body);
  font-size: 14px; font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.16s ease, color 0.16s ease, background 0.16s ease;
}
.btn-quiet:hover { border-color: var(--z700); color: var(--white); background: rgba(255,255,255,0.06); }
.btn-quiet:focus-visible { outline: 2px solid rgba(103,246,255,0.6); outline-offset: 2px; }

.spinner {
  width: 16px; height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(4,23,28,0.28);
  border-top-color: #04171C;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Mensagens ---------- */
.msg {
  display: flex; align-items: flex-start; gap: 9px;
  padding: 10px 12px;
  border-radius: 11px;
  font-size: 13px;
  line-height: 1.5;
  animation: msgIn 0.22s ease;
}
.msg svg { flex: none; margin-top: 1px; }
.msg--error { background: rgba(239,68,68,0.08); border: 1px solid rgba(239,68,68,0.22); color: #FCA5A5; }
.msg--ok    { background: rgba(103,246,255,0.07); border: 1px solid rgba(103,246,255,0.22); color: var(--cyan); }
@keyframes msgIn { from { opacity: 0; transform: translateY(-4px); } }

/* ---------- Rodapé do card ---------- */
.auth-actions {
  display: flex; align-items: center; justify-content: center;
  flex-wrap: wrap; gap: 4px 14px;
  margin-top: 18px;
  font-size: 13px;
  color: var(--z500);
}
.link-btn {
  background: none; border: none; padding: 4px 2px;
  font-family: var(--ff-body); font-size: 13px;
  color: var(--cyan);
  cursor: pointer;
  border-radius: 6px;
  transition: color 0.15s ease, opacity 0.15s ease;
}
.link-btn:hover:not(:disabled) { color: var(--white); }
.link-btn:focus-visible { outline: 2px solid rgba(103,246,255,0.6); outline-offset: 2px; }
.link-btn:disabled { color: var(--z500); cursor: not-allowed; }
.dot-sep { color: var(--z700); }

.email-pill {
  display: inline-flex; align-items: center; gap: 8px;
  max-width: 100%;
  margin: 14px auto 0;
  padding: 7px 8px 7px 14px;
  background: rgba(255,255,255,0.035);
  border: 1px solid var(--z800);
  border-radius: 999px;
  font-size: 13px;
  color: var(--z300);
}
.email-pill span {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.email-pill .link-btn { font-size: 12.5px; padding: 2px 8px; border-radius: 999px; background: rgba(103,246,255,0.10); }

/* ---------- Fora do card ---------- */
.auth-links {
  display: flex; flex-wrap: wrap; justify-content: center;
  gap: 8px 20px;
  margin-top: 24px;
  font-size: 13px;
}
.auth-links a {
  display: inline-flex; align-items: center; gap: 7px;
  color: var(--z400);
  text-decoration: none;
  transition: color 0.15s ease;
}
.auth-links a:hover { color: var(--cyan); }
.auth-links svg { opacity: 0.7; }
.auth-trust {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  margin-top: 18px;
  font-size: 12px;
  color: var(--z500);
}

.state { animation: stateIn 0.28s ease; }
@keyframes stateIn { from { opacity: 0; transform: translateY(6px); } }
[hidden] { display: none !important; }

@media (max-width: 480px) {
  .auth-page { padding: 108px 16px 56px; }
  .auth-card { padding: 28px 20px 24px; border-radius: 18px; }
  .otp-boxes { gap: 6px; }
  .otp-box { height: 52px; font-size: 20px; border-radius: 11px; }
  .auth-sub { font-size: 13.5px; }
}

@media (prefers-reduced-motion: reduce) {
  .state, .msg, .otp.shake, .spinner, .otp.is-focused .otp-box.is-active::after { animation: none !important; }
  .btn-cta, .btn-quiet, .otp-box { transition: none; }
}
