/* Login / 2FA: mismos tokens de paleta que el checkout (--gjj-*, --brand-red),
   con fondo vivo y tarjeta que entra una sola vez. Solo transform/opacity. */

body.gjj-auth {
    --auth-ease: cubic-bezier(0.23, 1, 0.32, 1);
    background: var(--gjj-app-bg, #0a0a0a);
    color: var(--gjj-app-page-text, #fff);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ── Fondo ─────────────────────────────────────────── */
.gjj-auth-backdrop {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.gjj-auth-orb {
    position: absolute;
    width: 46rem;
    height: 46rem;
    border-radius: 50%;
    will-change: transform;
}

.gjj-auth-orb--a {
    top: -18rem;
    left: -14rem;
    background: radial-gradient(circle, color-mix(in srgb, var(--brand-red) 34%, transparent), transparent 64%);
    animation: auth-drift-a 16s ease-in-out infinite alternate;
}

.gjj-auth-orb--b {
    bottom: -20rem;
    right: -16rem;
    background: radial-gradient(circle, color-mix(in srgb, var(--gjj-card-bg) 80%, var(--brand-red)), transparent 66%);
    opacity: 0.7;
    animation: auth-drift-b 20s ease-in-out infinite alternate;
}

.gjj-auth-grid {
    position: absolute;
    inset: 0;
    opacity: 0.55;
    background-image:
        linear-gradient(color-mix(in srgb, var(--gjj-app-page-text) 6%, transparent) 1px, transparent 1px),
        linear-gradient(90deg, color-mix(in srgb, var(--gjj-app-page-text) 6%, transparent) 1px, transparent 1px);
    background-size: 52px 52px;
    mask-image: radial-gradient(ellipse at 50% 40%, #000 15%, transparent 70%);
    -webkit-mask-image: radial-gradient(ellipse at 50% 40%, #000 15%, transparent 70%);
}

/* ── Contenido ─────────────────────────────────────── */
.gjj-auth-main {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    padding: 2rem 1.25rem;
}

.gjj-auth-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    color: var(--gjj-app-page-text);
    text-decoration: none;
    animation: auth-rise 600ms var(--auth-ease) both;
}

.gjj-auth-brand img {
    height: 52px;
    width: auto;
}

.gjj-auth-brand span {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    color: var(--brand-red);
}

.gjj-auth-card {
    width: 100%;
    max-width: 440px;
    animation: auth-rise 650ms var(--auth-ease) 90ms both;
    box-shadow:
        0 40px 80px -30px rgba(0, 0, 0, 0.6),
        0 0 0 1px color-mix(in srgb, var(--gjj-app-text) 6%, transparent),
        inset 0 1px 0 color-mix(in srgb, var(--gjj-app-text) 8%, transparent);
}

/* Línea de acento que recorre el borde superior de la tarjeta */
.gjj-auth-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 1.5rem;
    right: 1.5rem;
    height: 2px;
    border-radius: 0 0 2px 2px;
    background: linear-gradient(90deg, transparent, var(--brand-red), transparent);
    transform: scaleX(0);
    animation: auth-line 900ms var(--auth-ease) 450ms forwards;
}

.gjj-auth-back {
    animation: auth-rise 600ms var(--auth-ease) 220ms both;
}

/* Contenido de la tarjeta: entra escalonado */
.gjj-auth-card .gjj-section-tag,
.gjj-auth-card .gjj-app-title,
.gjj-auth-card .gjj-app-subtitle,
.gjj-auth-card .gjj-field,
.gjj-auth-card .gjj-checkbox,
.gjj-auth-card .gjj-btn {
    animation: auth-rise 520ms var(--auth-ease) both;
}

.gjj-auth-card .gjj-section-tag { animation-delay: 160ms; }
.gjj-auth-card .gjj-app-title { animation-delay: 210ms; }
.gjj-auth-card .gjj-app-subtitle { animation-delay: 260ms; }
.gjj-auth-card .gjj-field:nth-of-type(1) { animation-delay: 310ms; }
.gjj-auth-card .gjj-field:nth-of-type(2) { animation-delay: 360ms; }
.gjj-auth-card .gjj-checkbox { animation-delay: 400ms; }
.gjj-auth-card .gjj-btn { animation-delay: 440ms; }

/* ── Campos: dependen de la paleta, no de blanco fijo ── */
.gjj-auth-card .gjj-field label {
    color: color-mix(in srgb, var(--gjj-app-text) 60%, transparent);
    transition: color 180ms ease;
}

.gjj-auth-card .gjj-field:focus-within label {
    color: var(--brand-red);
}

.gjj-auth-card .gjj-field input {
    background: color-mix(in srgb, var(--gjj-app-text) 7%, transparent);
    border: 1px solid color-mix(in srgb, var(--gjj-app-text) 16%, transparent);
    color: var(--gjj-app-text);
    transition: border-color 180ms ease, background-color 180ms ease, box-shadow 220ms var(--auth-ease);
}

.gjj-auth-card .gjj-field input::placeholder {
    color: color-mix(in srgb, var(--gjj-app-text) 35%, transparent);
}

.gjj-auth-card .gjj-field input:focus {
    outline: none;
    border-color: var(--brand-red);
    background: color-mix(in srgb, var(--gjj-app-text) 10%, transparent);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand-red) 28%, transparent);
}

/* ── Botón ─────────────────────────────────────────── */
.gjj-auth-card .gjj-btn-primary {
    position: relative;
    overflow: hidden;
    background: var(--brand-red);
    transition: transform 160ms var(--auth-ease), box-shadow 220ms var(--auth-ease), filter 200ms ease;
    box-shadow: 0 14px 28px -14px color-mix(in srgb, var(--brand-red) 80%, transparent);
}

.gjj-auth-card .gjj-btn-primary:active {
    transform: scale(0.97);
}

.gjj-auth-card .gjj-btn-primary::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, 0.35) 50%, transparent 65%);
    transform: translateX(-120%);
    pointer-events: none;
}

