/* auth-video-bg — background video fullscreen detrás del login centrado
 * Ponytail: una hoja, sin abstracciones. El video real va en /assets/video/
 * Fallback poster = /assets/img/login-2.png (ya existente)
 */

.auth-video-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    background: #F2F0FA;
    pointer-events: none;
}
.auth-video-bg.has-fallback {
    background: url("../../video/pampeana-login-poster.jpg") center / cover no-repeat;
}
/* Fallback animado inmediato — mientras el MP4 real no existe, el poster NO queda estático.
 * Capa base con Ken Burns sutil + orbs laterales. Se oculta automáticamente cuando el video hace fade-in.
 */
.auth-video-bg::before {
    content: "";
    position: absolute;
    inset: -2%;
    z-index: 0;
    background: url("../../video/pampeana-login-poster.jpg") center 42% / cover no-repeat;
    transform-origin: center center;
    animation: auth-kb 18s ease-in-out infinite alternate;
    will-change: transform;
    /* levemente soft para no competir con la card */
    filter: saturate(0.92) brightness(0.97) contrast(0.98);
}
@keyframes auth-kb {
    0%   { transform: scale(1) translate3d(0, 0, 0); }
    100% { transform: scale(1.05) translate3d(-0.6%, -0.4%, 0); }
}
/* Orbs ambientales en tercios laterales — simulan vida de comercio sin video real.
 * Violeta izquierda, verde sutil derecha. Movimiento imperceptible, no distrae escritura.
 */
.auth-video-bg::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    background:
        radial-gradient(28rem 18rem at 18% 48%, rgba(106,41,219,0.10), transparent 68%),
        radial-gradient(26rem 16rem at 84% 42%, rgba(46,182,125,0.08), transparent 70%);
    animation: auth-orbs 22s ease-in-out infinite alternate;
    will-change: transform, opacity;
}
@keyframes auth-orbs {
    0%   { transform: translate3d(0,0,0); opacity: .95; }
    100% { transform: translate3d(0.4%, -0.3%, 0); opacity: 1; }
}

.auth-video-bg video {
    position: absolute;
    inset: -2%;
    width: 104%;
    height: 104%;
    object-fit: cover;
    object-position: center 45%;
    z-index: 2;
    /* ponytail: zoom 2% + blur suave extra para enterrar marca borde sup-der. Login sigue nítido. */
    transform: scale(1.025);
    transform-origin: center center;
    filter: saturate(0.92) brightness(0.97) contrast(0.98) blur(0.5px);
    display: block;
}

/* Scrim institucional: garantiza legibilidad de card blanca 860-900px
 * Sin blur pesado en el video — el blur lo puede agregar la app vía backdrop-filter si lo desea.
 * Este scrim es leve, desaturado y compatible con performance.
 */
.auth-video-scrim {
    position: absolute;
    inset: 0;
    z-index: 3;
    background:
        radial-gradient(90rem 48rem at 50% 38%, rgba(255,255,255,0.18) 0%, rgba(255,255,255,0.06) 42%, rgba(37,34,56,0.08) 78%),
        linear-gradient(180deg, rgba(250,249,255,0.22) 0%, rgba(242,240,250,0.32) 55%, rgba(242,240,250,0.42) 100%);
}

/* Cuando hay video, el body deja de pintar su gradiente fuerte para no competir.
 * Genérico para todos los auth (login, register, activar) — usuarios y comercios.
 */
body.auth-page.has-video-bg,
body.auth-page.auth-login.has-video-bg,
body.auth-page.auth-login.auth-login-user.has-video-bg,
body.auth-page.auth-login.auth-login-commerce.has-video-bg,
body.auth-page.auth-register.has-video-bg,
body.auth-page.auth-register.auth-register-user.has-video-bg,
body.auth-page.auth-register.auth-register-commerce.has-video-bg {
    background: #F2F0FA !important;
    background-image: none !important;
}

/* Eleva el contenido por encima del video */
body.auth-page.has-video-bg .container,
body.auth-page.has-video-bg .container-login,
body.auth-page.has-video-bg .container.my-3,
body.auth-page.auth-login.has-video-bg .container-login,
body.auth-page.auth-login.auth-login-user.has-video-bg .container-login,
body.auth-page.auth-login.auth-login-commerce.has-video-bg .container-login {
    position: relative;
    z-index: 1;
}

/* Suaviza el borde de la card contra video — sombra ya existe, solo se ajusta opacidad levemente */
body.auth-page.has-video-bg .card,
body.auth-page.auth-login.has-video-bg .card,
body.auth-page.auth-login.auth-login-user.has-video-bg .card,
body.auth-page.auth-login.auth-login-commerce.has-video-bg .card,
body.auth-page.auth-register.has-video-bg .card {
    /* mantiene tokens, agrega leve halo para recorte contra video claro */
    box-shadow:
        0 30px 60px -28px rgba(37, 34, 56, .28),
        0 8px 24px -10px rgba(79, 28, 168, .14),
        0 0 0 1px rgba(255, 255, 255, .7) inset !important;
}

/* Poster fallback visible mientras carga el video o si falla */
.auth-video-bg video:not([src]) ,
.auth-video-bg video[src=""] {
    background: url("../../video/pampeana-login-poster.jpg") center / cover no-repeat;
}

/* Reduced motion: pausa video y muestra poster estático */
@media (prefers-reduced-motion: reduce) {
    .auth-video-bg video {
        display: none;
    }
    .auth-video-bg {
        background: url("../../video/pampeana-login-poster.jpg") center / cover no-repeat;
    }
    .auth-video-bg::before,
    .auth-video-bg::after {
        animation: none !important;
    }
    .auth-video-bg .auth-video-scrim {
        background:
            linear-gradient(180deg, rgba(250,249,255,0.55) 0%, rgba(242,240,250,0.62) 100%);
    }
}

/* Mobile: evita autoplay costoso y layout shift. Poster estático en <768px si se desea ahorro de datos.
 * Por defecto MANTIENE video en mobile pero con poster; si querés forzar estático, descomentá el bloque.
 */
/*
@media (max-width: 767.98px) {
    .auth-video-bg video { display: none; }
    .auth-video-bg { background: url("../../img/login-2.png") center / cover no-repeat; }
}
*/

/* Data-saver: si el navegador anuncia save-data, oculta video */
@media (prefers-reduced-data: reduce) {
    .auth-video-bg video { display: none; }
    .auth-video-bg { background: url("../../video/pampeana-login-poster.jpg") center / cover no-repeat; }
}

/* Evita flash blanco en carga lenta: fade-in suave */
.auth-video-bg video {
    opacity: 0;
    transition: opacity .6s ease;
}
.auth-video-bg video.is-ready {
    opacity: 1;
}
@media (prefers-reduced-motion: reduce) {
    .auth-video-bg video { transition: none; }
}
