/* ==========================================================================
   Cabeçalho Idealux V3 — réplica do cabeçalho da Home v2 privada.
   Faixa escura fixa, menu com submenu de Produtos, busca com pré-visualização,
   CTA. No celular: lupa que abre a busca em tela cheia e gaveta lateral.
   Carregado apenas nas páginas privadas V3, onde o shell compartilhado é exibido.

   Muitas regras usam !important de propósito: o tema Astra estiliza links e
   campos de formulário com especificidade alta, e o cabeçalho precisa vencer.
   ========================================================================== */

.ixv3-header {
    --ixv3-hd-ink: var(--ast-global-color-2, #1e293b);
    --ixv3-hd-panel: #253347;
    --ixv3-hd-border: #3d4d61;
    --ixv3-hd-muted: #8fa3bd;
    --ixv3-hd-link: #cbd5e1;
    --ixv3-hd-item: #e2e8f0;
    --ixv3-hd-blue: var(--ast-global-color-0, #046bd2);
    --ixv3-hd-blue-dark: var(--ast-global-color-1, #045cb4);
    --ixv3-hd-accent: var(--ast-global-color-4, #4899d4);

    position: sticky;
    z-index: 999;
    top: var(--wp-admin--admin-bar--height, 0px);
    display: block;
    margin: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.14);
    background: var(--ixv3-hd-ink);
    font-family: inherit;
}

/* Esconde o cabeçalho do tema na página que usa este cabeçalho. */
body:has(.ixv3-header) #masthead,
body.ixv3-header-page #masthead { display: none; }

.ixv3-header *,
.ixv3-header *::before,
.ixv3-header *::after { box-sizing: border-box; }
.ixv3-header [hidden] { display: none !important; }
.ixv3-header a,
.ixv3-header a:hover,
.ixv3-header a:focus,
.ixv3-header a:visited { text-decoration: none !important; }
.ixv3-header button { margin: 0; font: inherit; }

.ixv3-header__inner {
    display: flex;
    align-items: center;
    gap: 24px;
    width: 100%;
    max-width: 1140px;
    margin: 0 auto;
    padding: 18px 20px;
}

.ixv3-header :is(a, button, input):focus-visible {
    outline: 3px solid var(--ixv3-hd-accent);
    outline-offset: 3px;
}
/* a busca já mostra o foco pela borda azul, como na Home v2 */
.ixv3-header__search-input:focus-visible { outline: none; }

/* --- logo --- */
.ixv3-header__logo { display: inline-flex; margin-right: auto; align-items: center; }
.ixv3-header__logo img { display: block; width: auto; height: 38px; max-width: 180px; object-fit: contain; }
.ixv3-header__logo-text { color: #fff; font-size: 20px; font-weight: 800; letter-spacing: .04em; }

/* --- navegação desktop --- */
.ixv3-header__nav { display: flex; }
.ixv3-header__menu { display: flex; align-items: center; gap: 24px; margin: 0; padding: 0; list-style: none; }
.ixv3-header__item { position: relative; margin: 0; }
.ixv3-header__link {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 0;
    color: var(--ixv3-hd-link);
    font-size: 14.5px;
    font-weight: 400;
    white-space: nowrap;
    transition: color .15s;
}
.ixv3-header__link:hover { color: #fff; }
.ixv3-header__link[aria-current="page"] { color: #fff; font-weight: 700; }
.ixv3-header__caret { font-size: 10px; opacity: .65; }
.ixv3-header__sub-toggle { display: none; }

.ixv3-header__sub {
    position: absolute;
    top: 100%;
    left: -14px;
    min-width: 196px;
    margin: 0;
    padding: 6px 0;
    list-style: none;
    background: var(--ixv3-hd-panel);
    border: 1px solid var(--ixv3-hd-border);
    border-radius: 4px;
    box-shadow: 0 12px 26px rgba(0, 0, 0, .32);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity .16s, transform .16s, visibility .16s;
    overflow: hidden;
    z-index: 1000;
}
.ixv3-header__sub li { width: 100%; margin: 0 !important; padding: 0 !important; }
.ixv3-header__item--sub:hover .ixv3-header__sub,
.ixv3-header__item--sub:focus-within .ixv3-header__sub,
.ixv3-header__item--sub.is-open .ixv3-header__sub {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.ixv3-header__sub a {
    display: block;
    width: 100%;
    margin: 0 !important;
    padding: 11px 18px;
    color: var(--ixv3-hd-item);
    font-size: 14px;
    white-space: nowrap;
}
.ixv3-header__sub a:hover,
.ixv3-header__sub a:focus-visible,
.ixv3-header__sub a[aria-current="page"] { background: var(--ixv3-hd-blue); color: #fff; }

/* --- busca --- */
.ixv3-header__search { position: relative; display: flex; align-items: center; margin: 0; }
.ixv3-header__search-open { display: none; }
.ixv3-header__search-input {
    width: 150px;
    height: 37px;
    margin: 0;
    padding: 0 12px;
    border: 1px solid rgba(255, 255, 255, .18) !important;
    border-radius: 4px !important;
    background: rgba(255, 255, 255, .08) !important;
    box-shadow: none !important;
    color: #fff !important;
    font-size: 13.5px;
    line-height: 1.2;
    -webkit-appearance: none;
    appearance: none;
}
.ixv3-header__search-input::placeholder { color: rgba(255, 255, 255, .6); opacity: 1; }
.ixv3-header__search-input:focus {
    outline: none;
    border-color: var(--ixv3-hd-accent) !important;
    background: rgba(255, 255, 255, .13) !important;
    box-shadow: none !important;
}
.ixv3-header__search-cancel { display: none; }
.ixv3-header__search-submit { display: none; }

.ixv3-header__results {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 345px;
    max-width: calc(100vw - 32px);
    max-height: 60vh;
    padding: 7px 0;
    overflow-y: auto;
    background: var(--ixv3-hd-panel);
    border: 1px solid var(--ixv3-hd-border);
    border-radius: 4px;
    box-shadow: 0 10px 24px rgba(15, 23, 42, .24);
    z-index: 1001;
}
.ixv3-header__group {
    padding: 9px 14px 6px;
    color: var(--ixv3-hd-muted);
    font-size: 10.5px;
    line-height: 1.2;
    letter-spacing: .12em;
    text-transform: uppercase;
}
.ixv3-header__result {
    display: block;
    color: var(--ixv3-hd-item);
}
.ixv3-header__result--produto {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 60px;
    padding: 9px 14px;
    font-size: 13.5px;
    line-height: 1.25;
}
.ixv3-header__thumb {
    display: block;
    flex: 0 0 42px;
    width: 42px;
    height: 42px;
    object-fit: cover;
    background: #e2e8f0;
    border: 1px solid #cbd5e1;
    border-radius: 2px;
}
.ixv3-header__thumb--vazia { background: var(--ixv3-hd-border); border-color: var(--ixv3-hd-muted); }
.ixv3-header__result-text { min-width: 0; }
.ixv3-header__result-title {
    display: block;
    overflow: hidden;
    color: var(--ixv3-hd-item);
    font-size: 13.5px;
    font-weight: 700;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ixv3-header__result-meta {
    display: block;
    margin-top: 3px;
    overflow: hidden;
    color: var(--ixv3-hd-muted);
    font: 10px/1.2 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    letter-spacing: .08em;
    text-transform: uppercase;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ixv3-header__result--artigo {
    overflow: hidden;
    padding: 8px 14px;
    font-size: 13.5px;
    line-height: 1.3;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ixv3-header__result:hover,
.ixv3-header__result.is-ativo { background: var(--ixv3-hd-blue); color: #fff; }
.ixv3-header__result:hover .ixv3-header__result-title,
.ixv3-header__result:hover .ixv3-header__result-meta,
.ixv3-header__result.is-ativo .ixv3-header__result-title,
.ixv3-header__result.is-ativo .ixv3-header__result-meta { color: #fff; }
.ixv3-header__all {
    display: block;
    margin-top: 6px;
    padding: 11px 14px 12px;
    border-top: 1px solid var(--ixv3-hd-border);
    color: var(--ixv3-hd-accent);
    font-size: 13.5px;
    font-weight: 600;
    line-height: 1.3;
}
.ixv3-header__all:hover,
.ixv3-header__all.is-ativo { background: var(--ixv3-hd-blue); color: #fff; }
.ixv3-header__empty {
    padding: 12px 14px;
    color: var(--ixv3-hd-item);
    font-size: 13.5px;
    line-height: 1.35;
}

/* --- CTA --- */
.ixv3-header__cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 9px 16px;
    border-radius: 4px;
    background: var(--ixv3-hd-blue);
    color: #fff !important;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    transition: background .15s;
}
.ixv3-header__cta:hover { background: var(--ixv3-hd-blue-dark); color: #fff !important; }

/* --- hambúrguer (só celular) --- */
.ixv3-header__toggle {
    display: none;
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid #718096;
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
}
.ixv3-header__toggle span {
    display: block;
    width: 18px;
    height: 2px;
    margin: 3px auto;
    background: var(--ixv3-hd-item);
    transition: transform .2s, opacity .2s;
}
.ixv3-header__toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(5px) rotate(45deg); }
.ixv3-header__toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.ixv3-header__toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-5px) rotate(-45deg); }

/* --- gaveta lateral (celular) --- */
.ixv3-header__backdrop {
    position: fixed;
    inset: 0;
    z-index: 2147483000;
    background: rgba(30, 41, 59, .72);
    opacity: 0;
    pointer-events: none;
    transition: opacity .28s ease;
}
.ixv3-header__backdrop.is-open { opacity: 1; pointer-events: auto; }

.ixv3-header__drawer {
    position: fixed;
    inset: 0 0 0 auto;
    z-index: 2147483001;
    display: flex;
    flex-direction: column;
    width: min(78vw, 320px);
    max-width: calc(100vw - 34px);
    background: var(--ixv3-hd-ink);
    border-left: 1px solid var(--ixv3-hd-border);
    box-shadow: -10px 0 24px rgba(30, 41, 59, .22);
    transform: translateX(100%);
    visibility: hidden;
    overflow-y: auto;
    transition: transform .28s ease, visibility 0s linear .28s;
}
.ixv3-header__drawer.is-open {
    transform: translateX(0);
    visibility: visible;
    transition: transform .28s ease;
}
.ixv3-header__drawer-close {
    flex: 0 0 auto;
    display: flex;
    width: 100%;
    min-height: 60px;
    align-items: center;
    justify-content: flex-end;
    margin: 0;
    padding: 8px 12px;
    border: 0;
    background: transparent;
    color: var(--ixv3-hd-link);
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
}
.ixv3-header__drawer-close span { display: grid; width: 44px; height: 44px; place-items: center; border-radius: 4px; }
.ixv3-header__drawer-nav { display: block; }
.ixv3-header__drawer-group,
.ixv3-header__drawer-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-height: 64px;
    margin: 0;
    padding: 0 22px;
    border: 0;
    border-bottom: 1px solid rgba(61, 77, 97, .7);
    background: transparent;
    color: var(--ixv3-hd-item);
    font-size: 16px;
    font-weight: 400;
    text-align: left;
    text-decoration: none !important;
}
.ixv3-header__drawer-group { padding: 0; color: var(--ixv3-hd-accent); font-weight: 500; }
.ixv3-header__drawer-parent {
    display: flex;
    min-width: 0;
    min-height: 64px;
    flex: 1;
    align-items: center;
    padding: 0 0 0 22px;
    color: var(--ixv3-hd-accent) !important;
    text-decoration: none !important;
}
.ixv3-header__drawer-group button {
    display: grid;
    flex: 0 0 64px;
    width: 64px;
    min-height: 64px;
    margin: 0;
    padding: 0;
    place-items: center;
    border: 0;
    background: transparent;
    color: var(--ixv3-hd-accent);
    cursor: pointer;
}
.ixv3-header__drawer-group button span,
.ixv3-header__drawer-row span { flex: 0 0 auto; color: var(--ixv3-hd-accent); font-size: 18px; line-height: 1; }
.ixv3-header__drawer-group button[aria-expanded="true"] span { transform: rotate(180deg); }
.ixv3-header__drawer-sub { display: block; background: rgba(0, 0, 0, .22); }
.ixv3-header__drawer-product {
    display: flex;
    align-items: center;
    min-height: 50px;
    padding: 0 22px 0 36px;
    border-bottom: 1px solid rgba(61, 77, 97, .5);
    color: var(--ixv3-hd-link);
    font-size: 15px;
    text-decoration: none !important;
}
.ixv3-header__drawer-product:hover,
.ixv3-header__drawer-product:focus-visible,
.ixv3-header__drawer-row:hover,
.ixv3-header__drawer-row:focus-visible { color: #fff; }
.ixv3-header__drawer-product[aria-current="page"],
.ixv3-header__drawer-row[aria-current="page"],
.ixv3-header__drawer-parent[aria-current="page"] { color: #fff !important; font-weight: 700; }
.ixv3-header__drawer-cta {
    flex: 0 0 auto;
    min-height: 48px;
    margin: auto 84px max(18px, env(safe-area-inset-bottom)) 16px;
    padding: 15px 20px;
    border: 1px solid var(--ixv3-hd-blue) !important;
    border-radius: 4px;
    background: var(--ixv3-hd-blue) !important;
    color: #fff !important;
    font-size: 15px;
    font-weight: 700;
    text-align: center;
    text-decoration: none !important;
}
.ixv3-header__drawer-cta:hover { background: var(--ixv3-hd-blue-dark) !important; color: #fff !important; }

/* impede rolagem do corpo com a gaveta ou a busca aberta */
body.ixv3-header-drawer-open,
body.ixv3-header-search-open { overflow: hidden; }

/* ==========================================================================
   Celular
   ========================================================================== */
@media (max-width: 900px) {
    .ixv3-header__inner { position: relative; gap: 0; }
    .ixv3-header__nav { display: none; }
    .ixv3-header__cta { display: none; }
    .ixv3-header__logo img { height: 32px; max-width: 132px; }

    .ixv3-header__search { flex: 0 0 auto; margin-left: auto; margin-right: 10px; }
    .ixv3-header__search-open {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        padding: 0;
        border: 1px solid rgba(255, 255, 255, .34);
        border-radius: 50%;
        background: transparent;
        color: var(--ixv3-hd-link);
        cursor: pointer;
    }
    .ixv3-header__search-input,
    .ixv3-header__search-submit,
    .ixv3-header__search-cancel,
    .ixv3-header__results { display: none; }

    .ixv3-header__toggle { display: flex; flex-direction: column; justify-content: center; }

    /* busca em tela cheia, como na Home v2 */
    .ixv3-header__search.is-aberta {
        --ixv3-hd-ink: var(--ast-global-color-2, #1e293b);
        --ixv3-hd-panel: #253347;
        --ixv3-hd-border: #3d4d61;
        --ixv3-hd-muted: #8fa3bd;
        --ixv3-hd-link: #cbd5e1;
        --ixv3-hd-item: #e2e8f0;
        --ixv3-hd-blue: var(--ast-global-color-0, #046bd2);
        --ixv3-hd-blue-dark: var(--ast-global-color-1, #045cb4);
        --ixv3-hd-accent: var(--ast-global-color-4, #4899d4);
        position: fixed !important;
        box-sizing: border-box;
        inset: 0 !important;
        z-index: 2147483000;
        display: grid;
        width: 100vw !important;
        max-width: none !important;
        height: 100vh;
        height: 100dvh;
        margin: 0 !important;
        overflow: hidden;
        grid-template-columns: minmax(0, 1fr) auto auto;
        grid-template-rows: auto minmax(0, 1fr);
        gap: 10px 8px;
        padding: 11px 13px;
        background: var(--ixv3-hd-ink);
    }
    .ixv3-header__search.is-aberta *,
    .ixv3-header__search.is-aberta *::before,
    .ixv3-header__search.is-aberta *::after { box-sizing: border-box; }
    .ixv3-header__search.is-aberta :is(button, input, a):focus-visible { outline: 3px solid var(--ixv3-hd-accent); outline-offset: 3px; }
    .ixv3-header__search.is-aberta .ixv3-header__search-input:focus-visible { outline: none; }
    .ixv3-header__search.is-aberta .ixv3-header__search-open { display: none; }
    .ixv3-header__search.is-aberta .ixv3-header__search-input {
        display: block;
        grid-column: 1;
        grid-row: 1;
        width: 100%;
        height: 46px;
        margin: 0;
        padding: 11px 12px;
        border: 1px solid var(--ixv3-hd-accent) !important;
        border-radius: 6px !important;
        background: rgba(255, 255, 255, .1) !important;
        box-shadow: none !important;
        color: #fff !important;
        font-size: 15px;
    }
    .ixv3-header__search.is-aberta .ixv3-header__search-submit {
        display: inline-flex;
        grid-column: 2;
        grid-row: 1;
        min-width: 68px;
        min-height: 46px;
        align-items: center;
        justify-content: center;
        margin: 0;
        padding: 8px 12px;
        border: 1px solid var(--ixv3-hd-blue) !important;
        border-radius: 5px;
        background: var(--ixv3-hd-blue) !important;
        color: #fff !important;
        font-size: 14px;
        font-weight: 700;
        cursor: pointer;
    }
    .ixv3-header__search.is-aberta .ixv3-header__search-cancel {
        display: block;
        grid-column: 3;
        grid-row: 1;
        align-self: center;
        min-width: 64px;
        min-height: 46px;
        margin: 0;
        padding: 0 4px;
        border: 0;
        background: transparent;
        color: #fff;
        font-size: 14px;
        font-weight: 600;
        cursor: pointer;
    }
    .ixv3-header__search.is-aberta .ixv3-header__results {
        display: block;
        position: static;
        align-self: start;
        grid-column: 1 / -1;
        grid-row: 2;
        width: auto;
        max-width: none;
        max-height: none;
        margin: 12px 0 0;
        padding: 4px 0 0;
        overflow-y: auto;
        background: transparent;
        border: 0;
        border-radius: 0;
        box-shadow: none;
        transform: none;
    }
    .ixv3-header__search.is-aberta .ixv3-header__results[hidden] { display: none; }
    .ixv3-header__search.is-aberta .ixv3-header__result--produto { min-height: 72px; }
    .ixv3-header__search.is-aberta .ixv3-header__thumb { flex-basis: 56px; width: 56px; height: 56px; }
    .ixv3-header__search.is-aberta .ixv3-header__result--artigo { min-height: 48px; padding: 14px; font-size: 14px; }
    .ixv3-header__search.is-aberta .ixv3-header__group { padding-top: 14px; }
}

@media (max-width: 359px) {
    .ixv3-header__inner { padding-right: 12px; padding-left: 12px; }
    .ixv3-header__logo img { height: 29px; max-width: 112px; }
    .ixv3-header__search { margin-right: 7px; }
    .ixv3-header__search.is-aberta { gap: 8px 6px; padding-right: 8px; padding-left: 8px; }
    .ixv3-header__search.is-aberta .ixv3-header__search-submit { min-width: 62px; padding-right: 9px; padding-left: 9px; }
    .ixv3-header__search.is-aberta .ixv3-header__search-cancel { font-size: 13px; }
}

@media (min-width: 901px) {
    .ixv3-header__toggle,
    .ixv3-header__backdrop,
    .ixv3-header__drawer { display: none !important; }
    .ixv3-header__search.is-aberta { position: relative; inset: auto; display: flex; padding: 0; background: transparent; }
}

@media (prefers-reduced-motion: reduce) {
    .ixv3-header *,
    .ixv3-header *::before,
    .ixv3-header *::after {
        transition-duration: .01ms !important;
        animation-duration: .01ms !important;
    }
}
