/* =========================================
   Header Dale Receitas
   ========================================= */

:root {
    --bds-header-bg: #0f6a6f;
    --bds-header-bg-dark: #0b5559;
    --bds-header-text: #ffffff;
    --bds-header-accent: #f2b33d;
    --bds-header-border: rgba(255, 255, 255, 0.16);
    --bds-header-height: 76px;
    --bds-header-radius: 8px;
    --bds-header-shadow: 0 3px 14px rgba(0, 0, 0, 0.16);
    --bds-transition: 0.2s ease;
}

/* Reset restrito ao header */

.bds-header,
.bds-header * {
    box-sizing: border-box;
}

.bds-header ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.bds-header a {
    color: inherit;
    text-decoration: none;
}

.bds-header button {
    margin: 0;
    font: inherit;
    cursor: pointer;
}

/* Estrutura principal */

.bds-header {
    position: sticky;
    top: 0;
    z-index: 9999;

    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;

    min-height: var(--bds-header-height);
    padding: 10px clamp(16px, 4vw, 48px);

    background-color: var(--bds-header-bg);
    color: var(--bds-header-text);
    box-shadow: var(--bds-header-shadow);
}

/* Logo */

.bds-header__logo {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.bds-header__logo a {
    display: flex;
    align-items: center;
}

.bds-header__logo img {
    display: block;
    width: auto;
    height: 52px;
    max-width: 160px;
    object-fit: contain;
}

/* Menu principal */

.bds-header__menu {
    display: flex;
    flex: 1;
    justify-content: flex-end;
}

.bds-menu-principal {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
}

.bds-menu-principal > li {
    position: relative;
}

.bds-menu-principal > li > a,
.bds-menu-dropdown-trigger {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;

    min-height: 42px;
    padding: 9px 13px;

    border: 1px solid transparent;
    border-radius: var(--bds-header-radius);

    background: transparent;
    color: var(--bds-header-text);

    font-size: 15px;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;

    transition:
        background-color var(--bds-transition),
        color var(--bds-transition),
        border-color var(--bds-transition);
}

.bds-menu-principal > li > a:hover,
.bds-menu-principal > li > a:focus-visible,
.bds-menu-dropdown-trigger:hover,
.bds-menu-dropdown-trigger:focus-visible,
.bds-menu-item--dropdown.is-open > .bds-menu-dropdown-trigger {
    background-color: rgba(255, 255, 255, 0.12);
    color: var(--bds-header-accent);
    outline: none;
}

/* Item da conta */

.bds-menu-item--conta > .bds-menu-dropdown-trigger {
    max-width: 230px;
    overflow: hidden;
    text-overflow: ellipsis;

    background-color: rgba(255, 255, 255, 0.08);
    border-color: var(--bds-header-border);
}

/* Seta dos dropdowns */

.bds-seta {
    display: inline-block;
    font-size: 12px;
    line-height: 1;
    transition: transform var(--bds-transition);
}

.bds-menu-item--dropdown.is-open .bds-seta {
    transform: rotate(180deg);
}

/* Dropdown */

.bds-menu-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;

    width: 220px;
    padding: 6px;

    border: 1px solid var(--bds-header-border);
    border-radius: var(--bds-header-radius);

    background-color: var(--bds-header-bg-dark);
    box-shadow: var(--bds-header-shadow);

    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-7px);

    transition:
        opacity var(--bds-transition),
        visibility var(--bds-transition),
        transform var(--bds-transition);
}

.bds-menu-item--conta .bds-menu-dropdown {
    right: 0;
    left: auto;
    width: 210px;
}

.bds-menu-item--dropdown.is-open > .bds-menu-dropdown {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
}

.bds-menu-dropdown li a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;

    width: 100%;
    min-height: 40px;
    padding: 9px 11px;

    border-radius: 6px;

    color: var(--bds-header-text);
    font-size: 14px;
    font-weight: 500;
    line-height: 1.3;

    transition:
        background-color var(--bds-transition),
        color var(--bds-transition);
}

