:root {
    --ag-primary: #111;
    --ag-secondary: #666;
    --ag-border: #e5e5e5;
    --ag-bg-light: #f9f9f9;
    --ag-accent: #000;
    --ag-white: #fff;
    --ag-radius: 12px;
    --ag-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    --ag-shadow-hover: 0 10px 30px rgba(0, 0, 0, 0.1);
}

/* --- Container & Layout --- */
.ag-shop-container {
    display: flex;
    gap: 30px;
    width: 90%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 40px 0;
}

.ag-shop-filters {
    width: 25%;
    flex-shrink: 0;
    min-width: 260px;
}

.ag-shop-products {
    flex-grow: 1;
    width: auto;
    /* Let flex handle it */
    min-width: 0;
    /* Prevent flex child overflow */
}

/* --- Mobile / Tablet Responsive --- */
@media (max-width: 1024px) {
    .ag-shop-container {
        flex-direction: column;
        width: 95%;
    }

    .ag-shop-filters {
        width: 100%;
        margin-bottom: 30px;
    }

    .ag-shop-products {
        width: 100%;
    }
}

/* --- Filters Styling --- */
.ag-filters-wrapper {
    background: #f9f9f9;
    /* Light grey background */
    padding: 30px;
    border-radius: 12px;
    /* border: 1px solid var(--ag-border); Removed border for cleaner look */
    position: sticky;
    top: 120px;
}

/* Filter Toggle & Collapsible */
.ag-mobile-filter-toggle {
    display: none;
    /* Hidden on desktop */
    width: 100%;
    padding: 12px;
    background: #000;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    margin-bottom: 20px;
    cursor: pointer;
    text-transform: uppercase;
}

.ag-widget-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 20px;
    color: #000;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.ag-widget-title::after {
    content: '\25BC';
    /* Down arrow */
    font-size: 12px;
    transition: transform 0.3s;
}

.ag-widget-title.active::after {
    transform: rotate(180deg);
}

@media (max-width: 1024px) {
    .ag-shop-filters {
        display: none;
        /* Hidden by default on mobile/tablet */
    }

    .ag-mobile-filter-toggle {
        display: block;
    }
}

.ag-price-input-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ag-filter-group {
    margin-bottom: 25px;
    border-bottom: 1px solid #eee;
    padding-bottom: 25px;
}

.ag-filter-group:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

/* Checkboxes */
.ag-filter-checkbox-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.ag-filter-checkbox-list li {
    margin-bottom: 12px;
}

.ag-filter-checkbox-list label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 15px;
    color: var(--ag-secondary);
    transition: color 0.2s;
}

.ag-filter-checkbox-list label:hover {
    color: var(--ag-primary);
}

.ag-filter-checkbox-list input[type="checkbox"] {
    margin-right: 12px;
    width: 18px;
    height: 18px;
    border: 1px solid #ccc;
    border-radius: 4px;
    accent-color: var(--ag-primary);
}

/* Price Slider */
.ag-price-slider-range {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    color: var(--ag-secondary);
    margin-top: 15px;
}

/* --- Product Grid --- */
.ag-products-grid {
    display: grid;
    /* Default to 3, but allow Elementor to override via style attribute */
    grid-template-columns: repeat(3, 1fr);
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); /* Fallback for safe fit */
    gap: 20px;
    width: 100%;
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* Fix for blank space at start of grid (Theme compatibility) */
.ag-products-grid::before,
.ag-products-grid::after {
    display: none !important;
    content: none !important;
}

/* Grid Item Force Width */
.ag-products-grid .product {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    float: none !important;
    position: relative;
    list-style: none !important;
    margin-bottom: 0 !important;
    min-width: 0; /* Prevents overflow in grid items */
    /* Grid handles gap */
}

@media (max-width: 1024px) {
    .ag-products-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .ag-products-grid {
        grid-template-columns: 1fr;
    }
}

/* --- Product Card --- */
/* --- Product Card --- */
.ag-products-grid .product,
.product-card {
    background: var(--ag-white);
    border-radius: 12px;
    /* Smooth radius */
    overflow: hidden;
    transition: all 0.3s ease;
    border: 1px solid #f0f0f0;
    position: relative;
    text-align: left;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
    /* Subtle shadow always */
}

.ag-products-grid .product:hover,
.product-card:hover {
    transform: translateY(-5px);
    /* Lift */
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.08);
    /* Enhanced shadow on hover */
    border-color: transparent;
}

.product-image-wrapper {
    position: relative;
    padding-top: 125%;
    /* Aspect Ratio 4:5 */
    overflow: hidden;
    background: #f8f8f8;
}

.product-image-wrapper img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease;
}

.product-image-wrapper:hover img {
    transform: scale(1.08);
}

.product-image-wrapper:hover .product-image-hover {
    opacity: 1;
}

.product-image-wrapper:hover .product-image-main {
    opacity: 0;
}

