/* ==========================================================
   AUTH MODAL — Login + Registro em popup (v1.41.0)

   Layout:
   - Desktop: modal centralizado, max-width 460px, animacao slide+fade+scale
   - Mobile (< 640px): bottom sheet desliza de baixo, ocupa 90vh

   Tokens herdam de main.css (--lime, --dark, etc).
   ========================================================== */

/* Container raiz — fixed full screen, z-index acima de tudo */
.hero-auth-modal{
    position: fixed;
    inset: 0;
    z-index: 99998;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    font-family: var(--font-body, 'Outfit', system-ui, sans-serif);
    -webkit-tap-highlight-color: transparent;
}
.hero-auth-modal[hidden]{ display: none; }

.hero-auth-modal__overlay{
    position: absolute;
    inset: 0;
    background: rgba(10, 10, 10, .55);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    opacity: 0;
    transition: opacity .35s cubic-bezier(.22,1,.36,1);
    cursor: pointer;
}
.hero-auth-modal.is-open .hero-auth-modal__overlay{ opacity: 1; }

/* Box do modal — desktop default */
.hero-auth-modal__box{
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 460px;
    max-height: calc(100vh - 48px);
    overflow-y: auto;
    background: #fff;
    border-radius: 22px;
    box-shadow: 0 30px 80px -20px rgba(0,0,0,.45), 0 8px 24px rgba(0,0,0,.12);
    padding: 32px 32px 28px;
    /* Animação de entrada: slide-up + fade + scale */
    transform: translateY(24px) scale(.96);
    opacity: 0;
    transition: transform .42s cubic-bezier(.22,1.18,.36,1), opacity .35s cubic-bezier(.22,1,.36,1);
    will-change: transform, opacity;
}
.hero-auth-modal.is-open .hero-auth-modal__box{
    transform: translateY(0) scale(1);
    opacity: 1;
}
[data-theme="dark"] .hero-auth-modal__box{ background: #1a1a1a; color: #f0f0f0; }

/* Botão fechar (X) */
.hero-auth-modal__close{
    position: absolute;
    top: 14px; right: 14px;
    width: 38px; height: 38px;
    border: none;
    background: transparent;
    color: var(--mid-gray, #999);
    cursor: pointer;
    border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    transition: background .2s, color .2s, transform .2s;
}
.hero-auth-modal__close:hover{
    background: rgba(0,0,0,.06);
    color: var(--text-primary, #1a1a1a);
    transform: rotate(90deg);
}
[data-theme="dark"] .hero-auth-modal__close:hover{
    background: rgba(255,255,255,.08);
    color: #fff;
}

/* Cabeçalho */
.hero-auth-modal__head{
    text-align: center;
    margin-bottom: 22px;
}
.hero-auth-modal__brand{
    display: block;
    font-family: var(--font-display, 'Bangers', cursive);
    font-size: 14px;
    letter-spacing: 3px;
    color: var(--lime-dark, #7BAA00);
    margin-bottom: 6px;
}
.hero-auth-modal__title{
    margin: 0;
    font-size: 22px;
    font-weight: 800;
    color: var(--text-primary, #1a1a1a);
    letter-spacing: .2px;
}
[data-theme="dark"] .hero-auth-modal__title{ color: #fff; }

/* Tabs (Login | Criar conta) */
.hero-auth-modal__tabs{
    display: grid;
    grid-template-columns: 1fr 1fr;
    background: #f5f5f3;
    padding: 4px;
    border-radius: 50px;
    margin-bottom: 20px;
}
[data-theme="dark"] .hero-auth-modal__tabs{ background: #2a2a2a; }
.hero-auth-modal__tab{
    background: transparent;
    border: none;
    padding: 10px 16px;
    border-radius: 50px;
    font-size: 13.5px;
    font-weight: 700;
    color: var(--mid-gray, #888);
    cursor: pointer;
    transition: background .25s, color .25s, box-shadow .25s;
    letter-spacing: .3px;
}
.hero-auth-modal__tab.is-active{
    background: #fff;
    color: var(--text-primary, #1a1a1a);
    box-shadow: 0 2px 8px rgba(0,0,0,.08);
}
[data-theme="dark"] .hero-auth-modal__tab.is-active{
    background: #1a1a1a;
    color: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,.3);
}

/* Alert global (erro/sucesso) */
.hero-auth-modal__alert{
    margin-bottom: 14px;
    padding: 12px 14px;
    border-radius: 10px;
    font-size: 13.5px;
    line-height: 1.45;
}
.hero-auth-modal__alert--error{
    background: rgba(230, 57, 70, .08);
    border: 1px solid rgba(230, 57, 70, .25);
    color: #B71C1C;
}
.hero-auth-modal__alert--success{
    background: rgba(39, 174, 96, .08);
    border: 1px solid rgba(39, 174, 96, .25);
    color: #1a7a00;
}
.hero-auth-modal__alert--info{
    background: rgba(245, 180, 0, .10);
    border: 1px solid rgba(245, 180, 0, .30);
    color: #7a5500;
}

/* Painéis (forms) */
.hero-auth-modal__panel{
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.hero-auth-modal__panel[hidden]{ display: none; }

/* Campos */
.hero-auth-modal__field{
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.hero-auth-modal__label{
    font-size: 11.5px;
    font-weight: 700;
    color: var(--mid-gray, #888);
    text-transform: uppercase;
    letter-spacing: .8px;
}
.hero-auth-modal__field input[type="text"],
.hero-auth-modal__field input[type="email"],
.hero-auth-modal__field input[type="password"]{
    width: 100%;
    padding: 12px 14px;
    font-size: 14.5px;
    font-family: inherit;
    border: 1.5px solid #e2e2dd;
    border-radius: 12px;
    background: #fff;
    color: var(--text-primary, #1a1a1a);
    transition: border-color .2s, box-shadow .2s, background .2s;
}
.hero-auth-modal__field input:focus{
    outline: none;
    border-color: var(--lime, #A3D900);
    box-shadow: 0 0 0 4px rgba(163,217,0,.18);
}
.hero-auth-modal__field input::placeholder{ color: #aaa; }
[data-theme="dark"] .hero-auth-modal__field input{
    background: #2a2a2a;
    border-color: #3a3a3a;
    color: #f0f0f0;
}
[data-theme="dark"] .hero-auth-modal__field input::placeholder{ color: #666; }

/* Wrapper de senha (input + botão olhinho) */
.hero-auth-modal__pw{
    position: relative;
    display: block;
}
.hero-auth-modal__pw input{ padding-right: 44px; }
.hero-auth-modal__pw-toggle{
    position: absolute;
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    width: 36px; height: 36px;
    color: var(--mid-gray, #999);
    cursor: pointer;
    border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    transition: color .2s, background .2s;
}
.hero-auth-modal__pw-toggle:hover{
    color: var(--text-primary, #1a1a1a);
    background: rgba(0,0,0,.04);
}
[data-theme="dark"] .hero-auth-modal__pw-toggle:hover{
    color: #fff;
    background: rgba(255,255,255,.06);
}

/* Linha "Lembrar de mim" + "Esqueci senha" */
.hero-auth-modal__row{
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.hero-auth-modal__check{
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary, #666);
    cursor: pointer;
    user-select: none;
}
.hero-auth-modal__check input[type="checkbox"]{
    width: 16px; height: 16px;
    accent-color: var(--lime, #A3D900);
    cursor: pointer;
    flex-shrink: 0;
}
.hero-auth-modal__check--terms{
    font-size: 12.5px;
    line-height: 1.5;
    align-items: flex-start;
}
.hero-auth-modal__check--terms input{ margin-top: 2px; }
.hero-auth-modal__check--terms a{
    color: var(--lime-dark, #7BAA00);
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* Links e botões-link */
.hero-auth-modal__link{
    background: transparent;
    border: none;
    padding: 0;
    font: inherit;
    color: var(--lime-dark, #7BAA00);
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: color .2s;
}
.hero-auth-modal__link:hover{
    color: var(--lime, #A3D900);
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* Botão primário */
.hero-auth-modal__btn{
    position: relative;
    display: inline-flex;
    align-items: center; justify-content: center;
    gap: 10px;
    padding: 14px 24px;
    border: none;
    border-radius: 50px;
    font-family: inherit;
    font-size: 14.5px;
    font-weight: 800;
    letter-spacing: .5px;
    text-transform: uppercase;
    cursor: pointer;
    transition: transform .2s, box-shadow .2s, background .2s, opacity .2s;
    margin-top: 4px;
}
.hero-auth-modal__btn--primary{
    background: var(--lime, #A3D900);
    color: #1a1a1a;
    box-shadow: 0 6px 16px rgba(163,217,0,.30);
}
.hero-auth-modal__btn--primary:hover:not(:disabled){
    transform: translateY(-2px);
    background: var(--lime-dark, #7BAA00);
    box-shadow: 0 10px 22px rgba(163,217,0,.40);
}
.hero-auth-modal__btn:disabled{
    opacity: .6;
    cursor: wait;
}

/* Spinner — só visível durante submit (JS remove o atributo hidden) */
.hero-auth-modal__spinner{
    width: 18px; height: 18px;
    border: 2.5px solid rgba(26,26,26,.2);
    border-top-color: #1a1a1a;
    border-radius: 50%;
    animation: hero-auth-spin .7s linear infinite;
    display: inline-block;
}
/* IMPORTANTE: respeita o atributo HTML `hidden` (display:inline-block sobrescreveria) */
.hero-auth-modal__spinner[hidden]{ display: none !important; }
@keyframes hero-auth-spin{ to { transform: rotate(360deg); } }

/* Rodapé do form (switch tabs) */
.hero-auth-modal__switch{
    margin: 8px 0 0;
    text-align: center;
    font-size: 13.5px;
    color: var(--text-secondary, #666);
}
.hero-auth-modal__switch .hero-auth-modal__link{ margin-left: 4px; }

/* Notice (cadastros desativados) */
.hero-auth-modal__notice{
    padding: 14px 16px;
    border-radius: 12px;
    font-size: 13.5px;
    line-height: 1.5;
    text-align: center;
}
.hero-auth-modal__notice--warning{
    background: rgba(245, 180, 0, .10);
    border: 1px solid rgba(245, 180, 0, .30);
    color: #7a5500;
}
.hero-auth-modal__notice strong{ display: block; margin-bottom: 4px; }
.hero-auth-modal__notice p{ margin: 0; opacity: .85; }

/* ━━━━━━━━━━━━━━━━━━━ MOBILE: BOTTOM SHEET ━━━━━━━━━━━━━━━━━━━ */
@media (max-width: 640px){
    .hero-auth-modal{
        padding: 0;
        align-items: flex-end;  /* gruda no fundo */
    }
    .hero-auth-modal__box{
        max-width: 100%;
        max-height: 90vh;
        width: 100%;
        border-radius: 24px 24px 0 0;
        padding: 28px 22px 24px;
        /* Animação: desliza de baixo */
        transform: translateY(100%);
    }
    .hero-auth-modal.is-open .hero-auth-modal__box{
        transform: translateY(0);
    }
    /* "Grip" visual (handle do bottom sheet) */
    .hero-auth-modal__box::before{
        content: '';
        display: block;
        width: 38px;
        height: 4px;
        background: #d8d8d3;
        border-radius: 4px;
        margin: -8px auto 16px;
    }
    [data-theme="dark"] .hero-auth-modal__box::before{ background: #3a3a3a; }
    .hero-auth-modal__close{
        top: 18px; right: 18px;
        width: 34px; height: 34px;
    }
    .hero-auth-modal__title{ font-size: 20px; }
    .hero-auth-modal__brand{ font-size: 12px; }
    .hero-auth-modal__btn{ width: 100%; }
}

/* Acessibilidade: prefers-reduced-motion */
@media (prefers-reduced-motion: reduce){
    .hero-auth-modal__overlay,
    .hero-auth-modal__box{
        transition: none !important;
    }
    .hero-auth-modal__spinner{ animation: none; }
    .hero-auth-modal__close:hover{ transform: none; }
}

/* Body lock quando modal aberto (gerenciado por JS) */
body.hero-auth-modal-open{ overflow: hidden; }
