/* Header Styles */
.site-header {
    background: #ffffff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: relative;
    z-index: 1000;
    padding: 0;
    min-height: 80px;
}

/* Mobile Header */
.header-mobile {
    display: block;
    position: relative;
    padding: 1rem;
    min-height: 80px;
}

/* Desktop Header - Hidden on Mobile */
.header-desktop {
    display: none;
}

.site-header .trp-language-switcher {
    width: auto;
}

.site-header .trp-language-switcher > div {
    border: 0;
    padding-block: 0;
}

/* .site-header .trp-language-switcher > div > a {
    padding-inline: 0;
} */
/* Desktop Layout */
@media (min-width: 768px) {
    .header-mobile {
        display: none;
    }
    
    .header-desktop {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0 20px;
        min-height: 100px;
    }

    /* Left Menu */
    .nav-left {
        order: 1;
        flex: 1;
        display: flex;
        justify-content: flex-start;
    }

    /* Logo */
    .site-branding {
        order: 2;
        flex: 0 0 auto;
        text-align: center;
        margin: 0 2rem;
    }

    /* Right Menu */
    .nav-right {
        order: 3;
        flex: 1;
        display: flex;
        justify-content: flex-end;
    }

    .nav-left ul li.current-menu-item > a,
    .nav-right ul li.current-menu-item > a {
        color: var(--wp--preset--color--primary);
    }

    /* Navigation Menu Styles */
    .site-header nav {
        display: flex;
        align-items: center;
    }

    .site-header nav ul {
        display: flex;
        list-style: none;
        margin: 0;
        padding: 0;
        gap: 2rem;
    }

    .site-header nav ul li {
        position: relative;
    }

    .site-header nav ul li a {
        color: #333333;
        text-decoration: none;
        font-weight: 500;
        font-size: 1rem;
        padding: 0.5rem 0;
        transition: color 0.3s ease;
        display: block;
    }

    .site-header nav ul li a:hover {
        color: #007cba;
    }

    /* Submenu */
    .site-header nav ul ul {
        position: absolute;
        top: 100%;
        left: 0;
        background: #ffffff;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
        border-radius: 4px;
        min-width: 200px;
        opacity: 0;
        visibility: hidden;
        transform: translateY(-10px);
        transition: all 0.3s ease;
        flex-direction: column;
        gap: 0;
        padding: 0.5rem 0;
    }

    .site-header nav ul li:hover > ul {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }

    .site-header nav ul ul li {
        width: 100%;
    }

    .site-header nav ul ul li a {
        padding: 0.75rem 1.5rem;
        border-bottom: 1px solid #f0f0f0;
        font-size: 0.9rem;
    }

    .site-header nav ul ul li:last-child a {
        border-bottom: none;
    }

    /* Logo Styles */
    .site-branding .custom-logo-link {
        display: block;
        text-align: center;
    }

    .site-branding .custom-logo {
        max-height: 60px;
        width: auto;
        height: auto;
    }

    .site-branding .site-title {
        font-size: 1.5rem;
        font-weight: bold;
        margin: 0;
        color: #333333;
    }

    .site-branding .site-title a {
        color: inherit;
        text-decoration: none;
    }

    .site-branding .site-title a:hover {
        color: #007cba;
    }

    .site-branding .site-description {
        font-size: 0.9rem;
        color: #666666;
        margin: 0.25rem 0 0 0;
    }

    /* Hide submenu toggle on desktop */
    .submenu-toggle {
        display: none;
    }
}

