
.phx-header,
.phx-header * { box-sizing: border-box; }

.phx-header {
    position: sticky;
    top: 0;
    z-index: 2147483000;
    width: 100%;
    background: rgba(255,255,255,.985);
    border-bottom: 1px solid rgba(24,18,22,.07);
    font-family: inherit;
    color: #181216;
    transition: box-shadow .2s ease, background .2s ease;
    isolation: isolate;
}

.admin-bar .phx-header { top: 32px; }
.phx-header.is-scrolled { box-shadow: 0 10px 34px rgba(24,18,22,.08); }

.phx-mobile-spacer { display:none; width:100%; height:0; pointer-events:none; }
.phx-shell { width: min(var(--phx-max), calc(100% - 36px)); margin: 0 auto; }

.phx-mainrow {
    min-height: 72px;
    display: grid;
    grid-template-columns: minmax(150px, 190px) minmax(320px, 1fr) auto;
    grid-template-areas: "logo search tools";
    align-items: center;
    gap: clamp(16px, 2.4vw, 36px);
    padding: 7px 0;
}

.phx-logo { grid-area:logo; display:flex; align-items:center; width:max-content; max-width:190px; color:var(--phx-accent); text-decoration:none; }
.phx-logo-img { display:block; width:auto; max-width:165px; max-height:45px; object-fit:contain; }
.phx-logo-text { display:flex; flex-direction:column; color:var(--phx-accent); font-weight:900; font-size:26px; line-height:.9; letter-spacing:.09em; }
.phx-logo-text small { margin-top:7px; font-size:6px; letter-spacing:.45em; text-align:center; }
.phx-search-slot { grid-area:search; min-width:0; width:100%; z-index:30; }

