/* ==========================================================================
   COMBINED NAVBAR & SPARKLE EFFECTS STYLESHEET
   ========================================================================== */

/* Navbar-specific styles only - body styles handled in style.css */

/* Ensure parent containers don't interfere with sticky */
html, body {
    position: relative; /* Required for sticky to work properly */
}

/* Force sticky behavior with fallback */
nav.navbar {
    position: -webkit-sticky !important;
    position: sticky !important;
    top: 0 !important;
    z-index: 9999 !important;
}

/* Sparkle CSS Variables */
:root {
    --sparkle-color: #00fffc;
    --sparkle-color-40: #00fffc66;
    --sparkle-color-45: #00fffc45;
    --sparkle-color-50: #00fffc50;
    --sparkle-color-80: #00fffc80;
}

/* ==========================================================================
   NAVBAR BASE STYLES
   ========================================================================== */

.navbar {
    position: sticky !important;
    top: 0 !important;
    width: 100% !important;
    background-color: rgba(34, 34, 34, 0.95) !important;
    color: white !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 15px 30px !important;
    z-index: 9999 !important;
    box-sizing: border-box !important;
    margin: 0 !important;
    border: none !important;
    position: relative;
}

/* Lightning Active Element */
.navbar .active-element {
    --active-element-scale-x: 1;
    --active-element-scale-y: 1;
    --active-element-show: 0;
    --active-element-opacity: 0;
    --active-element-width: 0px;
    --active-element-strike-x: 0%;
    --active-element-mask-position: 0%;
    position: absolute;
    left: 0;
    bottom: -3px;
    height: 3px;
    width: 36px;
    max-width: 36px;
    border-radius: 2px;
    background-color: #00fffc;
    opacity: var(--active-element-show);
    transition: opacity 0.2s ease;
    z-index: 10;
}

.navbar .active-element > svg,
.navbar .active-element .strike {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    opacity: var(--active-element-opacity);
    width: var(--active-element-width);
    mix-blend-mode: multiply;
}

