/* ==========================================================================
   Catalog mobile filter bar + bottom sheet
   ========================================================================== */

.catalog-filter-bar {
    display: none;
}

body.catalog-filter-sheet-open {
    overflow: hidden;
}

@media (max-width: 991px) {
    .page--prodotti .catalogue-body {
        padding-bottom: calc(4.75rem + env(safe-area-inset-bottom, 0px));
    }

    .page--prodotti .wa-float {
        bottom: calc(4.65rem + env(safe-area-inset-bottom, 0px));
    }

    .catalog-filter-bar {
        display: block;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 120;
        padding: 0.6rem 1rem calc(0.6rem + env(safe-area-inset-bottom, 0px));
        background: rgba(255, 255, 255, 0.97);
        backdrop-filter: blur(14px);
        -webkit-backdrop-filter: blur(14px);
        border-top: 1px solid #e5e7eb;
        box-shadow: 0 -6px 24px rgba(15, 23, 42, 0.1);
    }

    .catalog-filter-bar__btn {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.55rem;
        width: 100%;
        min-height: 48px;
        padding: 0.75rem 1.25rem;
        border: none;
        border-radius: 12px;
        background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
        color: #fff;
        font-size: 0.95rem;
        font-weight: 800;
        letter-spacing: 0.02em;
        cursor: pointer;
        box-shadow: 0 4px 14px rgba(220, 38, 38, 0.35);
        transition: transform 0.15s ease, box-shadow 0.15s ease;
    }

    .catalog-filter-bar__btn:active {
        transform: scale(0.98);
    }

    .catalog-filter-bar__btn i {
        font-size: 1rem;
    }

    .catalog-filter-bar__badge {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 22px;
        height: 22px;
        padding: 0 6px;
        border-radius: 99px;
        background: #fff;
        color: #dc2626;
        font-size: 0.72rem;
        font-weight: 800;
        line-height: 1;
    }

    .catalog-filter-bar__badge[hidden] {
        display: none !important;
    }

    #tech-sidebar-main {
        position: fixed;
        inset: 0;
        z-index: 200;
        pointer-events: none;
        visibility: hidden;
    }

    #tech-sidebar-main.catalog-filter-sheet--open {
        pointer-events: auto;
        visibility: visible;
    }

    .catalog-filter-sheet__backdrop {
        position: absolute;
        inset: 0;
        background: rgba(15, 23, 42, 0.5);
        opacity: 0;
        transition: opacity 0.28s ease;
    }

    #tech-sidebar-main.catalog-filter-sheet--open .catalog-filter-sheet__backdrop {
        opacity: 1;
    }

    .catalog-filter-sheet__panel {
        position: absolute;
        left: 0;
        right: 0;
        bottom: 0;
        max-height: 92vh;
        background: #fff;
        border-radius: 18px 18px 0 0;
        display: flex;
        flex-direction: column;
        transform: translateY(100%);
        transition: transform 0.32s cubic-bezier(0.32, 0.72, 0, 1);
        box-shadow: 0 -16px 48px rgba(15, 23, 42, 0.18);
    }

    #tech-sidebar-main.catalog-filter-sheet--open .catalog-filter-sheet__panel {
        transform: translateY(0);
    }

    .catalog-filter-sheet__header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.75rem;
        padding: 1rem 1.15rem 0.85rem;
        border-bottom: 1px solid #f3f4f6;
        flex-shrink: 0;
    }

    .catalog-filter-sheet__title-wrap {
        display: flex;
        align-items: center;
        gap: 0.55rem;
        min-width: 0;
    }

    .catalog-filter-sheet__title {
        margin: 0;
        font-size: 1.05rem;
        font-weight: 800;
        color: #111827;
    }

    .catalog-filter-sheet__header-badge {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 22px;
        height: 22px;
        padding: 0 6px;
        border-radius: 99px;
        background: #fef2f2;
        color: #dc2626;
        font-size: 0.72rem;
        font-weight: 800;
    }

    .catalog-filter-sheet__header-badge[hidden] {
        display: none !important;
    }

    .catalog-filter-sheet__close {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 36px;
        height: 36px;
        border: none;
        border-radius: 10px;
        background: #f3f4f6;
        color: #374151;
        font-size: 1.1rem;
        cursor: pointer;
        flex-shrink: 0;
    }

    .catalog-filter-sheet__body {
        overflow-y: auto;
        flex: 1;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }

    .catalog-filter-sheet__body .tech-sidebar {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        border: none !important;
        border-bottom: none !important;
    }

    .catalog-filter-sheet__footer {
        flex-shrink: 0;
        padding: 0.85rem 1.15rem calc(0.85rem + env(safe-area-inset-bottom, 0px));
        border-top: 1px solid #f3f4f6;
        background: #fff;
    }

    .catalog-filter-sheet__cta {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 100%;
        min-height: 46px;
        border: none;
        border-radius: 12px;
        background: #111827;
        color: #fff;
        font-size: 0.92rem;
        font-weight: 700;
        cursor: pointer;
    }

    .catalogue-layout > #tech-sidebar-main {
        order: 0;
        width: 0 !important;
        height: 0 !important;
        overflow: visible;
    }

    .catalogue-layout > .catalogue-main {
        order: 1;
    }
}

@media (min-width: 992px) {
    .catalog-filter-sheet__backdrop,
    .catalog-filter-sheet__header,
    .catalog-filter-sheet__footer {
        display: none;
    }

    .catalog-filter-sheet__panel {
        display: block;
        position: static;
        transform: none;
        max-height: none;
        border-radius: 0;
        box-shadow: none;
        background: transparent;
    }

    .catalog-filter-sheet__body {
        overflow: visible;
    }

    #tech-sidebar-main {
        position: sticky;
        top: 6rem;
        width: auto !important;
        height: auto !important;
        visibility: visible;
        pointer-events: auto;
    }
}