/*
 * Shared site header.
 * Single source of truth for the .header-bar markup rendered by renderHeader() in
 * server.js. Included on every page via <link rel="stylesheet" href="/css/header.css">.
 * Uses --swiss-red / --swiss-dark when the page defines them, with hard fallbacks.
 */

.header-bar {
    background-color: var(--swiss-red, #FF0000);
    color: #fff;
    padding: 10px 0;
    margin-bottom: 0;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.app-title-link {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    color: inherit;
}

.app-title-link:hover {
    text-decoration: none;
    color: inherit;
}

.app-title {
    font-weight: 700;
    letter-spacing: 1px;
    margin: 0;
    transition: opacity 0.3s ease;
}

.app-title-link:hover .app-title {
    opacity: 0.8;
}

.swiss-icon {
    display: inline-block;
    width: 20px;
    height: 20px;
    background-color: #fff;
    position: relative;
    margin-right: 10px;
    flex-shrink: 0;
    min-width: 20px;
    max-width: 20px;
}

.swiss-icon:before,
.swiss-icon:after {
    content: '';
    position: absolute;
    background-color: var(--swiss-red, #FF0000);
}

.swiss-icon:before {
    width: 12px;
    height: 4px;
    top: 8px;
    left: 4px;
}

.swiss-icon:after {
    width: 4px;
    height: 12px;
    top: 4px;
    left: 8px;
}

.header-sep {
    margin: 0 15px;
    color: rgba(255, 255, 255, 0.5);
}

/* Professional navigation tab */
.nav-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 12px 20px;
    color: #fff;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    border-bottom: 2px solid transparent;
    position: relative;
}

.nav-tab:hover {
    color: #fff;
    text-decoration: none;
    border-bottom-color: rgba(255, 255, 255, 0.6);
    background-color: rgba(255, 255, 255, 0.05);
}

.nav-tab:focus {
    color: #fff;
    text-decoration: none;
    outline: none;
}

.nav-tab .tab-icon {
    font-size: 1rem;
    opacity: 1;
    transition: opacity 0.2s ease;
}

.nav-tab .tab-text {
    letter-spacing: 0.2px;
    transition: all 0.2s ease;
}

/* Active state for the current page */
.nav-tab.active {
    color: #fff;
    border-bottom-color: #fff;
    background-color: rgba(255, 255, 255, 0.1);
}

.language-switcher .dropdown-toggle {
    border-color: rgba(255, 255, 255, 0.3);
    color: #fff;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
}

.language-switcher .dropdown-toggle:hover,
.language-switcher .dropdown-toggle:focus {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.5);
    color: #fff;
}

.language-switcher .dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
}

.language-switcher .dropdown-item img {
    width: 16px;
    height: 12px;
    border-radius: 2px;
}

.language-switcher .dropdown-item:hover {
    background-color: var(--swiss-red, #FF0000);
    color: #fff;
}

#currentLangFlag {
    width: 16px;
    height: 12px;
    border-radius: 2px;
}

/* Responsive */
@media (max-width: 768px) {
    .header-bar .container-fluid {
        padding: 0 10px;
    }

    .header-bar .d-flex {
        flex-wrap: wrap;
        gap: 10px;
    }

    .header-bar .d-flex > div:first-child {
        flex: 1;
        min-width: 0;
    }

    .app-title {
        font-size: 1.2rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .swiss-icon {
        width: 18px;
        height: 18px;
        min-width: 18px;
        max-width: 18px;
        margin-right: 8px;
    }

    /* Hide separators on mobile to save space */
    .header-sep {
        display: none;
    }

    .nav-tab {
        padding: 8px 12px;
        font-size: 0.8rem;
        gap: 4px;
        white-space: nowrap;
    }

    .nav-tab .tab-icon {
        font-size: 0.9rem;
    }

    /* Neutralise the old single-tab mobile hack if a stale inline copy lingers */
    .nav-tab .tab-text {
        display: inline;
    }

    .nav-tab::after {
        content: none !important;
    }

    .language-switcher .dropdown-toggle {
        padding: 4px 8px;
        font-size: 0.8rem;
    }

    .language-switcher .dropdown-toggle span {
        display: none;
    }
}

@media (max-width: 480px) {
    .header-bar .d-flex {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .header-bar .d-flex > div:first-child {
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: space-between;
        flex-wrap: wrap;
    }

    .app-title {
        font-size: 1.1rem;
        flex-shrink: 1;
        min-width: 0;
    }

    .swiss-icon {
        width: 16px;
        height: 16px;
        min-width: 16px;
        max-width: 16px;
        margin-right: 6px;
    }

    .nav-tab {
        padding: 6px 10px;
        font-size: 0.75rem;
        flex-shrink: 0;
    }

    .nav-tab .tab-text {
        display: inline;
    }

    .nav-tab::after {
        content: none !important;
    }

    .language-switcher {
        margin-top: 5px;
        align-self: flex-end;
    }
}

@media (max-width: 360px) {
    .app-title {
        font-size: 1rem;
    }

    .swiss-icon {
        width: 14px;
        height: 14px;
        min-width: 14px;
        max-width: 14px;
        margin-right: 4px;
    }

    .nav-tab {
        padding: 5px 8px;
        font-size: 0.7rem;
    }
}
