/* Navbar Animation Effects */

/* ============================================
   ANIMATED PARTICLES BACKGROUND
   ============================================ */

/* Particle container */
.navbar-particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
    z-index: 1;
}

/* Individual particles */
.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: radial-gradient(circle, rgba(255,255,255,0.8) 0%, transparent 70%);
    border-radius: 50%;
    animation: float-particle 20s infinite linear;
    opacity: 0;
}

/* Different particle sizes and colors */
.particle:nth-child(odd) {
    width: 3px;
    height: 3px;
    animation-duration: 25s;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.6) 0%, transparent 70%);
}

.particle:nth-child(even) {
    width: 5px;
    height: 5px;
    animation-duration: 15s;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.6) 0%, transparent 70%);
}

/* Particle animation */
@keyframes float-particle {
    0% {
        transform: translateY(100vh) translateX(0) scale(0);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(-100vh) translateX(100px) scale(1.5);
        opacity: 0;
    }
}

/* Only show particles on scrolled navbar */
.navbar-transparent .navbar-particles {
    display: none;
}

.navbar-scrolled .navbar-particles {
    display: block;
}

/* ============================================
   ANIMATED GRADIENT BACKGROUND
   ============================================ */

/* Animated gradient overlay */
.navbar-gradient-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        -45deg,
        rgba(59, 130, 246, 0.05),
        rgba(139, 92, 246, 0.05),
        rgba(236, 72, 153, 0.05),
        rgba(59, 130, 246, 0.05)
    );
    background-size: 400% 400%;
    animation: gradient-shift 15s ease infinite;
    z-index: 0;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.navbar-scrolled .navbar-gradient-overlay {
    opacity: 1;
}

@keyframes gradient-shift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* ============================================
   WAVE ANIMATION EFFECT
   ============================================ */

.navbar-wave {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, 
        transparent,
        rgba(59, 130, 246, 0.8),
        rgba(139, 92, 246, 0.8),
        transparent
    );
    animation: wave-animation 3s linear infinite;
    transform: translateX(-100%);
    opacity: 0;
    transition: opacity 0.5s ease;
}

.navbar-scrolled .navbar-wave {
    opacity: 1;
}

@keyframes wave-animation {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

/* ============================================
   GLOW EFFECT ON TRANSPARENT NAVBAR
   ============================================ */

.navbar-transparent::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.1) 20%,
        rgba(255, 255, 255, 0.2) 50%,
        rgba(255, 255, 255, 0.1) 80%,
        transparent 100%
    );
    animation: glow-sweep 8s linear infinite;
    pointer-events: none;
    z-index: 2;
}

@keyframes glow-sweep {
    0% {
        transform: translateX(-200%);
    }
    100% {
        transform: translateX(200%);
    }
}

/* ============================================
   FLOATING ORBS BACKGROUND
   ============================================ */

.navbar-orbs {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(40px);
    opacity: 0.3;
    animation: float-orb 20s infinite ease-in-out;
}

.orb-1 {
    width: 150px;
    height: 150px;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.8), transparent);
    top: -50px;
    left: -50px;
    animation-delay: 0s;
}

.orb-2 {
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.8), transparent);
    top: -100px;
    right: -100px;
    animation-delay: 5s;
}

.orb-3 {
    width: 100px;
    height: 100px;
    background: radial-gradient(circle, rgba(236, 72, 153, 0.8), transparent);
    bottom: -50px;
    left: 50%;
    animation-delay: 10s;
}

@keyframes float-orb {
    0%, 100% {
        transform: translate(0, 0) scale(1);
    }
    25% {
        transform: translate(30px, -30px) scale(1.1);
    }
    50% {
        transform: translate(-20px, 20px) scale(0.9);
    }
    75% {
        transform: translate(40px, 10px) scale(1.05);
    }
}

/* Only show orbs on scrolled navbar */
.navbar-transparent .navbar-orbs {
    display: none;
}

/* ============================================
   MENU ITEM ANIMATIONS
   ============================================ */

/* Hover effect with animated underline */
.navbar-nav .nav-link,
.navbar-nav .page-scroll {
    position: relative;
    overflow: hidden;
}

.navbar-nav .nav-link::before,
.navbar-nav .page-scroll::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, 
        rgba(59, 130, 246, 0.8),
        rgba(139, 92, 246, 0.8)
    );
    transition: width 0.3s ease;
}

.navbar-nav .nav-link:hover::before,
.navbar-nav .page-scroll:hover::before {
    width: 100%;
    animation: shimmer-line 1s linear infinite;
}