/* Mobile Layout */
@media (max-width: 767px) {
    .header-mobile {
        display: block;
        padding: 1rem;
        min-height: 80px;
    }

    /* Mobile Menu Toggle */
    .mobile-menu-toggle {
        display: block;
        position: absolute;
        top: 1rem;
        right: 1rem;
        background: #ffffff;
        border: 2px solid #e9ecef;
        font-size: 1.2rem;
        cursor: pointer;
        color: #333333;
        z-index: 1001;
        padding: 0.75rem;
        border-radius: 8px;
        transition: all 0.3s ease;
        width: 48px;
        height: 48px;
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }

    .mobile-menu-toggle:hover {
        color: #007cba;
        border-color: #007cba;
        background-color: #f8f9fa;
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    }

    .mobile-menu-toggle.active {
        color: #ffffff;
        background-color: #007cba;
        border-color: #007cba;
        transform: rotate(90deg);
    }

    .mobile-menu-toggle .menu-icon {
        transition: transform 0.3s ease;
    }

    .mobile-menu-toggle.active .menu-icon {
        transform: rotate(180deg);
    }

    /* Logo on Mobile */
    .site-branding-mobile {
        text-align: center;
        margin: 2rem 0 1rem 0;
    }

    .site-branding-mobile .custom-logo {
        max-height: 50px;
        width: auto;
        height: auto;
    }

    /* Mobile Navigation Container */
    .mobile-nav-container {
        display: none;
        width: 100%;
        margin-top: 1rem;
        background: #f8f9fa;
        border-radius: 12px;
        padding: 1rem;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    }

    .mobile-nav-container.active {
        display: block;
    }

    /* Mobile Navigation - Stacked Vertically */
    .nav-left-mobile,
    .nav-right-mobile {
        width: 100%;
        margin-bottom: 2rem;
    }

    .nav-left-mobile:last-child,
    .nav-right-mobile:last-child {
        margin-bottom: 0;
    }

    /* Section Headers for Mobile Menus */
    .nav-left-mobile::before,
    .nav-right-mobile::before {
        content: attr(data-menu-title);
        display: block;
        font-size: 1.1rem;
        font-weight: 600;
        color: #495057;
        margin-bottom: 1rem;
        padding: 0.5rem 0;
        border-bottom: 2px solid #dee2e6;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }

    .nav-left-mobile ul,
    .nav-right-mobile ul {
        list-style: none;
        margin: 0;
        padding: 0;
        background: #ffffff;
        border-radius: 8px;
        overflow: hidden;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
        border: 1px solid #e9ecef;
    }

    .nav-left-mobile ul li,
    .nav-right-mobile ul li {
        border-bottom: 1px solid #f1f3f4;
        position: relative;
        transition: all 0.3s ease;
    }

    .nav-left-mobile ul li:last-child,
    .nav-right-mobile ul li:last-child {
        border-bottom: none;
    }

    .nav-left-mobile ul li:hover,
    .nav-right-mobile ul li:hover {
        background-color: #f8f9fa;
        transform: translateX(5px);
    }

    .nav-left-mobile ul li.current-menu-item > a,
    .nav-right-mobile ul li.current-menu-item > a {
        color: var(--wp--preset--color--secondary);
    }

    .nav-left-mobile ul li a,
    .nav-right-mobile ul li a {
        color: #333333;
        text-decoration: none;
        font-weight: 500;
        padding: 1.25rem 1.5rem;
        display: block;
        transition: all 0.3s ease;
        font-size: 1rem;
        position: relative;
    }

    .nav-left-mobile ul li a:hover,
    .nav-right-mobile ul li a:hover {
        background-color: #e3f2fd;
        color: #1976d2;
        padding-left: 2rem;
    }

    .nav-left-mobile ul li a::before,
    .nav-right-mobile ul li a::before {
        content: "→";
        position: absolute;
        left: 1rem;
        opacity: 0;
        transition: all 0.3s ease;
        color: #007cba;
    }

    .nav-left-mobile ul li a:hover::before,
    .nav-right-mobile ul li a:hover::before {
        opacity: 1;
        left: 0.5rem;
    }

    /* Submenu on Mobile - Stacked */
    .nav-left-mobile ul ul,
    .nav-right-mobile ul ul {
        background: #fafbfc;
        border-top: 1px solid #e9ecef;
        margin-left: 1rem;
        display: none;
        box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
        border-radius: 0 0 8px 8px;
    }

    .nav-left-mobile ul ul li a,
    .nav-right-mobile ul ul li a {
        padding: 1rem 2rem;
        font-size: 0.95rem;
        color: #666666;
        background-color: #f8f9fa;
    }

    .nav-left-mobile ul ul li a:hover,
    .nav-right-mobile ul ul li a:hover {
        background-color: #e3f2fd;
        color: #1976d2;
        padding-left: 2.5rem;
    }

    /* Submenu Toggle Button */
    .submenu-toggle {
        position: absolute;
        right: 1rem;
        top: 50%;
        transform: translateY(-50%);
        background: #ffffff;
        border: 1px solid #e9ecef;
        font-size: 1rem;
        cursor: pointer;
        color: #666666;
        padding: 0.5rem;
        border-radius: 6px;
        transition: all 0.3s ease;
        min-width: 32px;
        height: 32px;
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    }

    .submenu-toggle:hover {
        color: #007cba;
        background-color: #f8f9fa;
        border-color: #007cba;
        transform: translateY(-50%) scale(1.1);
    }

    .submenu-toggle .toggle-icon {
        font-weight: bold;
        line-height: 1;
        transition: transform 0.3s ease;
    }

    .submenu-toggle[aria-expanded="true"] .toggle-icon {
        transform: rotate(180deg);
    }

    /* Body class for menu open */
    body.menu-open {
        overflow: hidden;
    }

    /* Mobile menu overlay effect */
    .mobile-nav-container.active {
        animation: slideInFromTop 0.4s ease-out;
    }

    @keyframes slideInFromTop {
        from {
            opacity: 0;
            transform: translateY(-20px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
}

/* Hide mobile menu toggle on desktop */
@media (min-width: 768px) {
    .mobile-menu-toggle {
        display: none;
    }
}

/* Accessibility */
.screen-reader-text {
    clip: rect(1px, 1px, 1px, 1px);
    position: absolute !important;
    height: 1px;
    width: 1px;
    overflow: hidden;
}

.screen-reader-text:focus {
    background-color: #f1f1f1;
    border-radius: 3px;
    box-shadow: 0 0 2px 2px rgba(0, 0, 0, 0.6);
    clip: auto !important;
    color: #21759b;
    display: block;
    font-size: 14px;
    font-weight: bold;
    height: auto;
    left: 5px;
    line-height: normal;
    padding: 15px 23px 14px;
    text-decoration: none;
    top: 5px;
    width: auto;
    z-index: 100000;
}

/* Skip Link */
.skip-link {
    background: #000000;
    color: #ffffff;
    font-weight: 700;
    left: 6px;
    padding: 8px 16px;
    position: absolute;
    top: 8px;
    text-decoration: none;
    transform: translateY(-100%);
    transition: transform 0.3s;
}

.skip-link:focus {
    transform: translateY(0%);
}

/* Responsive Breakpoints */
@media (max-width: 480px) {
    .header-mobile {
        padding: 0.5rem;
    }
    
    .site-branding-mobile .custom-logo {
        max-height: 40px;
    }
    
    .nav-left-mobile ul li a,
    .nav-right-mobile ul li a {
        padding: 1rem 1rem;
    }

    .submenu-toggle {
        right: 0.5rem;
        min-width: 28px;
        height: 28px;
        font-size: 0.9rem;
    }

    .mobile-menu-toggle {
        width: 44px;
        height: 44px;
        padding: 0.5rem;
        font-size: 1rem;
    }

    .mobile-nav-container {
        padding: 0.75rem;
        margin-top: 0.75rem;
    }

    .nav-left-mobile,
    .nav-right-mobile {
        margin-bottom: 1.5rem;
    }
}

@media (min-width: 1300px) {
    .header-desktop {
        padding: 0 4rem;
        min-height: 120px;
    }
    
    .site-branding .custom-logo {
        max-height: 80px;
    }
    
    .site-header nav ul {
        gap: 24px;
    }
}

/* Animation for mobile menu */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.mobile-nav-container.active {
    animation: slideDown 0.3s ease-out;
}

/* Focus styles for accessibility */

/* High contrast mode support */
@media (prefers-contrast: high) {
    .site-header {
        border-bottom: 2px solid #000000;
    }
    
    .site-header nav ul li a {
        border: 1px solid transparent;
    }
    
    .site-header nav ul li a:hover,
    .site-header nav ul li a:focus {
        border-color: #000000;
    }
}

/* Ensure proper menu display */
.site-header nav ul.menu-left,
.site-header nav ul.menu-right,
.site-header nav ul.menu-left-mobile,
.site-header nav ul.menu-right-mobile {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
}

/* Mobile menu specific styles */
@media (max-width: 767px) {
    .site-header nav ul.menu-left-mobile,
    .site-header nav ul.menu-right-mobile {
        flex-direction: column;
    }
}

/* Fallback for when no menu is assigned */
.site-header nav:empty::after {
    content: "Menu not assigned";
    color: #999;
    font-style: italic;
    padding: 1rem;
    text-align: center;
    display: block;
}
