.shop-header {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 20px;
    padding-right: 20px;
}

.shop-sorting {
    position: relative;
    z-index: 100;
}

.sorting-button {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    color: #333;
    transition: all 0.3s ease;
}

.sorting-button:hover {
    background: #f5f5f5;
}

.sorting-button svg {
    transition: transform 0.3s ease;
}

.sorting-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    width: 220px;
    background: #fff;
    border-radius: 16px;
    margin-top: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    display: none;
    padding: 12px 0;
}

.sorting-dropdown.active {
    display: block;
}

.sorting-option {
    display: block;
    padding: 8px 24px;
    color: #666;
    text-decoration: none;
    transition: background 0.3s ease;
    font-size: 13px;
    font-weight: 500;
    text-align: left;
    line-height: 1.4;
}

.sorting-option:hover {
    background: #f8f8f8;
    color: #333;
}

/* Active state for the button */
.sorting-dropdown.active + .sorting-button svg {
    transform: rotate(180deg);
}

/* Load More Button */
.load-more-container {
    display: flex;
    justify-content: center;
    margin: 40px 0;
    position: relative;
    z-index: 10;
}

.load-more-button {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 12px 32px;
    font-size: 15px;
    color: #333;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 160px;
    text-align: center;
    font-weight: 500;
}

.load-more-button:hover {
    background: #f5f5f5;
}

.load-more-button.loading {
    opacity: 0.7;
    cursor: wait;
}

.load-more-button.loading::after {
    content: '';
    display: inline-block;
    width: 12px;
    height: 12px;
    margin-left: 8px;
    border: 2px solid #333;
    border-top-color: transparent;
    border-radius: 50%;
    animation: loading-spinner 0.8s linear infinite;
}

@keyframes loading-spinner {
    to {
        transform: rotate(360deg);
    }
}

/* Mobile Styles */
.mobile-shop-header {
    display: none;
    padding: 16px 12px;
    gap: 10px;
    background: #fff;
    border-bottom: 1px solid #eee;
    margin-top: 100px;
    justify-content: center;
    flex-direction: row-reverse;
    position: relative;
    margin-bottom: -130px;
    z-index: 1200; /* below fs-sidebar overlay (1500) and sidebar (2000) */
}

.mobile-filter-button {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    color: #333;
    min-width: 160px;
    justify-content: center;
    flex: 1;
}

.mobile-filter-header {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border-bottom: 1px solid #eee;
    background: #fff;
}

.filter-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-title {
    font-size: 15px;
    font-weight: 500;
    color: #333;
}

.close-filter {
    width: 32px;
    height: 32px;
    border: none;
    background: none;
    padding: 0;
    cursor: pointer;
    color: #333;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.3s ease;
}

.close-filter:hover {
    background: #f5f5f5;
}

.close-filter svg {
    width: 24px;
    height: 24px;
}

.clear-filter {
    border: none;
    background: none;
    padding: 8px 12px;
    color: #666;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
}

.clear-filter svg {
    color: #666;
}

.filter-content {
    padding: 16px;
}

.filter-content h3 {
    display: none;
}

.filter-content .widget {
    margin-bottom: 24px;
}

.filter-content .widget-title {
    font-size: 15px;
    font-weight: 500;
    margin-bottom: 12px;
    color: #333;
}

.filter-content ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.filter-content li {
    margin-bottom: 8px;
}