@keyframes shimmer-line {
    0% {
        background-position: -100px;
    }
    100% {
        background-position: 100px;
    }
}

/* Ripple effect on click */
.navbar-nav .nav-link::after,
.navbar-nav .page-scroll::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.navbar-nav .nav-link:active::after,
.navbar-nav .page-scroll:active::after {
    width: 300px;
    height: 300px;
    opacity: 0;
}

/* ============================================
   LOGO ANIMATION EFFECTS
   ============================================ */

/* Logo glow animation when scrolled */
.navbar-scrolled .navbar-brand {
    animation: logo-entrance 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes logo-entrance {
    0% {
        transform: scale(0) rotate(-180deg);
        opacity: 0;
        filter: blur(10px);
    }
    50% {
        transform: scale(1.1) rotate(10deg);
        filter: blur(0);
    }
    100% {
        transform: scale(1) rotate(0);
        opacity: 1;
        filter: blur(0);
    }
}

/* Logo pulse on hover */
.navbar-brand:hover .navbar-logo {
    animation: logo-pulse 1s ease-in-out infinite;
}

@keyframes logo-pulse {
    0%, 100% {
        transform: scale(1);
        filter: drop-shadow(0 0 0 transparent);
    }
    50% {
        transform: scale(1.05);
        filter: drop-shadow(0 0 20px rgba(59, 130, 246, 0.6));
    }
}

/* ============================================
   BACKGROUND PATTERN ANIMATION
   ============================================ */

.navbar-pattern {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.03;
    background-image: 
        repeating-linear-gradient(45deg, transparent, transparent 35px, rgba(59, 130, 246, 0.5) 35px, rgba(59, 130, 246, 0.5) 70px),
        repeating-linear-gradient(-45deg, transparent, transparent 35px, rgba(139, 92, 246, 0.5) 35px, rgba(139, 92, 246, 0.5) 70px);
    animation: pattern-slide 60s linear infinite;
    pointer-events: none;
    z-index: 1;
}

@keyframes pattern-slide {
    0% {
        transform: translate(0, 0);
    }
    100% {
        transform: translate(70px, 70px);
    }
}

.navbar-transparent .navbar-pattern {
    display: none;
}

/* ============================================
   MOBILE MENU ANIMATION
   ============================================ */

/* Animated background for mobile menu */
@media (max-width: 991.98px) {
    #navbarSupportedContent2.mobile-menu-open::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: linear-gradient(
            135deg,
            rgba(59, 130, 246, 0.02),
            rgba(139, 92, 246, 0.02)
        );
        animation: mobile-bg-shift 10s ease infinite;
        z-index: -1;
    }
    
    @keyframes mobile-bg-shift {
        0%, 100% {
            transform: rotate(0deg) scale(1);
        }
        50% {
            transform: rotate(180deg) scale(1.1);
        }
    }
    
    /* Staggered menu item animation */
    #navbarSupportedContent2.mobile-menu-open .nav-item {
        animation: slide-in-menu 0.5s ease forwards;
        opacity: 0;
        transform: translateX(-30px);
    }
    
    #navbarSupportedContent2.mobile-menu-open .nav-item:nth-child(1) { animation-delay: 0.1s; }
    #navbarSupportedContent2.mobile-menu-open .nav-item:nth-child(2) { animation-delay: 0.15s; }
    #navbarSupportedContent2.mobile-menu-open .nav-item:nth-child(3) { animation-delay: 0.2s; }
    #navbarSupportedContent2.mobile-menu-open .nav-item:nth-child(4) { animation-delay: 0.25s; }
    #navbarSupportedContent2.mobile-menu-open .nav-item:nth-child(5) { animation-delay: 0.3s; }
    #navbarSupportedContent2.mobile-menu-open .nav-item:nth-child(6) { animation-delay: 0.35s; }
    #navbarSupportedContent2.mobile-menu-open .nav-item:nth-child(7) { animation-delay: 0.4s; }
    
    @keyframes slide-in-menu {
        to {
            opacity: 1;
            transform: translateX(0);
        }
    }
}

/* ============================================
   PERFORMANCE OPTIMIZATIONS
   ============================================ */

/* Use GPU acceleration */
.navbar-particles,
.navbar-gradient-overlay,
.navbar-wave,
.navbar-orbs,
.navbar-pattern {
    will-change: transform, opacity;
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* Reduce animations on low-power mode */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
