/* =========================================================
   Prezzomania V2 - Header / Navigation
   Desktop + tablet + mobile
   Uses current #pmMegaMenuWrapper markup from menu_statico.asp
   ========================================================= */

/* ---------- Global shell ---------- */

.pm-site-header {
    position: relative;
    z-index: 1050;
    background: var(--pm-surface);
    color: var(--pm-text);
}

.pm-site-header a {
    text-decoration: none;
}

.pm-site-header__desktop {
    display: none;
}

.pm-site-header__mobile {
    display: block;
}

/* ---------- Top bar ---------- */

.pm-topbar-v2 {
    background: var(--pm-black);
    color: var(--pm-white);
    font-size: 0.78rem;
}

.pm-topbar-v2__inner {
    min-height: var(--pm-topbar-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.pm-topbar-v2__group {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    min-width: 0;
}

.pm-topbar-v2 a {
    color: var(--pm-white);
    opacity: 0.95;
}

.pm-topbar-v2 a:hover {
    color: var(--pm-white);
    opacity: 1;
}

.pm-topbar-v2__item {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    white-space: nowrap;
}

/* ---------- Desktop main row ---------- */

.pm-header-main {
    background: var(--pm-surface);
    border-bottom: 1px solid var(--pm-border);
}

.pm-header-main__inner {
    min-height: 104px;
    display: grid;
    grid-template-columns: 350px minmax(360px, 560px) auto;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
}

.pm-header-logo {
    display: inline-flex;
    align-items: center;
    min-width: 0;
}

.pm-header-logo img {
    display: block;
    width: 350px;
    max-width: 100%;
    height: auto;
    max-height: 88px;
    object-fit: contain;
}

/* ---------- Search ---------- */

.pm-header-search {
    position: relative;
    width: 100%;
    max-width: 560px;
    margin-inline: auto;
    line-height: 1;
}

.pm-header-search__input {
    display: block;
    width: 100%;
    height: 52px;
    margin: 0;
    padding: 0 58px 0 20px;

    border: 2px solid #F7931E;
    border-radius: 999px;

    background-color: #fff;

    /*
       Lente inserita direttamente come background:
       niente SVG nel DOM, quindi nessun rischio di icona gigante
       se il browser ha ancora vecchi CSS in cache.
    */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='26' height='26' viewBox='0 0 24 24' fill='none' stroke='%23F7931E' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='10.5' cy='10.5' r='6.5'/%3E%3Cpath d='M15.5 15.5L21 21'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 18px center;
    background-size: 26px 26px;

    color: var(--pm-text);
    font-family: var(--pm-font-family);
    font-size: 1rem;
    font-weight: 400;

    outline: none;
    box-shadow: 0 7px 18px rgba(0, 0, 0, 0.08);

    appearance: none;
    -webkit-appearance: none;

    transition:
        border-color var(--pm-transition),
        box-shadow var(--pm-transition),
        background-color var(--pm-transition);
}

.pm-header-search__input::placeholder {
    color: #757575;
    opacity: 1;
}

.pm-header-search__input:hover {
    border-color: #F7931E;
}

.pm-header-search__input:focus {
    background-color: #fff;
    border-color: #F7931E;
    box-shadow:
        0 7px 18px rgba(0, 0, 0, 0.10),
        0 0 0 3px rgba(247, 147, 30, 0.14);
}

/* Nasconde la X nativa del type=search dove presente. */
.pm-header-search__input::-webkit-search-cancel-button {
    -webkit-appearance: none;
    appearance: none;
}

/* ---------- Right actions - Home24-style ---------- */

.pm-header-actions {
    display: flex;
    align-items: stretch;
    justify-content: flex-end;
    gap: 0.45rem;
}

.pm-header-action {
    position: relative;
    min-width: 72px;
    min-height: 64px;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;

    padding: 0.35rem 0.45rem;

    border: 0;
    border-radius: var(--pm-radius);
    background: transparent;
    color: var(--pm-gray-600);

    font: inherit;
    cursor: pointer;
    text-decoration: none;

    transition:
        background-color var(--pm-transition-fast),
        color var(--pm-transition-fast);
}

.pm-header-action:hover,
.pm-header-action.is-open {
    background: var(--pm-gray-50);
    color: var(--pm-black);
}

.pm-header-action__icon {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 32px;
}

.pm-header-action__icon svg {
    width: 30px;
    height: 30px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.65;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.pm-header-action__label {
    display: block;
    font-size: 0.76rem;
    line-height: 1.15;
    white-space: nowrap;
}

.pm-header-action__badge {
    position: absolute;
    top: -7px;
    right: -9px;

    min-width: 21px;
    height: 21px;
    padding: 0 5px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    border: 2px solid #fff;
    border-radius: var(--pm-radius-pill);
    background: var(--pm-primary);
    color: #fff;

    font-size: 0.68rem;
    font-weight: 700;
    line-height: 1;
}

/* ---------- Account dropdown ---------- */

.pm-account {
    position: relative;
}

.pm-account-menu {
    position: absolute;
    top: calc(100% + 11px);
    right: 50%;
    z-index: 1100;

    width: 310px;
    padding: 1rem;

    border: 1px solid var(--pm-border-strong);
    border-radius: 0.25rem;
    background: #fff;
    box-shadow: var(--pm-shadow);

    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translate(50%, -4px);

    transition:
        opacity var(--pm-transition),
        transform var(--pm-transition),
        visibility var(--pm-transition);
}

.pm-account-menu::before {
    content: "";
    position: absolute;
    top: -10px;
    left: 50%;
    width: 18px;
    height: 18px;
    transform: translateX(-50%) rotate(45deg);
    border-top: 1px solid var(--pm-border-strong);
    border-left: 1px solid var(--pm-border-strong);
    background: #fff;
}

.pm-account.is-open .pm-account-menu {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translate(50%, 0);
}

.pm-account-menu__primary {
    width: 100%;
    min-height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;

    border: 0;
    border-radius: var(--pm-radius);
    background: var(--pm-primary);
    color: #fff;

    font-weight: 700;
    text-decoration: none;
}

.pm-account-menu__primary:hover {
    background: var(--pm-primary-hover);
    color: #fff;
}

.pm-account-menu__register {
    margin: 1rem 0 0.85rem;
    color: var(--pm-text-secondary);
    line-height: 1.45;
}

.pm-account-menu__register a {
    color: var(--pm-text);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.pm-account-menu__divider {
    height: 1px;
    margin: 0.8rem 0;
    background: var(--pm-border);
}

.pm-account-menu__link {
    display: block;
    padding: 0.55rem 0;
    color: var(--pm-text-secondary);
    font-size: 0.93rem;
}

.pm-account-menu__link:hover {
    color: var(--pm-primary);
}

.pm-account-menu__hello {
    margin-bottom: 0.4rem;
    color: var(--pm-text);
    font-size: 0.94rem;
}

.pm-account-menu__email {
    color: var(--pm-text-muted);
    font-size: 0.78rem;
    word-break: break-word;
}

/* ---------- Desktop category nav ---------- */

.pm-category-nav {
    position: relative;
    z-index: 1000;
    background: #fff;
    border-bottom: 1px solid var(--pm-border);
}

.pm-category-nav__inner {
    min-height: var(--pm-nav-height);
    display: flex;
    align-items: center;
}

/*
   Existing menu_statico.asp selectors.
   We deliberately scope everything to #pmMegaMenuWrapper
   so legacy CSS outside V2 cannot leak in.
*/

#pmMegaMenuWrapper,
#pmMegaMenuWrapper * {
    box-sizing: border-box;
}

#pmMegaMenuWrapper {
    position: relative;
    z-index: 1000;
    width: 100%;
    max-width: 100%;
    font-family: var(--pm-font-family);
    overflow: visible;
}

#pmMegaMenuWrapper ul,
#pmMegaMenuWrapper li {
    margin: 0;
    padding: 0;
    list-style: none;
}

#pmMegaMenuWrapper .pm-menu {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.1rem;
    overflow: visible;
}

