/* Moved from Elementor (P4): Archivio Prodotti (677) */
@media (min-width: 768px) {
    .elementor .elementor-element.dv-archive-hero__details {
        position: relative !important;
        top: 0;
    }
}

/* Moved from Elementor (P4): Risultati di ricerca (1751) */
@media (min-width: 1025px) {
    .elementor .elementor-element.dv-filters-sidebar {
        position: sticky;
        top: 120px;
        background: #fff !important;
    }
}

.elementor .elementor-element.dv-search-results .e-loop-nothing-found-message__text {
    text-align: left !important;
    margin-top: 0 !important;
}





.post-type-archive-product .no-display-shop {
    display: none;
}


/* Filters */
.tax-linea .filter-linea,
.tax-zona .filter-zona,
.tax-esigenza .filter-esigenza {
    display: none;
}
.tax-linea .product-topbar-filters .filter-linea,
.tax-zona .product-topbar-filters .filter-zona,
.tax-esigenza .product-topbar-filters .filter-esigenza {
    display: none;
}

.product-filter > strong {
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--e-global-color-text);
    padding-left: 18px;
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 11.609 13.81"><path fill="%23547EC1" d="M11.609 0H9.18a3.992 3.992 0 0 0-3.292 1.968L0 13.81h2.07a4.594 4.594 0 0 0 3.8-2.275Z" data-name="Path 99"/></svg>');
    background-size: 12px 14px;
    background-repeat: no-repeat;
    background-position: left 3px;
    margin-bottom: 16px;
    display: block;
}
.product-filter-buttons {
    font-size: 14px;
    line-height: 1.2;
    color: var(--e-global-color-text);
    text-transform: uppercase;
    list-style-type: none;
    padding: 0;
    margin-bottom: 30px;
}
.product-filter-buttons li {
    margin-bottom: 6px;
}
.product-filter-buttons [data-filter] {
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15"><rect width="15" height="15" fill="rgba(84,126,193,0.15)" data-name="Rectangle 239" rx="3"/></svg>') !important;
    background-position: left 1px !important;
    padding-left: 22px !important;
    margin-bottom: 7px !important;
    line-height: 1.3;
    background-repeat: no-repeat;
    display: block;
    background-size: 15px;
}
.product-filter-buttons .selected[data-filter] {
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15"><rect width="15" height="15" fill="%23547EC1" data-name="Rectangle 239" rx="3"/></svg>') !important;
    color: var(--e-global-color-primary);
}
.product-filter-buttons [data-filter]:hover {
    color: var(--e-global-color-primary);
}
.product-filters-apply {
    display: none;
}

@media (max-width:1024px) {
    .product-filter-buttons [data-filter] {
        background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15"><rect width="15" height="15" fill="rgba(255,255,255,1)" data-name="Rectangle 239" rx="3"/></svg>') !important;
    }
    button.product-filters-apply {
        background-color: var(--e-global-color-secondary);
        padding: 10px 20px 10px 20px;
        text-transform: uppercase;
        color: var(--e-global-color-117bc47);
        border-radius: 10px 30px 30px 0px;
        display: inline-block;
        font-size: 15px;
        line-height: 1;
        text-align: center;
        transition: all .3s;
        cursor: pointer;
        border: 0 !important;
        width: 100%;
        margin-bottom: 20px;
    }
}



/* Isotope */
.product-grid .e-loop-item.hidden {
    display: none;
    opacity: 0;
}

/* Filtered grid */
body:not(.elementor-editor-active) .product-grid .elementor-grid {
    opacity: 0;
}

.product-grid .elementor-grid  {
    display: block;
    margin: -12px;
    transition: all .5s ease;
    min-height: 400px;
}
.product-grid .product-type-variable {
    display: none;
}

.product-grid .elementor-grid.isotope-ready,
body:not(.elementor-editor-active) .product-grid .elementor-grid.isotope-ready {
    opacity: 1;
}
.product-grid .e-loop-item{
    width: calc(25% - 24px);
    margin: 12px !important;
    float: left;
    transition-property: opacity !important;
}

@media (max-width:767px) {
    .product-grid .elementor-grid {
        margin: -8px;
    }
    .product-grid .e-loop-item {
        width: calc(50% - 16px);
        margin: 0 8px 32px 8px !important;
    }
}
@media (max-width:479px) {
    .product-grid .e-loop-item {
        width: calc(50% - 16px);
    }
}


/* Filters */
body:not(.elementor-editor-active) .product-filters,
body:not(.elementor-editor-active) .load-more {
    opacity: 0;
    transition: opacity .5s ease;
}
body:not(.elementor-editor-active) .product-filters.filters-ready,
body:not(.elementor-editor-active) .load-more.isotope-ready {
    opacity: 1;
}

