/* Login inmersivo — fondo 3D estilo landing + imágenes flotantes */

.login-immersive-body {
    font-family: 'Outfit', sans-serif;
    background: #0a0512;
    min-height: 100vh;
    overflow: hidden;
}

.login-webgl {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

.login-vignette {
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background: radial-gradient(circle at center, transparent 30%, rgba(10, 5, 18, 0.95) 100%);
}

.login-float-layer {
    position: fixed;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    overflow: hidden;
}

.login-float-card {
    position: absolute;
    width: clamp(88px, 14vw, 168px);
    aspect-ratio: 4 / 3;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid rgba(207, 201, 255, 0.14);
    box-shadow:
        0 20px 50px rgba(0, 0, 0, 0.45),
        0 0 24px rgba(140, 126, 255, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    transform-style: preserve-3d;
    animation: login-float-drift 9s ease-in-out infinite;
    opacity: 0.4;
    filter: brightness(0.88) saturate(0.85);
    transition:
        opacity 0.4s ease,
        filter 0.4s ease,
        border-color 0.4s ease,
        box-shadow 0.4s ease;
}

.login-float-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

@media (hover: hover) and (pointer: fine) {
    .login-float-card {
        pointer-events: auto;
    }

    .login-float-card:hover {
        opacity: 0.96;
        filter: brightness(1.06) saturate(1.05);
        border-color: rgba(207, 201, 255, 0.42);
        box-shadow:
            0 24px 56px rgba(0, 0, 0, 0.55),
            0 0 36px rgba(140, 126, 255, 0.22),
            inset 0 1px 0 rgba(255, 255, 255, 0.18);
    }
}

.login-float-card--placeholder {
    background: linear-gradient(135deg, rgba(67, 56, 202, 0.22) 0%, rgba(14, 165, 233, 0.14) 50%, rgba(226, 135, 35, 0.1) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

@media (hover: hover) and (pointer: fine) {
    .login-float-card--placeholder:hover {
        background: linear-gradient(135deg, rgba(67, 56, 202, 0.42) 0%, rgba(14, 165, 233, 0.28) 50%, rgba(226, 135, 35, 0.18) 100%);
    }
}

.login-float-card--placeholder span {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(207, 201, 255, 0.45);
}

@keyframes login-float-drift {
    0%, 100% { translate: 0 0; }
    25% { translate: 8px -14px; }
    50% { translate: -6px 10px; }
    75% { translate: 12px 6px; }
}

.login-content-wrap {
    position: relative;
    z-index: 10;
    margin-left: auto;
    margin-right: auto;
}

/* Cursor estrella fugaz (igual que landing) */
@media (hover: hover) and (pointer: fine) {
    .login-immersive-body {
        cursor: none;
    }

    .login-immersive-body input,
    .login-immersive-body button,
    .login-immersive-body a,
    .login-immersive-body [role="button"] {
        cursor: none;
    }
}

#star-cursor {
    position: fixed;
    left: 0;
    top: 0;
    width: 22px;
    height: 22px;
    pointer-events: none;
    z-index: 2147483647;
    transform: translate(-50%, -50%);
    opacity: 0;
    transition: opacity 180ms ease;
    mix-blend-mode: screen;
}

#star-cursor .core {
    position: absolute;
    inset: 0;
    border-radius: 9999px;
    background: radial-gradient(circle, rgba(255,255,255,1) 0%, rgba(255,255,255,0.95) 12%, rgba(255,255,255,0.65) 26%, rgba(140,126,255,0.7) 48%, rgba(140,126,255,0) 74%);
    filter: blur(1px);
    box-shadow: 0 0 12px rgba(140, 126, 255, 0.95), 0 0 28px rgba(255, 255, 255, 0.45);
}

#star-cursor .tail {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 115px;
    height: 1px;
    transform-origin: left center;
    transform: rotate(0deg) translateY(-50%);
    background: linear-gradient(90deg, rgba(255,255,255,0.95) 0%, rgba(255,255,255,0.2) 45%, rgba(140,126,255,0) 100%);
    filter: blur(0.3px);
    opacity: 0.8;
    border-radius: 9999px;
    box-shadow: 0 0 8px rgba(140, 126, 255, 0.2);
}

.star-trail {
    position: fixed;
    width: 8px;
    height: 8px;
    pointer-events: none;
    z-index: 2147483646;
    transform: translate(-50%, -50%) scale(0.8);
    opacity: 0;
    mix-blend-mode: screen;
    animation: login-star-trail 420ms linear forwards;
}

.star-trail::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 9999px;
    background: radial-gradient(circle, rgba(255,255,255,0.9) 0%, rgba(255,255,255,0.4) 35%, rgba(140,126,255,0.12) 70%, rgba(140,126,255,0) 100%);
    filter: blur(0.6px);
    box-shadow: 0 0 7px rgba(255,255,255,0.3);
}

