/* Mobile navigation for both the black top bar and the primary header. */
body.lsm-theme .sm-topbar__panel{
    width:100%;
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:24px;
}
body.lsm-theme .sm-topbar-toggle{
    display:none;
    width:44px;
    height:44px;
    flex:0 0 44px;
    padding:9px;
    border:0;
    border-radius:6px;
    background:transparent;
    color:#fff;
    cursor:pointer;
}
body.lsm-theme .sm-topbar-toggle>span:not(.screen-reader-text){
    display:block;
    width:24px;
    height:2px;
    margin:5px auto;
    border-radius:99px;
    background:currentColor;
    transition:transform .22s ease,opacity .22s ease;
}
body.lsm-theme .sm-topbar-toggle[aria-expanded="true"]>span:nth-child(1){transform:translateY(7px) rotate(45deg)}
body.lsm-theme .sm-topbar-toggle[aria-expanded="true"]>span:nth-child(2){opacity:0}
body.lsm-theme .sm-topbar-toggle[aria-expanded="true"]>span:nth-child(3){transform:translateY(-7px) rotate(-45deg)}

@media (max-width:820px){
    body.lsm-theme .sm-topbar{
        position:relative;
        z-index:1200;
    }
    body.lsm-theme .sm-topbar__inner{
        position:relative;
        width:min(calc(100% - 24px),var(--lsm-container));
        min-height:52px!important;
        justify-content:flex-end!important;
        gap:0;
    }
    body.lsm-theme .sm-topbar-toggle{
        display:block;
        margin-left:auto;
    }
    body.lsm-theme .sm-topbar__panel{
        position:absolute;
        top:100%;
        left:50%;
        width:100vw;
        transform:translateX(-50%);
        display:none;
        padding:8px 16px 18px;
        background:#050505;
        border-top:1px solid rgba(255,255,255,.12);
        box-shadow:0 18px 34px rgba(0,0,0,.32);
    }
    body.lsm-theme .sm-topbar.is-open .sm-topbar__panel{
        display:block;
    }
    body.lsm-theme .sm-topbar__nav,
    body.lsm-theme .sm-topbar__actions{
        display:block!important;
        width:100%;
    }
    body.lsm-theme .sm-topbar__right{
        display:block!important;
        width:100%;
        margin:12px 0 0!important;
    }
    body.lsm-theme .sm-topbar__social{
        display:none!important;
    }
    body.lsm-theme .sm-topbar__nav .sm-topbar-menu{
        display:block!important;
        width:100%;
        margin:0!important;
        padding:0!important;
        list-style:none;
    }
    body.lsm-theme .sm-topbar__nav .sm-topbar-menu>li{
        display:block;
        width:100%;
        border-bottom:1px solid rgba(255,255,255,.12);
    }
    body.lsm-theme .sm-topbar__nav .sm-topbar-menu>li>a{
        display:block;
        width:100%;
        padding:13px 4px;
        color:#fff!important;
        font-size:12px;
        font-weight:800;
        text-transform:uppercase;
        text-decoration:none!important;
    }
    body.lsm-theme .sm-topbar-actions-menu{
        display:grid!important;
        grid-template-columns:repeat(2,minmax(0,1fr));
        gap:10px!important;
        width:100%;
        margin:0!important;
        padding:0!important;
        list-style:none;
    }
    body.lsm-theme .sm-topbar-actions-menu>li,
    body.lsm-theme .sm-topbar-actions-menu>li>a{
        width:100%;
    }
    body.lsm-theme .sm-topbar-actions-menu>li>a{
        min-height:42px;
        padding:10px 12px!important;
        font-size:11px!important;
    }

    body.lsm-theme .header-inner{
        position:relative;
        display:grid!important;
        grid-template-columns:minmax(0,1fr) 44px 44px;
        align-items:center;
        gap:7px!important;
        min-height:82px!important;
    }
    body.lsm-theme .header-inner .site-branding{
        grid-column:1;
        min-width:0;
        width:100%;
        margin:0!important;
        overflow:hidden;
    }
    body.lsm-theme .header-inner .custom-logo-link{
        display:flex;
        align-items:center;
        min-width:0;
    }
    body.lsm-theme .header-inner .custom-logo{
        width:auto!important;
        max-width:min(100%,240px)!important;
        max-height:68px!important;
        object-fit:contain;
    }
    body.lsm-theme .menu-toggle{
        grid-column:2;
        display:block!important;
        width:44px;
        height:44px;
        margin:0;
        padding:8px 9px;
        color:#111!important;
        flex:0 0 44px;
        border-radius:6px;
        z-index:2;
    }
    body.lsm-theme .menu-toggle>span:not(.screen-reader-text){
        width:24px;
        margin:5px auto;
        border-radius:99px;
        background:#111!important;
        transition:transform .22s ease,opacity .22s ease;
    }
    body.lsm-theme .menu-toggle[aria-expanded="true"]>span:nth-child(1){transform:translateY(7px) rotate(45deg)}
    body.lsm-theme .menu-toggle[aria-expanded="true"]>span:nth-child(2){opacity:0}
    body.lsm-theme .menu-toggle[aria-expanded="true"]>span:nth-child(3){transform:translateY(-7px) rotate(-45deg)}
    body.lsm-theme .header-actions{
        grid-column:3;
        display:flex;
        justify-content:flex-end;
        align-items:center;
        gap:0!important;
        min-width:44px;
    }
    body.lsm-theme .header-actions .search-toggle{
        display:grid;
        place-items:center;
        width:44px!important;
        height:44px!important;
        padding:8px;
        color:#111!important;
        flex:0 0 44px;
    }
    body.lsm-theme .header-actions .search-toggle svg{
        width:28px;
        height:28px;
    }
    body.lsm-theme .primary-navigation{
        position:absolute!important;
        top:100%!important;
        left:0!important;
        right:0!important;
        display:none!important;
        width:100%!important;
        max-height:calc(100vh - 110px);
        overflow-y:auto;
        margin:0!important;
        padding:8px 18px 18px!important;
        background:#fff!important;
        border-top:1px solid #e7e9ef!important;
        box-shadow:0 18px 34px rgba(0,0,0,.16)!important;
        z-index:1000;
    }
    body.lsm-theme .primary-navigation.is-open{
        display:block!important;
    }
    body.lsm-theme .primary-navigation ul{
        display:block!important;
        width:100%;
        margin:0!important;
        padding:0!important;
        list-style:none;
    }
    body.lsm-theme .primary-navigation li{
        display:block;
        width:100%;
        margin:0!important;
        border-bottom:1px solid #e7e9ef!important;
    }
    body.lsm-theme .primary-navigation li:last-child{
        border-bottom:0!important;
    }
    body.lsm-theme .primary-navigation a{
        display:block!important;
        width:100%;
        padding:14px 4px!important;
        color:#111!important;
        font-size:13px!important;
        line-height:1.35;
        text-transform:uppercase;
    }
    body.lsm-theme .primary-navigation a:after{
        display:none!important;
    }
    body.lsm-theme .primary-navigation .sub-menu{
        position:static!important;
        display:block!important;
        width:100%!important;
        padding:0 0 4px 16px!important;
        border:0!important;
        box-shadow:none!important;
        background:#fff!important;
    }
    body.lsm-theme .primary-navigation .sub-menu a{
        padding:11px 4px!important;
        font-size:12px!important;
        text-transform:none;
    }
}

