/* Particles.js Styling */
#particles-js {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    opacity: 0.6;
    pointer-events: none;
}

/* Custom Particle Animations */
.particle {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.8);
    animation: float 6s ease-in-out infinite;
    pointer-events: none;
}

.particle:nth-child(odd) {
    animation-delay: -2s;
    animation-duration: 8s;
}

.particle:nth-child(even) {
    animation-delay: -4s;
    animation-duration: 10s;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px) rotate(0deg);
        opacity: 0.8;
    }
    25% {
        transform: translateY(-20px) rotate(90deg);
        opacity: 1;
    }
    50% {
        transform: translateY(-10px) rotate(180deg);
        opacity: 0.6;
    }
    75% {
        transform: translateY(-30px) rotate(270deg);
        opacity: 1;
    }
}

/* Floating Elements */
.floating-element {
    position: absolute;
    pointer-events: none;
    z-index: 0;
    opacity: 0.1;
}

.floating-element-1 {
    top: 10%;
    left: 10%;
    width: 60px;
    height: 60px;
    background: linear-gradient(45deg, #667eea, #764ba2);
    border-radius: 50%;
    animation: floatUpDown 8s ease-in-out infinite;
}

.floating-element-2 {
    top: 20%;
    right: 15%;
    width: 40px;
    height: 40px;
    background: linear-gradient(45deg, #4facfe, #00f2fe);
    border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
    animation: floatLeftRight 10s ease-in-out infinite;
}

.floating-element-3 {
    bottom: 30%;
    left: 20%;
    width: 80px;
    height: 80px;
    background: linear-gradient(45deg, #43e97b, #38f9d7);
    border-radius: 20%;
    animation: floatRotate 12s linear infinite;
}

.floating-element-4 {
    bottom: 10%;
    right: 10%;
    width: 50px;
    height: 50px;
    background: linear-gradient(45deg, #fa709a, #fee140);
    border-radius: 50% 20% 50% 20%;
    animation: floatUpDown 6s ease-in-out infinite reverse;
}

.floating-element-5 {
    top: 50%;
    left: 5%;
    width: 30px;
    height: 30px;
    background: linear-gradient(45deg, #ff6b6b, #ffa726);
    border-radius: 50%;
    animation: floatDiagonal 14s ease-in-out infinite;
}

.floating-element-6 {
    top: 70%;
    right: 25%;
    width: 70px;
    height: 70px;
    background: linear-gradient(45deg, #f093fb, #f5576c);
    border-radius: 40% 60% 60% 40% / 60% 30% 70% 40%;
    animation: floatScale 9s ease-in-out infinite;
}

/* Floating Animations */
@keyframes floatUpDown {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-30px);
    }
}

@keyframes floatLeftRight {
    0%, 100% {
        transform: translateX(0px);
    }
    50% {
        transform: translateX(25px);
    }
}

@keyframes floatRotate {
    0% {
        transform: rotate(0deg) translateY(0px);
    }
    25% {
        transform: rotate(90deg) translateY(-15px);
    }
    50% {
        transform: rotate(180deg) translateY(0px);
    }
    75% {
        transform: rotate(270deg) translateY(-15px);
    }
    100% {
        transform: rotate(360deg) translateY(0px);
    }
}

@keyframes floatDiagonal {
    0%, 100% {
        transform: translate(0px, 0px);
    }
    25% {
        transform: translate(15px, -15px);
    }
    50% {
        transform: translate(30px, 0px);
    }
    75% {
        transform: translate(15px, 15px);
    }
}

@keyframes floatScale {
    0%, 100% {
        transform: scale(1) rotate(0deg);
    }
    25% {
        transform: scale(1.2) rotate(90deg);
    }
    50% {
        transform: scale(0.8) rotate(180deg);
    }
    75% {
        transform: scale(1.1) rotate(270deg);
    }
}

/* Particle Trail Effect */
.particle-trail {
    position: absolute;
    width: 2px;
    height: 2px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 50%;
    pointer-events: none;
    animation: trail 3s linear infinite;
}

@keyframes trail {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    100% {
        opacity: 0;
        transform: scale(0);
    }
}

/* Glowing Orbs */
.glowing-orb {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.8) 0%, rgba(255, 255, 255, 0) 70%);
    pointer-events: none;
    animation: glow 4s ease-in-out infinite alternate;
}

.glowing-orb-1 {
    top: 15%;
    left: 80%;
    width: 100px;
    height: 100px;
    background: radial-gradient(circle, rgba(102, 126, 234, 0.3) 0%, rgba(102, 126, 234, 0) 70%);
    animation-delay: -1s;
}

.glowing-orb-2 {
    bottom: 25%;
    left: 10%;
    width: 80px;
    height: 80px;
    background: radial-gradient(circle, rgba(79, 172, 254, 0.3) 0%, rgba(79, 172, 254, 0) 70%);
    animation-delay: -2s;
}

.glowing-orb-3 {
    top: 60%;
    right: 5%;
    width: 120px;
    height: 120px;
    background: radial-gradient(circle, rgba(67, 233, 123, 0.3) 0%, rgba(67, 233, 123, 0) 70%);
    animation-delay: -3s;
}

@keyframes glow {
    0% {
        opacity: 0.3;
        transform: scale(1);
    }
    100% {
        opacity: 0.8;
        transform: scale(1.2);
    }
}

/* Responsive Particles */
@media (max-width: 768px) {
    #particles-js {
        opacity: 0.4;
    }
    
    .floating-element {
        opacity: 0.05;
    }
    
    .floating-element-1,
    .floating-element-3 {
        width: 40px;
        height: 40px;
    }
    
    .floating-element-2,
    .floating-element-4,
    .floating-element-5 {
        width: 25px;
        height: 25px;
    }
    
    .floating-element-6 {
        width: 50px;
        height: 50px;
    }
    
    .glowing-orb-1 {
        width: 60px;
        height: 60px;
    }
    
    .glowing-orb-2 {
        width: 50px;
        height: 50px;
    }
    
    .glowing-orb-3 {
        width: 70px;
        height: 70px;
    }
}

@media (max-width: 480px) {
    #particles-js {
        opacity: 0.3;
    }
    
    .floating-element {
        opacity: 0.03;
    }
    
    .floating-element-1,
    .floating-element-3 {
        width: 30px;
        height: 30px;
    }
    
    .floating-element-2,
    .floating-element-4,
    .floating-element-5 {
        width: 20px;
        height: 20px;
    }
    
    .floating-element-6 {
        width: 35px;
        height: 35px;
    }
    
    .glowing-orb {
        display: none;
    }
}

