/* Página inicial (/): entrar ou criar conta. Mesma identidade do cardápio: Poppins, vermelho GrowFood e branco,
 * rodapé "Desenvolvido por GrowSoft".
 * Computador: dois lados (cadastro à esquerda, login à direita) e um quadro vermelho por cima de um deles.
 * Trocar de modo desliza o quadro para o outro lado: o formulário que sai esmaece e o outro entra. */
.auth {
  --brand: #fa3b50;
  --brand-dark: #db243d;
  --ink: #172949;
  --muted: #71809c;
  --bg: #f6f7f9;
  --line: #e1e6ee;
  --motion-ease: cubic-bezier(.16, 1, .3, 1);
  --slide-ms: 760ms;
  min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column;
  background: #fff;
  -webkit-font-smoothing: antialiased;
}
.auth .icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.icon-library { position: absolute; width: 0; height: 0; overflow: hidden; }
.auth :focus-visible { outline: 3px solid #426bc4; outline-offset: 3px; }
.auth h1, .auth p { margin-top: 0; }

/* ---------- Palco: dois lados + quadro vermelho ---------- */
.auth-stage { flex: 1; position: relative; display: grid; grid-template-columns: 1fr 1fr; overflow: hidden; min-height: 620px; }
.auth-slot { grid-row: 1; display: flex; align-items: center; justify-content: center; padding: clamp(32px, 5vw, 72px) clamp(24px, 4vw, 64px); }
.auth-slot-register { grid-column: 1; }
.auth-slot-login { grid-column: 2; }

.auth-panel {
  position: absolute; z-index: 3; top: 0; bottom: 0; left: 0; width: 50%;
  display: flex; align-items: center; justify-content: center; overflow: hidden; isolation: isolate;
  padding: 48px clamp(28px, 5vw, 80px); color: #fff; text-align: center;
  background: linear-gradient(150deg, #ff5266 0%, var(--brand) 45%, var(--brand-dark) 100%);
  transform: translateX(0);
}
/* Um círculo claro só para o vermelho não ficar chapado */
.auth-panel::before {
  content: ''; position: absolute; z-index: -1; width: 640px; height: 640px; border-radius: 50%;
  top: -260px; right: -220px; background: rgb(255 255 255 / 8%);
}
.auth-stage[data-tab="register"] .auth-panel { transform: translateX(100%); }
.auth-panel-in { max-width: 420px; display: flex; flex-direction: column; align-items: center; }
.auth-logo { height: clamp(56px, 6vw, 84px); color: #fff; -webkit-mask-position: center; mask-position: center; margin-bottom: 40px; }
.auth-head h1 { font-size: clamp(26px, 2.4vw, 34px); font-weight: 700; letter-spacing: -.02em; line-height: 1.15; margin-bottom: 10px; }
.auth-head p { font-size: 15.5px; line-height: 1.55; color: #ffe2e7; margin-bottom: 32px; }
.auth-toggle {
  min-width: 200px; min-height: 50px; padding: 12px 28px; border-radius: 14px; cursor: pointer;
  border: 2px solid rgb(255 255 255 / 85%); background: transparent; color: #fff; font-size: 15px; font-weight: 700;
  transition: background .18s ease, color .18s ease, border-color .18s ease;
}
.auth-toggle:hover { background: #fff; color: var(--brand); border-color: #fff; }
.auth-toggle:focus-visible { outline-color: #fff; }

/* ---------- Formulários ---------- */
.auth-form { width: 100%; max-width: 420px; }
.auth-form label { font-size: 13px; font-weight: 600; color: var(--ink); margin: 16px 0 6px; }
.auth-form > label:first-child, .auth-grid label { margin-top: 0; }
.auth-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.auth-grid + label { margin-top: 16px; }
.auth-form input {
  height: 48px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line); font-size: 15px; color: var(--ink); background: #fff;
  transition: border-color .15s ease, box-shadow .2s ease;
}
.auth-form input::placeholder { color: #a3adbf; }
.auth-form input:hover { border-color: #cfd6e2; }
.auth-form input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px rgb(250 59 80 / 12%); }
.auth-pass { position: relative; }
.auth-pass input { padding-right: 50px; }
.auth-eye { position: absolute; top: 0; right: 2px; width: 46px; height: 48px; display: grid; place-items: center; border: 0; background: transparent; color: var(--muted); cursor: pointer; border-radius: 10px; }
.auth-eye:hover { color: var(--ink); }
.auth .auth-error { margin: 12px 0 0; color: #c62828; font-size: 13.5px; font-weight: 600; }
.auth-error:empty { display: none; }
.auth .auth-submit { position: relative; margin-top: 24px; min-height: 54px; border-radius: 14px; font-size: 15px; font-weight: 700; gap: 10px; box-shadow: 0 8px 16px rgb(250 59 80 / 18%); }
.auth .auth-submit:disabled { opacity: 1; cursor: progress; }
.auth-submit.loading span, .auth-submit.loading .icon { opacity: 0; }
.auth-submit.loading::after {
  content: ''; position: absolute; width: 20px; height: 20px; border-radius: 50%;
  border: 2.5px solid rgb(255 255 255 / 35%); border-top-color: #fff; animation: auth-spin .7s linear infinite;
}

/* Formulário fora de cena: invisível (o quadro também fica por cima dele) */
.auth-form[inert] { opacity: 0; visibility: hidden; }
.auth-slot-login .auth-form[inert] { transform: translateX(32px); }
.auth-slot-register .auth-form[inert] { transform: translateX(-32px); }

/* ---------- Rodapé (mesmo do cardápio) ---------- */
.site-footer { border-top: 1px solid var(--line); background: #fff; padding: 18px 0 calc(18px + env(safe-area-inset-bottom)); }
.site-footer .container { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: min(100% - 64px, 1264px); max-width: none; padding: 0; }
.site-footer .gf-wordmark { height: 26px; color: var(--brand); }
.site-footer .gf-lang-pill { margin-left: auto; }
.site-powered { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); text-decoration: none; white-space: nowrap; }
.site-powered .gs-wordmark { height: 11px; margin-left: 2px; color: #111; transition: opacity .15s; }
.site-powered:hover .gs-wordmark { opacity: .7; }

/* ---------- Movimento ---------- */
@keyframes auth-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: no-preference) {
  /* O quadro atravessa a tela: acelera e freia (ease-in-out), para parecer arrastado e não um salto */
  .auth-panel { transition: transform var(--slide-ms) cubic-bezier(.65, 0, .35, 1); }
  /* Sai rápido (o quadro já está passando por cima); o que entra aparece depois que o quadro sai da frente */
  .auth-form { transition: opacity 420ms ease 400ms, transform 640ms var(--motion-ease) 360ms, visibility 0s linear 0s; }
  .auth-form[inert] { transition: opacity 200ms ease, transform 300ms ease, visibility 0s linear 300ms; }
  .auth-stage.swap .auth-head { animation: auth-text 560ms var(--motion-ease) 180ms both; }
  .auth-stage.swap .auth-toggle { animation: auth-text 560ms var(--motion-ease) 240ms both; }
  .auth-stage.no-anim *, .auth-stage.no-anim { transition: none !important; }
  /* Entrada da página */
  .auth-logo { animation: auth-arrive 560ms var(--motion-ease) both; }
  .auth-head { animation: auth-arrive 560ms 90ms var(--motion-ease) both; }
  .auth-toggle { animation: auth-arrive 560ms 170ms var(--motion-ease) both; }
  .auth-slot { animation: auth-arrive 600ms 140ms var(--motion-ease) both; }
  .auth .auth-submit { transition: transform 160ms var(--motion-ease), background .18s ease, box-shadow .18s ease; }
  .auth .auth-submit .icon { transition: transform 180ms var(--motion-ease), opacity .15s; }
  .auth .auth-submit:active:not(:disabled) { transform: scale(.98); }
  .gf-fielderr { animation: auth-arrive 240ms var(--motion-ease); }
  @media (hover: hover) and (pointer: fine) {
    .auth .auth-submit:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 12px 22px rgb(250 59 80 / 24%); }
    .auth .auth-submit:hover:not(:disabled) .icon { transform: translateX(3px); }
  }
}
@media (prefers-reduced-motion: reduce) {
  .auth *, .auth *::before, .auth *::after { animation-duration: 0s !important; transition: none !important; }
  .auth-submit.loading::after { animation: auth-spin 1.4s linear infinite !important; }
}
@keyframes auth-arrive { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes auth-text { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes auth-slide-l { from { opacity: 0; transform: translateX(-28px); } to { opacity: 1; transform: none; } }
@keyframes auth-slide-r { from { opacity: 0; transform: translateX(28px); } to { opacity: 1; transform: none; } }

/* ---------- Celular e telas estreitas: faixa vermelha no topo, formulário embaixo ---------- */
@media (max-width: 900px) {
  .auth-stage { display: flex; flex-direction: column; min-height: 0; overflow: visible; }
  .auth-panel, .auth-stage[data-tab="register"] .auth-panel { position: relative; width: auto; transform: none; padding: 36px 24px 76px; transition: none; }
  .auth-logo { height: 46px; margin-bottom: 22px; }
  .auth-head h1 { font-size: 24px; }
  .auth-head p { font-size: 14.5px; margin-bottom: 20px; }
  .auth-toggle { min-height: 44px; min-width: 160px; font-size: 14px; }
  .auth-slot { padding: 0 16px 40px; animation: none; }
  .auth-stage[data-tab="login"] .auth-slot-register, .auth-stage[data-tab="register"] .auth-slot-login { display: none; }
  .auth-form, .auth-form[inert] { opacity: 1; visibility: visible; transform: none; transition: none; }
  .auth-form {
    position: relative; z-index: 4; margin-top: -48px; max-width: 520px; padding: 28px 22px;
    background: #fff; border-radius: 24px; border: 1px solid var(--line); box-shadow: 0 24px 44px rgb(23 41 73 / 12%);
  }
}
@media (max-width: 900px) and (prefers-reduced-motion: no-preference) {
  .auth-stage.swap[data-tab="register"] .auth-slot-register .auth-form { animation: auth-slide-l 460ms var(--motion-ease); }
  .auth-stage.swap[data-tab="login"] .auth-slot-login .auth-form { animation: auth-slide-r 460ms var(--motion-ease); }
}
@media (max-width: 560px) {
  .auth-grid { grid-template-columns: 1fr; gap: 0; }
  .auth-grid > div + div label { margin-top: 16px; }
  .site-footer { padding: 12px 0 calc(12px + env(safe-area-inset-bottom)); }
  .site-footer .container { width: calc(100% - 40px); flex-wrap: wrap; row-gap: 10px; }
  .site-footer .gf-lang-pill { order: 3; margin: 0 auto; } /* idioma numa linha só dele, no centro */
  .site-footer .gf-wordmark { height: 22px; }
  .site-powered { font-size: 12px; }
  .site-powered .gs-wordmark { height: 10px; }
}

/* ---------- Esqueci minha senha / nova senha: no lado do login, um formulário por cima do outro ---------- */
/* coluna 1fr explícita: sem ela a grade mede a largura pelo conteúdo e o formulário não chega aos 420px */
.auth-slot-login { display: grid; grid-template-columns: minmax(0, 1fr); place-items: center; }
.auth-slot-login > .auth-form { grid-area: 1 / 1; }
.auth .auth-forgot { margin: 10px 0 0; text-align: right; font-size: 13.5px; }
.auth .auth-back { margin: 20px 0 0; text-align: center; font-size: 13.5px; }
.auth-forgot a, .auth-back a { color: var(--brand-dark); font-weight: 600; text-decoration: none; border-radius: 4px; }
.auth-forgot a:hover, .auth-back a:hover { text-decoration: underline; }
.auth .auth-for { margin: 0 0 4px; font-size: 14px; color: var(--muted); overflow-wrap: anywhere; }
.auth-for b { color: var(--ink); font-weight: 600; }
.auth-for b:empty::after { content: '…'; }
.auth .auth-ok { margin: 14px 0 0; padding: 12px 14px; border-radius: 12px; background: #e8f6ee; color: #1d6b3f; font-size: 13.5px; font-weight: 600; line-height: 1.5; }
.auth-ok:empty { display: none; }
/* Celular: só um lado aparece e os formulários não se sobrepõem (o de fora de cena some) */
@media (max-width: 900px) {
  .auth-slot-login > .auth-form[inert] { display: none; }
}

/* Anti-robô do cadastro (Cloudflare Turnstile) */
.auth-captcha { margin-top: 16px; }
.auth-captcha[hidden] { display: none; }
.auth-captcha-w { min-height: 65px; } /* altura da caixa: o formulário não pula quando ela carrega */
.auth-captcha-note { margin: 8px 0 0; font-size: 13px; color: #c62828; font-weight: 600; }
.auth-captcha-note[hidden] { display: none; }