/* Topbar Filters */
body:not(.elementor-editor-active) .product-topbar-filters {
    opacity: 0;
    transition: opacity .5s ease;
}
body:not(.elementor-editor-active) .product-topbar-filters.filters-ready {
    opacity: 1;
}

.elementor-element.elementor-widget-shortcode:has(.product-topbar-filters):has(.is-open) {
    z-index: 90 !important;
}

.product-topbar-filters {
    position: relative;
    z-index: 90;
    margin-bottom: 30px;
}

/* Desktop topbar */
.topbar-desktop {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px;
    border: 1px solid var(--e-global-color-secondary-alt);
    border-radius: 10px;
    background-color: var(--e-global-color-accent);
}
.topbar-dropdown {
    position: relative;
}
.topbar-dropdown.topbar-sort {
    margin-left: auto;
}
.topbar-dropdown-toggle {
    background: transparent !important;
    border: none;
    border-radius: 50px !important;
    padding: 10px 20px !important;
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: var(--e-global-color-text) !important;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all .25s ease-out;
    white-space: nowrap;
}
.topbar-dropdown-toggle:hover {
    color: var(--e-global-color-primary);
}
.topbar-dropdown-toggle svg {
    transition: transform .25s ease-out;
    flex-shrink: 0;
}
.topbar-dropdown.is-open .topbar-dropdown-toggle {
    background: var(--e-global-color-primary);
    color: #fff;
}
.topbar-dropdown.is-open .topbar-dropdown-toggle svg {
    transform: rotate(180deg);
}

.topbar-dropdown-panel {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 100;
    background: #fff;
    border-radius: 0 16px 16px 16px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
    padding: 20px 24px;
    min-width: 302px;
    display: none;
}
.topbar-dropdown.is-open .topbar-dropdown-panel {
    display: block;
}
.topbar-sort .topbar-dropdown-panel {
    left: auto;
    right: 0;
    border-radius: 16px 0 16px 16px;
    min-width: 200px;
}

/* Topbar filter checkbox overrides */
.topbar-dropdown-panel .product-filter-buttons {
    margin-bottom: 0;
}
.topbar-dropdown-panel .product-filter-buttons [data-filter] {
    cursor: pointer;
}
.product-filter-buttons .topbar-filter-count {
    color: var(--e-global-color-secondary-alt);
    font-weight: 400;
}
.product-filter-buttons [data-filter].is-disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

/* Sort options */
.topbar-sort-options {
    list-style: none;
    padding: 0;
    margin: 0;
}
.topbar-sort-options li {
    margin-bottom: 4px;
}
.topbar-sort-options li:last-child {
    margin-bottom: 0;
}
.topbar-sort-options span {
    display: block;
    padding-left: 22px;
    cursor: pointer;
    font-size: 14px;
    text-transform: uppercase;
    color: var(--e-global-color-text);
    transition: color .2s ease;
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15"><circle cx="7.5" cy="7.5" r="7.5" fill="rgba(84,126,193,0.15)"/></svg>');
    background-size: 15px;
    background-repeat: no-repeat;
    background-position: left center;
}
.topbar-sort-options span:hover {
    color: var(--e-global-color-primary);
}
.topbar-sort-options span.selected {
    color: var(--e-global-color-primary);
    font-weight: 700;
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15"><circle cx="7.5" cy="7.5" r="7.5" fill="%23547EC1"/></svg>');
}

/* Selected filter chips */
.topbar-selected-filters {
    display: none;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
}
.topbar-selected-filters.is-active {
    display: flex;
}

.topbar-selected-reset,
.topbar-selected-filter {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--e-global-color-primary);
    border: 1px solid var(--e-global-color-primary);
    padding: 4px 16px;
    border-radius: 50px;
    font-size: 14px;
    line-height: 1.4;
    font-weight: 400;
    text-transform: uppercase;
    cursor: pointer;
    transition: background-color .2s ease, color .2s ease;
    white-space: nowrap;
}
.topbar-selected-filter:hover {
    color: var(--e-global-color-secondary-alt);
}
.topbar-selected-reset {
    color: #fff !important;
    background-color: var(--e-global-color-primary);
}
.topbar-selected-reset:hover {
    background-color: var(--e-global-color-secondary-alt);
    color: var(--e-global-color-secondary-alt) !important;
}
.topbar-selected-filter-remove {
    font-weight: 300;
    font-size: 26px;
    line-height: 0;
    flex-shrink: 0;
    transform: translatey(-1px);
}

/* Mobile topbar */
.topbar-mobile {
    display: none;
}