/* Performance Optimizations */
@media (prefers-reduced-motion: reduce) {
    #particles-js,
    .floating-element,
    .glowing-orb,
    .particle-trail {
        animation: none !important;
        opacity: 0.1 !important;
    }
}

/* Battery Saving Mode */
@media (max-width: 480px) and (max-height: 800px) {
    #particles-js {
        display: none;
    }
    
    .floating-element,
    .glowing-orb {
        display: none;
    }
}

/* High Performance Mode */
.performance-mode #particles-js {
    opacity: 0.2;
}

.performance-mode .floating-element {
    animation-duration: 20s;
    opacity: 0.02;
}

.performance-mode .glowing-orb {
    animation-duration: 8s;
    opacity: 0.1;
}

/* Custom Particle Colors Based on Theme */
.theme-purple #particles-js canvas {
    filter: hue-rotate(0deg);
}

.theme-blue #particles-js canvas {
    filter: hue-rotate(60deg);
}

.theme-green #particles-js canvas {
    filter: hue-rotate(120deg);
}

.theme-orange #particles-js canvas {
    filter: hue-rotate(180deg);
}

.theme-red #particles-js canvas {
    filter: hue-rotate(240deg);
}

.theme-pink #particles-js canvas {
    filter: hue-rotate(300deg);
}

/* Particle Interaction Effects */
.particle-burst {
    position: absolute;
    pointer-events: none;
    z-index: 10;
}

.particle-burst::before {
    content: '';
    position: absolute;
    width: 4px;
    height: 4px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    animation: burst 0.6s ease-out forwards;
}

@keyframes burst {
    0% {
        opacity: 1;
        transform: scale(0);
    }
    50% {
        opacity: 0.8;
        transform: scale(3);
    }
    100% {
        opacity: 0;
        transform: scale(6);
    }
}

/* Smooth Transitions */
#particles-js,
.floating-element,
.glowing-orb {
    transition: opacity 0.3s ease;
}

/* Loading Animation */
.particles-loading {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.particles-loading.show {
    opacity: 1;
}

.loading-particle {
    width: 8px;
    height: 8px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    display: inline-block;
    margin: 0 2px;
    animation: loadingBounce 1.4s ease-in-out infinite both;
}

.loading-particle:nth-child(1) { animation-delay: -0.32s; }
.loading-particle:nth-child(2) { animation-delay: -0.16s; }
.loading-particle:nth-child(3) { animation-delay: 0s; }

@keyframes loadingBounce {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1);
    }
}