#pmMegaMenuWrapper .pm-root {
    position: relative;
    min-width: 0;
}

#pmMegaMenuWrapper .pm-root-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;

    min-height: var(--pm-nav-height);
    padding: 0 0.6rem;

    color: #444;
    background: transparent;

    font-size: 0.82rem;
    line-height: 1.2;
    font-weight: 600;
    white-space: nowrap;
    text-decoration: none;

    transition: color var(--pm-transition-fast);
}

#pmMegaMenuWrapper .pm-root:hover > .pm-root-link,
#pmMegaMenuWrapper .pm-root-link:hover,
#pmMegaMenuWrapper .pm-root-link:focus-visible {
    color: var(--pm-primary);
}

#pmMegaMenuWrapper .pm-root-arrow {
    margin-left: 0.15rem;
    color: inherit;
    font-size: 0.75rem;
}

#pmMegaMenuWrapper .pm-mega-box {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;

    width: 780px;
    min-height: 1px;
    z-index: 1200;

    background: transparent;
    overflow: visible;
}

#pmMegaMenuWrapper .pm-root:hover > .pm-mega-box,
#pmMegaMenuWrapper .pm-root:focus-within > .pm-mega-box {
    display: block;
}

#pmMegaMenuWrapper .pm-col {
    display: none;
    position: absolute;
    top: 0;

    width: 260px;
    max-height: min(560px, calc(100vh - 190px));
    padding: 0.7rem 0;

    background: #fff;
    box-shadow: var(--pm-shadow-lg);
    overflow-y: auto;
    overflow-x: visible;
}

