/* ============================================================
   Insights de Mercado — Auth Components v0.3
   Story 002.2 — Padrão VIP/Premium (D-47 a D-56)
   Mobile-first · 375px funcional · touch targets >= 44px
   ============================================================ */

:root {
  /* Tokens extras v0.3 — adicionados sem quebrar theme.css */
  --success: #2fcc66;
  --success-soft: rgba(47, 204, 102, 0.12);
  --danger: #f04848;
  --danger-soft: rgba(240, 72, 72, 0.12);
  --input-bg: #0e0f13;
  --input-border: #2a2b32;
  --input-border-focus: #d4af37;
  --input-border-error: #f04848;
  --z-toast: 9999;
  --ease-out: cubic-bezier(0.4, 0, 0.2, 1);
  --dur-fast: 140ms;
  --dur-normal: 220ms;
  --dur-slow: 320ms;
}

/* ── Page wrapper ─────────────────────────────────────────── */
.auth-page {
  min-height: calc(100vh - 220px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-5) var(--space-4);
}

/* ── Card ──────────────────────────────────────────────────── */
.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-elev-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-6) var(--space-5);
  position: relative;
  overflow: hidden;
  animation: cardEnter 480ms var(--ease-out) both;
}

.auth-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  opacity: 0.6;
}

@keyframes cardEnter {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.auth-card__header {
  text-align: center;
  margin-bottom: var(--space-5);
}
.auth-card__eyebrow {
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--gold);
  text-transform: uppercase;
  font-weight: 600;
  margin-bottom: var(--space-2);
}
.auth-card__title {
  font-size: 24px;
  margin-bottom: var(--space-2);
  line-height: 1.2;
}
.auth-card__lead {
  font-size: 14px;
  color: var(--text-muted);
  margin: 0;
}

/* ── AuthChooser layout ───────────────────────────────────── */
.auth-chooser {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

/* GOOGLE_OAUTH_DISABLED START — botão fica display:none via classe pai */
.auth-chooser__google {
  display: none; /* D-63 — feature flag desabilitada */
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: #fff;
  color: #111;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 14px;
  min-height: 46px;
  cursor: pointer;
  transition: all var(--dur-normal) var(--ease-out);
}
.auth-chooser__google:hover {
  background: #f5f5f7;
  transform: translateY(-1px);
}
/* Quando GOOGLE_OAUTH_ENABLED=true no futuro: adicionar classe .auth-chooser--google-on no <main> */
.auth-chooser--google-on .auth-chooser__google { display: inline-flex; }
/* GOOGLE_OAUTH_DISABLED END */

.auth-divider {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  color: var(--text-dim);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── Form fields ───────────────────────────────────────────── */
.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.form-field + .form-field { margin-top: var(--space-3); }

.form-field__label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.02em;
}
.form-field__label .required {
  color: var(--gold);
  margin-left: 2px;
}

.form-field__input {
  background: var(--input-bg);
  color: var(--text);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.4;
  min-height: 44px;
  transition: border-color var(--dur-normal) var(--ease-out),
              background var(--dur-normal) var(--ease-out),
              box-shadow var(--dur-normal) var(--ease-out);
  width: 100%;
}
.form-field__input::placeholder {
  color: var(--text-dim);
}
.form-field__input:hover:not(:disabled) {
  border-color: var(--border-strong);
}
.form-field__input:focus {
  outline: none;
  border-color: var(--input-border-focus);
  box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.18);
  background: #0a0b0e;
}
.form-field__input:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.form-field--error .form-field__input {
  border-color: var(--input-border-error);
}
.form-field--error .form-field__input:focus {
  box-shadow: 0 0 0 3px rgba(240, 72, 72, 0.22);
}

.form-field__helper {
  font-size: 11.5px;
  color: var(--text-dim);
  margin-top: 2px;
  min-height: 16px;
}
.form-field__error {
  font-size: 12px;
  color: var(--danger);
  font-weight: 500;
  margin-top: 2px;
  min-height: 16px;
  display: none;
}
.form-field--error .form-field__error { display: block; }
.form-field--error .form-field__helper { display: none; }

