/**
 * Modern Glassmorphism Navigation
 * Professional, modern navigation with glass effect
 */

/* CRITICAL: Override old navigation white background from style.css */
.site-header {
    background-color: transparent !important;  /* Override style.css line 245 */
    background: transparent !important;  /* Override style.css line 251 */
    border-bottom: none !important;  /* Remove old border */
    box-shadow: none !important;  /* Remove old shadow until we add our own */
    position: fixed !important;  /* Override sticky position */
    /* These get overridden by our glassmorphism styles below */
}

/* Hide any previous header background elements and remove old styling */
.site-header::before,
.site-header::after,
#masthead::before,
#masthead::after,
#page::before {
    display: none !important;
}

/* Remove any default backgrounds from parent elements */
#page {
    background: transparent !important;
    position: relative;
}

/* Ensure body doesn't have white corners at top */
body {
    background-position: 0 95px !important;  /* Push any body background down to match padding */
}

/* Modern Glassmorphism Header - Override all other styles */
.site-header,
#masthead.site-header,
body .site-header,
#page .site-header,
body #page .site-header {
    background: rgba(255, 255, 255, 0.78) !important;  /* Less opacity for more modern glass effect */
    background-color: rgba(255, 255, 255, 0.78) !important;
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.9) !important;
    border-bottom: 1px solid rgba(230, 230, 230, 0.3) !important;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06) !important;
    padding: 0.8rem 2rem !important;
    margin: 0 auto;  /* Center horizontally, no top margin */
    border-radius: 16px;
    position: fixed;  /* Fixed position to stay on screen */
    top: 0.8rem;  /* Small elegant gap from top */
    left: 50%;  /* Start from center */
    transform: translateX(-50%) !important;  /* Center perfectly */
    width: calc(100% - 2rem);  /* Account for margins */
    max-width: 1400px;  /* Max width for large screens */
    z-index: 10000;  /* Higher z-index to stay on top */
    transition: box-shadow 0.3s ease, background 0.3s ease;  /* Only animate non-position properties */
    min-height: 70px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-sizing: border-box;
    overflow: hidden;  /* Hide any overflow */
}

/* Sticky scroll effect - Keep navbar same style when scrolled */
body.scrolled .site-header,
body.scrolled #masthead.site-header,
body.scrolled #page .site-header {
    background: rgba(255, 255, 255, 0.82) !important;  /* Slightly more opaque when scrolled but still glassy */
    background-color: rgba(255, 255, 255, 0.82) !important;
    backdrop-filter: blur(16px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(16px) saturate(180%) !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08) !important;
    margin: 0 auto !important;
    border-radius: 16px !important;  /* Keep rounded corners */
    top: 0.8rem !important;  /* SAME gap as non-scrolled to prevent jump */
    left: 50% !important;
    transform: translateX(-50%) !important;
    border: 1px solid rgba(255, 255, 255, 0.9) !important;
    border-bottom: 1px solid rgba(230, 230, 230, 0.3) !important;
    position: fixed !important;
    width: calc(100% - 2rem) !important;  /* Keep same width as non-scrolled */
    max-width: 1400px !important;  /* Keep max-width */
    padding: 0.8rem 2rem !important;  /* Keep same padding */
    min-height: 70px !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
}

/* Add padding to body to prevent content hiding behind fixed navbar */
body {
    padding-top: 95px !important;  /* Space for fixed navbar plus top gap */
}

/* Ensure all child elements stay in place */
.site-header *,
#masthead * {
    transform: none !important;
}

/* Logo enhancement - Keep logo fixed in navbar */
.site-branding {
    display: flex;
    align-items: center;
    transition: opacity 0.3s ease;
    transform: none !important;
    position: relative;
}

.site-branding:hover {
    opacity: 0.95;
}

.site-logo {
    display: inline-block;
    text-decoration: none;
    transition: opacity 0.3s ease;  /* Only opacity, no transform */
    position: relative;
    transform: none !important;
}

/* Ensure logo image stays in place */
.site-logo img,
.header-logo {
    transform: none !important;
    position: relative;
}

.site-logo::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, #74b72a, #5a9023);
    transition: width 0.3s ease;
}

.site-logo:hover::after {
    width: 100%;
}

/* Modern Navigation Menu */
.main-navigation {
    display: flex;
    align-items: center;
}

.main-navigation .main-menu {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 0.5rem;
}

.main-navigation li {
    margin: 0;
    position: relative;
}

