/* ===== SAPIbr: telas de login (marca A + cartao B) ===== */
html { background: radial-gradient(circle at 70% 45%, #173a24 0%, #101214 55%, #0b0c0e 100%) fixed !important; }
body { background: transparent !important; min-height: 100vh; }

/* Vitorias-regias na agua */
html::after {
    content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none;
    background: url('/img/sapibr-vitoria.svg') repeat; background-size: 300px 220px;
    opacity: .2; animation: sapibr-agua 40s linear infinite;
}
@keyframes sapibr-agua { from { background-position: 0 0; } to { background-position: 300px 0; } }

/* Sapos pulando (duas camadas) */
html::before, body::before {
    content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none;
    background-image: url('/img/sapibr-sapo-pulo.svg'); background-repeat: repeat;
}
html::before { background-size: 240px 200px; opacity: .25; animation: sapibr-pulo 1.6s ease-in-out infinite, sapibr-anda 14s linear infinite; }
body::before { background-size: 330px 275px; background-position: 160px 60px; opacity: .15; animation: sapibr-pulo 2.2s ease-in-out .8s infinite, sapibr-anda2 20s linear infinite; }
@keyframes sapibr-pulo {
    0%, 100% { transform: translateY(0) scaleY(1); }
    10%      { transform: translateY(0) scaleY(.9); }
    40%      { transform: translateY(-34px) scaleY(1.04); }
    70%      { transform: translateY(0) scaleY(.92); }
    80%      { transform: translateY(0) scaleY(1); }
}
@keyframes sapibr-anda  { from { background-position: 0 0; }       to { background-position: 240px 0; } }
@keyframes sapibr-anda2 { from { background-position: 160px 60px; } to { background-position: -170px 60px; } }

/* Lado esquerdo: a marca */
body::after {
    content: ""; position: fixed; top: 0; bottom: 0; left: 0; width: 50vw; z-index: 1; pointer-events: none;
    background: url('/img/sapibr-marca.svg') center / min(80%, 540px) no-repeat;
    filter: drop-shadow(0 12px 30px rgba(34, 197, 94, .3));
    animation: sapibr-flutua 4s ease-in-out infinite;
}
@keyframes sapibr-flutua { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
body > * { position: relative; z-index: 2; }
@media (min-width: 900px) { body { padding-left: 50vw !important; } }
@media (max-width: 899px) {
    body::after { position: absolute; width: 100%; height: 160px; bottom: auto; background-size: min(82%, 380px); }
    body { padding-top: 160px !important; }
}
@media (prefers-reduced-motion: reduce) {
    html::before, html::after, body::before, body::after, .auth-form__form, .auth-form__branding { animation: none !important; }
}

/* Cartao brilhante */
.auth-form { background: transparent !important; }
.auth-form__form {
    width: min(420px, 92vw); margin: 0 auto; padding: 28px 30px 24px !important;
    background: rgba(20, 20, 24, .92) !important; border: 1px solid rgba(34, 197, 94, .55) !important;
    border-radius: 18px !important; backdrop-filter: blur(6px);
    animation: sapibr-brilho 3s ease-in-out infinite;
}
@keyframes sapibr-brilho {
    0%, 100% { box-shadow: 0 0 0 1px rgba(34, 197, 94, .25), 0 0 26px rgba(34, 197, 94, .22), 0 24px 60px rgba(0, 0, 0, .5); }
    50%      { box-shadow: 0 0 0 1px rgba(34, 197, 94, .6), 0 0 42px rgba(34, 197, 94, .4), 0 24px 60px rgba(0, 0, 0, .5); }
}

/* Sapinho pulando no topo, com titulo e subtitulo */
.auth-form__branding {
    display: block !important; margin: 0 0 20px !important; padding-top: 70px;
    font-size: 0 !important; text-align: center; pointer-events: none;
    background: url('/img/sapibr-logo.svg') top center / 62px no-repeat;
    animation: sapibr-pulinho 2.4s ease-in-out infinite;
}
.auth-form__branding * { display: none !important; }
.auth-form__branding::before { content: "Bem-vindo"; display: block; font-size: 26px; font-weight: 800; color: #f4f4f5; }
.auth-form__branding::after { content: "Compartilhar é o que nos conecta"; display: block; margin-top: 4px; font-size: 14px; color: #9a9aa3; }
@keyframes sapibr-pulinho { 0%, 70%, 100% { background-position: top center; } 80% { background-position: center -10px; } }

.auth-form__form:has(input[name="remember"]) .auth-form__branding::before { content: "Entrar"; }
.auth-form__form:has(input[name="remember"]) .auth-form__branding::after { content: "Faça login para acessar a plataforma"; }
.auth-form__form:has(input[name="email"]):not(:has(input[name="password"])):not(:has(textarea)) .auth-form__branding::before { content: "Esqueceu sua senha?"; }
.auth-form__form:has(input[name="email"]):not(:has(input[name="password"])):not(:has(textarea)) .auth-form__branding::after { content: "Informe seu e-mail para receber o link de recuperação"; }
.auth-form__form:has(input[name="password_confirmation"]):not(:has(textarea)) .auth-form__branding::before { content: "Criar nova senha"; }
.auth-form__form:has(input[name="password_confirmation"]):not(:has(textarea)) .auth-form__branding::after { content: "Escolha uma senha forte para a sua conta"; }
.auth-form__form:has(input[name="code"], input[name="recovery_code"]) .auth-form__branding::before { content: "Verificação em duas etapas"; }
.auth-form__form:has(input[name="code"], input[name="recovery_code"]) .auth-form__branding::after { content: "Digite o código do seu aplicativo autenticador"; }
.auth-form__form:has(textarea) .auth-form__branding::before { content: "Inscreva-se"; }
.auth-form__form:has(textarea) .auth-form__branding::after { content: "Conte um pouco sobre você para entrar na comunidade"; }

/* Campos */
.auth-form__label { font-size: 14px; font-weight: 700; color: #e4e4e7; }
.auth-form__text-input {
    height: 50px; color: #f1f1f1 !important; background: #1c1c21 !important;
    border: 1.5px solid #2c2c33 !important; border-radius: 10px !important;
    transition: border-color .2s, box-shadow .2s;
}
.auth-form__text-input:focus { border-color: #22c55e !important; box-shadow: 0 0 0 3px rgba(34, 197, 94, .2) !important; outline: none; }
.auth-form__text-input::placeholder { color: #77777f; }

/* "Lembrar de mim" como chave verde */
.auth-form__checkbox-input-group { display: flex !important; flex-direction: row-reverse; align-items: center; justify-content: space-between; margin: 6px 0 4px; }
.auth-form__checkbox-input {
    appearance: none; -webkit-appearance: none; position: relative; flex-shrink: 0;
    width: 52px; height: 28px; margin: 0; cursor: pointer;
    background: #1c1c21; border: 1.5px solid #3a3b45; border-radius: 999px; transition: background .2s, border-color .2s;
}
.auth-form__checkbox-input::before {
    content: ""; position: absolute; top: 3px; left: 3px; width: 19px; height: 19px;
    background: #d4d4d8; border-radius: 50%; transition: transform .2s, background .2s;
}
.auth-form__checkbox-input:checked { background: #16a34a; border-color: #22c55e; }
.auth-form__checkbox-input:checked::before { transform: translateX(24px); background: #fff; }

/* Botao verde */
.auth-form__primary-button {
    width: 100%; height: 50px; margin-top: 14px;
    font-size: 16px; font-weight: 800; letter-spacing: 1.5px; text-transform: uppercase;
    color: #04210f !important; background: linear-gradient(180deg, #34d375, #16a34a) !important;
    border: 0 !important; border-radius: 10px !important; cursor: pointer;
    box-shadow: 0 8px 20px rgba(34, 197, 94, .3); transition: filter .2s, transform .1s;
}
.auth-form__primary-button:hover { filter: brightness(1.1); }
.auth-form__primary-button:active { transform: translateY(1px); }

/* Links de baixo */
.auth-form__footer { display: flex; flex-direction: column; gap: 8px; width: min(420px, 92vw); margin: 14px auto 0; }
.auth-form__footer-item {
    display: flex; align-items: center; justify-content: center; padding: 12px;
    color: #e4e4e7 !important; text-decoration: none !important;
    background: rgba(20, 20, 24, .9); border: 1px solid #2c2c33; border-radius: 10px; transition: border-color .2s, color .2s;
}
.auth-form__footer-item:hover { color: #4ade80 !important; border-color: #22c55e; }

/* ===== Correcoes de posicao e tamanho ===== */
.auth-form, .auth-form *, .auth-form *::before, .auth-form *::after { box-sizing: border-box; }

/* Computador: o cartao fica centralizado na metade direita */
@media (min-width: 900px) {
    body { padding-left: 0 !important; }
    .auth-form {
        position: relative !important; left: auto !important; right: auto !important; transform: none !important;
        width: 50vw !important; max-width: none !important; min-height: 100vh;
        margin: 0 0 0 50vw !important; padding: 32px 20px !important;
        display: flex !important; flex-direction: column; align-items: center; justify-content: center;
    }
}

/* O cartao e os campos nunca passam da largura */
.auth-form__form { width: min(420px, 100%) !important; max-width: 420px !important; }
.auth-form__footer { width: min(420px, 100%) !important; }
.auth-form__text-input-group, .auth-form__checkbox-input-group { width: 100%; }
.auth-form__text-input { width: 100% !important; }

/* Preenchimento automatico do navegador sem o fundo azul-claro */
.auth-form__text-input:-webkit-autofill,
.auth-form__text-input:-webkit-autofill:hover,
.auth-form__text-input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 1000px #1c1c21 inset !important;
    -webkit-text-fill-color: #f1f1f1 !important;
    caret-color: #f1f1f1;
    transition: background-color 9999s ease-out 0s;
}

/* Logo do topo do cartao no tamanho certo */
.auth-form__branding { background-size: auto 58px !important; padding-top: 72px; }

/* ===== Formularios compridos (inscricao) e links de voltar ===== */
@media (min-width: 900px) {
    .auth-form { justify-content: flex-start !important; }
    .auth-form > :first-child { margin-top: auto !important; }
    .auth-form > :last-child { margin-bottom: auto !important; }
}

/* Marca da esquerda clicavel: volta ao login */
body > a.sapibr-marca-link {
    position: fixed !important; top: 0; bottom: 0; left: 0; width: 50vw; z-index: 3 !important; cursor: pointer;
}
@media (max-width: 899px) {
    body > a.sapibr-marca-link { position: absolute !important; width: 100%; height: 160px; bottom: auto; }
}

/* Botao "Voltar ao login" */
body > a.sapibr-voltar {
    position: fixed !important; top: 18px; right: 22px; z-index: 5 !important;
    padding: 9px 16px; font-weight: 700; color: #4ade80 !important; text-decoration: none !important;
    background: rgba(20, 20, 24, .92); border: 1px solid rgba(34, 197, 94, .5); border-radius: 10px;
    transition: background .2s, color .2s;
}
body > a.sapibr-voltar:hover { color: #04210f !important; background: #22c55e; }

/* Sapinho do cartao clicavel de novo */
.auth-form__branding { pointer-events: auto !important; cursor: pointer; }