/* Error: una sacudida corta, solo al aparecer */
.gjj-auth-card .gjj-alert-error {
    animation: auth-shake 420ms var(--auth-ease) both;
}

@media (hover: hover) and (pointer: fine) {
    .gjj-auth-card .gjj-btn-primary:hover {
        box-shadow: 0 20px 36px -14px color-mix(in srgb, var(--brand-red) 90%, transparent);
    }

    .gjj-auth-card .gjj-btn-primary:hover::after {
        transform: translateX(120%);
        transition: transform 700ms var(--auth-ease);
    }
}

/* ── Keyframes ─────────────────────────────────────── */
@keyframes auth-rise {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes auth-line {
    to { transform: scaleX(1); }
}

@keyframes auth-drift-a {
    from { transform: translate3d(0, 0, 0); }
    to { transform: translate3d(6rem, 4rem, 0); }
}

@keyframes auth-drift-b {
    from { transform: translate3d(0, 0, 0); }
    to { transform: translate3d(-5rem, -3rem, 0); }
}

@keyframes auth-shake {
    0% { opacity: 0; transform: translateX(0); }
    25% { opacity: 1; transform: translateX(-6px); }
    50% { transform: translateX(5px); }
    75% { transform: translateX(-3px); }
    100% { opacity: 1; transform: translateX(0); }
}

@media (prefers-reduced-motion: reduce) {
    .gjj-auth-orb { animation: none; }

    .gjj-auth-brand,
    .gjj-auth-card,
    .gjj-auth-back,
    .gjj-auth-card .gjj-section-tag,
    .gjj-auth-card .gjj-app-title,
    .gjj-auth-card .gjj-app-subtitle,
    .gjj-auth-card .gjj-field,
    .gjj-auth-card .gjj-checkbox,
    .gjj-auth-card .gjj-btn,
    .gjj-auth-card .gjj-alert-error {
        animation: auth-fade 250ms ease both;
        animation-delay: 0ms;
    }

    .gjj-auth-card::after {
        animation: none;
        transform: scaleX(1);
    }
}

@keyframes auth-fade {
    from { opacity: 0; }
    to { opacity: 1; }
}