/* Modern Menu Items - Override all default styles */
.main-navigation a,
.main-navigation li a,
.main-navigation ul li a,
#site-navigation a,
#site-navigation li a,
#primary-menu a,
#primary-menu li a,
.main-menu a,
.main-menu li a {
    display: inline-flex !important;
    align-items: center !important;
    padding: 0.6rem 1.2rem !important;
    color: #74b72a !important;  /* Grüne Schrift für alle Menüpunkte */
    text-decoration: none !important;
    border-radius: 12px !important;
    position: relative !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    font-weight: 650 !important;
    font-size: 0.95rem !important;
    letter-spacing: 0.01em !important;
    background: transparent !important;
}

/* Glass hover effect - No transform to prevent logo movement */
.main-navigation a:hover,
.main-navigation li a:hover,
#site-navigation a:hover,
#primary-menu a:hover,
.main-menu a:hover {
    background: rgba(116, 183, 42, 0.08) !important;
    color: #5a9023 !important;  /* Dunkleres Grün beim Hover für besseren Kontrast */
    box-shadow: 0 4px 12px rgba(116, 183, 42, 0.15) !important;
}

/* Active menu item with glass effect - Extended for custom post types */
.main-navigation .current-menu-item > a,
.main-navigation .current_page_item > a,
.main-navigation .current-page-ancestor > a,
.main-navigation .current-menu-ancestor > a,
.main-navigation .current-post-type-ancestor > a,
.main-navigation .current-archive-ancestor > a,
#site-navigation .current-menu-item > a,
#site-navigation .current_page_item > a,
#site-navigation .current-menu-ancestor > a,
#primary-menu .current-menu-item > a,
#primary-menu .current_page_item > a,
#primary-menu .current-menu-ancestor > a,
body.post-type-archive-project_solar_anlage .main-navigation a[href*="projekte"],
body.single-project_solar_anlage .main-navigation a[href*="projekte"],
body.tax-project_category .main-navigation a[href*="projekte"],
body.page-slug-projekte .main-navigation a[href*="projekte"],
body.page-id-projekte .main-navigation a[href*="projekte"],
.main-navigation a[href="/projekte/"].current-menu-item {
    background: linear-gradient(135deg, rgba(116, 183, 42, 0.12), rgba(90, 144, 35, 0.08)) !important;
    color: #5a9023 !important;  /* Dunkleres Grün für aktive Seiten */
    font-weight: 780 !important;
    box-shadow: inset 0 1px 3px rgba(116, 183, 42, 0.1),
                0 2px 8px rgba(116, 183, 42, 0.1) !important;
    position: relative !important;
}