.phx-tools { grid-area:tools; display:flex; align-items:center; justify-content:flex-end; gap:7px; }
.phx-tool { -webkit-appearance:none; appearance:none; position:relative; width:42px; height:42px; display:flex; align-items:center; justify-content:center; border:0; border-radius:999px; background:transparent; color:#181216; text-decoration:none; cursor:pointer; transition:background .2s ease,color .2s ease,transform .2s ease; }
.phx-tool:hover,.phx-tool:focus-visible { background:var(--phx-soft); color:var(--phx-accent); }
.phx-tool:active { transform:scale(.96); }
.phx-tool svg { width:20px; height:20px; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }
.phx-cart-count { position:absolute; top:-1px; right:-3px; min-width:20px; height:20px; padding:0 5px; display:flex; align-items:center; justify-content:center; border:2px solid #fff; border-radius:999px; background:var(--phx-accent); color:#fff; font-size:10.5px; line-height:1; font-weight:850; box-shadow:0 3px 9px rgba(242,78,127,.22); }
.phx-cart-count.is-empty { display:none; }
.phx-mobile-toggle { display:none; }
.phx-close-icon { display:none; }

.phx-nav { position:relative; z-index:40; border-top:1px solid rgba(24,18,22,.055); }
.phx-menu { min-height:56px; margin:0!important; padding:0!important; display:flex; align-items:stretch; justify-content:center; gap:clamp(10px,1.25vw,20px); list-style:none!important; }
.phx-menu li { position:relative; margin:0; padding:0; list-style:none; }
.phx-menu > li { display:flex; align-items:stretch; }
.phx-menu a { display:flex; align-items:center; gap:7px; color:#21191d!important; text-decoration:none!important; font-size:14.4px; font-weight:610; line-height:1.25; letter-spacing:.025em; text-transform:uppercase; white-space:nowrap; -webkit-font-smoothing:antialiased; }
.phx-menu > li > a { position:relative; min-height:56px; padding:0 2px; }
.phx-menu > li > a::after { content:""; position:absolute; left:50%; right:50%; bottom:0; height:2px; background:var(--phx-accent); transition:left .18s ease,right .18s ease; }
.phx-menu > li.is-desktop-open > a,.phx-menu > li.current-menu-item > a,.phx-menu > li.current-menu-ancestor > a { color:var(--phx-accent)!important; }
.phx-menu > li.is-desktop-open > a::after,.phx-menu > li.current-menu-item > a::after { left:0; right:0; }
.phx-menu .menu-item-has-children > a::before { content:""; width:6px; height:6px; border-right:1.5px solid currentColor; border-bottom:1.5px solid currentColor; transform:rotate(45deg) translateY(-2px); order:2; }
.phx-menu .sub-menu { position:absolute; top:calc(100% - 1px); left:50%; z-index:50; min-width:300px; max-width:min(660px,92vw); margin:0!important; padding:18px!important; display:grid; grid-template-columns:repeat(2,minmax(205px,1fr)); gap:5px 24px; list-style:none!important; background:rgba(255,255,255,.995)!important; border:1px solid rgba(24,18,22,.085); border-radius:0 0 18px 18px; box-shadow:0 20px 46px rgba(24,18,22,.11); opacity:0; visibility:hidden; transform:translate(-50%,8px); pointer-events:none; transition:opacity .18s ease,transform .18s ease,visibility .18s ease; }
.phx-menu > li.is-desktop-open > .sub-menu { opacity:1; visibility:visible; transform:translate(-50%,0); pointer-events:auto; }
.phx-header.is-nav-scroll-closed .phx-menu > li > .sub-menu { opacity:0!important; visibility:hidden!important; transform:translate(-50%,8px)!important; pointer-events:none!important; }
.phx-header.is-nav-scroll-closed .phx-menu > li > a { color:#21191d!important; }
.phx-header.is-nav-scroll-closed .phx-menu > li > a::after { left:50%!important; right:50%!important; }
.phx-menu .sub-menu > li { min-width:0; }
.phx-menu .sub-menu > li > a { min-height:42px; padding:9px 10px; border-radius:10px; color:#33282e!important; font-size:13.7px; font-weight:560; line-height:1.35; letter-spacing:.005em; text-transform:none; }
.phx-menu .sub-menu > li > a:hover { background:#fff6f3!important; color:var(--phx-accent)!important; }
.phx-menu .sub-menu .sub-menu { position:static; min-width:0; max-width:none; padding:0 5px 8px!important; display:block; border:0; box-shadow:none; border-radius:0; opacity:1; visibility:visible; transform:none; pointer-events:auto; background:transparent!important; }
.phx-menu .sub-menu .sub-menu a { min-height:32px; padding:6px 10px; color:#66565e!important; font-size:12.9px; font-weight:470; line-height:1.4; text-transform:none; }
.phx-menu .sub-menu .menu-item-has-children > a::before { display:none; }
.phx-subtoggle { display:none; }

/* Desktop: zamknięte podmenu jest naprawdę nieaktywne, a nie tylko niewidoczne.
   Chroni przed klikaniem niewidzialnych podkategorii pod pozycją głównego menu. */
@media (min-width: 1025px) {
    .phx-menu > li.menu-item-has-children:not(.is-desktop-open) > .sub-menu,
    .phx-menu > li.menu-item-has-children:not(.is-desktop-open) > .sub-menu *,
    .phx-menu > li.menu-item-has-children:not(.is-desktop-open) > .sub-menu .sub-menu,
    .phx-menu > li.menu-item-has-children:not(.is-desktop-open) > .sub-menu .sub-menu * {
        pointer-events: none !important;
    }

    .phx-menu > li.menu-item-has-children:not(.is-desktop-open) > .sub-menu .sub-menu {
        visibility: hidden !important;
    }

    .phx-menu > li.is-desktop-open > .sub-menu,
    .phx-menu > li.is-desktop-open > .sub-menu > li,
    .phx-menu > li.is-desktop-open > .sub-menu > li > a,
    .phx-menu > li.is-desktop-open > .sub-menu .sub-menu,
    .phx-menu > li.is-desktop-open > .sub-menu .sub-menu * {
        pointer-events: auto !important;
    }

    .phx-menu > li.is-desktop-open > .sub-menu .sub-menu {
        visibility: visible !important;
    }
}

.phx-mobile-backdrop,
.phx-mobile-navhead,
.phx-mobile-actions { display:none; }

.phx-header .phx-live-search { z-index:70; }
.phx-header .phx-search__form { margin:0; }

@media (max-width: 1024px) {
    body.phx-mobile-menu-open { overflow:hidden!important; }

    /* Na mobile header jest fixed. Dzięki temu WooCommerce, katalog produktów
       i elementy z własnym z-indexem nie potrafią wypchnąć sticky headera. */
    .phx-header {
        position:fixed!important;
        top:0!important;
        left:0!important;
        right:0!important;
        width:100%!important;
        z-index:2147483000!important;
        transform:none!important;
        contain:none!important;
    }
    .admin-bar .phx-header { top:46px!important; }
    .phx-mobile-spacer {
        display:block!important;
        height:var(--phx-mobile-header-height, 0px)!important;
        min-height:var(--phx-mobile-header-height, 0px)!important;
    }

    /* Podczas otwartego menu żaden floating cart ani badge ze sklepu nie może
       wejść nad drawer. */
    body.phx-mobile-menu-open .pcd-floating-cart,
    body.phx-mobile-menu-open .pcd-floating-cart-wrap,
    body.phx-mobile-menu-open [class*="floating-cart"],
    body.phx-mobile-menu-open [class*="sticky-cart"] {
        opacity:0!important;
        visibility:hidden!important;
        pointer-events:none!important;
    }

    .phx-shell { width:calc(100% - 18px); }

    .phx-mainrow {
        min-height:64px;
        grid-template-columns:minmax(108px,150px) 1fr auto;
        grid-template-areas:"logo logo tools" "search search search";
        gap:7px 12px;
        padding:8px 0 9px;
    }

    .phx-logo { display:flex!important; max-width:150px; }
    .phx-logo-img { max-width:132px; max-height:34px; }
    .phx-tools { display:flex!important; gap:4px; }
    .phx-tools > .phx-tool:not(.phx-cart):not(.phx-mobile-toggle) { display:none!important; }
    .phx-tool { width:44px; height:44px; }

    /* Burger: wyraźny punkt wejścia, nadal w lekkim stylu Pleasy. */
    .phx-mobile-toggle {
        display:flex!important;
        width:50px!important;
        height:50px!important;
        border:1.5px solid rgba(242,78,127,.32)!important;
        border-radius:17px!important;
        background:linear-gradient(180deg,#fff 0%,#fff8fa 100%)!important;
        color:#171216!important;
        box-shadow:0 7px 20px rgba(24,18,22,.08),0 0 0 3px rgba(242,78,127,.045)!important;
    }
    .phx-mobile-toggle:hover,
    .phx-mobile-toggle:focus-visible {
        border-color:rgba(242,78,127,.55)!important;
        background:#fff3f7!important;
        color:#111!important;
        box-shadow:0 8px 22px rgba(24,18,22,.10),0 0 0 4px rgba(242,78,127,.07)!important;
    }
    .phx-mobile-toggle svg { width:31px!important; height:31px!important; stroke-width:2.65!important; }
    .phx-header.is-mobile-open .phx-mobile-toggle { background:#fff!important; color:var(--phx-accent)!important; }
    .phx-header.is-mobile-open .phx-menu-icon { display:block!important; }
    .phx-header.is-mobile-open .phx-close-icon { display:none!important; }
    .phx-search-slot { width:100%; min-width:0; }

    /* Otwarty drawer ma zawsze przesłaniać cały header mobilny.
       Ukrywamy sam main row bez zmiany jego wysokości, więc spacer strony nie skacze. */
    .phx-header.is-mobile-open .phx-mainrow {
        opacity:0!important;
        visibility:hidden!important;
        pointer-events:none!important;
    }

    .phx-header.is-mobile-open .phx-nav,
    .phx-header.is-mobile-open .phx-mobile-backdrop {
        pointer-events:auto;
    }

    /* Dodatkowe zabezpieczenie na puste elementy menu pochodzące z menu WordPress. */
    .phx-menu > li.phx-empty-menu-item,
    .phx-menu > li[hidden] {
        display:none!important;
    }

    .phx-mobile-backdrop {
        display:block;
        position:fixed;
        inset:0;
        z-index:500;
        background:rgba(24,18,22,.27);
        opacity:0;
        visibility:hidden;
        pointer-events:none;
        backdrop-filter:blur(2px);
        -webkit-backdrop-filter:blur(2px);
        transition:opacity .22s ease,visibility .22s ease;
    }
    .phx-header.is-mobile-open .phx-mobile-backdrop {
        opacity:1;
        visibility:visible;
        pointer-events:auto;
    }

    .phx-nav {
        position:fixed;
        top:0;
        right:0;
        bottom:0;
        z-index:600;
        width:min(410px, calc(100vw - 26px));
        height:100vh;
        height:100dvh;
        display:flex!important;
        flex-direction:column;
        overflow:hidden;
        border:0;
        border-left:1px solid #f1e4e9;
        background:#fff!important;
        box-shadow:-20px 0 55px rgba(24,18,22,.12);
        transform:translateX(104%);
        visibility:hidden;
        transition:transform .28s cubic-bezier(.2,.75,.25,1),visibility .28s ease;
    }
    .admin-bar .phx-nav { top:46px; height:calc(100dvh - 46px); }
    .phx-header.is-mobile-open .phx-nav { transform:translateX(0); visibility:visible; }

    .phx-nav { will-change:transform; }

    /* Stan gestu krawędziowego nie blokuje pionowego scrollowania strony. */
    .phx-header.phx-edge-swipe-ready .phx-mobile-toggle {
        border-color:rgba(242,78,127,.42)!important;
    }

    .phx-mobile-navhead {
        flex:0 0 auto;
        display:flex;
        align-items:center;
        justify-content:flex-end;
        min-height:56px;
        padding:8px 14px 7px;
        border-bottom:1px solid #f0e6ea;
        background:#fff;
    }
    .phx-mobile-close {
        flex:0 0 42px;
        width:42px;
        height:42px;
        display:flex;
        align-items:center;
        justify-content:center;
        margin:0;
        padding:0;
        border:1px solid #f2e3e9;
        border-radius:50%;
        background:#fff;
        color:#2a2025;
        cursor:pointer;
        box-shadow:none;
    }
    .phx-mobile-close:hover,
    .phx-mobile-close:focus-visible { color:var(--phx-accent); background:#fff8fa; }
    .phx-mobile-close svg { width:20px; height:20px; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; }

    .phx-mobile-scroll {
        flex:1 1 auto;
        min-height:0;
        overflow-y:auto;
        overscroll-behavior:contain;
        padding:12px 14px max(22px, env(safe-area-inset-bottom));
        scrollbar-width:thin;
        scrollbar-color:#efc8d5 transparent;
        background:#fff;
    }

    .phx-menu {
        min-height:0;
        width:100%;
        display:flex!important;
        flex-direction:column;
        gap:7px;
        margin:0!important;
        padding:0!important;
    }

    .phx-menu > li {
        position:relative!important;
        display:block!important;
        width:100%;
        margin:0!important;
        border:1px solid #f0dfe6!important;
        border-radius:14px!important;
        background:#fff!important;
        overflow:visible;
        box-shadow:0 2px 8px rgba(24,18,22,.018);
    }
    .phx-menu > li:last-child { border-bottom:1px solid #f0dfe6!important; }
    .phx-menu a { white-space:normal; }
    .phx-menu > li > a {
        min-height:50px!important;
        width:calc(100% - 48px)!important;
        padding:0 12px 0 15px!important;
        color:#251d21!important;
        font-size:15.25px!important;
        font-weight:540!important;
        line-height:1.25!important;
        letter-spacing:0!important;
        text-transform:none!important;
    }
    .phx-menu > li > a::after,
    .phx-menu .menu-item-has-children > a::before { display:none!important; }
    .phx-menu > li.current-menu-item > a,
    .phx-menu > li.current-menu-ancestor > a,
    .phx-menu > li.is-sub-open > a { color:var(--phx-accent)!important; }

    /* Mały chevron bez różowego kafla. */
    .phx-subtoggle {
        position:absolute;
        top:5px;
        right:5px;
        z-index:3;
        width:40px;
        height:40px;
        display:flex!important;
        align-items:center;
        justify-content:center;
        margin:0;
        padding:0;
        border:0!important;
        border-radius:10px!important;
        background:transparent!important;
        color:#33282d!important;
        cursor:pointer;
        box-shadow:none!important;
    }
    .phx-subtoggle:hover,
    .phx-subtoggle:focus-visible { color:var(--phx-accent)!important; background:#fff8fa!important; }
    .phx-subtoggle::before {
        content:"";
        width:7px;
        height:7px;
        border-right:1.7px solid currentColor;
        border-bottom:1.7px solid currentColor;
        transform:rotate(45deg) translate(-2px,-2px);
        transition:transform .2s ease;
    }
    .phx-menu li.is-sub-open > .phx-subtoggle { color:var(--phx-accent)!important; background:transparent!important; }
    .phx-menu li.is-sub-open > .phx-subtoggle::before { transform:rotate(225deg) translate(-1px,-1px); }

    .phx-menu .sub-menu,
    .phx-menu .sub-menu .sub-menu {
        position:static!important;
        top:auto!important;
        left:auto!important;
        width:auto!important;
        min-width:0!important;
        max-width:none!important;
        margin:0 8px 9px!important;
        padding:0 0 0 11px!important;
        display:none!important;
        grid-template-columns:none!important;
        gap:0!important;
        border:0!important;
        border-left:1px solid #f0dfe6!important;
        border-radius:0!important;
        background:transparent!important;
        box-shadow:none!important;
        opacity:1!important;
        visibility:visible!important;
        transform:none!important;
        pointer-events:auto!important;
    }
    .phx-menu li.is-sub-open > .sub-menu { display:block!important; }

    .phx-menu .sub-menu > li {
        position:relative!important;
        display:block!important;
        width:100%!important;
        margin:5px 0!important;
        border:1px solid #f2e6eb!important;
        border-radius:12px!important;
        background:#fff!important;
        overflow:visible;
    }
    .phx-menu .sub-menu > li > a {
        width:calc(100% - 42px)!important;
        min-height:42px!important;
        padding:0 9px 0 12px!important;
        border-radius:12px!important;
        background:#fff!important;
        color:#33292e!important;
        font-size:13.75px!important;
        font-weight:480!important;
        line-height:1.35!important;
        letter-spacing:0!important;
        text-transform:none!important;
    }
    .phx-menu .sub-menu > li:not(.menu-item-has-children) > a { width:100%!important; }
    .phx-menu .sub-menu > li > a:hover,
    .phx-menu .sub-menu > li > a:focus-visible { background:#fff8fa!important; color:var(--phx-accent)!important; }
    .phx-menu .sub-menu > li > .phx-subtoggle {
        top:2px;
        right:2px;
        width:38px;
        height:38px;
    }

    .phx-menu .sub-menu .sub-menu {
        margin:0 8px 7px 12px!important;
        padding:1px 0 1px 10px!important;
        border-left:1px solid #f1e5ea!important;
    }
    .phx-menu .sub-menu .sub-menu > li {
        margin:2px 0!important;
        border:0!important;
        border-radius:0!important;
        background:transparent!important;
    }
    .phx-menu .sub-menu .sub-menu a {
        width:100%!important;
        min-height:34px!important;
        padding:6px 7px!important;
        color:#6b5b63!important;
        font-size:12.7px!important;
        font-weight:430!important;
        line-height:1.4!important;
        background:transparent!important;
    }

    /* Twarde zabezpieczenie przed białym tekstem narzucanym przez motyw. */
    .phx-nav .phx-menu .sub-menu a,
    .phx-nav .phx-menu .sub-menu a:link,
    .phx-nav .phx-menu .sub-menu a:visited { color:#33292e!important; text-shadow:none!important; }
    .phx-nav .phx-menu .sub-menu .sub-menu a,
    .phx-nav .phx-menu .sub-menu .sub-menu a:link,
    .phx-nav .phx-menu .sub-menu .sub-menu a:visited { color:#6b5b63!important; }

    .phx-mobile-actions {
        display:grid;
        grid-template-columns:1fr 1fr;
        gap:10px;
        margin:18px 0 0;
        padding-top:16px;
        border-top:1px solid #f1e8ec;
    }
    .phx-mobile-action {
        min-width:0;
        min-height:68px;
        display:grid;
        grid-template-columns:34px minmax(0,1fr) auto;
        align-items:center;
        gap:9px;
        padding:12px;
        border:1px solid #efe3e8;
        border-radius:15px;
        background:#fff;
        color:#241b20!important;
        text-decoration:none!important;
        box-shadow:none;
    }
    .phx-mobile-action svg { width:20px; height:20px; fill:none; stroke:var(--phx-accent); stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }
    .phx-mobile-action span { min-width:0; display:flex; flex-direction:column; gap:3px; }
    .phx-mobile-action small { color:#8c7780; font-size:10px; line-height:1.1; }
    .phx-mobile-action strong { overflow:hidden; color:#241b20; font-size:13.5px; line-height:1.15; font-weight:580; text-overflow:ellipsis; }
    .phx-mobile-cart-count { min-width:22px; height:22px; padding:0 5px; display:flex; align-items:center; justify-content:center; border-radius:999px; background:var(--phx-accent); color:#fff; font-size:10px; }
}

@media (max-width: 600px) {
    .phx-shell { width:calc(100% - 14px); }
    .phx-mainrow { grid-template-columns:minmax(96px,1fr) auto; grid-template-areas:"logo tools" "search search"; gap:6px 8px; padding:7px 0 8px; }
    .phx-logo-img { max-width:118px; max-height:31px; }
    .phx-nav { width:min(390px,calc(100vw - 18px)); }
    .phx-mobile-actions { grid-template-columns:1fr; }
}

@media (max-width: 782px) { .admin-bar .phx-header { top:46px; } }
@media (prefers-reduced-motion: reduce) {
    .phx-header,.phx-menu a::after,.phx-menu .sub-menu,.phx-nav,.phx-mobile-backdrop,.phx-subtoggle::before { transition:none!important; }
}

/* Integracja z Pleasy Designerski Koszyk.
   Gdy drawer jest otwarty, koszyk musi być wyżej niż cały sticky header. */
body.pcd-open .phx-header {
    z-index: 9999998 !important;
}

body.pcd-open > .phx-search__results--portal,
body.pcd-open > #phx-ajax-results.phx-search__results--portal {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}
