/* ===================================
   WhispeeAi - Header Enhancements
   Advanced animations and effects for the header/navbar
   =================================== */

/* Floating particles effect for navbar background */
.navbar::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    background-image: 
        radial-gradient(circle at 20% 50%, rgba(102, 126, 234, 0.03) 0%, transparent 50%),
        radial-gradient(circle at 80% 30%, rgba(240, 147, 251, 0.03) 0%, transparent 50%),
        radial-gradient(circle at 40% 80%, rgba(118, 75, 162, 0.03) 0%, transparent 50%);
    animation: particles-float 20s ease-in-out infinite;
    pointer-events: none;
    z-index: -1;
}

@keyframes particles-float {
    0%, 100% {
        background-position: 0% 0%, 100% 0%, 50% 100%;
    }
    50% {
        background-position: 100% 100%, 0% 100%, 0% 0%;
    }
}

/* Magnetic effect for nav links */
.nav-links a {
    transform-style: preserve-3d;
    will-change: transform;
}

/* Ripple effect on button click */
.btn-primary,
.btn-secondary,
.btn-outline {
    overflow: hidden;
    position: relative;
}

.ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    transform: scale(0);
    animation: ripple-animation 0.6s ease-out;
    pointer-events: none;
}

@keyframes ripple-animation {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* Glassmorphism enhancement for scrolled state */
.navbar.scrolled {
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(30px) saturate(180%) brightness(1.1);
    -webkit-backdrop-filter: blur(30px) saturate(180%) brightness(1.1);
}

/* Navbar border glow effect */
.navbar.scrolled::before {
    box-shadow: inset 0 -1px 0 0 rgba(102, 126, 234, 0.15),
                inset 0 1px 20px 0 rgba(102, 126, 234, 0.05);
}

/* User menu entrance animation variants */
.user-dropdown.slide-in {
    animation: dropdown-slide-in 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes dropdown-slide-in {
    0% {
        opacity: 0;
        transform: translateY(-20px) scale(0.9);
    }
    50% {
        transform: translateY(5px) scale(1.02);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Stagger animation for dropdown items */
.user-dropdown.active .dropdown-item {
    animation: item-fade-in 0.3s ease-out backwards;
}

.user-dropdown.active .dropdown-item:nth-child(1) { animation-delay: 0.05s; }
.user-dropdown.active .dropdown-item:nth-child(2) { animation-delay: 0.1s; }
.user-dropdown.active .dropdown-item:nth-child(3) { animation-delay: 0.15s; }
.user-dropdown.active .dropdown-item:nth-child(4) { animation-delay: 0.2s; }

@keyframes item-fade-in {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Mobile menu slide animation enhancement */
@media (max-width: 768px) {
    .nav-links.active a {
        animation: mobile-link-slide 0.4s ease-out backwards;
    }
    
    .nav-links.active a:nth-child(1) { animation-delay: 0.1s; }
    .nav-links.active a:nth-child(2) { animation-delay: 0.15s; }
    .nav-links.active a:nth-child(3) { animation-delay: 0.2s; }
    .nav-links.active a:nth-child(4) { animation-delay: 0.25s; }
    .nav-links.active a:nth-child(5) { animation-delay: 0.3s; }
    
    @keyframes mobile-link-slide {
        from {
            opacity: 0;
            transform: translateX(30px);
        }
        to {
            opacity: 1;
            transform: translateX(0);
        }
    }
}

/* Breathing animation for important buttons */
@keyframes btn-breathe {
    0%, 100% {
        box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    }
    50% {
        box-shadow: 0 6px 25px rgba(102, 126, 234, 0.6),
                    0 0 30px rgba(240, 147, 251, 0.3);
    }
}

.nav-links .btn-primary {
    animation: btn-breathe 3s ease-in-out infinite;
}

/* Scroll reveal animation for navbar */
.navbar {
    animation: navbar-reveal 0.6s ease-out;
}

@keyframes navbar-reveal {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Enhanced focus states for accessibility */
.nav-links a:focus-visible,
.btn-primary:focus-visible,
.btn-secondary:focus-visible,
.btn-outline:focus-visible {
    outline: 3px solid rgba(102, 126, 234, 0.5);
    outline-offset: 3px;
    border-radius: 8px;
}

/* Gradient text animation for logo */
@keyframes gradient-text-shift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

.logo span {
    background-size: 200% auto;
    animation: gradient-text-shift 6s ease infinite;
}

/* Micro-interactions for better UX */
.nav-links a,
.btn-primary,
.btn-secondary,
.btn-outline,
.logo {
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

/* Prevent layout shift */
.navbar,
.nav-wrapper {
    contain: layout;
}

/* Performance optimization */
.navbar,
.nav-links,
.logo,
.user-dropdown {
    will-change: transform, opacity;
}

/* Smooth color transitions */
* {
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}