/* ── Checkbox (LGPD + opt-in) ─────────────────────────────── */
.form-check {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.5;
  cursor: pointer;
}
.form-check input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  min-width: 18px;
  border: 1.5px solid var(--input-border);
  border-radius: 4px;
  background: var(--input-bg);
  cursor: pointer;
  position: relative;
  margin-top: 2px;
  transition: all var(--dur-normal) var(--ease-out);
}
.form-check input[type="checkbox"]:hover {
  border-color: var(--gold);
}
.form-check input[type="checkbox"]:checked {
  background: var(--gold);
  border-color: var(--gold);
}
.form-check input[type="checkbox"]:checked::after {
  content: '✓';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #1a1300;
  font-weight: 700;
  font-size: 12px;
}
.form-check a {
  color: var(--gold);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ── Buttons (extending .btn from theme.css) ──────────────── */
.auth-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.02em;
  padding: 12px 18px;
  min-height: 46px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-elev-2);
  color: var(--text);
  cursor: pointer;
  transition: all var(--dur-normal) var(--ease-out);
  width: 100%;
  position: relative;
}
.auth-btn:hover:not(:disabled) {
  background: var(--bg-elev-3);
  border-color: var(--gold-deep);
  transform: translateY(-1px);
}
.auth-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}
.auth-btn--primary {
  background: var(--gold);
  border-color: var(--gold);
  color: #1a1300;
}
.auth-btn--primary:hover:not(:disabled) {
  background: var(--gold-bright);
  border-color: var(--gold-bright);
  color: #1a1300;
  box-shadow: 0 6px 20px rgba(212, 175, 55, 0.22);
}
.auth-btn--ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}
.auth-btn--ghost:hover:not(:disabled) {
  background: var(--bg-elev-2);
  border-color: var(--gold);
  color: var(--gold);
}

