/* Header */
header {
    background-color: var(--color-white);
    box-shadow: 0 2px 10px rgba(0, 47, 94, 0.08);
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    width: 100%;
}

header .container {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    height: 80px;
    gap: 15px;
    padding: 0 20px;
    flex-wrap: nowrap;
    width: 100%;
}

/* Logo Styles */
.logo {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    padding: 5px 0;
    flex-shrink: 0;
    order: 1;
}

.logo a {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.logo img {
    height: 60px;
    width: auto;
    object-fit: contain;
    display: block;
    transition: transform 0.3s ease;
}

.logo:hover img {
    transform: scale(1.05);
}

.secondary-logo {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    padding: 5px 0;
    order: 3;
    margin-left: 0;
    flex-shrink: 0;
}

.secondary-logo img {
    height: 35px;
    width: auto;
    object-fit: contain;
    display: block;
    transition: opacity 0.3s ease;
}

.secondary-logo:hover img {
    opacity: 0.85;
}

/* Main Navigation */
nav {
    flex: 0 0 auto;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    width: auto;
    min-width: 0;
    padding: 0 15px;
    order: 2;
}

nav .nav-links {
    list-style: none;
    display: flex;
    gap: 20px;
    margin: 0;
    padding: 0;
    align-items: center;
    height: 100%;
    flex-wrap: nowrap;
    width: auto;
}

nav .nav-links li {
    height: 100%;
    display: flex;
    align-items: center;
    white-space: nowrap;
    flex-shrink: 0;
    padding: 0;
}

nav .nav-links a {
    text-decoration: none;
    color: var(--color-primary);
    font-weight: 600;
    font-size: 1.05em;
    padding: 0 5px;
    height: auto;
    transition: all 0.3s ease;
    position: relative;
    display: inline-block;
}

nav .nav-links a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    background-color: var(--color-secondary);
    left: 0;
    bottom: -5px;
    transition: width 0.3s ease;
}

nav .nav-links a:hover {
    color: var(--color-secondary);
}

nav .nav-links a:hover::after,
nav .nav-links a.active::after {
    width: 100%;
}

/* Language Switcher */
.language-switcher {
    position: relative;
    margin-left: 0;
    margin-right: 0;
    z-index: 1100;
    display: flex;
    align-items: center;
    height: 100%;
    order: 4;
    flex-shrink: 0;
    margin-left: auto;
}

.language-switcher:hover .lang-dropdown-content {
    display: flex;
    flex-direction: column;
    transform: translateY(0);
    opacity: 1;
}

.lang-hamburger-menu {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.5em;
    color: var(--color-primary);
    padding: 8px;
    transition: all 0.3s ease;
    border-radius: 50%;
}

.lang-hamburger-menu:hover {
    color: var(--color-secondary);
    transform: scale(1.1);
    background-color: rgba(0, 47, 94, 0.05);
}