@keyframes login-star-trail {
    0% { opacity: 0.85; transform: translate(-50%, -50%) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(0.2); }
}

#preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #050510;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.5s ease, visibility 0.5s;
}

#preloader.fade-out {
    opacity: 0;
    visibility: hidden;
}

@media (max-width: 768px) {
    .login-float-card {
        width: clamp(64px, 22vw, 110px);
        opacity: 0.32;
        filter: brightness(0.85) saturate(0.8);
        pointer-events: none;
    }
}

@media (max-width: 480px) {
    .login-float-layer .login-float-card:nth-child(n+7) {
        display: none;
    }
}

/* Botón discreto — volver a la landing */
.login-back-landing-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.38rem 0.72rem;
    border-radius: 999px;
    border: 1px solid rgba(140, 126, 255, 0.22);
    background: rgba(8, 14, 33, 0.42);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: rgba(226, 232, 240, 0.72);
    font-size: 0.58rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-decoration: none;
    text-shadow: none;
    overflow: hidden;
    cursor: pointer;
    z-index: 15;
    opacity: 0.55;
    box-shadow: none;
    transition:
        opacity 0.25s ease,
        color 0.25s ease,
        border-color 0.25s ease,
        background 0.25s ease,
        transform 0.2s ease;
}

.login-back-landing-btn__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    opacity: 0.85;
}

.login-back-landing-btn:hover {
    opacity: 0.92;
    color: rgba(248, 250, 252, 0.95);
    border-color: rgba(140, 126, 255, 0.45);
    background: rgba(8, 14, 33, 0.62);
    transform: translateY(-1px);
}

.login-back-landing-btn:active {
    transform: translateY(0);
    opacity: 0.78;
}

.login-back-landing-btn--fixed {
    position: fixed;
    top: max(0.75rem, env(safe-area-inset-top, 0px));
    left: max(0.75rem, env(safe-area-inset-left, 0px));
}

.login-back-landing-btn--card {
    margin: 0 auto;
}

@media (max-width: 480px) {
    .login-back-landing-btn--fixed .login-back-landing-btn__label {
        display: none;
    }

    .login-back-landing-btn--fixed {
        padding: 0.34rem 0.5rem;
    }
}

/* Recuperación de clave — panel elegante */
.login-forgot-link {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    text-decoration: none;
    letter-spacing: 0.01em;
}

.login-forgot-link:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
}

.login-recover-grid {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.login-recover-card {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    width: 100%;
    padding: 0.95rem 1rem;
    border-radius: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(15, 23, 42, 0.85);
    text-decoration: none;
    text-align: left;
    color: #f8fafc !important;
    font: inherit;
    cursor: pointer;
    transition:
        transform 0.2s ease,
        border-color 0.2s ease,
        background 0.2s ease,
        box-shadow 0.25s ease;
}

.login-recover-card:hover,
.login-recover-card:focus,
.login-recover-card:visited {
    color: #ffffff !important;
    text-decoration: none;
}

.login-recover-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.35);
}

