/* ========== HEADER INSTITUCIONAL (topbar + menu) ========== */
.topbar {
    position: sticky;
    top: 0;
    z-index: 60;
    background: var(--blue-800);
    color: #fff;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}
.topbar-content {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    height: 56px;
    padding: 0 16px;
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: stretch;
    gap: 1rem;
}
.brand-row {
    display: flex;
    align-items: stretch;
    gap: 0.35rem;
    height: 100%;
    flex-wrap: nowrap;
}
.brand-logo {
    width: 104px;
    height: 100%;
    border-radius: 0;
    background: transparent;
    display: grid;
    place-items: center;
    text-decoration: none;
    position: relative;
    overflow: hidden;
    padding: 0 6px;
    transition: background-color 0.18s ease;
}
.brand-logo img {
    grid-area: 1 / 1;
    max-width: 100%;
    max-height: 34px;
    width: auto;
    object-fit: contain;
    transition: opacity 0.2s ease;
}
.brand-logo--fundec,
.brand-logo--anglo,
.brand-logo--maxi,
.brand-logo--cep,
.brand-logo--template {
    width: 104px;
}
.brand-logo--anglo img {
    max-height: 32px;
}
.brand-logo--fundec img {
    max-height: 28px;
}
.brand-logo--cep img {
    max-height: 30px;
}
.brand-logo--maxi img {
    max-height: 31px;
}
.brand-logo--template img {
    max-height: 29px;
}
.brand-logo .logo-white {
    opacity: 1;
}
.brand-logo .logo-color {
    opacity: 0;
}
.logo-white.is-filtered {
    filter: brightness(0) invert(1);
}
.brand-logo:hover,
.brand-logo:focus-visible,
.brand-logo--active {
    background: #ffffff;
    outline: none;
}
.brand-logo:hover .logo-white,
.brand-logo:focus-visible .logo-white,
.brand-logo--active .logo-white {
    opacity: 0;
}
.brand-logo:hover .logo-color,
.brand-logo:focus-visible .logo-color,
.brand-logo--active .logo-color {
    opacity: 1;
}
.brand-logo.brand-logo--no-color:hover .logo-white,
.brand-logo.brand-logo--no-color:focus-visible .logo-white,
.brand-logo.brand-logo--no-color.brand-logo--active .logo-white {
    opacity: 1;
}
.top-links {
    display: flex;
    align-items: center;
    gap: 0;
    padding-right: 10px;
}
.top-links a {
    color: #f4f4f5;
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 400;
    letter-spacing: 0.01em;
    line-height: 1;
    transition: opacity 0.2s ease;
}
.top-links a + a::before {
    content: "|";
    margin: 0 0.75rem;
    opacity: 0.9;
    pointer-events: none;
}
.top-links a:hover {
    opacity: 0.8;
}

/* ========== MENU SECUNDÁRIO (navegação + busca + mobile) ========== */
.secondary-nav {
    background: #ffffff;
    position: sticky;
    top: 56px;
    z-index: 59;
}
.secondary-nav-content {
    width: 100%;
    max-width: 1280px;
    height: 56px;
    margin: 0 auto;
    padding: 0 16px;
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 1rem;
}
.main-menu {
    display: flex;
    align-items: center;
    gap: 1.7rem;
    flex-wrap: nowrap;
}
.main-menu-area {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}
.menu-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid rgba(15, 34, 48, 0.15);
    background: #fff;
    color: var(--ink);
    cursor: pointer;
}
.main-menu a {
    color: #2a2f3a;
    text-decoration: none;
    font-size: 0.86rem;
    font-weight: 400;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0;
    transition: color 0.2s ease;
}
.main-menu > a:hover,
.submenu-trigger:hover,
.has-submenu:not(.is-collapsed):hover > .submenu-trigger,
.has-submenu:not(.is-collapsed):focus-within > .submenu-trigger,
.has-submenu.is-open > .submenu-trigger {
    color: var(--blue-800);
}
.main-menu > a:focus-visible,
.submenu-trigger:focus-visible {
    color: var(--blue-800);
}
.has-submenu:not(.is-collapsed):hover > .submenu,
.has-submenu:not(.is-collapsed):focus-within > .submenu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.has-submenu:not(.is-collapsed):hover > .submenu-trigger .caret,
.has-submenu:not(.is-collapsed):focus-within > .submenu-trigger .caret,
.has-submenu.is-open > .submenu-trigger .caret {
    transform: rotate(-135deg) translateY(0);
    border-color: var(--blue-800);
}
.has-submenu.is-open > .submenu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.menu-item {
    position: relative;
}
@media (min-width: 721px) {
    .main-menu-area,
    .main-menu {
        align-self: stretch;
        height: 100%;
    }
    .main-menu > .menu-item {
        display: flex;
        align-items: center;
        align-self: stretch;
        height: 100%;
    }
}
.submenu-trigger {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.3rem 0;
}
.caret {
    width: 5px;
    height: 5px;
    border-right: 1.6px solid #5d6475;
    border-bottom: 1.6px solid #5d6475;
    transform: rotate(45deg) translateY(-1px);
    transform-origin: center;
    display: inline-block;
    transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
    margin-left: 2px;
}
.submenu {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 246px;
    background: #f3f4f6;
    border: 1px solid #d6d8df;
    border-radius: 12px;
    box-shadow: 0 10px 28px rgba(35, 39, 47, 0.2);
    padding: 0.45rem 0;
    z-index: 20;
    opacity: 0;
    visibility: hidden;
    transform: translateY(6px);
    transition:
        opacity 0.15s ease,
        transform 0.15s ease,
        visibility 0.15s ease;
}
.has-submenu::after {
    content: "";
    position: absolute;
    left: 0;
    top: 100%;
    width: 100%;
    height: 10px;
}