.navbar .active-element > svg {
    display: block;
    overflow: visible;
    height: 5px;
    filter: blur(0.5px) drop-shadow(2px 0px 8px #00fffc40) drop-shadow(1px 0px 2px #00fffc80) drop-shadow(0px 0px 3px #00fffc40) drop-shadow(2px 0px 8px #00fffc45) drop-shadow(8px 0px 16px #00fffc50);
}

.navbar .active-element .strike {
    padding: 24px 0;
    -webkit-mask-image: linear-gradient(to right, transparent calc(0% + var(--active-element-mask-position)), black calc(15% + var(--active-element-mask-position)), black 80%, transparent);
    mask-image: linear-gradient(to right, transparent calc(0% + var(--active-element-mask-position)), black calc(15% + var(--active-element-mask-position)), black 80%, transparent);
}

.navbar .active-element .strike svg {
    display: block;
    overflow: visible;
    height: 12px;
    width: calc(var(--active-element-width) * 2);
    transform: translate(var(--active-element-strike-x), 30%) scale(var(--active-element-scale-x), var(--active-element-scale-y));
}

.navbar .active-element .strike svg:last-child {
    transform: translate(var(--active-element-strike-x), -30%) scale(-1);
}

.navbar .active-element .strike svg g path:nth-child(2) {
    filter: blur(2px);
}

.navbar .active-element .strike svg g path:nth-child(3) {
    filter: blur(4px);
}

.navbar.before .active-element {
    transform: rotateY(180deg);
}

.navbar.after .active-element {
    transform: rotateY(0deg);
}

.navbar.blurred {
    backdrop-filter: blur(12px);
    background: rgba(34, 34, 34, 0.85);
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.logo {
    font-size: 1.3em; /* Reduced logo size */
    font-weight: bold;
    flex-shrink: 0; /* Prevent logo from shrinking */
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 20px;
    margin: 0;
    padding: 0;
    position: relative; /* Keep for sparkle positioning */
    flex: 1;
    justify-content: center;
}

.nav-links li {
    margin: 0; /* Using gap instead */
}

.nav-links li a {
    color: white;
    text-decoration: none;
    font-size: 1.2em;
    transition: color 0.3s ease;
    font-weight: 600;
}

.nav-links li a:hover {
    color: #00bcd4;
}

/* Navbar right section */
.navbar-right {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-shrink: 0; /* Prevent shrinking */
}

/* FPS Counter */
.fps-counter {
    font-size: 0.9em;
    color: #00bcd4;
    font-weight: 600;
    background: rgba(0, 188, 212, 0.1);
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid rgba(0, 188, 212, 0.3);
    min-width: 60px;
    text-align: center;
}

/* Hamburger menu */
.menu-toggle {
    display: none;
    flex-direction: column;
    cursor: pointer;
}

.menu-toggle span {
    width: 25px;
    height: 3px;
    background: white;
    margin: 4px;
    transition: all 0.3s ease;
}

/* Hamburger Animation */
.menu-toggle.open span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.menu-toggle.open span:nth-child(2) {
    opacity: 0;
}

.menu-toggle.open span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

/* Mobile Styles */
@media (max-width: 768px) {
    .navbar {
        padding: 14px 20px;
        justify-content: space-between;
        align-items: center;
        height: 60px;
        position: sticky;
        width: 100%;
    }
    
    .logo {
        order: 1;
        flex: 0 0 auto;
    }

    .navbar-right {
        gap: 10px;
        order: 3;
        flex: 0 0 auto;
        margin-left: auto;
    }

    .fps-counter {
        font-size: 0.8em;
        padding: 3px 6px;
        min-width: 50px;
    }

    .menu-toggle {
        display: flex;
        z-index: 1001;
        padding: 5px;
    }

    .nav-links {
        position: fixed;
        top: 0;
        right: -100%;
        height: 100vh;
        width: 280px;
        background: rgba(34, 34, 34, 0.98);
        backdrop-filter: blur(10px);
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 0;
        transition: right 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
        box-shadow: -5px 0 15px rgba(0, 0, 0, 0.3);
        transform: none;
        left: auto;
    }

    .nav-links li {
        margin: 25px 0;
        opacity: 0;
        transform: translateX(50px);
        transition: all 0.3s ease;
    }

    .nav-links.active {
        right: 0;
    }

    .nav-links.active li {
        opacity: 1;
        transform: translateX(0);
    }

    .nav-links.active li:nth-child(1) { transition-delay: 0.1s; }
    .nav-links.active li:nth-child(2) { transition-delay: 0.2s; }
    .nav-links.active li:nth-child(3) { transition-delay: 0.3s; }
    .nav-links.active li:nth-child(4) { transition-delay: 0.4s; }

    .nav-links a {
        font-size: 1.5em;
        padding: 10px 20px;
        border-radius: 8px;
        transition: all 0.3s ease;
    }

    .nav-links a:hover {
        background: rgba(0, 188, 212, 0.2);
        color: #00bcd4;
    }
}

/* Enhanced fixed navbar behavior */
.navbar {
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    transform: translateZ(0); /* Force hardware acceleration */
}

/* Tablet Styles */
@media (max-width: 1024px) and (min-width: 769px) {
    .navbar {
        padding: 14px 25px;
        height: 60px;
    }
    
    .nav-links a {
        font-size: 1.1em;
        margin: 0 12px;
    }
}

/* ==========================================================================
   SPARKLE NAVBAR EFFECTS
   ========================================================================== */

/* Sparkle navigation effects */
.navbar.sparkle-nav {
    position: relative;
}

.navbar.sparkle-nav .nav-links {
    position: relative;
}

/* Sparkle hover effects for non-active items */
.navbar.sparkle-nav .nav-links li:not(.active):hover a {
    text-shadow: 0 0 10px var(--sparkle-color), 
                 0 0 20px var(--sparkle-color);
    transition: text-shadow 0.25s ease;
}

/* Active sparkle element */
.sparkle-active-element {
    --active-element-scale-x: 1;
    --active-element-scale-y: 1;
    --active-element-show: 0;
    --active-element-opacity: 0;
    --active-element-width: 0px;
    --active-element-strike-x: 0%;
    --active-element-mask-position: 0%;
    position: absolute;
    left: 0;
    top: 50px;
    height: 3px;
    width: 36px;
    max-width: 36px;
    border-radius: 2px;
    background-color: var(--sparkle-color);
    opacity: var(--active-element-show);
    pointer-events: none;
    z-index: 1001;
    overflow: hidden;
    transition: transform 0.3s ease;
}

/* SVG beam and strike elements */
.sparkle-active-element > svg,
.sparkle-active-element .strike {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    opacity: var(--active-element-opacity);
    width: var(--active-element-width);
    max-width: 100px;
    mix-blend-mode: multiply;
    overflow: hidden;
}

.sparkle-active-element > svg {
    display: block;
    overflow: visible;
    height: 5px;
    filter: blur(0.5px) 
            drop-shadow(2px 0px 8px var(--sparkle-color-40)) 
            drop-shadow(1px 0px 2px var(--sparkle-color-80)) 
            drop-shadow(0px 0px 3px var(--sparkle-color-40)) 
            drop-shadow(2px 0px 8px var(--sparkle-color-45)) 
            drop-shadow(8px 0px 16px var(--sparkle-color-50));
}

.sparkle-active-element .strike {
    padding: 24px 0;
    -webkit-mask-image: linear-gradient(to right, 
        transparent calc(0% + var(--active-element-mask-position)), 
        black calc(15% + var(--active-element-mask-position)), 
        black 80%, 
        transparent);
    mask-image: linear-gradient(to right, 
        transparent calc(0% + var(--active-element-mask-position)), 
        black calc(15% + var(--active-element-mask-position)), 
        black 80%, 
        transparent);
}

.sparkle-active-element .strike svg {
    display: block;
    overflow: visible;
    height: 12px;
    width: calc(var(--active-element-width) * 2);
    transform: translate(var(--active-element-strike-x), 30%) 
              scale(var(--active-element-scale-x), var(--active-element-scale-y));
}

.sparkle-active-element .strike svg:last-child {
    transform: translate(var(--active-element-strike-x), -30%) scale(-1);
}

.sparkle-active-element .strike svg g path:nth-child(2) {
    filter: blur(2px);
}

.sparkle-active-element .strike svg g path:nth-child(3) {
    filter: blur(4px);
}

/* Direction-based animations */
.navbar.sparkle-nav.before .sparkle-active-element {
    transform: rotateY(180deg);
}

/* Enhanced active link styling */
.navbar.sparkle-nav .nav-links a.sparkle-active {
    color: var(--sparkle-color);
    text-shadow: 0 0 15px var(--sparkle-color);
}

/* ==========================================================================
   SPARKLE THEME VARIATIONS
   ========================================================================== */

.navbar.sparkle-nav.theme-red {
    --sparkle-color: #ff6b6b;
    --sparkle-color-40: #ff6b6b66;
    --sparkle-color-45: #ff6b6b45;
    --sparkle-color-50: #ff6b6b50;
    --sparkle-color-80: #ff6b6b80;
}

.navbar.sparkle-nav.theme-blue {
    --sparkle-color: #45b7d1;
    --sparkle-color-40: #45b7d166;
    --sparkle-color-45: #45b7d145;
    --sparkle-color-50: #45b7d150;
    --sparkle-color-80: #45b7d180;
}

.navbar.sparkle-nav.theme-purple {
    --sparkle-color: #a78bfa;
    --sparkle-color-40: #a78bfa66;
    --sparkle-color-45: #a78bfa45;
    --sparkle-color-50: #a78bfa50;
    --sparkle-color-80: #a78bfa80;
}

.navbar.sparkle-nav.theme-green {
    --sparkle-color: #4ecdc4;
    --sparkle-color-40: #4ecdc466;
    --sparkle-color-45: #4ecdc445;
    --sparkle-color-50: #4ecdc450;
    --sparkle-color-80: #4ecdc480;
}

/* ==========================================================================
   SPARKLE MOBILE RESPONSIVE ADJUSTMENTS
   ========================================================================== */

@media (max-width: 768px) {
    .sparkle-active-element {
        top: 45px;
        height: 2px;
        width: 30px;
    }
    
    .sparkle-active-element > svg {
        height: 4px;
    }
    
    .sparkle-active-element .strike svg {
        height: 10px;
    }
    
    /* Hide sparkle effects in mobile menu */
    .nav-links.active .sparkle-active-element {
        display: none;
    }
}