.lang-dropdown-content {
    display: none;
    position: absolute;
    background-color: var(--color-white);
    min-width: 120px;
    box-shadow: 0 8px 32px rgba(0, 47, 94, 0.15);
    right: 0;
    top: 100%;
    border-radius: 12px;
    overflow: hidden;
    transform: translateY(10px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: all;
}

.lang-dropdown-content.show {
    display: flex;
    flex-direction: column;
    transform: translateY(0);
    opacity: 1;
}

.lang-button {
    padding: 12px 20px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 1em;
    color: var(--color-primary);
    transition: all 0.2s ease;
    text-align: left;
    width: 100%;
}

.lang-button:hover {
    background-color: rgba(0, 47, 94, 0.05);
    color: var(--color-secondary);
}

.lang-button.active {
    background-color: rgba(0, 47, 94, 0.1);
    color: var(--color-secondary);
    font-weight: 600;
}

/* Mobile Navigation */
.hamburger-menu {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 24px;
    position: relative;
    z-index: 1100;
    padding: 4px;
}

.hamburger-menu .bar {
    height: 2px;
    width: 100%;
    background-color: var(--color-primary);
    border-radius: 4px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.hamburger-menu:hover .bar {
    background-color: var(--color-secondary);
}

/* Mobile Navigation Active State */
.hamburger-menu.active .bar:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}

.hamburger-menu.active .bar:nth-child(2) {
    opacity: 0;
}

.hamburger-menu.active .bar:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

/* Responsive Design */
@media (max-width: 1024px) {
    header .container {
        height: 70px;
    }

    .logo img {
        height: 60px;
    }

    .secondary-logo img {
        height: 35px;
    }

    nav .nav-links {
        gap: 25px;
    }

    nav .nav-links a {
        font-size: 1em;
    }
}

@media (max-width: 768px) {
    header .container {
        height: 60px;
        padding: 0 15px;
        position: relative;
        justify-content: center;
    }

    .hamburger-menu {
        display: flex;
        position: absolute;
        left: 15px;
        top: 50%;
        transform: translateY(-50%);
        z-index: 1100;
    }

    .logo {
        position: absolute;
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%);
        margin: 0;
        max-width: 50%;
        order: 2;
        flex: 0 0 auto;
    }

    .logo img {
        height: 50px;
        margin: 0 auto;
        display: block;
    }

    .secondary-logo {
        display: none;
    }

    .language-switcher {
        position: absolute;
        right: 15px;
        top: 50%;
        transform: translateY(-50%);
        margin: 0;
        order: 1;
    }

    nav .nav-links {
        /* Overlay behaviour: nav positioned absolutely and overlays page content */
        display: none;
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
        position: absolute; /* relative to header .container */
        left: 0;
        top: 60px;
        width: 100%;
        background: #ffffff !important;
        background-color: #ffffff !important;
        box-shadow: 0 8px 32px rgba(0, 47, 94, 0.12) !important;
        padding: 0 !important;
        gap: 0;
        z-index: 1002;
    }

    nav .nav-links.active {
        display: flex;
    }

    nav .nav-links li {
        width: 100%;
        text-align: center;
        height: auto !important;
        display: block !important;
        margin: 0;
    }

    nav .nav-links a {
        padding: 12px 20px !important;
        display: block !important;
        width: 100% !important;
        font-size: 1.05em !important;
        border-bottom: 1px solid var(--color-grey-light);
        background: transparent !important;
        color: var(--color-text-dark) !important;
        box-sizing: border-box;
    }

    nav .nav-links li:last-child a {
        border-bottom: none;
    }

    nav .nav-links a::after {
        display: none;
    }

    nav .nav-links a:hover {
        background-color: rgba(0, 47, 94, 0.05);
    }

    .lang-dropdown-content {
        position: fixed;
        top: 60px;
        right: 15px;
        transform: translateY(0);
        border-radius: 8px;
    }
}

@media (max-width: 480px) {
    header .container {
        padding: 0 10px;
    }

    .logo {
        left: 50%;
        transform: translate(-50%, -50%);
        max-width: 60%;
    }

    .logo img {
        height: 45px;
    }

    .hamburger-menu {
        left: 10px;
        transform: scale(0.9) translateY(-50%);
    }

    .language-switcher {
        right: 10px;
        transform: scale(0.9) translateY(-50%);
    }

    nav .nav-links a {
        font-size: 1em;
        padding: 12px;
    }
}

/* Strong override to ensure mobile nav dropdown is solid white
   Placed in header.css (most relevant file) to avoid other file overrides */
@media (max-width: 1024px) {
    header .container nav .nav-links,
    header .container nav .nav-links.active,
    /* Ensure all children show a solid white background (prevent transparency) */
    header .container nav .nav-links * {
        background: #ffffff !important;
        background-color: #ffffff !important;
        opacity: 1 !important;
        transform: translateY(0) !important;
        box-shadow: 0 10px 30px rgba(0, 47, 94, 0.14) !important;
        z-index: 9999 !important;
    }

    /* Ensure the links are readable on white background */
    header .container nav .nav-links a {
        color: var(--color-text-dark) !important;
        background: transparent !important;
    }
}

/* Backdrop for mobile nav overlay (fade-in) */
.nav-backdrop {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: 0; /* default covers whole viewport; will be constrained on mobile */
    background: rgba(0,0,0,0.28);
    opacity: 0;
    transition: opacity 260ms ease;
    z-index: 900; /* below header (1000) */
    pointer-events: none;
}
.nav-backdrop.show {
    opacity: 1;
    pointer-events: auto;
}

/* Small animation helper for nav panel (optional) */
@media (max-width: 768px) {
    nav .nav-links {
        transition: transform 220ms ease, opacity 200ms ease;
        transform-origin: top center;
    }
    nav .nav-links.active {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Mobile-specific overrides: ensure backdrop starts below the header and nav stays above it */
@media (max-width: 768px) {
    .nav-backdrop {
        top: 60px !important; /* header height on mobile */
        z-index: 900 !important; /* below header (1000) */
    }

    /* Force nav panel and its children above header/backdrop on mobile */
    header .container nav .nav-links,
    header .container nav .nav-links * {
        z-index: 1002 !important;
    }
}