@media (max-width: 1024px) {
    .topbar-desktop {
        display: none;
    }
    .topbar-mobile {
        display: flex;
        align-items: center;
        justify-content: space-between;
        position: relative;
        flex-wrap: wrap;
        background-color: transparent !important;
        z-index: 99;
        border-radius: 16px 16px 0 0;
        padding-top: 16px;
        padding-inline: 16px;
        margin-inline: -16px;
    }

    .topbar-mobile:has(.is-open) {
        background: var(--e-global-color-accent) !important;
    }
    body:has(.topbar-mobile-filter-toggle.is-open)::before,
    body:has(.topbar-mobile-sort-toggle.is-open)::before {
        opacity: 1;
        pointer-events: all;
    }

    .topbar-mobile-filter-toggle,
    .topbar-mobile-sort-toggle {
        background: var(--e-global-color-accent) !important;
        border: none;
        border-radius: 50px !important;
        padding: 10px 18px !important;
        font-family: inherit;
        font-size: 13px;
        font-weight: 700;
        text-transform: uppercase;
        color: var(--e-global-color-text) !important;
        cursor: pointer;
        display: flex;
        align-items: center;
        gap: 6px;
        transition: all .25s ease-out;
        position: relative;
    }
    .topbar-mobile-filter-toggle.is-open,
    .topbar-mobile-sort-toggle.is-open {
        background: var(--e-global-color-primary) !important;
        color: #fff !important;
        border-radius: 20px 20px 0 0;
    }
    .topbar-mobile:has(.is-open) .topbar-mobile-filter-toggle:not(.is-open),
    .topbar-mobile:has(.is-open) .topbar-mobile-sort-toggle:not(.is-open) { 
        background: #fff !important;
    }
    .topbar-mobile-filter-toggle.is-open svg g,
    .topbar-mobile-sort-toggle.is-open svg path {  
        fill: #fff !important;
    }

    .topbar-product-count {
        font-size: 14px;
        font-weight: 700;
        color: var(--e-global-color-text);
        text-transform: uppercase;
    }

    .topbar-mobile-filter-panel,
    .topbar-mobile-sort-panel {
        width: 100%;
        order: 4;
        overflow: hidden;
        max-height: 0;
        opacity: 0;
        transition: max-height .35s ease-out, opacity .25s ease-out, padding .35s ease-out;
        background: var(--e-global-color-accent);
        color: var(--e-global-color-text);
        border-radius: 0 0 16px 16px;
        padding: 0 20px;
        position: absolute;
        top: 100%;
        left: 0;
    }
    .topbar-mobile-filter-panel.is-open,
    .topbar-mobile-sort-panel.is-open {
        max-height: 800px;
        opacity: 1;
        padding: 20px;
    }

    /* Mobile filter groups */
    .topbar-mobile-group {
        margin-bottom: 16px;
    }
    .topbar-mobile-group > strong {
        font-size: 14px;
        font-weight: 700;
        text-transform: uppercase;
        display: block;
        margin-bottom: 10px;
    }
    .topbar-mobile-group .product-filter-buttons {
        color: var(--e-global-color-text);
        margin-bottom: 0;
    }
    .topbar-mobile-group .product-filter-buttons [data-filter] {
        background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15"><rect width="15" height="15" fill="rgba(255,255,255,1)" data-name="Rectangle 239" rx="3"/></svg>') !important;
        cursor: pointer;
    }
    .topbar-mobile-group .product-filter-buttons [data-filter].selected {
        background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15"><rect width="15" height="15" fill="rgba(84,126,193,1)" data-name="Rectangle 239" rx="3"/></svg>') !important;
        cursor: pointer;
    }

    /* Mobile sort options */
    .topbar-mobile-sort-panel .topbar-sort-options span {
        color: var(--e-global-color-text);
        background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15"><circle cx="7.5" cy="7.5" r="7.5" fill="rgba(255,255,255,1)"/></svg>');
    }
    .topbar-mobile-sort-panel .topbar-sort-options span.selected {
        background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15"><circle cx="7.5" cy="7.5" r="7.5" fill="rgba(84,126,193,1)"/></svg>');
    }

    /* Mobile apply button */
    .topbar-mobile-apply {
        background-color: var(--e-global-color-secondary);
        padding: 10px 20px !important;
        text-transform: uppercase;
        color: var(--e-global-color-primary);
        border-radius: 10px 30px 30px 0;
        display: block;
        font-family: inherit;
        font-size: 15px;
        font-weight: 700;
        line-height: 1;
        text-align: center;
        transition: all .3s;
        cursor: pointer;
        border: 0;
        width: 100%;
        margin-top: 10px;
    }
}

