/* ============================================
   SHOP PAGE FILTERING SYSTEM
   ============================================ */

/* Main shop container */
.bollypiano-shop-container {
    width: 100%;
    max-width: 100%;
}

/* Active Filters Bar */
.shop-active-filters {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 0;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    border-bottom: 1px solid #E5E5E5;
}

/* Tablet + mobile: horizontal inset for active filters bar */
@media (max-width: 1024px) {
    .shop-active-filters {
        padding-left: 10px;
        padding-right: 10px;
    }
}

/* Fixed to bottom of viewport on mobile (bar is first in DOM; fixed keeps it visible while scrolling) */
@media (max-width: 768px) {
    .bollypiano-shop-container {
        padding-bottom: 5.75rem;
        box-sizing: border-box;
    }

    .shop-active-filters {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        z-index: 100;
        background-color: #FFFFFF;
        padding: 1rem 10px;
        padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
        margin-top: 0;
        margin-bottom: 0;
        border-top: 1px solid #E5E5E5;
        border-bottom: none;
        box-shadow: 0 -2px 4px rgba(0, 0, 0, 0.05);
    }
}

/* Filters Toggle Button (hidden on desktop, visible on tablet/mobile) */
.shop-filters-toggle-btn {
    display: none; /* Hidden on desktop */
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    background-color: #FFFFFF;
    border: 1px solid var(--primary);
    border-radius: 8px;
    color: var(--primary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.shop-filters-toggle-btn:hover {
    background-color: var(--primary);
    color: #FFFFFF;
}

.shop-filters-toggle-btn svg {
    width: 16px;
    height: 16px;
}

.shop-filters-selected-count {
    min-width: 1.35rem;
    height: 1.35rem;
    padding: 0 0.4rem;
    border-radius: 999px;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1;
    background-color: var(--primary);
    color: #FFFFFF;
}

/* Results count */
.shop-results-count {
    font-size: 0.875rem;
    color: var(--text-color);
    font-weight: 400;
}

.results-number {
    font-weight: 600;
    color: #1f1f1f;
}

/* Active filters list */
.shop-active-filters-list {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    flex: 1;
}

/* Filter badge (pill) */
.shop-filter-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.75rem;
    background-color: var(--secondary);
    color: #FFFFFF;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 400;
}

.shop-filter-badge .remove-filter {
    cursor: pointer;
    font-size: 1.125rem;
    line-height: 1;
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

.shop-filter-badge .remove-filter:hover {
    opacity: 1;
}

/* Archive filter badge (category/tag from URL): primary color, not removable */
.shop-filter-badge-archive {
    background-color: var(--primary);
    color: #FFFFFF;
    cursor: default;
}

.shop-filter-badge-archive .remove-filter {
    display: none;
}

/* Archive checkbox in sidebar: disabled, no remove — visual hint it's locked */
.shop-filter-checkbox-archive {
    opacity: 0.9;
}

.shop-filter-checkbox-archive input[disabled] {
    cursor: not-allowed;
}

/* Clear all link */
.shop-clear-all,
.shop-clear-all-link {
    color: var(--primary);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 600;
    transition: color 0.3s ease;
}

.shop-clear-all:hover,
.shop-clear-all-link:hover {
    color: #C57200;
    text-decoration: underline;
}

/* Main content area */
.shop-main-content {
    display: flex;
    gap: 2rem;
    margin-top: 2rem;
}

/* Sorting wrapper */
.shop-sorting-wrapper {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    margin-bottom: 1.5rem;
}

.bollypiano-sort-select {
    border: 1px solid #E5E5E5;
    border-radius: 8px;
    padding: 0.5rem 1.75rem 0.5rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 400;
    color: #1f1f1f;
    background-color: #FFFFFF;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666666' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    transition: all 0.3s ease;
    width: auto;
    min-width: auto;
    max-width: 200px;
}

.bollypiano-sort-select:hover {
    border-color: #CCCCCC;
}

.bollypiano-sort-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(220, 129, 0, 0.1);
}

/* Filter Sidebar */
.shop-filters-sidebar {
    flex: 0 0 280px;
    background-color: #FFFFFF;
    border: 1px solid #E5E5E5;
    border-radius: 12px;
    padding: 1.5rem;
    height: fit-content;
}

/* Hide filters on mobile/tablet by default - show only when active */
@media (max-width: 1024px) {
    .shop-filters-sidebar {
        display: block !important;
    }
}

/* Filter Overlay (for mobile/tablet) */
.shop-filters-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 998;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.shop-filters-overlay.active {
    display: block;
    opacity: 1;
}

/* Filter header actions */
.shop-filters-header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.shop-filters-close-btn {
    display: none; /* Hidden on desktop */
    background: none;
    border: none;
    padding: 0.25rem;
    cursor: pointer;
    color: #1f1f1f;
    transition: color 0.3s ease;
}

.shop-filters-close-btn:hover {
    color: var(--primary);
}

.shop-filters-close-btn svg {
    width: 20px;
    height: 20px;
}

/* Filter header */
.shop-filters-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #E5E5E5;
}