/* Badge */
.ag-badge {
    position: absolute;
    top: 15px;
    left: 15px;
    background: #fff;
    color: #000;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 700;
    border-radius: 6px;
    z-index: 2;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Product Info */
.product-details {
    padding: 15px;
}

/* Category Pill */
body .product-category,
body .ag-category-wrap .product-category,
body .ag-products-grid li.product .product-category {
    font-size: 10px !important;
    color: #F26635 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    font-weight: 700 !important;
    border: 1px solid #F26635 !important;
    border-radius: 20px !important;
    padding: 3px 10px !important;
    display: inline-block !important;
    line-height: normal !important;
    background: transparent !important;
    box-sizing: border-box !important;
    margin: 0 !important;
    /* Margin handled by wrapper */
    text-decoration: none !important;
}

body .product-category:hover {
    background: #F26635 !important;
    color: #fff !important;
}

body .product-title,
body .woocommerce-loop-product__title,
body .woocommerce ul.products li.product .woocommerce-loop-product__title {
    font-size: 15px !important;
    font-weight: 700 !important;
    color: var(--ag-primary) !important;
    margin: 5px 0 5px !important;
    line-height: 1.4 !important;
    padding-left: 15px !important;
    padding-right: 15px !important;
    box-sizing: border-box !important;
    width: 100% !important;
    clear: both !important;
    /* Ensure it drops below category */
}

body .product-title a,
body .woocommerce-loop-product__title a {
    text-decoration: none !important;
    color: inherit !important;
    display: block !important;
}

body .product-rating,
body .star-rating {
    margin-bottom: 8px !important;
    padding-left: 15px !important;
    padding-right: 15px !important;
    box-sizing: border-box !important;
    clear: both !important;
}

body .product-price,
body .price,
body .woocommerce ul.products li.product .price {
    font-size: 18px !important;
    font-weight: 700 !important;
    color: #111 !important;
    display: flex !important;
    align-items: center !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
    padding-left: 15px !important;
    padding-right: 15px !important;
    margin-bottom: 15px !important;
    box-sizing: border-box !important;
    clear: both !important;
}

body .product-price del,
body .price del {
    font-size: 14px !important;
    color: #bbb !important;
    font-weight: 400 !important;
    opacity: 0.7 !important;
}

/* Add to Cart Button */
body .ag-add-to-cart-btn,
body .product-card .add_to_cart_button,
body .product-card .button,
body .woocommerce ul.products li.product .button,
body .woocommerce ul.products li.product .add_to_cart_button {
    display: inline-block !important;
    width: auto !important;
    /* Force Auto Width */
    max-width: 100% !important;
    min-width: unset !important;
    margin: 0 0 20px 15px !important;
    /* Margin Left 15px */
    padding: 10px 20px !important;
    background: #000 !important;
    color: #fff !important;
    text-decoration: none !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    border-radius: 6px !important;
    transition: all 0.3s ease !important;
    text-align: center !important;
    border: none !important;
    cursor: pointer !important;
    text-transform: uppercase !important;
    letter-spacing: 1px !important;
    float: none !important;
    line-height: 1.5 !important;
}

body .ag-add-to-cart-btn:hover,
body .product-card .add_to_cart_button:hover,
body .product-card .button:hover,
body .woocommerce ul.products li.product .button:hover,
body .woocommerce ul.products li.product .add_to_cart_button:hover {
    background: #F26635 !important;
    color: #fff !important;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(242, 102, 53, 0.3) !important;
}

/* WhatsApp Button */
body .ag-whatsapp-btn {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 10px !important;
    background: #25d366 !important;
    color: #fff !important;
    margin: 0 15px 20px 15px !important;
    padding: 10px 20px !important;
    border-radius: 6px !important;
    text-decoration: none !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    transition: all 0.3s ease !important;
    border: none !important;
}

body .ag-whatsapp-btn:hover {
    background: #128c7e !important;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(37, 211, 102, 0.3) !important;
}

body .ag-whatsapp-btn svg {
    width: 18px !important;
    height: 18px !important;
    fill: currentColor !important;
}

body .ag-add-to-cart-btn.loading,
body .add_to_cart_button.loading {
    opacity: 0.7 !important;
    cursor: wait !important;
}

/* --- Loader --- */
.ag-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    z-index: 10;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 100px;
    border-radius: 12px;
}

.ag-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(0, 0, 0, 0.05);
    border-radius: 50%;
    border-top-color: #000;
    animation: ag-spin 0.8s ease-in-out infinite;
}

@keyframes ag-spin {
    to {
        transform: rotate(360deg);
    }
}

/* --- Pagination --- */
.ag-pagination {
    margin-top: 50px;
    text-align: center;
    display: flex;
    justify-content: center;
}

.ag-pagination ul {
    list-style: none;
    display: flex;
    padding: 0;
    gap: 10px;
    margin: 0;
}

.ag-pagination .page-numbers {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    /* Square with radius */
    background: #fff;
    border: 1px solid #eee;
    color: #000;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.2s;
}

.ag-pagination .page-numbers.current,
.ag-pagination .page-numbers:hover {
    background: #000;
    color: white;
    border-color: #000;
}