/* Animated underline for active item - LONGER */
.main-navigation .current-menu-item > a::before,
.main-navigation .current_page_item > a::before,
.main-navigation .current-page-ancestor > a::before,
.main-navigation .current-menu-ancestor > a::before,
.main-navigation .current-post-type-ancestor > a::before,
.main-navigation .current-archive-ancestor > a::before,
body.post-type-archive-project_solar_anlage .main-navigation a[href*="projekte"]::before,
body.single-project_solar_anlage .main-navigation a[href*="projekte"]::before,
body.tax-project_category .main-navigation a[href*="projekte"]::before,
body.page-slug-projekte .main-navigation a[href*="projekte"]::before,
body.page-id-projekte .main-navigation a[href*="projekte"]::before,
.main-navigation a[href="/projekte/"].current-menu-item::before {
    content: '';
    position: absolute;
    bottom: 6px;
    left: 1.2rem; /* Direkt beim Padding-Start positioniert */
    right: 1.2rem; /* Direkt beim Padding-Ende */
    transform: none; /* Keine Transform nötig */
    width: auto; /* Automatische Breite zwischen left und right */
    height: 3px;
    background: linear-gradient(90deg, #74b72a, #5a9023);
    border-radius: 2px;
    animation: pulse-underline 2s ease-in-out infinite;
}

@keyframes pulse-underline {
    0%, 100% { opacity: 1; transform: scaleX(1); }
    50% { opacity: 0.7; transform: scaleX(1.05); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: translateX(-50%) scaleX(1); }
    50% { opacity: 0.7; transform: translateX(-50%) scaleX(1.2); }
}

/* Premium button style for last menu item (Kundenportal) */
.main-navigation li:last-child a,
#primary-menu li:last-child a,
.main-menu li:last-child a {
    background: linear-gradient(135deg, #74b72a, #5a9023) !important;
    color: white !important;
    font-weight: 780;
    padding: 0.65rem 1.4rem !important;
    box-shadow: 0 4px 12px rgba(116, 183, 42, 0.25);
    position: relative;
    overflow: hidden;
}

.main-navigation li:last-child a::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.main-navigation li:last-child a:hover::before {
    left: 100%;
}

.main-navigation li:last-child a:hover,
#primary-menu li:last-child a:hover,
.main-menu li:last-child a:hover {
    box-shadow: 0 6px 20px rgba(116, 183, 42, 0.35) !important;
    color: white !important;
    opacity: 0.95;
    background: linear-gradient(135deg, #5a9023, #4a7b25) !important;
}

/* Mobile Menu Toggle - Modern Style */
.mobile-menu-toggle {
    display: none;
    background: rgba(116, 183, 42, 0.1);
    border: 1px solid rgba(116, 183, 42, 0.2);
    border-radius: 10px;
    padding: 0.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.mobile-menu-toggle:hover {
    background: rgba(116, 183, 42, 0.2);
    opacity: 0.9;
}

.hamburger-icon {
    display: block;
    width: 24px;
    height: 2px;
    background: #74b72a;
    position: relative;
    transition: all 0.3s ease;
}

.hamburger-icon::before,
.hamburger-icon::after {
    content: '';
    position: absolute;
    width: 24px;
    height: 2px;
    background: #74b72a;
    transition: all 0.3s ease;
}

.hamburger-icon::before {
    top: -7px;
}

.hamburger-icon::after {
    top: 7px;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .site-header {
        margin: 0.5rem;
        padding: 0.6rem 1.5rem !important;
    }
}

@media (max-width: 768px) {
    .site-header,
    #masthead.site-header {
        margin: 0;
        border-radius: 0;
        padding: 0.5rem 1rem !important;
        min-height: 60px;
        top: 0 !important;
        left: 0 !important;
        transform: none !important;  /* No transform on mobile */
        width: 100% !important;
    }
    
    body {
        padding-top: 70px !important;  /* Less padding on mobile */
    }
    
    .mobile-menu-toggle {
        display: block;
    }
    
    .main-navigation .main-menu {
        display: none;
        position: absolute;
        top: calc(100% + 0.5rem);
        left: 1rem;
        right: 1rem;
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(12px);
        border-radius: 12px;
        padding: 1rem;
        flex-direction: column;
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
        border: 1px solid rgba(230, 230, 230, 0.3);
    }
    
    .main-navigation.is-open .main-menu {
        display: flex;
    }
    
    .main-navigation li {
        width: 100%;
    }
    
    .main-navigation a {
        width: 100%;
        justify-content: center;
        padding: 0.8rem !important;
    }
    
    .main-navigation li:last-child a {
        margin-top: 0.5rem;
    }
    
    /* Mobile menu animation */
    .main-navigation.is-open .hamburger-icon {
        background: transparent;
    }
    
    .main-navigation.is-open .hamburger-icon::before {
        transform: rotate(45deg);
        top: 0;
    }
    
    .main-navigation.is-open .hamburger-icon::after {
        transform: rotate(-45deg);
        top: 0;
    }
}

/* Micro-interactions */
.main-navigation a {
    position: relative;
    overflow: hidden;
}

.main-navigation a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 100%;
    background: radial-gradient(circle, rgba(116, 183, 42, 0.05) 0%, transparent 70%);
    transition: all 0.5s ease;
    transform: translateX(-50%);
    pointer-events: none;
}

.main-navigation a:hover::after {
    width: 100%;
}

/* Smooth page transitions */
.site-header {
    animation: slideDown 0.5s ease-out;
}

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

/* Performance optimizations */
.site-header {
    will-change: transform, box-shadow;
}

.main-navigation a {
    will-change: transform, background-color;
}

/* Dark mode support (optional) */
@media (prefers-color-scheme: dark) {
    .site-header {
        background: rgba(30, 30, 30, 0.85) !important;
        border: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .main-navigation a {
        color: #f0f0f0 !important;
    }
    
    .main-navigation a:hover {
        background: rgba(116, 183, 42, 0.15) !important;
    }
}

/* ULTIMATE OVERRIDE - Ensure green navigation text (except Kundenportal button) */
body #page .site-header .main-navigation li:not(:last-child) a,
body #page .site-header #primary-menu li:not(:last-child) a,
body #page .site-header .main-menu li:not(:last-child) a,
body .site-header nav li:not(:last-child) a,
body header nav li:not(:last-child) a,
body header#masthead nav li:not(:last-child) a {
    color: #74b72a !important;
}

/* Ensure Kundenportal button stays white text on green background */
body #page .site-header .main-navigation li:last-child a,
body #page .site-header #primary-menu li:last-child a,
body #page .site-header .main-menu li:last-child a {
    color: white !important;
    background: linear-gradient(135deg, #74b72a, #5a9023) !important;
}

/* Ensure hover states are also green */
body #page .site-header .main-navigation a:hover,
body #page .site-header #primary-menu a:hover,
body header nav a:hover {
    color: #5a9023 !important;
}