/**
 * Shop filters – mobile off-canvas only (< 992px).
 * Desktop layout unchanged. Scoped under .shop-layout.
 *
 * @package RinnoTools
 */

@media (max-width: 991px) {
    .widget__title {
        display: none;
    }
    .shop-layout .shop-layout__sidebar {
        /* Hide sidebar in flow on mobile; content is moved into drawer when open */
        display: none;
    }

    /* Sticky bar: Filters button + count */
    .shop-filters-mobile-bar {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 12px 0;
        margin-bottom: 0;
        position: sticky;
        top: 0;
        z-index: 100;
        background: #fff;
        flex-shrink: 0;
    }

    .shop-filters-mobile-bar__btn {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        padding: 10px 16px;
        font-size: 14px;
        font-weight: 500;
        color: #333;
        background: #f5f5f5;
        border: 1px solid #e0e0e0;
        border-radius: 4px;
        cursor: pointer;
    }

    .shop-filters-mobile-bar__btn:hover {
        background: #eee;
        border-color: #ccc;
    }

    .shop-filters-mobile-bar__count {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 20px;
        height: 20px;
        padding: 0 6px;
        font-size: 12px;
        font-weight: 600;
        color: #fff;
        background: #236f76;
        border-radius: 10px;
    }

    .shop-filters-mobile-bar__count[data-count="0"] {
        display: none;
    }

    /* Drawer overlay */
    .shop-filters-drawer {
        position: fixed;
        inset: 0;
        z-index: 1000;
        visibility: hidden;
        pointer-events: none;
    }

    .shop-filters-drawer.is-open {
        visibility: visible;
        pointer-events: auto;
    }

    .shop-filters-drawer__backdrop {
        position: absolute;
        inset: 0;
        background: rgba(0, 0, 0, 0.4);
        opacity: 0;
        transition: opacity 0.25s ease;
    }

    .shop-filters-drawer.is-open .shop-filters-drawer__backdrop {
        opacity: 1;
    }

    /* Drawer panel (left side) */
    .shop-filters-drawer__panel {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        max-width: 320px;
        height: 100%;
        background: #fff;
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }

    .shop-filters-drawer.is-open .shop-filters-drawer__panel {
        transform: translateX(0);
    }

    .shop-filters-drawer__header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        flex-shrink: 0;
        padding: 16px;
        border-bottom: 1px solid #e5e5e5;
        background: #fff;
    }

    .shop-filters-drawer__title {
        margin: 0;
        font-size: 18px;
        font-weight: 600;
    }

    .shop-filters-drawer__close {
        padding: 8px;
        background: transparent;
        border: none;
        cursor: pointer;
        line-height: 1;
        color: #666;
    }

    .shop-filters-drawer__close:hover {
        color: #333;
    }

    .shop-filters-drawer__inner {
        flex: 1;
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        padding: 16px;
    }

    .shop-filters-drawer__inner .block-sidebar__item {
        padding: 0;
    }

    .shop-filters-drawer__inner .widget-filters {
        border: none;
        padding: 0;
    }

    .shop-filters-drawer__actions {
        flex-shrink: 0;
        display: flex;
        gap: 12px;
        padding: 16px;
        border-top: 1px solid #e5e5e5;
        background: #fff;
    }

    .shop-filters-drawer__actions .btn {
        flex: 1;
        padding: 12px 16px;
        font-size: 14px;
        font-weight: 500;
        border-radius: 4px;
        cursor: pointer;
        text-align: center;
    }

    .shop-filters-drawer__apply {
        background: #236f76;
        color: #fff;
        border: none;
    }

    .shop-filters-drawer__apply:hover {
        background: #1d5d63;
    }

    .shop-filters-drawer__clear {
        background: #fff;
        color: #333;
        border: 1px solid #ccc;
    }

    .shop-filters-drawer__clear:hover {
        background: #f5f5f5;
    }

    /* Prevent horizontal overflow when drawer is open; top set by JS for scroll restore */
    body.shop-filters-drawer-open {
        overflow: hidden;
        position: fixed;
        width: 100%;
        left: 0;
        right: 0;
    }

    body.admin-bar.shop-filters-drawer-open {
        top: 46px !important;
    }

    body.admin-bar .shop-filters-drawer__panel {
        top: 46px !important;
        height: calc(100vh - 46px) !important;
    }
}

/* Desktop: hide mobile bar and drawer UI */
@media (min-width: 992px) {
    .shop-filters-mobile-bar,
    .shop-filters-drawer {
        display: none !important;
    }
}