@media (max-width:480px){
    body.lsm-theme .header-inner{
        grid-template-columns:minmax(0,1fr) 42px 42px;
        gap:4px!important;
    }
    body.lsm-theme .header-inner .custom-logo{
        max-width:min(100%,205px)!important;
        max-height:62px!important;
    }
    body.lsm-theme .sm-topbar-actions-menu{
        grid-template-columns:1fr;
    }
}

/* 2.6.12: hamburger a sinistra e accesso/registrazione sempre visibili a destra. */
body.lsm-theme .sm-topbar__mobile-actions{
    display:none;
}

@media (max-width:820px){
    body.lsm-theme .sm-topbar__inner{
        display:flex!important;
        align-items:center!important;
        justify-content:space-between!important;
        gap:8px!important;
    }
    body.lsm-theme .sm-topbar-toggle{
        display:block!important;
        margin:0!important;
        order:1;
    }
    body.lsm-theme .sm-topbar__mobile-actions{
        display:block!important;
        min-width:0;
        margin-left:auto;
        order:2;
    }
    body.lsm-theme .sm-topbar__mobile-actions .sm-topbar-actions-menu{
        display:flex!important;
        align-items:center;
        justify-content:flex-end;
        gap:7px!important;
        width:auto!important;
        margin:0!important;
        padding:0!important;
        list-style:none;
    }
    body.lsm-theme .sm-topbar__mobile-actions .sm-topbar-action-item{
        display:none!important;
        width:auto!important;
        margin:0!important;
    }
    body.lsm-theme .sm-topbar__mobile-actions .sm-topbar-action-item--login,
    body.lsm-theme .sm-topbar__mobile-actions .sm-topbar-action-item--register,
    body.lsm-theme .sm-topbar__mobile-actions .sm-topbar-action-item--dashboard,
    body.lsm-theme .sm-topbar__mobile-actions .sm-topbar-action-item--logout{
        display:block!important;
    }
    body.lsm-theme .sm-topbar__mobile-actions .sm-topbar-action-item>a{
        display:inline-flex!important;
        align-items:center;
        justify-content:center;
        width:auto!important;
        min-height:38px;
        padding:8px 12px!important;
        white-space:nowrap;
        font-size:10px!important;
        line-height:1!important;
    }

    /* Nel pannello apribile non ripetere i pulsanti già visibili nella barra. */
    body.lsm-theme .sm-topbar__panel .sm-topbar-action-item--login,
    body.lsm-theme .sm-topbar__panel .sm-topbar-action-item--register,
    body.lsm-theme .sm-topbar__panel .sm-topbar-action-item--dashboard,
    body.lsm-theme .sm-topbar__panel .sm-topbar-action-item--logout{
        display:none!important;
    }
    body.lsm-theme .sm-topbar__panel .sm-topbar-actions-menu{
        grid-template-columns:1fr!important;
    }
    body.lsm-theme .sm-topbar__panel .sm-topbar__right:has(.sm-topbar-actions-menu:empty){
        display:none!important;
    }
}

@media (max-width:420px){
    body.lsm-theme .sm-topbar__inner{
        width:min(calc(100% - 14px),var(--lsm-container));
        gap:5px!important;
    }
    body.lsm-theme .sm-topbar-toggle{
        width:40px;
        height:40px;
        flex-basis:40px;
        padding:7px;
    }
    body.lsm-theme .sm-topbar__mobile-actions .sm-topbar-actions-menu{
        gap:5px!important;
    }
    body.lsm-theme .sm-topbar__mobile-actions .sm-topbar-action-item>a{
        min-height:36px;
        padding:7px 9px!important;
        font-size:9px!important;
    }
}