.auth-btn[data-loading="true"] {
  color: transparent;
}
.auth-btn[data-loading="true"]::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  color: var(--text);
  animation: spin 720ms linear infinite;
}
.auth-btn--primary[data-loading="true"]::after { color: #1a1300; }
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── Footer link (entre login/cadastro) ───────────────────── */
.auth-footer-link {
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  margin-top: var(--space-4);
}
.auth-footer-link a {
  color: var(--gold);
  font-weight: 600;
}

/* ── Skeleton (loading state) ─────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg,
    var(--bg-elev-2) 0%,
    var(--bg-elev-3) 50%,
    var(--bg-elev-2) 100%);
  background-size: 200% 100%;
  border-radius: var(--radius-sm);
  animation: shimmer 1.2s infinite;
}
@keyframes shimmer {
  to { background-position: -200% 0; }
}

/* ── Toast (feedback global) ──────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  width: min(420px, calc(100vw - 32px));
}
.toast {
  background: var(--bg-elev-3);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-size: 13.5px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  pointer-events: auto;
  animation: toastIn 320ms var(--ease-out) both;
}
.toast--success {
  border-color: var(--success);
  background: linear-gradient(180deg, var(--success-soft), var(--bg-elev-3));
}
.toast--error {
  border-color: var(--danger);
  background: linear-gradient(180deg, var(--danger-soft), var(--bg-elev-3));
}
.toast__icon {
  font-size: 16px;
  flex-shrink: 0;
}
.toast--success .toast__icon { color: var(--success); }
.toast--error   .toast__icon { color: var(--danger); }
.toast.is-exiting {
  animation: toastOut 220ms var(--ease-out) both;
}
@keyframes toastIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes toastOut {
  to { opacity: 0; transform: translateY(8px); }
}

/* ── Mobile (375px target — D-54) ─────────────────────────── */
@media (max-width: 480px) {
  .auth-page { padding: var(--space-4) var(--space-3); min-height: auto; }
  .auth-card { padding: var(--space-5) var(--space-4); border-radius: var(--radius-md); }
  .auth-card__title { font-size: 21px; }
  .auth-card__lead { font-size: 13px; }
  .auth-btn { font-size: 13.5px; }
}

/* ── Reduced motion ───────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .auth-card,
  .toast,
  .auth-btn,
  .form-field__input {
    animation: none !important;
    transition: none !important;
  }
}

/* ── Password Rules indicator (2026-05-16) ──────────────────── */
.password-rules {
  list-style: none;
  margin: 10px 0 0;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(212, 175, 55, 0.12);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.password-rules li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: #6b6f76;
  transition: color 220ms cubic-bezier(.4,0,.2,1);
  font-family: Inter, -apple-system, sans-serif;
}
.password-rules__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
  transition: all 240ms cubic-bezier(.4,0,.2,1);
  position: relative;
}
/* "○" empty state */
.password-rules li[data-met="false"] .password-rules__icon::before {
  content: '';
  display: block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
}
/* "✓" met state — verde dourado */
.password-rules li[data-met="true"] {
  color: #c8e6c9;
  font-weight: 500;
}
.password-rules li[data-met="true"] .password-rules__icon {
  background: linear-gradient(135deg, #2fcc66, #1fa854);
  border-color: #2fcc66;
  box-shadow: 0 0 0 2px rgba(47, 204, 102, 0.18);
}
.password-rules li[data-met="true"] .password-rules__icon::before {
  content: '';
  display: block;
  width: 9px;
  height: 5px;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(-45deg) translate(1px, -1px);
  background: transparent;
  border-radius: 0;
  animation: checkPop 240ms cubic-bezier(.4,0,.2,1) both;
}
@keyframes checkPop {
  0%   { opacity: 0; transform: rotate(-45deg) translate(1px, -1px) scale(0.4) }
  60%  { opacity: 1; transform: rotate(-45deg) translate(1px, -1px) scale(1.15) }
  100% { opacity: 1; transform: rotate(-45deg) translate(1px, -1px) scale(1) }
}

@media (prefers-reduced-motion: reduce) {
  .password-rules li,
  .password-rules__icon,
  .password-rules li[data-met="true"] .password-rules__icon::before {
    animation: none !important;
    transition: none !important;
  }
}

/* ── Resend Modal + "Não recebeu" link (2026-05-16) ─────────── */
.auth-resend-link {
  margin: 14px 0 0;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted, #9ba0a8);
}
.link-button {
  background: none;
  border: 0;
  padding: 0;
  color: var(--gold, #d4af37);
  font: inherit;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color 200ms cubic-bezier(.4,0,.2,1);
}
.link-button:hover { color: #f5cf57; }
.link-button:focus-visible { outline: 2px solid var(--gold, #d4af37); outline-offset: 3px; border-radius: 3px; }

.resend-modal[hidden] { display: none; }
.resend-modal {
  position: fixed;
  inset: 0;
  z-index: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.resend-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  animation: backdropFadeIn 200ms cubic-bezier(.4,0,.2,1) both;
}
@keyframes backdropFadeIn { from { opacity: 0 } to { opacity: 1 } }

.resend-modal__card {
  position: relative;
  background: #131418;
  border: 1px solid #26272d;
  border-radius: 14px;
  padding: 28px 28px 24px;
  width: 100%;
  max-width: 440px;
  box-shadow:
    0 0 0 1px rgba(212, 175, 55, 0.18),
    0 20px 60px rgba(0, 0, 0, 0.6),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
  animation: cardSlideIn 240ms cubic-bezier(.4,0,.2,1) both;
}
@keyframes cardSlideIn {
  from { opacity: 0; transform: translateY(20px) scale(0.97) }
  to   { opacity: 1; transform: translateY(0) scale(1) }
}

.resend-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.resend-modal__title {
  margin: 0;
  font-family: Montserrat, sans-serif;
  font-weight: 700;
  font-size: 19px;
  color: #f5f5f7;
  letter-spacing: -0.01em;
}
.resend-modal__close {
  background: none;
  border: 0;
  color: #9ba0a8;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
  transition: color 200ms cubic-bezier(.4,0,.2,1);
}
.resend-modal__close:hover { color: #f5f5f7; }
.resend-modal__close:focus-visible { outline: 2px solid var(--gold, #d4af37); outline-offset: 2px; border-radius: 4px; }

.resend-modal__lead {
  margin: 0 0 18px;
  font-size: 14px;
  line-height: 1.55;
  color: #9ba0a8;
}
.resend-modal__footnote {
  margin: 14px 0 0;
  font-size: 12px;
  color: #6b6f76;
  text-align: center;
  font-style: italic;
}

@media (max-width: 480px) {
  .resend-modal__card { padding: 22px 20px 20px; border-radius: 12px; }
  .resend-modal__title { font-size: 17px; }
}
@media (prefers-reduced-motion: reduce) {
  .resend-modal__backdrop,
  .resend-modal__card { animation: none !important; }
}