.login-recover-card--wa {
    border-color: rgba(52, 211, 153, 0.45);
}

.login-recover-card--wa:hover {
    border-color: rgba(110, 231, 183, 0.75);
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.22), rgba(14, 165, 233, 0.12));
}

.login-recover-card--mail {
    border-color: rgba(167, 139, 250, 0.45);
}

.login-recover-card--mail:hover {
    border-color: rgba(196, 181, 253, 0.75);
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.22), rgba(14, 165, 233, 0.12));
}

.login-recover-card__icon {
    flex-shrink: 0;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.85rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.login-recover-card--wa .login-recover-card__icon {
    color: #6ee7b7 !important;
    background: rgba(16, 185, 129, 0.18);
}

.login-recover-card--mail .login-recover-card__icon {
    color: #c4b5fd !important;
    background: rgba(139, 92, 246, 0.18);
}

.login-recover-card__body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.login-recover-card__title {
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    color: #ffffff !important;
}

.login-recover-card__desc {
    font-size: 0.72rem;
    font-weight: 500;
    color: #cbd5e1 !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.login-recover-card__arrow {
    color: #e2e8f0 !important;
    font-size: 1rem;
    transition: transform 0.2s ease, color 0.2s ease;
}

.login-recover-card:hover .login-recover-card__arrow {
    transform: translateX(3px);
    color: #ffffff !important;
}

/* Volteo 3D login ↔ recuperar clave */
.login-flip {
    perspective: 1400px;
    -webkit-perspective: 1400px;
}

.login-flip__inner {
    position: relative;
    width: 100%;
    display: grid;
    transform-style: preserve-3d;
    -webkit-transform-style: preserve-3d;
    transition: transform 0.75s cubic-bezier(0.4, 0.05, 0.2, 1);
    will-change: transform;
}

.login-flip.is-flipped .login-flip__inner {
    transform: rotateY(180deg);
}

.login-flip__face {
    grid-area: 1 / 1;
    width: 100%;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    transform: rotateY(0deg);
    -webkit-transform: rotateY(0deg);
}

.login-flip__face--back {
    transform: rotateY(180deg);
    -webkit-transform: rotateY(180deg);
}

/* Evita interacción / foco en la cara oculta */
.login-flip:not(.is-flipped) .login-flip__face--back,
.login-flip.is-flipped .login-flip__face--front {
    pointer-events: none;
    user-select: none;
}

.login-flip:not(.is-flipped) .login-flip__face--front,
.login-flip.is-flipped .login-flip__face--back {
    pointer-events: auto;
    user-select: auto;
}

.login-flip__shell {
    position: relative;
    width: 100%;
    padding: 2px;
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.55);
}

.login-flip__glow,
.login-flip__glow-blur {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background: conic-gradient(
        from 0deg,
        transparent 20%,
        #8c7eff 35%,
        #0EA5E9 55%,
        #E28723 70%,
        transparent 85%
    );
    animation: login-flip-spin 6s linear infinite;
}

.login-flip__glow--back {
    background: conic-gradient(
        from 0deg,
        transparent 20%,
        #34d399 35%,
        #0EA5E9 55%,
        #8c7eff 70%,
        transparent 85%
    );
}

.login-flip__glow-blur {
    filter: blur(14px);
    opacity: 0.45;
}

@keyframes login-flip-spin {
    to { transform: rotate(360deg); }
}

.login-flip__panel {
    position: relative;
    z-index: 1;
    padding: 2rem;
    border-radius: 0.95rem;
    background: rgba(8, 14, 33, 0.92);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    overflow: hidden;
}

/* Reduce destello en mitad del giro */
@media (prefers-reduced-motion: reduce) {
    .login-flip__inner {
        transition-duration: 0.01ms;
    }
    .login-flip__glow,
    .login-flip__glow-blur {
        animation: none;
    }
}