.shop-filters-header h3 {
    font-size: 1.125rem;
    font-weight: 700;
    color: #1f1f1f;
    margin: 0;
}

/* Filter section */
.shop-filter-section {
    margin-bottom: 1.5rem;
    border-bottom: 1px solid #E5E5E5;
    padding-bottom: 1.5rem;
}

.shop-filter-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

/* Filter header (collapsible) */
.shop-filter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    padding: 0.75rem 0;
    user-select: none;
}

.shop-filter-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: #1f1f1f;
}

.shop-filter-toggle {
    font-size: 1rem;
    color: #666666;
    transition: transform 0.3s ease;
}

/* Filter content */
.shop-filter-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.shop-filter-content.active {
    max-height: 2000px;
    overflow: visible;
}

/* Checkbox styling */
.shop-filter-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 2.5rem;
    padding: 0.5rem 0;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--text-color);
    transition: color 0.3s ease;
    box-sizing: border-box;
}

.shop-filter-checkbox:hover {
    color: var(--primary);
}

.shop-filter-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary);
}

.shop-checkbox-label {
    flex: 1;
}

/* Browse by Letter Grid */
.shop-letter-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.shop-letter-btn {
    background-color: #F5F5F5;
    color: #1f1f1f;
    border: 1px solid #E5E5E5;
    border-radius: 8px;
    padding: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.shop-letter-btn:hover {
    background-color: var(--primary);
    color: #FFFFFF;
    border-color: var(--primary);
}

.shop-letter-btn.active {
    background-color: var(--primary);
    color: #FFFFFF;
    border-color: var(--primary);
}

/* Attribute search */
.shop-attribute-search {
    margin-bottom: 0.75rem;
}

.shop-attribute-search-input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid #E5E5E5;
    border-radius: 8px;
    font-size: 0.875rem;
    color: #1f1f1f;
    background-color: #FFFFFF;
}

.shop-attribute-search-input:focus {
    outline: none;
    border-color: var(--primary);
}

/* Attribute list (scrollable) */
.shop-attribute-list {
    max-height: 12.5rem; /* 5 items * 2.5rem = 12.5rem (200px) */
    overflow: auto; /* Use overflow instead of overflow-y for better browser support */
    padding-right: 0.5rem;
}

.shop-attribute-list::-webkit-scrollbar {
    width: 6px;
}

.shop-attribute-list::-webkit-scrollbar-track {
    background: #F5F5F5;
    border-radius: 3px;
}

.shop-attribute-list::-webkit-scrollbar-thumb {
    background: #CCCCCC;
    border-radius: 3px;
}

.shop-attribute-list::-webkit-scrollbar-thumb:hover {
    background: #999999;
}

/* Products Area */
.shop-products-area {
    flex: 1;
    min-width: 0;
}

.shop-products-grid {
    transition: opacity 0.3s ease;
}

/* Override WooCommerce default width for shop products */
.shop-products-grid .woocommerce ul.products.columns-5 li.product,
.shop-products-grid .woocommerce-page ul.products.columns-5 li.product,
.shop-products-grid ul.products.columns-5 li.product {
    width: 100% !important;
    flex: 0 0 auto !important;
    max-width: 100% !important;
}