#pmMegaMenuWrapper .pm-col-1 {
    left: 0;
    display: block;
    border-radius: 0 0 0 1rem;
}

#pmMegaMenuWrapper .pm-col-2 {
    left: 260px;
}

#pmMegaMenuWrapper .pm-col-3 {
    left: 520px;
    border-radius: 0 0 1rem 0;
}

#pmMegaMenuWrapper .pm-col.is-visible {
    display: block;
}

#pmMegaMenuWrapper .pm-link {
    width: 100%;
    min-height: 43px;

    display: flex;
    align-items: center;
    gap: 0.7rem;

    padding: 0.6rem 0.9rem;

    background: #fff;
    color: #5f5f5f;

    font-size: 0.9rem;
    font-weight: 500;
    line-height: 1.3;
    text-decoration: none;
    white-space: normal;

    transition:
        color var(--pm-transition-fast),
        background-color var(--pm-transition-fast);
}

#pmMegaMenuWrapper .pm-link:hover,
#pmMegaMenuWrapper .pm-item:hover > .pm-link,
#pmMegaMenuWrapper .pm-item.active > .pm-link {
    color: var(--pm-primary);
    background: #fffaf3;
}

#pmMegaMenuWrapper .pm-text {
    flex: 1 1 auto;
    min-width: 0;
}

#pmMegaMenuWrapper .pm-arrow {
    margin-left: auto;
    color: #777;
    font-size: 1rem;
}

#pmMegaMenuWrapper .pm-item:hover .pm-arrow,
#pmMegaMenuWrapper .pm-item.active .pm-arrow {
    color: var(--pm-primary);
}

#pmMegaMenuWrapper .pm-icon {
    width: 26px;
    min-width: 26px;
    height: 26px;

    display: flex;
    align-items: center;
    justify-content: center;

    color: #222;
}

#pmMegaMenuWrapper .pm-icon img {
    display: block;
    max-width: 23px;
    max-height: 23px;
}

/* ---------- Mobile header ---------- */

.pm-mobile-topline {
    min-height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;

    padding: 0.25rem 0.75rem;

    background: var(--pm-black);
    color: #fff;

    font-size: 0.72rem;
    text-align: center;
}

.pm-mobile-mainbar {
    min-height: 60px;
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.5rem;

    padding: 0.4rem 0.75rem;

    background: #fff;
    border-bottom: 1px solid var(--pm-border);
}

.pm-mobile-menu-button,
.pm-mobile-action {
    width: 42px;
    height: 42px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--pm-text-secondary);

    cursor: pointer;
}

.pm-mobile-menu-button:hover,
.pm-mobile-action:hover {
    background: var(--pm-gray-100);
    color: var(--pm-black);
}

