/* ================================================================
   Login Page Animated Bubbles & Effects
   Dynamic bubbles spawned by JS + micro-animations for the form.
   ================================================================ */

/* ---- Bubbles Container ---- */
.login-bubbles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
    z-index: 2;
}

/* Base bubble style – JS sets position, size, color, and animation */
.login-bubbles .bubble {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 0 12px var(--bubble-glow, rgba(99, 102, 241, 0.2)),
        inset 0 0 10px rgba(255, 255, 255, 0.05);
    opacity: 0;
    will-change: transform, opacity;
    animation: bubbleLife var(--duration, 12s) var(--delay, 0s) linear infinite;
}

/* The main animation – JS sets custom properties for direction */
@keyframes bubbleLife {
    0% {
        transform: translate(0, 0) scale(0.3);
        opacity: 0;
    }

    8% {
        opacity: var(--peak-opacity, 0.6);
    }

    40% {
        opacity: calc(var(--peak-opacity, 0.6) * 0.6);
    }

    85% {
        opacity: calc(var(--peak-opacity, 0.6) * 0.2);
    }

    100% {
        transform: translate(var(--move-x, 100px), var(--move-y, -400px)) scale(var(--end-scale, 1));
        opacity: 0;
    }
}

/* ---- Animated gradient overlay on the form panel ---- */
.login-form-panel {
    position: relative;
    overflow: hidden;
}

.login-form-panel::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 600px 400px at 10% 90%,
            rgba(99, 102, 241, 0.12) 0%,
            transparent 70%),
        radial-gradient(ellipse 500px 500px at 90% 10%,
            rgba(168, 85, 247, 0.10) 0%,
            transparent 70%),
        radial-gradient(ellipse 700px 300px at 50% 50%,
            rgba(59, 130, 246, 0.08) 0%,
            transparent 70%);
    animation: gradientMove 8s ease-in-out infinite alternate;
    pointer-events: none;
    z-index: 1;
}

@keyframes gradientMove {
    0% {
        opacity: 0.6;
        transform: scale(1) translate(0, 0);
    }

    33% {
        opacity: 1;
        transform: scale(1.1) translate(2%, -2%);
    }

    66% {
        opacity: 0.8;
        transform: scale(1.05) translate(-1%, 1%);
    }

    100% {
        opacity: 0.6;
        transform: scale(1) translate(0, 0);
    }
}

/* Ensure login form content sits ABOVE the gradient overlay & bubbles */
.login-form-panel>* {
    position: relative;
    z-index: 3;
}

/* ---- Left panel: pulsing glow ring behind the logo image ---- */
.login-left-panel {
    position: relative;
    overflow: hidden;
}

.login-left-panel::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 350px;
    height: 350px;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.25) 0%, rgba(139, 92, 246, 0.10) 40%, transparent 70%);
    animation: glowPulse 4s ease-in-out infinite;
    pointer-events: none;
    z-index: 1;
}

@keyframes glowPulse {

    0%,
    100% {
        transform: translate(-50%, -50%) scale(0.8);
        opacity: 0.4;
    }

    50% {
        transform: translate(-50%, -50%) scale(1.5);
        opacity: 1;
    }
}

/* ---- Micro-animations for the form elements ---- */

/* Fade-in-up for the form wrapper */
.login-form-animate {
    animation: fadeInUp 0.8s ease-out both;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Staggered children animation */
.login-form-animate>*:nth-child(1) {
    animation-delay: 0.1s;
}

.login-form-animate>*:nth-child(2) {
    animation-delay: 0.2s;
}

.login-form-animate>*:nth-child(3) {
    animation-delay: 0.3s;
}

.login-form-animate>*:nth-child(4) {
    animation-delay: 0.4s;
}

.login-form-animate>*:nth-child(5) {
    animation-delay: 0.5s;
}

.login-form-animate>*:nth-child(6) {
    animation-delay: 0.6s;
}

.login-form-animate>* {
    animation: fadeInUp 0.6s ease-out both;
}

/* Subtle logo float animation */
.login-logo-float {
    animation: logoFloat 3s ease-in-out infinite;
}

@keyframes logoFloat {

    0%,
    100% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-8px);
    }
}

/* Button shimmer effect on hover */
.login-btn-shimmer {
    position: relative;
    overflow: hidden;
}

.login-btn-shimmer::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -60%;
    width: 40%;
    height: 200%;
    background: linear-gradient(90deg,
            transparent,
            rgba(255, 255, 255, 0.25),
            transparent);
    transform: skewX(-20deg);
    transition: none;
    animation: none;
}

.login-btn-shimmer:hover::after {
    animation: shimmer 0.8s ease forwards;
}

@keyframes shimmer {
    0% {
        left: -60%;
    }

    100% {
        left: 120%;
    }
}

/* Input focus glow effect */
.login-input-glow:focus {
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.20), 0 0 20px rgba(99, 102, 241, 0.12) !important;
    border-color: rgba(99, 102, 241, 0.6) !important;
    transition: box-shadow 0.3s ease, border-color 0.3s ease;
}

/* ---- Dark mode adjustments ---- */
html.dark .login-bubbles .bubble {
    border-color: rgba(255, 255, 255, 0.08);
}

html.dark .login-form-panel::before {
    background:
        radial-gradient(ellipse 600px 400px at 10% 90%,
            rgba(99, 102, 241, 0.15) 0%,
            transparent 70%),
        radial-gradient(ellipse 500px 500px at 90% 10%,
            rgba(168, 85, 247, 0.12) 0%,
            transparent 70%),
        radial-gradient(ellipse 700px 300px at 50% 50%,
            rgba(59, 130, 246, 0.10) 0%,
            transparent 70%);
}

html.dark .login-left-panel::after {
    background: radial-gradient(circle, rgba(99, 102, 241, 0.30) 0%, rgba(139, 92, 246, 0.15) 40%, transparent 70%);
}

html.dark .login-input-glow:focus {
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25), 0 0 25px rgba(99, 102, 241, 0.15) !important;
}

/* ---- Responsive: fewer bubbles on mobile (handled in JS) ---- */
@media (max-width: 768px) {
    .login-left-panel::after {
        width: 200px;
        height: 200px;
    }
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {

    .login-bubbles .bubble,
    .login-form-panel::before,
    .login-left-panel::after,
    .login-form-animate,
    .login-form-animate>*,
    .login-logo-float {
        animation: none !important;
    }
}