/* Apex FlexPay Glassy 3D Auth Motion (Preserves Existing Emerald/Gold Theme) */
.login-page {
    perspective: 1400px;
    overflow-x: hidden;
}

/* Subtle diagonal animated light streaks matching the reference motion */
.auth-streaks {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}
.auth-streak {
    position: absolute;
    width: 140%;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(52, 211, 153, 0.35), rgba(212, 165, 116, 0.25), transparent);
    transform: rotate(-28deg);
    opacity: 0.55;
    animation: authStreakMove 9s linear infinite;
}
.auth-streak:nth-child(1) { top: 18%; left: -40%; animation-duration: 11s; }
.auth-streak:nth-child(2) { top: 52%; left: -30%; animation-duration: 14s; animation-delay: -4s; height: 1.5px; }
.auth-streak:nth-child(3) { top: 82%; left: -50%; animation-duration: 10s; animation-delay: -7s; }

@keyframes authStreakMove {
    0%   { transform: translateX(-18%) rotate(-28deg); opacity: 0; }
    20%  { opacity: 0.65; }
    80%  { opacity: 0.65; }
    100% { transform: translateX(22%) rotate(-28deg); opacity: 0; }
}

.login-container {
    position: relative;
    z-index: 5;
    transform-style: preserve-3d;
}

.login-card {
    position: relative;
    overflow: hidden;
    transform-style: preserve-3d;
    will-change: transform, opacity;
    transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.3s ease, border-color 0.3s ease;
    animation: authFlipIn 0.72s cubic-bezier(0.22, 1, 0.36, 1) both !important;
    box-shadow: 0 24px 65px rgba(0, 0, 0, 0.5), 0 0 32px rgba(16, 185, 129, 0.14);
}

/* Cursor-following glass spotlight */
.login-card::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: radial-gradient(360px circle at var(--mx, 50%) var(--my, 20%), rgba(52, 211, 153, 0.16), transparent 65%);
    opacity: 0;
    transition: opacity 0.35s ease;
    z-index: 0;
}
.login-card:hover::before {
    opacity: 1;
}

/* Animated top & bottom glowing edge sweep */
.login-card::after {
    content: "";
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    pointer-events: none;
    background: linear-gradient(135deg, rgba(52, 211, 153, 0.45), transparent 30%, transparent 70%, rgba(212, 165, 116, 0.38));
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    padding: 1.5px;
    opacity: 0.85;
}

/* Decorative corner HUD brackets (top-left & bottom-right chamfered vibe) */
.auth-corner {
    position: absolute;
    width: 28px;
    height: 28px;
    pointer-events: none;
    z-index: 2;
    opacity: 0.75;
    transition: transform 0.35s ease, opacity 0.35s ease;
}
.auth-corner-tl {
    top: 10px; left: 10px;
    border-top: 2px solid var(--emerald-light, #34d399);
    border-left: 2px solid var(--emerald-light, #34d399);
    border-top-left-radius: 8px;
}
.auth-corner-br {
    bottom: 10px; right: 10px;
    border-bottom: 2px solid var(--gold, #d4a574);
    border-right: 2px solid var(--gold, #d4a574);
    border-bottom-right-radius: 8px;
}
.login-card:hover .auth-corner-tl { transform: translate(-2px, -2px); opacity: 1; }
.login-card:hover .auth-corner-br { transform: translate(2px, 2px); opacity: 1; }

.login-card > *:not(.auth-corner) {
    position: relative;
    z-index: 1;
}

/* 3D Flip Entrance & Exit when switching between Login <-> Register */
@keyframes authFlipIn {
    0% {
        opacity: 0;
        transform: perspective(1200px) rotateY(-28deg) rotateX(6deg) scale(0.92) translateY(18px);
        filter: blur(4px);
    }
    60% {
        opacity: 1;
        transform: perspective(1200px) rotateY(4deg) rotateX(-1deg) scale(1.01) translateY(-2px);
        filter: blur(0);
    }
    100% {
        opacity: 1;
        transform: perspective(1200px) rotateY(0deg) rotateX(0deg) scale(1) translateY(0);
        filter: blur(0);
    }
}

.login-card.auth-flip-out {
    animation: authFlipOut 0.42s cubic-bezier(0.55, 0.06, 0.68, 0.19) forwards !important;
}
@keyframes authFlipOut {
    0% {
        opacity: 1;
        transform: perspective(1200px) rotateY(0deg) scale(1);
    }
    100% {
        opacity: 0;
        transform: perspective(1200px) rotateY(75deg) scale(0.9);
        filter: blur(3px);
    }
}

/* Staggered Field Entrance */
.login-card .form-group,
.login-card .form-row,
.login-card .btn-primary,
.login-card .login-footer {
    animation: authFieldRise 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.login-card .form-group:nth-of-type(1) { animation-delay: 0.10s; }
.login-card .form-group:nth-of-type(2) { animation-delay: 0.16s; }
.login-card .form-group:nth-of-type(3) { animation-delay: 0.22s; }
.login-card .form-group:nth-of-type(4) { animation-delay: 0.28s; }
.login-card .form-row                  { animation-delay: 0.32s; }
.login-card .btn-primary               { animation-delay: 0.36s; }
.login-card .login-footer              { animation-delay: 0.42s; }

@keyframes authFieldRise {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Smooth Input Focus Glow */
.login-card .form-input {
    transition: border-color 0.25s ease, box-shadow 0.25s ease, transform 0.2s ease;
}
.login-card .form-input:focus {
    transform: translateY(-1px);
    box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.22), 0 6px 18px rgba(0, 0, 0, 0.25);
}

/* Glossy Shimmer Sweep on Submit Button */
.login-card .btn-primary {
    position: relative;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.25s ease;
}
.login-card .btn-primary::after {
    content: "";
    position: absolute;
    top: 0; left: -120%;
    width: 60%; height: 100%;
    background: linear-gradient(110deg, transparent, rgba(255, 255, 255, 0.32), transparent);
    transition: left 0.55s ease;
}
.login-card .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 26px rgba(16, 185, 129, 0.38);
}
.login-card .btn-primary:hover::after {
    left: 140%;
}

/* Floating Logo Pulse */
.login-card .login-logo {
    animation: authLogoFloat 4s ease-in-out infinite;
}
@keyframes authLogoFloat {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-4px); }
}

@media (prefers-reduced-motion: reduce) {
    .login-card, .auth-streak, .login-card .form-group, .login-card .login-logo {
        animation: none !important;
        transition: none !important;
    }
}
