/* Modern Animated Background - Inspired by Apple & Stripe */
body {
    position: relative;
}

/* Add premium gradient background to dark theme */
body.dark-theme {
    background: 
        linear-gradient(rgba(15, 15, 15, 0.92), rgba(15, 15, 15, 0.92)),
        radial-gradient(at 0% 0%, rgba(94, 96, 206, 0.6) 0%, transparent 50%),
        radial-gradient(at 100% 0%, rgba(105, 48, 195, 0.5) 0%, transparent 50%),
        radial-gradient(at 0% 100%, rgba(116, 0, 184, 0.55) 0%, transparent 50%),
        radial-gradient(at 100% 100%, rgba(94, 96, 206, 0.45) 0%, transparent 50%);
    background-attachment: fixed;
}

/* Light mode background */
body:not(.dark-theme) {
    background: 
        linear-gradient(rgba(255, 255, 255, 1), rgba(255, 255, 255, 1)),
        radial-gradient(at 0% 0%, rgba(0, 113, 227, 0.05) 0%, transparent 50%),
        radial-gradient(at 100% 0%, rgba(64, 169, 255, 0.05) 0%, transparent 50%),
        radial-gradient(at 0% 100%, rgba(24, 144, 255, 0.05) 0%, transparent 50%),
        radial-gradient(at 100% 100%, rgba(0, 113, 227, 0.05) 0%, transparent 50%);
    background-attachment: fixed;
}

/* Add subtle grid overlay */
.grid-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -2;
    background-image: 
        linear-gradient(to right, rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 30px 30px;
    pointer-events: none;
}

/* Light mode grid overlay */
body:not(.dark-theme) .grid-overlay {
    background-image: 
        linear-gradient(to right, rgba(0, 0, 0, 0.02) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(0, 0, 0, 0.02) 1px, transparent 1px);
    background-size: 30px 30px;
}

/* Floating blobs - to create organic shapes like Apple's UI */
.floating-blob {
    position: fixed;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.5;
    pointer-events: none;
    z-index: -3;
    background: var(--primary-gradient);
    animation: float-animation 20s infinite alternate ease-in-out;
}

/* Light mode blobs */
body:not(.dark-theme) .floating-blob {
    opacity: 0.2;
    filter: blur(80px);
}

#blob1 {
    width: 40vw;
    height: 40vw;
    top: -10%;
    left: -5%;
    background: radial-gradient(circle at center, rgba(94, 96, 206, 0.7), rgba(94, 96, 206, 0));
    animation-delay: 0s;
}

body:not(.dark-theme) #blob1 {
    background: radial-gradient(circle at center, rgba(0, 113, 227, 0.3), rgba(0, 113, 227, 0));
}

#blob2 {
    width: 35vw;
    height: 35vw;
    bottom: -15%;
    right: -5%;
    background: radial-gradient(circle at center, rgba(116, 0, 184, 0.7), rgba(116, 0, 184, 0));
    animation-delay: -5s;
}

body:not(.dark-theme) #blob2 {
    background: radial-gradient(circle at center, rgba(64, 169, 255, 0.3), rgba(64, 169, 255, 0));
}

#blob3 {
    width: 45vw;
    height: 45vw;
    bottom: 20%;
    left: -15%;
    background: radial-gradient(circle at center, rgba(105, 48, 195, 0.6), rgba(105, 48, 195, 0));
    animation-delay: -10s;
}

body:not(.dark-theme) #blob3 {
    background: radial-gradient(circle at center, rgba(24, 144, 255, 0.3), rgba(24, 144, 255, 0));
}

#blob4 {
    width: 30vw;
    height: 30vw;
    top: 15%;
    right: -10%;
    background: radial-gradient(circle at center, rgba(94, 96, 206, 0.7), rgba(94, 96, 206, 0));
    animation-delay: -15s;
}

body:not(.dark-theme) #blob4 {
    background: radial-gradient(circle at center, rgba(0, 113, 227, 0.3), rgba(0, 113, 227, 0));
}

@keyframes float-animation {
    0% {
        transform: translate(0, 0) scale(1);
    }
    33% {
        transform: translate(3%, 3%) scale(1.05);
    }
    66% {
        transform: translate(-3%, 1%) scale(0.95);
    }
    100% {
        transform: translate(0, 0) scale(1);
    }
}

/* Animation for background gradients */
@keyframes gradientAnimation {
    0% {
        background-position: 0% 0%, 0% 0%, 100% 0%, 0% 100%, 100% 100%;
    }
    50% {
        background-position: 0% 0%, 50% 50%, 150% 50%, 50% 150%, 150% 150%;
    }
    100% {
        background-position: 0% 0%, 0% 0%, 100% 0%, 0% 100%, 100% 100%;
    }
}

/* Apply animation */
body.dark-theme {
    animation: gradientAnimation 25s ease infinite;
}

body:not(.dark-theme) {
    animation: gradientAnimation 30s ease infinite;
}

/* Media query for mobile optimization */
@media (max-width: 768px) {
    .floating-blob {
        opacity: 0.4;
        filter: blur(50px);
    }
    
    body:not(.dark-theme) .floating-blob {
        opacity: 0.15;
    }
    
    #blob1, #blob2, #blob3, #blob4 {
        width: 70vw;
        height: 70vw;
    }
}