.pm-mobile-menu-button svg,
.pm-mobile-action svg {
    width: 26px;
    height: 26px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.pm-mobile-logo {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    min-width: 0;
}

.pm-mobile-logo img {
    display: block;
    width: auto;
    max-width: 185px;
    max-height: 40px;
    object-fit: contain;
}

.pm-mobile-actions {
    display: flex;
    align-items: center;
    gap: 0.15rem;
}

.pm-mobile-action {
    position: relative;
}

.pm-mobile-badge {
    position: absolute;
    top: 0;
    right: -1px;

    min-width: 19px;
    height: 19px;
    padding: 0 4px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    border: 2px solid #fff;
    border-radius: 99px;
    background: var(--pm-primary);
    color: #fff;

    font-size: 0.62rem;
    font-weight: 700;
}

.pm-mobile-search {
    padding: 0.5rem 0.75rem 0.7rem;
    background: #fff;
    border-bottom: 1px solid var(--pm-border);
}

.pm-mobile-search .pm-header-search__input {
    height: 44px;
    padding-right: 3.25rem;
    font-size: 1rem;
}

.pm-mobile-search .pm-header-search__icon {
    right: 15px;
}

.pm-mobile-search .pm-header-search__icon svg {
    width: 24px;
    height: 24px;
}

/* ---------- Mobile category drawer ---------- */

html.pm-menu-open,
body.pm-menu-open {
    overflow: hidden;
}

.pm-mobile-menu-overlay {
    position: fixed;
    inset: 0;
    z-index: 1080;

    background: rgba(0, 0, 0, 0.48);

    opacity: 0;
    visibility: hidden;
    pointer-events: none;

    transition:
        opacity 0.22s ease,
        visibility 0.22s ease;
}

.pm-mobile-menu-overlay.is-active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.pm-mobile-drawer {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1090;

    width: min(88vw, 410px);
    height: 100vh;
    height: 100dvh;

    display: flex;
    flex-direction: column;

    background: #fff;
    box-shadow: 10px 0 35px rgba(0, 0, 0, 0.22);

    transform: translateX(-105%);
    visibility: hidden;

    transition:
        transform 0.26s ease,
        visibility 0.26s ease;
}

.pm-mobile-drawer.is-open {
    transform: translateX(0);
    visibility: visible;
}

.pm-mobile-drawer-header {
    flex: 0 0 62px;

    display: grid;
    grid-template-columns: 48px minmax(0, 1fr) 48px;
    align-items: center;

    padding: 0 0.75rem;

    border-bottom: 1px solid var(--pm-border);
    background: #fff;
}

.pm-mobile-drawer-title {
    min-width: 0;
    width: 100%;
    padding-inline: 0.75rem;

    color: var(--pm-text);
    font-size: 1.05rem;
    font-weight: 700;
    text-align: center;

    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pm-mobile-drawer-back,
.pm-mobile-drawer-close {
    width: 42px;
    height: 42px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    padding: 0;
    border: 0;
    border-radius: 50%;

    background: transparent;
    color: var(--pm-text);

    cursor: pointer;
}

.pm-mobile-drawer-back {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.pm-mobile-drawer-back.is-visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.pm-mobile-drawer-close {
    color: var(--pm-primary);
}

.pm-mobile-drawer-content {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

.pm-mobile-menu-generated {
    height: 100%;
    overflow-x: hidden;
    overflow-y: auto;

    padding: 0.5rem 1rem 1.5rem;

    -webkit-overflow-scrolling: touch;
}

.pm-mobile-menu-row {
    border-bottom: 1px solid var(--pm-border);
}

.pm-mobile-menu-link {
    width: 100%;
    min-height: 58px;

    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.875rem;

    padding: 0.75rem 0.25rem;

    border: 0;
    background: transparent;
    color: var(--pm-text);

    font: inherit;
    font-size: 1rem;
    font-weight: 500;
    line-height: 1.3;
    text-align: left;
    text-decoration: none;

    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.pm-mobile-menu-text {
    flex: 1 1 auto;
    min-width: 0;
}

.pm-mobile-menu-link--with-icon {
    gap: 0.95rem;
}

.pm-mobile-menu-icon {
    flex: 0 0 2.5rem;
    width: 2.5rem;
    height: 2.5rem;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    border-radius: 0.85rem;
    background: rgba(var(--pm-primary-rgb), 0.10);
    color: var(--pm-primary);
}

.pm-mobile-menu-icon svg {
    width: 1.35rem;
    height: 1.35rem;
    stroke: currentColor;
    stroke-width: 1.8;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.pm-mobile-menu-arrow {
    flex: 0 0 auto;
    color: var(--pm-text-muted);
    font-size: 1.4rem;
    line-height: 1;
}

.pm-mobile-menu-view-all {
    margin-bottom: 0.25rem;
    border-bottom: 0;
}

.pm-mobile-menu-view-all .pm-mobile-menu-link {
    color: var(--pm-primary);
    font-weight: 700;
}

.pm-mobile-menu-support {
    margin-top: 1rem;
    border-bottom: 0;
}

.pm-mobile-menu-support .pm-mobile-menu-link {
    justify-content: center;

    min-height: 48px;
    padding-inline: 1rem;

    border-radius: var(--pm-radius);
    background: var(--pm-primary);
    color: #fff;

    font-weight: 700;
}

@media (hover: none), (pointer: coarse) {
    .pm-mobile-menu-link,
    .pm-mobile-menu-link:hover,
    .pm-mobile-menu-link:active,
    .pm-mobile-menu-link:focus {
        background: transparent;
        color: var(--pm-text);
        -webkit-tap-highlight-color: transparent;
    }

    .pm-mobile-menu-view-all .pm-mobile-menu-link,
    .pm-mobile-menu-view-all .pm-mobile-menu-link:hover,
    .pm-mobile-menu-view-all .pm-mobile-menu-link:active,
    .pm-mobile-menu-view-all .pm-mobile-menu-link:focus {
        color: var(--pm-primary);
    }

    .pm-mobile-menu-support .pm-mobile-menu-link,
    .pm-mobile-menu-support .pm-mobile-menu-link:hover,
    .pm-mobile-menu-support .pm-mobile-menu-link:active,
    .pm-mobile-menu-support .pm-mobile-menu-link:focus {
        background: var(--pm-primary);
        color: #fff;
    }
}

@media (hover: hover) and (pointer: fine) {
    .pm-mobile-menu-link:hover {
        color: var(--pm-primary);
    }

    .pm-mobile-drawer-back:hover,
    .pm-mobile-drawer-close:hover {
        background: var(--pm-gray-100);
    }

    .pm-mobile-menu-support .pm-mobile-menu-link:hover {
        background: var(--pm-primary-hover);
        color: #fff;
    }
}

/* ---------- Breakpoints ---------- */

@media (min-width: 992px) {
    .pm-site-header__mobile {
        display: none;
    }

    .pm-site-header__desktop {
        display: block;
    }
}

@media (min-width: 992px) and (max-width: 1199.98px) {
    .pm-header-main__inner {
        grid-template-columns: 270px minmax(300px, 1fr) auto;
        gap: 1.25rem;
    }

    .pm-header-logo img {
        max-width: 270px;
        max-height: 68px;
    }

    .pm-header-search {
        max-width: 560px;
    }
}

@media (min-width: 1200px) {
    .pm-header-main__inner {
        grid-template-columns: 350px minmax(360px, 560px) auto;
        gap: 2rem;
    }

.pm-header-logo img {
        width: 350px;
        max-width: 350px;
        max-height: 82px;
    }

    .pm-header-search {
        max-width: 620px;
    }

    .pm-header-action {
        min-width: 78px;
    }

    #pmMegaMenuWrapper .pm-root-link {
        padding-inline: 0.75rem;
        font-size: 0.86rem;
    }
}

@media (max-width: 430px) {
    .pm-mobile-mainbar {
        grid-template-columns: 40px minmax(0, 1fr) auto;
        gap: 0.25rem;
        padding-inline: 0.5rem;
    }

    .pm-mobile-logo img {
        max-width: 155px;
        max-height: 38px;
    }

    .pm-mobile-actions {
        gap: 0;
    }

    .pm-mobile-action {
        width: 38px;
        height: 40px;
    }
}

@media (max-width: 360px) {
    .pm-mobile-logo img {
        max-width: 138px;
    }

    .pm-mobile-action {
        width: 34px;
    }

    .pm-mobile-mainbar {
        padding-inline: 0.35rem;
    }
}


/* ---------- Header V2 hardening / responsive proportions ---------- */

@media (min-width: 992px) and (max-width: 1199.98px) {
    .pm-header-main__inner {
        grid-template-columns: 280px minmax(300px, 500px) auto;
        gap: 1.25rem;
    }

    .pm-header-logo img {
        width: 280px;
        max-height: 76px;
    }

    .pm-header-search {
        max-width: 500px;
    }

    .pm-header-action {
        min-width: 66px;
    }
}

@media (min-width: 1400px) {
    .pm-header-main__inner {
        grid-template-columns: 350px 560px auto;
    }

    .pm-header-logo img {
        width: 350px;
    }
}

/*
  Difesa contro CSS legacy/cache:
  eventuali vecchi elementi .pm-header-search__icon non devono
  influenzare l'altezza della testata.
*/
.pm-header-search__icon {
    display: none !important;
}

.pm-header-search svg {
    width: 24px;
    height: 24px;
    max-width: 24px;
    max-height: 24px;
}