/* Remove WooCommerce ::before and ::after pseudo-elements that interfere with grid */
.shop-products-grid .woocommerce ul.products::before,
.shop-products-grid .woocommerce ul.products::after,
.shop-products-grid .woocommerce-page ul.products::before,
.shop-products-grid .woocommerce-page ul.products::after,
.shop-products-grid ul.products::before,
.shop-products-grid ul.products::after {
    content: none !important;
    display: none !important;
}

/* WooCommerce Product Loop Wrapper - Global */

ul.products,
.shop-products-grid ul.products {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1.5rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

/* Responsive columns */
@media (max-width: 1400px) {
    ul.products,
    .shop-products-grid ul.products {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 1024px) {
    ul.products,
    .shop-products-grid ul.products {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    ul.products,
    .shop-products-grid ul.products {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
}

@media (max-width: 480px) {
    ul.products,
    .shop-products-grid ul.products {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
}

/* Pagination */
.bollypiano-pagination-container {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid #E5E5E5;
    width: 100%;
}

.bollypiano-pagination-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

/* Left section - Show per page */
.bollypiano-pagination-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
    flex-shrink: 0;
}

.bollypiano-pagination-label {
    font-size: 0.875rem;
    color: #1f1f1f;
    white-space: nowrap;
}

.bollypiano-per-page-select {
    border: 1px solid var(--primary);
    border-radius: 8px;
    padding: 0.5rem 2rem 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: #1f1f1f;
    background-color: #FFFFFF;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23DC8100' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    transition: all 0.3s ease;
}

.bollypiano-per-page-select:hover {
    border-color: #C57200;
}

.bollypiano-per-page-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(220, 129, 0, 0.1);
}

/* Center section - Pagination controls */
.bollypiano-pagination-center {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
    flex: 1;
}

.bollypiano-pagination-btn {
    background-color: #FFFFFF;
    color: var(--primary);
    border: 1px solid var(--primary);
    border-radius: 8px;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 40px;
    text-align: center;
}

.bollypiano-pagination-btn:hover:not(:disabled):not(.disabled) {
    background-color: var(--primary);
    color: #FFFFFF;
    border-color: var(--primary);
}

.bollypiano-pagination-btn.active {
    background-color: color-mix(in srgb, var(--primary) 70%, black);
    color: #FFFFFF;
    border-color: color-mix(in srgb, var(--primary) 70%, black);
}

.bollypiano-pagination-btn:disabled,
.bollypiano-pagination-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* Default: Show text, hide arrows on desktop */
.bollypiano-pagination-prev .pagination-arrow,
.bollypiano-pagination-next .pagination-arrow {
    display: none;
}

.bollypiano-pagination-prev .pagination-text,
.bollypiano-pagination-next .pagination-text {
    display: inline-block;
}

.bollypiano-pagination-dots {
    padding: 0 0.5rem;
    color: #666666;
    font-size: 0.875rem;
}

/* Right section - Page count */
.bollypiano-pagination-right {
    display: flex;
    align-items: center;
}

.bollypiano-page-count {
    font-size: 0.875rem;
    color: #1f1f1f;
}

/* Responsive */
@media (max-width: 768px) {
    .shop-sorting-wrapper {
        justify-content: flex-start;
        margin-bottom: 1rem;
    }
    
    .bollypiano-sort-select {
        font-size: 0.75rem;
        padding: 0.375rem 1.5rem 0.375rem 0.5rem;
        max-width: 160px;
    }
    
    .bollypiano-pagination-container {
        padding-top: 1rem;
        margin-top: 1rem;
    }
    
    .bollypiano-pagination-wrapper {
        flex-direction: column;
        align-items: center;
        gap: 1rem;
    }
    
    /* Compact left section - full width row */
    .bollypiano-pagination-left {
        width: 100%;
        justify-content: center;
        gap: 0.25rem;
    }
    
    .bollypiano-pagination-label {
        font-size: 0.75rem;
    }
    
    .bollypiano-per-page-select {
        padding: 0.375rem 1.5rem 0.375rem 0.75rem;
        font-size: 0.75rem;
        min-width: 50px;
    }
    
    /* Compact center section - full width row, arrows only for prev/next */
    .bollypiano-pagination-center {
        width: 100%;
        justify-content: center;
        gap: 0.25rem;
    }
    
    .bollypiano-pagination-btn {
        padding: 0.375rem 0.75rem;
        font-size: 0.75rem;
        min-width: 32px;
    }
    
    /* Hide text in prev/next buttons, show only arrows on mobile */
    .bollypiano-pagination-prev .pagination-text,
    .bollypiano-pagination-next .pagination-text {
        display: none;
    }
    
    .bollypiano-pagination-prev .pagination-arrow,
    .bollypiano-pagination-next .pagination-arrow {
        display: inline-block;
        font-size: 1.125rem;
        line-height: 1;
    }
    
    .bollypiano-pagination-prev,
    .bollypiano-pagination-next {
        padding: 0.375rem;
        min-width: 32px;
    }
    
    /* Compact right section - full width row */
    .bollypiano-pagination-right {
        width: 100%;
        justify-content: center;
    }
    
    .bollypiano-page-count {
        font-size: 0.75rem;
    }
    
    .bollypiano-pagination-dots {
        padding: 0 0.25rem;
        font-size: 0.75rem;
    }
}

/* Legacy support for custom product items */
.shop-product-item {
    background-color: #FFFFFF;
    border: 1px solid #E5E5E5;
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.shop-product-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.shop-product-item a {
    text-decoration: none;
    color: inherit;
    display: block;
}

.shop-product-image {
    width: 100%;
    aspect-ratio: 1;
    overflow: hidden;
    background-color: #F5F5F5;
}

.shop-product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.shop-product-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: #1f1f1f;
    margin: 0.75rem;
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.shop-product-price {
    margin: 0 0.75rem 0.75rem;
    font-size: 0.875rem;
    color: var(--primary);
    font-weight: 600;
}

/* Responsive Design */
/* Tablet: Slide out from side */
@media (min-width: 769px) and (max-width: 1024px) {
    .shop-main-content {
        flex-direction: column;
        gap: 1.5rem;
    }
    
    .shop-filters-toggle-btn {
        display: flex;
    }
    
    .shop-filters-close-btn {
        display: block;
    }
    
    /* Hide sidebar from normal flow on tablet */
    .shop-filters-sidebar {
        display: none !important;
        flex: none;
    }
    
    /* Show sidebar when active (slide from left) */
    .shop-filters-sidebar.active {
        display: block !important;
        position: fixed;
        top: 0;
        left: 0;
        width: 320px;
        max-width: 85vw;
        height: 100vh;
        z-index: 999;
        border-radius: 0;
        border-left: 1px solid #E5E5E5;
        overflow-y: auto;
        transition: left 0.3s ease;
        box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1);
    }
    
    .shop-products-grid ul.products {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
        gap: 1rem;
    }
}

/* Mobile: Fixed to bottom, slide up */
@media (max-width: 768px) {
    .shop-main-content {
        flex-direction: column;
    }
    
    /* Hide sidebar from normal flow on mobile */
    .shop-filters-sidebar {
        display: none !important;
    }
    
    .shop-active-filters {
        flex-direction: row;
        align-items: center;
        flex-wrap: wrap;
    }
    
    .shop-active-filters-list,
    .shop-clear-all {
        display: none !important;
    }

    .shop-filters-selected-count {
        display: inline-flex;
    }
    
    .shop-filters-toggle-btn {
        display: flex;
    }
    
    .shop-filters-close-btn {
        display: block;
    }
    
    /* Show filters sidebar when active (fixed to bottom) */
    .shop-filters-sidebar.active {
        display: block !important;
        flex: none;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        max-width: 100%;
        max-height: 85vh;
        z-index: 999;
        border-radius: 16px 16px 0 0;
        border: none;
        border-top: 1px solid #E5E5E5;
        padding: 1rem;
        overflow-y: auto;
        transition: bottom 0.3s ease;
        box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1);
    }
    
    .shop-letter-grid {
        grid-template-columns: repeat(5, 1fr);
    }
    
    .shop-products-grid ul.products {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 0.75rem;
    }
}

@media (max-width: 480px) {
    .shop-letter-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .shop-products-grid ul.products {
        grid-template-columns: repeat(2, 1fr);
    }
}