/* 2º nível: abre ao lado (ECAP / Departamentos) */
.has-submenu--nested > .submenu-trigger {
    width: 100%;
    padding: 0.45rem 0.82rem;
    font-size: 0.9rem;
    font-weight: 400;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: #3f3f46;
}
.has-submenu--nested > .submenu-trigger:hover,
.has-submenu--nested:not(.is-collapsed):hover > .submenu-trigger,
.has-submenu--nested:not(.is-collapsed):focus-within > .submenu-trigger,
.has-submenu--nested.is-open > .submenu-trigger {
    background: rgba(0, 58, 141, 0.06);
    color: var(--blue-800);
}
.has-submenu--nested > .submenu-trigger .caret {
    margin-left: auto;
    transform: rotate(-45deg) translateY(0);
}
.has-submenu--nested:not(.is-collapsed):hover > .submenu-trigger .caret,
.has-submenu--nested:not(.is-collapsed):focus-within > .submenu-trigger .caret,
.has-submenu--nested.is-open > .submenu-trigger .caret {
    transform: rotate(45deg) translateY(0);
    border-color: var(--blue-800);
}
.submenu--nested {
    top: 0;
    left: calc(100% - 4px);
    transform: translateX(6px);
    z-index: 21;
}
.has-submenu--nested:not(.is-collapsed):hover > .submenu--nested,
.has-submenu--nested:not(.is-collapsed):focus-within > .submenu--nested,
.has-submenu--nested.is-open > .submenu--nested {
    transform: translateX(0);
}
.has-submenu--nested::after {
    left: 100%;
    top: 0;
    width: 12px;
    height: 100%;
}

.submenu a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.82rem;
    font-size: 0.9rem;
    font-weight: 400;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: #3f3f46;
    white-space: nowrap;
    transition:
        background-color 0.15s ease,
        color 0.15s ease;
}
.submenu a:hover {
    background: rgba(0, 58, 141, 0.06);
    color: var(--blue-800);
}
.submenu .bullet {
    color: var(--blue-800);
    font-weight: 400;
    font-size: 0.68rem;
}

.search-form {
    display: flex;
    align-items: center;
    border: 1px solid #c4c8d2;
    border-radius: 4px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
}
.search-form input {
    width: auto;
    flex: 1 1 auto;
    min-width: 180px;
    border: 0;
    outline: none;
    padding: 0.34rem 0.55rem;
    font-size: 0.7rem;
    font-family: inherit;
}
.search-form button {
    border: 0;
    background: #fff;
    border-left: 1px solid #d0d4de;
    height: 28px;
    width: 30px;
    cursor: pointer;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    font-family: inherit;
}

