/* =========================================================
   CABEÇALHO

   01. Estrutura e marca
   02. Navegação desktop
   03. Seletor de idiomas
   04. Navegação tablet/celular
   05. Telas estreitas
   ========================================================= */

/* =========================================================
   01. ESTRUTURA E MARCA
   ========================================================= */

#header-container {
    position: sticky;
    top: 0;
    z-index: var(--z-header);
}

.site-header {
    position: relative;
    height: 100px;
    color: var(--white);
    background: var(--alliance-graphite);
    border-bottom: 4px solid var(--alliance-yellow);
    box-shadow: 0 3px 14px rgba(0, 0, 0, 0.2);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    height: 100%;
}

.brand {
    display: flex;
    flex: 0 1 auto;
    align-items: center;
    min-width: 0;
}

.site-header .brand-logo {
    display: block;
    width: auto;
    max-width: 240px;
    height: 52px;
    object-fit: contain;
}

.header-right {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 14px;
}

/* =========================================================
   02. NAVEGAÇÃO DESKTOP
   ========================================================= */

.main-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
    min-width: 0;
}

.main-nav a {
    position: relative;
    color: #f3f3f3;
    font-size: 16px;
    font-weight: 500;
    letter-spacing: 0.3px;
    white-space: nowrap;
    transition: color var(--transition);
}

.main-nav a:hover,
.main-nav a.active {
    color: var(--alliance-yellow);
}

.main-nav a.active::before {
    content: "";
    position: absolute;
    right: 0;
    bottom: -12px;
    left: 0;
    height: 3px;
    background: var(--alliance-yellow);
    border-radius: 3px;
}

.nav-divider {
    color: var(--text-on-dark);
}

/* Escondido no desktop; exibido a partir de 900px. */
.nav-toggle {
    display: none;
}

/* =========================================================
   03. SELETOR DE IDIOMAS
   ========================================================= */

.language-selector {
    position: relative;
}

.language-dropdown-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 54px;
    min-height: 44px;
    padding: 4px;
    color: var(--white);
    background: transparent;
    border: 0;
    border-radius: var(--radius-small);
}

.language-dropdown-btn img {
    display: block;
    width: 36px;
    height: 27px;
    object-fit: cover;
    border-radius: 3px;
}

.language-arrow {
    color: var(--white);
    font-size: 12px;
}

.language-dropdown-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    z-index: 1;
    display: none;
    min-width: 180px;
    overflow: hidden;
    color: var(--text-primary);
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: var(--shadow-dropdown);
}

.language-dropdown-menu.show {
    display: block;
}

.language-dropdown-menu .lang-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    color: var(--text-primary);
    text-align: left;
    background: var(--white);
    border: 0;
    cursor: pointer;
}

.language-dropdown-menu .lang-btn:hover {
    background: var(--background-soft);
}

.language-dropdown-menu .lang-btn.active {
    background: var(--alliance-yellow-soft);
    font-weight: 700;
}

.language-dropdown-menu .lang-btn img {
    display: block;
    flex: 0 0 auto;
    width: 28px;
    height: 21px;
    object-fit: cover;
}

/* =========================================================
   04. TABLET E CELULAR: MENU RECOLHÍVEL
   ========================================================= */

@media (max-width: 900px) {
    .site-header {
        height: 76px;
    }

    .header-content {
        gap: 12px;
    }

    .site-header .brand-logo {
        max-width: 200px;
        height: 44px;
    }

    .nav-toggle {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 5px;
        width: 44px;
        height: 44px;
        padding: 8px;
        color: var(--white);
        background: transparent;
        border: 0;
        border-radius: var(--radius-small);
        cursor: pointer;
    }

    .nav-toggle span {
        display: block;
        width: 24px;
        height: 3px;
        background: currentColor;
        border-radius: 2px;
    }

    .main-nav {
        position: absolute;
        top: 100%;
        right: 0;
        left: 0;
        z-index: 1;
        display: none;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: 6px max(15px, calc((100vw - var(--container-width)) / 2));
        background: var(--alliance-graphite);
        border-bottom: 4px solid var(--alliance-yellow);
        box-shadow: 0 12px 22px rgba(0, 0, 0, 0.18);
    }

    .main-nav.open {
        display: flex;
    }

    .main-nav a {
        display: flex;
        align-items: center;
        min-height: 48px;
        padding: 12px 16px;
        white-space: normal;
        overflow-wrap: anywhere;
    }

    .main-nav a.active::before {
        top: 6px;
        bottom: 6px;
        left: 0;
        width: 4px;
        height: auto;
    }

    .nav-divider {
        display: none;
    }
}

/* =========================================================
   05. TELAS ESTREITAS
   ========================================================= */

@media (max-width: 480px) {
    .site-header {
        height: 70px;
    }

    .site-header .brand-logo {
        width: min(180px, calc(100vw - 150px));
        max-width: 100%;
        height: auto;
        max-height: 40px;
    }

    .header-right {
        gap: 6px;
    }
}

@media (max-width: 340px) {
    .site-header .brand-logo {
        width: min(155px, calc(100vw - 145px));
    }

    .language-dropdown-btn {
        min-width: 48px;
    }
}