/* =========================================================
   HEADER PREMIUM V2.2 — PALADINI
   Camada final e isolada. Carregada após todos os demais CSS.
   Desktop refinado sem alterar o fluxo mobile existente.
========================================================= */

:root {
    --header-v22-height: 82px;
    --header-v22-surface: rgba(255, 255, 255, .94);
    --header-v22-border: rgba(15, 23, 42, .09);
    --header-v22-control: rgba(248, 250, 252, .96);
    --header-v22-control-border: rgba(148, 163, 184, .28);
    --header-v22-text: #0f172a;
    --header-v22-muted: #64748b;
    --header-v22-green: #16a34a;
    --header-v22-green-light: #22c55e;
}


.icone-busca-header,
.icone-whatsapp-header,
.icone-carrinho-header,
.theme-switch-icone {
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.icone-carrinho-header {
    width: 21px;
    height: 21px;
}

@media (min-width: 1181px) {
    body.home-integrada,
    body.home-premium {
        padding-top: var(--header-v22-height);
    }

    .topo-premium,
    body.home-marketplace .topo-premium,
    body.home-premium .topo-premium {
        min-height: var(--header-v22-height) !important;
        background:
            linear-gradient(180deg, rgba(255,255,255,.98), rgba(248,250,252,.96)) !important;
        border-bottom: 1px solid var(--header-v22-border) !important;
        box-shadow: 0 12px 34px rgba(15, 23, 42, .075) !important;
        overflow: visible !important;
    }

    .topo-premium::after {
        content: "";
        position: absolute;
        left: 0;
        right: 0;
        bottom: -1px;
        height: 1px;
        background: linear-gradient(90deg, transparent, rgba(34,197,94,.52), transparent);
        pointer-events: none;
    }

    .topo-premium-inner,
    body.home-marketplace .topo-premium-inner,
    body.home-premium .topo-premium-inner {
        width: min(1480px, calc(100% - 48px)) !important;
        height: var(--header-v22-height) !important;
        min-height: var(--header-v22-height) !important;
        display: grid !important;
        grid-template-columns: 132px max-content minmax(340px, 1fr) max-content !important;
        align-items: center !important;
        gap: 22px !important;
        padding: 0 !important;
    }

    .topo-premium-inner > .logo-premium,
    .topo-premium-inner > .menu-premium,
    .topo-premium-inner > .busca-premium,
    .topo-premium-inner > .acoes-premium {
        align-self: center !important;
        margin-top: 0 !important;
        margin-bottom: 0 !important;
    }

    .btn-mobile-sidebar {
        display: none !important;
    }

    .topo-premium .logo-premium,
    .logo-premium,
    body.home-marketplace .logo-premium,
    body.home-premium.home-marketplace .logo-premium {
        width: 132px !important;
        min-width: 132px !important;
        height: 62px !important;
        padding: 0 !important;
        overflow: visible !important;
    }

    .topo-premium .logo-premium img,
    .logo-premium img,
    #logoSite,
    body.home-marketplace .logo-premium img,
    body.home-premium.home-marketplace .logo-premium img {
        width: 126px !important;
        max-width: 126px !important;
        height: 54px !important;
        max-height: 54px !important;
        object-fit: contain !important;
        transform: none !important;
        filter: drop-shadow(0 8px 18px rgba(15,23,42,.13)) !important;
    }

    .logo-premium:hover #logoSite,
    .logo-premium:hover img {
        transform: translateY(-1px) scale(1.025) !important;
    }

    .menu-premium {
        height: 100% !important;
        display: flex !important;
        align-items: center !important;
        justify-content: flex-start !important;
        gap: 4px !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    .menu-dropdown-premium {
        height: 44px !important;
        display: inline-flex !important;
        align-items: center !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    .menu-premium > a,
    .menu-produtos-toggle {
        position: relative;
        height: 44px !important;
        min-height: 44px !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 0 14px !important;
        margin: 0 !important;
        border-radius: 13px !important;
        color: var(--header-v22-text) !important;
        font-size: 14px !important;
        font-weight: 800 !important;
        line-height: 1 !important;
        letter-spacing: -.01em;
        vertical-align: middle !important;
    }

    .menu-premium > a::after,
    .menu-produtos-toggle::after {
        content: "";
        position: absolute;
        left: 14px;
        right: 14px;
        bottom: 6px;
        height: 2px;
        border-radius: 99px;
        background: linear-gradient(90deg, #22c55e, #16a34a);
        opacity: 0;
        transform: scaleX(.35);
        transition: opacity .2s ease, transform .2s ease;
    }

    .menu-premium > a:hover,
    .menu-produtos-toggle:hover,
    .menu-premium > a.ativo,
    .menu-produtos-toggle.ativo,
    .menu-dropdown-premium.aberto .menu-produtos-toggle {
        background: rgba(34,197,94,.075) !important;
        color: #15803d !important;
    }

    .menu-premium > a.ativo::after,
    .menu-produtos-toggle.ativo::after,
    .menu-dropdown-premium.aberto .menu-produtos-toggle::after {
        opacity: 1;
        transform: scaleX(1);
    }

    .busca-premium,
    .topo-premium .busca {
        min-width: 340px !important;
        max-width: 570px !important;
        height: 48px !important;
        padding: 4px 4px 4px 16px !important;
        justify-self: center;
        background: var(--header-v22-control) !important;
        border: 1px solid var(--header-v22-control-border) !important;
        box-shadow: inset 0 1px 0 rgba(255,255,255,.8), 0 5px 18px rgba(15,23,42,.045) !important;
        transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
    }

    .busca-premium:focus-within,
    .topo-premium .busca:focus-within {
        background: #fff !important;
        border-color: rgba(34,197,94,.62) !important;
        box-shadow: 0 0 0 4px rgba(34,197,94,.10), 0 10px 26px rgba(15,23,42,.08) !important;
    }

    .busca-premium input,
    .topo-premium .busca input {
        min-width: 0;
        padding: 0 !important;
        font-size: 14px !important;
        font-weight: 600;
    }

    .busca-premium button,
    .topo-premium .busca button {
        min-width: 102px;
        height: 40px;
        padding: 0 16px !important;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        border-radius: 999px !important;
        font-size: 13px;
        font-weight: 900;
        box-shadow: 0 8px 20px rgba(34,197,94,.20) !important;
    }

    .icone-busca-header,
    .icone-whatsapp-header,
    .icone-carrinho-header,
    .theme-switch-icone {
        fill: none;
        stroke: currentColor;
        stroke-width: 1.9;
        stroke-linecap: round;
        stroke-linejoin: round;
    }

    .icone-busca-header {
        width: 17px;
        height: 17px;
    }

    .acoes-premium {
        height: 46px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: flex-end !important;
        align-self: center !important;
        gap: 8px !important;
        min-width: max-content;
        margin: 0 !important;
        padding: 0 !important;
    }

    .btn-whatsapp-premium,
    .carrinho-premium,
    .usuario-dropdown-btn,
    .theme-switch {
        height: 46px !important;
        border: 1px solid var(--header-v22-control-border) !important;
        background: rgba(255,255,255,.72) !important;
        box-shadow: 0 6px 18px rgba(15,23,42,.055) !important;
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
    }

    .btn-whatsapp-premium {
        padding: 0 14px !important;
        gap: 8px;
        color: #166534 !important;
        border-radius: 14px !important;
        font-size: 13px !important;
    }

    .icone-whatsapp-header {
        width: 19px;
        height: 19px;
        stroke-width: 1.75;
    }

    .carrinho-premium {
        width: 46px !important;
        min-width: 46px;
        border-radius: 14px !important;
        color: #334155;
    }

    .icone-carrinho-header {
        width: 22px;
        height: 22px;
    }

    .carrinho-premium span {
        top: -7px !important;
        right: -6px !important;
        min-width: 20px !important;
        height: 20px !important;
        padding: 0 5px;
        background: linear-gradient(135deg, #22c55e, #15803d) !important;
        border: 2px solid #fff;
        font-size: 10px !important;
        box-shadow: 0 4px 10px rgba(22,163,74,.30);
    }

    .usuario-dropdown-btn {
        min-width: 170px;
        max-width: 190px;
        padding: 4px 12px 4px 6px !important;
        border-radius: 14px !important;
        display: grid !important;
        grid-template-columns: 34px minmax(0, 1fr) auto;
        align-items: center;
        gap: 9px;
        text-align: left;
    }

    .avatar-conta-header {
        width: 34px;
        height: 34px;
        border-radius: 11px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        color: #fff;
        background: linear-gradient(145deg, #22c55e, #15803d);
        box-shadow: 0 7px 16px rgba(34,197,94,.20);
        font-size: 13px;
        font-weight: 950;
    }

    .texto-conta-header {
        display: flex;
        min-width: 0;
        flex-direction: column;
        gap: 2px;
    }

    .usuario-dropdown-btn .minha-conta-label {
        color: #16a34a !important;
        font-size: 9px !important;
        line-height: 1;
        letter-spacing: .12em;
        text-transform: uppercase;
        font-weight: 900;
    }

    .usuario-dropdown-btn strong {
        max-width: 102px !important;
        color: var(--header-v22-text) !important;
        font-size: 13px !important;
        line-height: 1.1;
    }

    .seta-usuario {
        color: #64748b;
        font-size: 11px;
        transition: transform .2s ease;
    }

    .usuario-dropdown-premium.aberto .seta-usuario,
    .usuario-dropdown-menu.ativo + .seta-usuario {
        transform: rotate(180deg);
    }

    .theme-switch {
        position: relative;
        width: 60px !important;
        min-width: 60px;
        padding: 0 5px !important;
        border-radius: 14px !important;
        overflow: hidden;
    }

    .theme-switch-icone {
        position: absolute;
        top: 50%;
        width: 14px;
        height: 14px;
        transform: translateY(-50%);
        color: #64748b;
        z-index: 1;
    }

    .theme-switch-sol { left: 8px; }
    .theme-switch-lua { right: 8px; }

    .theme-switch-bolinha {
        position: relative;
        z-index: 2;
        width: 24px !important;
        height: 24px !important;
        transition: transform .25s cubic-bezier(.2,.8,.2,1) !important;
    }

    .btn-whatsapp-premium:hover,
    .carrinho-premium:hover,
    .usuario-dropdown-btn:hover,
    .theme-switch:hover {
        transform: translateY(-1px);
        border-color: rgba(34,197,94,.42) !important;
        box-shadow: 0 11px 25px rgba(15,23,42,.10) !important;
    }

    .carrinho-premium.ativo,
    .usuario-dropdown-btn.ativo {
        border-color: rgba(34,197,94,.52) !important;
        box-shadow: 0 0 0 3px rgba(34,197,94,.08), 0 8px 22px rgba(15,23,42,.08) !important;
    }

    .dropdown-categorias-premium,
    .usuario-dropdown-menu {
        margin-top: 4px;
        border-radius: 16px !important;
        border: 1px solid rgba(148,163,184,.22) !important;
        box-shadow: 0 24px 55px rgba(15,23,42,.18) !important;
    }
}

/* Modo escuro: uma linguagem única, sem cápsulas brancas. */
@media (min-width: 1181px) {
    body.modo-escuro .topo-premium,
    body.modo-escuro.home-marketplace .topo-premium,
    body.modo-escuro.home-premium .topo-premium {
        background:
            radial-gradient(circle at 18% 0, rgba(34,197,94,.07), transparent 24%),
            linear-gradient(180deg, rgba(5,11,20,.985), rgba(5,11,20,.955)) !important;
        border-bottom-color: rgba(148,163,184,.13) !important;
        box-shadow: 0 14px 36px rgba(0,0,0,.28) !important;
    }

    body.modo-escuro .topo-premium::after {
        background: linear-gradient(90deg, transparent 4%, rgba(34,197,94,.55) 50%, transparent 96%);
        opacity: .72;
    }

    body.modo-escuro .menu-premium > a,
    body.modo-escuro .menu-produtos-toggle {
        color: #cbd5e1 !important;
    }

    body.modo-escuro .menu-premium > a:hover,
    body.modo-escuro .menu-produtos-toggle:hover,
    body.modo-escuro .menu-premium > a.ativo,
    body.modo-escuro .menu-produtos-toggle.ativo,
    body.modo-escuro .menu-dropdown-premium.aberto .menu-produtos-toggle {
        color: #f8fafc !important;
        background: rgba(34,197,94,.10) !important;
    }

    body.modo-escuro .busca-premium,
    body.modo-escuro .topo-premium .busca {
        background: rgba(9,18,31,.90) !important;
        border-color: rgba(148,163,184,.20) !important;
        box-shadow: inset 0 1px 0 rgba(255,255,255,.025), 0 8px 22px rgba(0,0,0,.16) !important;
    }

    body.modo-escuro .busca-premium:focus-within,
    body.modo-escuro .topo-premium .busca:focus-within {
        background: rgba(10,21,36,.98) !important;
        border-color: rgba(34,197,94,.60) !important;
        box-shadow: 0 0 0 4px rgba(34,197,94,.09), 0 12px 28px rgba(0,0,0,.24) !important;
    }

    body.modo-escuro .btn-whatsapp-premium,
    body.modo-escuro .carrinho-premium,
    body.modo-escuro .usuario-dropdown-btn,
    body.modo-escuro .theme-switch {
        background: rgba(12,23,39,.88) !important;
        border-color: rgba(148,163,184,.18) !important;
        color: #dbe5f1 !important;
        box-shadow: inset 0 1px 0 rgba(255,255,255,.025), 0 8px 22px rgba(0,0,0,.18) !important;
    }

    body.modo-escuro .btn-whatsapp-premium {
        color: #67e998 !important;
    }

    body.modo-escuro .usuario-dropdown-btn strong {
        color: #f1f5f9 !important;
    }

    body.modo-escuro .seta-usuario,
    body.modo-escuro .theme-switch-icone {
        color: #7f8ea3;
    }

    body.modo-escuro .carrinho-premium span {
        border-color: #050b14;
    }

    body.modo-escuro .theme-switch-bolinha {
        transform: translateX(26px) !important;
    }
}

/* =========================================================
   PADRÃO FINAL DO HEADER — ALINHAMENTO E LOGO CLARA
   Mantém todos os controles na mesma linha em qualquer página
   e compensa a área transparente interna da logo colorida.
========================================================= */
@media (min-width: 1181px) {
    html:not(.paladini-tema-escuro) body:not(.modo-escuro) .topo-premium #logoSite,
    html:not(.paladini-tema-escuro) body:not(.modo-escuro) .logo-premium img {
        transform: scale(1.66) !important;
        transform-origin: center center !important;
    }

    html:not(.paladini-tema-escuro) body:not(.modo-escuro) .logo-premium:hover #logoSite,
    html:not(.paladini-tema-escuro) body:not(.modo-escuro) .logo-premium:hover img {
        transform: translateY(-1px) scale(1.70) !important;
    }
}

/* Entre desktop e tablet, reduz elementos sem quebrar o fluxo. */
@media (min-width: 1181px) and (max-width: 1360px) {
    .topo-premium-inner,
    body.home-marketplace .topo-premium-inner,
    body.home-premium .topo-premium-inner {
        width: min(100% - 28px, 1380px) !important;
        grid-template-columns: 112px max-content minmax(300px, 1fr) max-content !important;
        gap: 12px !important;
    }

    .topo-premium .logo-premium,
    .logo-premium {
        width: 112px !important;
        min-width: 112px !important;
    }

    .topo-premium .logo-premium img,
    .logo-premium img,
    #logoSite {
        width: 108px !important;
        max-width: 108px !important;
    }

    .menu-premium > a,
    .menu-produtos-toggle {
        padding-inline: 10px !important;
        font-size: 13px !important;
    }

    .btn-whatsapp-premium {
        width: 46px;
        padding: 0 !important;
    }

    .btn-whatsapp-premium span {
        display: none;
    }

    .usuario-dropdown-btn {
        min-width: 150px;
        max-width: 160px;
    }
}

/* Mobile e tablet continuam com a navegação já aprovada. */
@media (max-width: 1180px) {
    .avatar-conta-header,
    .theme-switch-icone,
    .icone-busca-header,
    .icone-whatsapp-header {
        display: none;
    }

    .texto-conta-header {
        display: contents;
    }
}