.header {
    position: sticky;
    top: 0;
    z-index: 60;
    background: #fff;
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.06);
}
.header__top {
    background: var(--blue-800);
    color: #fff;
    font-size: 11px;
}
.header__top-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 72px;
    gap: 14px;
}
.header__top-logos {
    display: flex;
    align-items: center;
    gap: 10px;
}
.header__main-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 2px;
    width: 72px;
    height: 48px;
    background: #fff;
    border-radius: 8px;
    padding: 6px;
}
.header__main-logo img {
    max-height: 100%;
    object-fit: contain;
}
.header__top-slot {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 48px;
    border-radius: 8px;
    padding: 6px;
    background: transparent;
    transition: background 0.15s ease;
}
.header__top-slot img {
    max-height: 100%;
    max-width: 100%;
    object-fit: contain;
}
.header__top-slot--active {
    background: #fff;
    padding: 4px;
    border: 1px solid rgba(255, 255, 255, 0.7);
}
.header__top-slot-ph {
    width: 40px;
    height: 32px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.35);
}
.header__top-slot--ph .header__top-slot-ph {
    background: rgba(255, 255, 255, 0.25);
}
.header__top-right {
    display: flex;
    align-items: center;
    gap: 18px;
}
.header__mini {
    color: #fff;
    opacity: 0.95;
    font-weight: 600;
    font-size: 13px;
}
.header__main {
    border-bottom: 1px solid rgba(15, 34, 48, 0.08);
}
.header__main-inner {
    display: flex;
    align-items: center;
    gap: 18px;
    height: 72px;
}
.header__nav {
    display: flex;
    align-items: center;
    gap: 24px;
    flex: 1;
    justify-content: center;
}
.header__link {
    font-weight: 700;
    font-size: 12px;
    color: rgba(15, 34, 48, 0.9);
    letter-spacing: 0.25px;
    text-transform: uppercase;
}
.header__link--dropdown {
    background: 0;
    border: 0;
    cursor: pointer;
    font: inherit;
    color: inherit;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0;
}
.header__chevron {
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid currentColor;
    margin-top: 2px;
    transition: transform 0.2s ease;
}
.header__dropdown.is-open .header__chevron {
    transform: rotate(180deg);
}
.header__dropdown {
    position: relative;
}
.header__dropdown-menu {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-top: 6px;
    min-width: 280px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
    padding: 10px 0;
    opacity: 0;
    visibility: hidden;
    transition:
        opacity 0.15s ease,
        visibility 0.15s ease;
    z-index: 70;
}
.header__dropdown:hover .header__dropdown-menu,
.header__dropdown.is-open .header__dropdown-menu {
    opacity: 1;
    visibility: visible;
}
.header__dropdown-item {
    display: block;
    padding: 10px 16px;
    font-size: 11px;
    font-weight: 600;
    color: rgba(15, 34, 48, 0.9);
    letter-spacing: 0.2px;
    text-transform: uppercase;
}
.header__dropdown-item:hover {
    background: rgba(0, 58, 141, 0.08);
}
.header__dropdown-item:before {
    content: "> ";
    color: var(--blue-800);
    margin-right: 4px;
}
.header__actions {
    display: flex;
    align-items: center;
    gap: 10px;
}
.header__search {
    display: flex;
    align-items: center;
    height: 36px;
    border-radius: 999px;
    border: 1px solid rgba(15, 34, 48, 0.12);
    padding: 0 6px 0 12px;
    background: #fff;
}
.header__search-input {
    border: 0;
    outline: 0;
    height: 30px;
    width: 160px;
    font-size: 12px;
}
.header__search-btn {
    width: 30px;
    height: 30px;
    border: 0;
    border-radius: 99px;
    background: rgba(0, 58, 141, 0.12);
    cursor: pointer;
    position: relative;
}
.header__search-btn:before {
    content: "";
    position: absolute;
    width: 10px;
    height: 10px;
    border: 2px solid var(--blue-800);
    border-radius: 99px;
    left: 9px;
    top: 8px;
}
.header__search-btn:after {
    content: "";
    position: absolute;
    width: 8px;
    height: 2px;
    background: var(--blue-800);
    transform: rotate(45deg);
    left: 17px;
    top: 18px;
}
@media (max-width: 980px) {
    .header__nav {
        display: none;
    }
    .header__search-input {
        width: 120px;
    }
    .main-menu {
        flex-wrap: wrap;
        gap: 1rem;
    }
}
@media (max-width: 720px) {
    .top-links {
        display: none;
    }
    .brand-row {
        flex-wrap: wrap;
        height: auto;
        padding: 4px 0;
    }
    .brand-logo {
        width: auto !important;
        flex: 1 1 18%;
        height: 28px;
        padding: 2px 0;
    }
    .brand-logo--fundec,
    .brand-logo--anglo,
    .brand-logo--maxi,
    .brand-logo--cep,
    .brand-logo--template {
        width: auto !important;
    }
    .brand-logo img {
        max-height: 20px;
        max-width: 100%;
    }

    .secondary-nav-content {
        align-items: start;
    }
    .menu-toggle {
        display: inline-flex;
    }
    .main-menu-area {
        width: 100%;
    }
    .main-menu {
        display: none;
        flex-direction: column;
        align-items: stretch;
        gap: 0.25rem;
        width: 100%;
        padding: 10px 0 6px;
        background: #fff;
        border-radius: 12px;
    }
    .secondary-nav.is-menu-open .secondary-nav-content {
        height: auto;
    }
    .secondary-nav.is-menu-open .main-menu {
        display: flex;
    }

    .main-menu a {
        width: 100%;
        padding: 0.65rem 0.75rem;
        border-radius: 10px;
    }
    .main-menu > a:hover,
    .submenu-trigger:hover,
    .has-submenu:not(.is-collapsed):hover > .submenu-trigger,
    .has-submenu.is-open > .submenu-trigger,
    .main-menu > a:focus-visible,
    .submenu-trigger:focus-visible {
        color: var(--blue-800);
    }

    .menu-item {
        width: 100%;
    }
    .submenu-trigger {
        width: 100%;
    }

    .submenu {
        position: static;
        left: auto;
        right: auto;
        top: auto;
        min-width: 0;
        width: auto;
        max-width: none;
        transform: none;
        opacity: 0;
        visibility: hidden;
        max-height: 0;
        overflow: hidden;
        box-shadow: none;
        border: 1px solid #d6d8df;
        padding: 0.45rem 0;
        margin: 6px 0 0 12px;
    }
    .submenu--nested {
        left: auto;
        transform: none;
    }
    .has-submenu:not(.is-collapsed):hover > .submenu,
    .has-submenu:not(.is-collapsed):focus-within > .submenu {
        opacity: 0;
        visibility: hidden;
        transform: none;
    }
    .has-submenu::after {
        display: none;
    }
    .has-submenu.is-open > .submenu {
        opacity: 1;
        visibility: visible;
        max-height: 800px;
        overflow: visible;
    }
    .has-submenu--nested > .submenu-trigger .caret,
    .has-submenu--nested:not(.is-collapsed):hover > .submenu-trigger .caret,
    .has-submenu--nested:not(.is-collapsed):focus-within > .submenu-trigger .caret,
    .has-submenu--nested.is-open > .submenu-trigger .caret {
        transform: rotate(45deg) translateY(-1px);
    }
    .has-submenu--nested.is-open > .submenu-trigger .caret {
        transform: rotate(-135deg) translateY(0);
    }
    .submenu a {
        white-space: normal;
        word-break: break-word;
    }
}
@media (max-width: 520px) {
    .header__top {
        display: none;
    }
    .header__search {
        display: none;
    }

    .topbar-content {
        grid-template-columns: 1fr;
        padding: 0 8px;
    }
    .top-links {
        display: none;
    }
    .brand-row {
        flex-wrap: wrap;
        height: auto;
        padding: 4px 0;
    }
    .brand-logo {
        width: auto !important;
        flex: 1 1 18%;
        height: 28px;
        padding: 2px 0;
    }
    .brand-logo--fundec,
    .brand-logo--anglo,
    .brand-logo--maxi,
    .brand-logo--cep,
    .brand-logo--template {
        width: auto !important;
    }
    .brand-logo img {
        max-height: 20px;
        max-width: 100%;
    }

    .secondary-nav-content {
        grid-template-columns: 1fr;
        align-items: start;
        height: auto;
        padding: 10px 8px;
        gap: 0.6rem;
    }
    .main-menu {
        gap: 0.85rem;
        align-items: flex-start;
    }
    .main-menu a {
        font-size: 0.78rem;
    }

    .search-form {
        width: 100%;
    }
    .search-form input {
        min-width: 0;
        padding: 0.38rem 0.6rem;
    }

    .submenu {
        min-width: 0;
        width: auto;
        max-width: none;
        left: auto;
        right: auto;
    }
    .submenu a {
        white-space: normal;
        word-break: break-word;
    }
}