.bds-menu-dropdown li a:hover,
.bds-menu-dropdown li a:focus-visible {
    background-color: rgba(255, 255, 255, 0.12);
    color: var(--bds-header-accent);
    outline: none;
}

/* Contagem de receitas */

.bds-contagem {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-width: 28px;
    padding: 2px 7px;

    border-radius: 999px;

    background-color: var(--bds-header-accent);
    color: var(--bds-header-bg-dark);

    font-size: 12px;
    font-weight: 700;
    line-height: 1.4;
}

/* Botão mobile */

.bds-header__toggle {
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 5px;

    width: 42px;
    height: 42px;
    padding: 8px;

    border: 0;
    border-radius: 6px;

    background: transparent;
}

.bds-header__toggle:hover,
.bds-header__toggle:focus-visible {
    background-color: rgba(255, 255, 255, 0.12);
    outline: none;
}

.bds-header__toggle span {
    display: block;

    width: 25px;
    height: 2px;

    border-radius: 2px;
    background-color: var(--bds-header-text);

    transition:
        transform var(--bds-transition),
        opacity var(--bds-transition);
}

.bds-header__toggle[aria-expanded="true"] span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.bds-header__toggle[aria-expanded="true"] span:nth-child(2) {
    opacity: 0;
}

.bds-header__toggle[aria-expanded="true"] span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* =========================================
   Tablet e mobile
   ========================================= */

@media (max-width: 1024px) {
    .bds-header {
        gap: 12px;
        padding-right: 16px;
        padding-left: 16px;
    }

    .bds-header__logo img {
        height: 48px;
        max-width: 140px;
    }

    .bds-header__toggle {
        display: flex;
        flex-shrink: 0;
    }

    .bds-header__menu {
        position: fixed;
        top: var(--bds-header-height);
        right: 0;
        bottom: 0;
        left: 0;

        display: block;
        padding: 12px 16px 30px;

        overflow-y: auto;

        background-color: var(--bds-header-bg);

        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transform: translateY(-10px);

        transition:
            opacity var(--bds-transition),
            visibility var(--bds-transition),
            transform var(--bds-transition);
    }

    .bds-header__menu.is-open {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        transform: translateY(0);
    }

    .bds-menu-principal {
        display: flex;
        align-items: stretch;
        flex-direction: column;
        gap: 0;

        width: 100%;
    }

    .bds-menu-principal > li {
        width: 100%;
    }

    .bds-menu-principal > li > a,
    .bds-menu-dropdown-trigger {
        justify-content: space-between;

        width: 100%;
        min-height: 52px;
        padding: 14px 8px;

        border-right: 0;
        border-bottom: 1px solid var(--bds-header-border);
        border-left: 0;
        border-radius: 0;

        font-size: 16px;
        text-align: left;
    }

    .bds-menu-item--conta > .bds-menu-dropdown-trigger {
        max-width: none;
    }

    /* Dropdown vira acordeão */

    .bds-menu-dropdown,
    .bds-menu-item--conta .bds-menu-dropdown {
        position: static;

        width: 100%;
        max-height: 0;
        padding: 0 0 0 16px;

        overflow: hidden;

        border: 0;
        border-radius: 0;
        box-shadow: none;

        background-color: transparent;

        opacity: 1;
        visibility: visible;
        pointer-events: none;
        transform: none;

        transition: max-height var(--bds-transition);
    }

    .bds-menu-item--dropdown.is-open > .bds-menu-dropdown {
        max-height: 600px;
        pointer-events: auto;
    }

    .bds-menu-dropdown li a {
        min-height: 46px;
        padding: 12px 8px;

        border-bottom: 1px solid rgba(255, 255, 255, 0.1);

        font-size: 15px;
    }
}

/* Telas pequenas */

@media (max-width: 480px) {
    .bds-header {
        min-height: 68px;
    }

    .bds-header__logo img {
        height: 43px;
        max-width: 125px;
    }

    .bds-header__menu {
        top: 68px;
    }
}

/* Evita que o conteúdo fique escondido atrás do header */

body {
    scroll-padding-top: var(--bds-header-height);
}