.filter-content label {
    font-size: 14px;
    color: #666;
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-content input[type="checkbox"] {
    width: 18px;
    height: 18px;
}

/* Price range inputs */
.price-inputs {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 12px;
}

.price-input-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.price-input-group label {
    font-size: 14px;
    color: #666;
    min-width: 40px;
}

.price-input-group input {
    width: 80px;
    padding: 6px 8px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    font-size: 14px;
}

/* Desktop/Mobile visibility */
@media (max-width: 768px) {
    .mobile-shop-header {
        display: flex;
    }

    .sorting-button {
        min-width: 160px;
        justify-content: center;
        flex: 1;
        position: relative;
    }

    .sorting-dropdown {
        position: absolute;
        top: calc(100% + 8px);
        left: 12px;
        right: 12px;
        width: auto;
        min-width: 200px;
        max-width: calc(100vw - 24px);
        z-index: 1300; /* above content but below fs overlay (1500) and sidebar (2000) */
    }

    .mobile-shop-header > * {
        flex: 1;
    }

    .desktop-only {
        display: none;
    }

    #masthead {
        z-index: 1 !important;
    }

    .shop-filter {
        position: fixed;
        top: 0;
        right: -320px;
        width: 320px;
        height: 100vh;
        background: #fff;
        z-index: 999999;
        transition: right 0.3s ease;
        overflow-y: auto;
        box-shadow: -4px 0 20px rgba(0, 0, 0, 0.08);
    }

    .shop-filter.active {
        right: 0;
    }

    /* Responsive: narrower filter drawer for small/mobile devices */
    @media (max-width: 414px) { /* iPhone SE / 12 / 14 widths */
        .shop-filter { width: 300px; right: -300px; }
    }
    @media (max-width: 390px) { /* iPhone 12/13 mini */
        .shop-filter { width: 280px; right: -280px; }
    }
    @media (max-width: 375px) { /* iPhone SE */
        .shop-filter { width: 270px; right: -270px; }
    }
    @media (max-width: 360px) { /* small Android / older devices */
        .shop-filter { width: 260px; right: -260px; }
    }
    @media (min-width: 768px) and (max-width: 820px) { /* iPad mini / small tablets in portrait */
        .shop-filter { width: 360px; right: -360px; }
    }

    .mobile-filter-header {
        display: flex;
    }

    .filter-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999998;
    }

    .filter-overlay.active {
        display: block;
    }

    body.filter-open {
        overflow: hidden;
    }

    .shop-layout {
        flex-direction: column;
    }

    .shop-container {
        min-height: calc(100vh + 900px);
        height: auto;
        overflow: visible;
    }

    .shop-content {
        position: relative;
        z-index: 2;
        padding-bottom: 100px;
        min-height: 900px;
        overflow: visible;
    }

    /* EXTREMELY STRONG MOBILE GRID STYLES - ONE PRODUCT PER ROW */
    ul.products,
    .products,
    .products-grid,
    .product-grid,
    #products-container,
    .woocommerce ul.products,
    .woocommerce-page ul.products {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 20px !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 0 12px !important;
        list-style: none !important;
        box-sizing: border-box !important;
        min-height: 300px !important;
        overflow: visible !important;
        grid-auto-rows: auto !important;
    }

    /* FORCE PRODUCT ITEMS TO BE GRID ITEMS */
    ul.products li,
    .products li,
    .products-grid li,
    .product-grid li,
    #products-container li,
    ul.products li.product,
    .products li.product,
    .products-grid li.product,
    .product-grid li.product,
    #products-container li.product,
    .woocommerce ul.products li.product,
    .woocommerce-page ul.products li.product,
    li.product {
        width: 100% !important;
        height: auto !important;
        margin: 0 !important;
        padding: 0 !important;
        float: none !important;
        display: block !important;
        clear: none !important;
        position: relative !important;
        box-sizing: border-box !important;
        grid-column: span 1 !important;
        opacity: 1 !important;
        visibility: visible !important;
        overflow: visible !important;
    }

    /* Force nth-child visibility */
    ul.products li:nth-child(n+5),
    .products li:nth-child(n+5),
    ul.products li.product:nth-child(n+5),
    .products li.product:nth-child(n+5),
    .woocommerce ul.products li.product:nth-child(n+5) {
        display: block !important;
        opacity: 1 !important;
        visibility: visible !important;
        position: relative !important;
        height: auto !important;
        max-height: none !important;
        overflow: visible !important;
    }

    /* REMOVE ALL CLEARFIX AND PSEUDO ELEMENTS */
    ul.products::before,
    ul.products::after,
    .products::before,
    .products::after,
    .products-grid::before,
    .products-grid::after,
    .woocommerce ul.products::before,
    .woocommerce ul.products::after,
    .woocommerce-page ul.products::before,
    .woocommerce-page ul.products::after {
        display: none !important;
        content: none !important;
    }

    /* CAROUSEL PRODUCT OVERRIDES - ONE PER ROW */
    .carousel-product-card,
    .carousel-product-image,
    .brxe-carousel .swiper-slide {
        width: 100% !important;
        margin-right: 0 !important;
        margin-bottom: 20px !important;
        float: none !important;
        display: block !important;
        opacity: 1 !important;
        visibility: visible !important;
    }

    .carousel-product-card:nth-child(2n),
    .carousel-product-card:nth-child(2n+1) {
        margin-right: 0 !important;
        float: none !important;
        clear: none !important;
    }

    /* SWIPER OVERRIDES FOR MOBILE - ONE PER ROW */
    .swiper-wrapper {
        display: flex !important;
        flex-direction: column !important;
        flex-wrap: nowrap !important;
        transform: none !important;
        height: auto !important;
        min-height: 300px !important;
    }

    .swiper-slide {
        width: 100% !important;
        margin-right: 0 !important;
        margin-bottom: 20px !important;
        flex-shrink: 0 !important;
        opacity: 1 !important;
        visibility: visible !important;
    }

    /* Override any height restrictions */
    .swiper-container,
    .brxe-carousel {
        height: auto !important;
        min-height: 300px !important;
        overflow: visible !important;
    }

    /* Mobile Load More Button */
    .load-more-container {
        position: relative;
        z-index: 2;
        margin: 20px 0 40px 0;
        width: 100%;
    }

    .load-more-button {
        min-width: 200px;
        width: auto;
        margin: 0;
        padding: 12px 32px;
        font-size: 15px;
        background: #fff;
        position: relative;
        z-index: 2;
        border: 1px solid #e0e0e0;
        border-radius: 4px;
        font-weight: 500;
    }

    /* Hide recommendations section */
    .brxe-block[data-id="recommendations"],
    .featured-section {
        display: none !important;
    }
    
    /* Hide features-section and footer on mobile */
    .features-section {
        display: none !important;
    }
    
    #footer,
    footer {
        display: none !important;
    }
}

@media (min-width: 769px) {
    .mobile-shop-header {
        display: none;
    }
} 