/**
 * MCJ Product Filter Styles
 * Custom WooCommerce product filtering and grid styles
 *
 * @version 1.0.0
 */

/* --- BASE PRODUCT GRID STYLES (3 Columns on Desktop/Large Tablet) --- */
.products.columns-3 {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 20px !important;
    list-style: none !important;
    padding: 0 !important;
    margin: 0 0 30px 0 !important;
}
.products.columns-3::before, .products.columns-3::after { display: none !important; content: none !important; }
.products.columns-3 .product {
    margin: 0 !important;
    width: 100% !important;
    padding: 0 !important;
}
.woocommerce-pagination { text-align: center; margin: 30px 0; padding: 20px 0; }
.woocommerce-pagination .page-numbers { display: inline-flex; gap: 8px; align-items: center; justify-content: center; flex-wrap: wrap; }
.woocommerce-pagination a.page-numbers, .woocommerce-pagination span.page-numbers { display: inline-flex; align-items: center; justify-content: center; min-width: 40px; height: 40px; padding: 8px 12px; margin: 4px; border: 1px solid #ddd; border-radius: 4px; text-decoration: none; color: #333; font-weight: 500; transition: all 0.3s ease; background: #fff; }
.woocommerce-pagination a.page-numbers:hover { background: #013d29; color: #fff; border-color: #013d29; }
.woocommerce-pagination span.page-numbers.current { background: #f2bf09; color: #013d29; border-color: #f2bf09; font-weight: 600; }
.woocommerce-pagination a.prev, .woocommerce-pagination a.next { padding: 8px 16px; font-weight: 600; }

/* Custom Checkbox Styling */
.shop-filters-wrapper .custom-checkbox-label { display: flex; align-items: center; cursor: pointer; margin-bottom: 12px; position: relative; padding-left: 35px; user-select: none; line-height: 1.4; }
.shop-filters-wrapper .custom-checkbox-label input[type="checkbox"] { position: absolute; opacity: 0; cursor: pointer; height: 0; width: 0; }
.shop-filters-wrapper .custom-checkbox { position: absolute; left: 0; top: 50%; transform: translateY(-50%); height: 22px; width: 22px; background-color: #fff; border: 2px solid #fff; border-radius: 3px; transition: all 0.3s ease; }
.shop-filters-wrapper .custom-checkbox-label:hover .custom-checkbox { background-color: #f0f0f0; border-color: #f2bf09; }
.shop-filters-wrapper .custom-checkbox-label input[type="checkbox"]:checked~.custom-checkbox { background-color: #f2bf09; border-color: #f2bf09; }
.shop-filters-wrapper .custom-checkbox:after { content: ""; position: absolute; display: none; left: 5px; top: 1px; width: 6px; height: 11px; border: solid #013d29; border-width: 0 3px 3px 0; transform: rotate(45deg); }
.shop-filters-wrapper .custom-checkbox-label input[type="checkbox"]:checked~.custom-checkbox:after { display: block; }
.shop-filters-wrapper .checkbox-text { color: #fff; font-size: 14px; transition: color 0.2s ease; }
.shop-filters-wrapper .custom-checkbox-label:hover .checkbox-text { color: #f2bf09; }
.shop-filters-wrapper .filter-heading { color: #f2bf09; font-size: 16px; font-weight: 600; margin-bottom: 15px; margin-top: 0; }
.shop-filters-wrapper .custom-checkbox-label input[type="checkbox"]:focus~.custom-checkbox { box-shadow: 0 0 0 3px rgba(242, 191, 9, 0.3); }

/* --- 1. TABLET/SMALL DESKTOP LAYOUT (991px to 480px) --- */
@media (max-width: 991px) {
    .products.columns-3 {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 15px !important;
    }
}

/* --- 2. MOBILE LAYOUT (767px and below) - Keep 2 columns --- */
@media (max-width: 767px) {
    .products.columns-3 {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
    }
}

/* --- 3. SMALL MOBILE (479px and below) --- */
@media (max-width: 479px) {
    .products.columns-3 {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
    }
    .woocommerce-pagination a.page-numbers, .woocommerce-pagination span.page-numbers {
        min-width: 36px; height: 36px; padding: 6px 10px; font-size: 14px;
    }
}

/* --- LOADING INDICATOR (Pulsing Dots) --- */
.mcj-loader-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.85);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
}
.mcj-loader-overlay.active {
    display: flex;
}
.mcj-loader-dots {
    display: flex;
    gap: 8px;
}
.mcj-loader-dots span {
    width: 12px;
    height: 12px;
    background: #013d29;
    border-radius: 50%;
    animation: mcj-pulse 1.4s ease-in-out infinite;
}
.mcj-loader-dots span:nth-child(2) {
    animation-delay: 0.2s;
}
.mcj-loader-dots span:nth-child(3) {
    animation-delay: 0.4s;
}
@keyframes mcj-pulse {
    0%, 80%, 100% {
        transform: scale(0.6);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}
#products-container {
    position: relative;
}

/* --- MOBILE DRAWER & VISIBILITY FIX (991px and below) --- */
@media (max-width: 991px) {
    #filter-toggle-button { display: block !important; }
    #close-filters-button { display: block !important; }

    #shop-filters-mobile-drawer {
        position: fixed;
        top: 64px;
        left: 0;
        width: 100%;
        height: calc(100% - 64px);
        z-index: 99999;
        background-color: rgba(0, 0, 0, 0.7);
        overflow-y: auto;
        display: none;
        transform: translateX(-100%);
        transition: transform 0.3s ease-in-out;
    }
    #shop-filters-mobile-drawer.active {
        display: block;
        transform: translateX(0);
    }
    .shop-filters-wrapper {
        width: 80%;
        max-width: 300px;
        height: fit-content;
        border-radius: 0;
        overflow: scroll;
    }
    .shop-content-wrapper { display: flex; flex-direction: column; }
    #filter-toggle-button { order: -1; }
}
