:root {
    /* Colors */
    --color-primary: #27272a;
    --color-secondary: #EA252E;
    --color-accent: #EA252E;
    --color-success: #15803d;
    --color-text: #1f2937;
    --color-text-light: #3f3f46;
    --color-text-muted: #e4e4e4;
    --color-border: #e0e0e0;
    --color-background: #ffffff;
    --color-background-light: #f4f4f5;

    /* Spacing */
    --spacing-xs: 5px;
    --spacing-sm: 10px;
    --spacing-md: 16px;
    --spacing-lg: 18px;

    /* Font Sizes */
    --font-size-xs: 0.8em;
    --font-size-sm: 0.9em;
    --font-size-md: 1em;
    --font-size-lg: 1.2em;
    --font-size-xl: 1.25em;
    --font-size-badge: 16px;

    /* Border Radius */
    --border-radius-sm: 4px;
    --border-radius-md: 6px;
    --border-radius-lg: 8px;

    /* Transitions */
    --transition-default: 0.3s ease;

    /* Font Family */
    --font-family-base: var( --e-global-typography-primary-font-family ), Sans-serif;
}

/* Product Grid Styles */
.custom-product-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--spacing-lg);
}

.product-card {
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius-lg);
    padding: var(--spacing-lg);
    position: relative;
}

.product-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

/* Sale Badge (Discount) */
.sale-badge {
    font-family: var(--e-global-typography-primary-font-family);
    position: absolute;
    top: var(--spacing-md);
    right: var(--spacing-md);
    background-color: var(--color-accent);
    color: var(--color-background);
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--border-radius-sm);
    z-index: 2;
    font-size: var(--font-size-badge) !important;
    text-transform: uppercase;
}

/* Stock Badge */
.stock-badge {
    font-family: var(--e-global-typography-primary-font-family);
    position: absolute;
    top: var(--spacing-md);
    left: var(--spacing-md);
    background-color: var(--color-success);
    color: var(--color-background);
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--border-radius-sm);
    z-index: 2;
    font-size: var(--font-size-badge) !important;
    text-transform: uppercase;
}

.product-image img {
    width: 100% !important;
    height: 200px !important;
    object-fit: contain !important;
    transition: transform var(--transition-default);
}

.product-card:hover .product-image img {
    transform: scale(1.05);
}

.product-category,
.stock-status {
    font-family: var(--e-global-typography-primary-font-family);
    font-size: var(--font-size-xs);
    color: var(--color-secondary) !important;
    margin-bottom: var(--spacing-xs);
}

.product-category a {
    font-family: var(--e-global-typography-primary-font-family);
    font-size: var(--font-size-sm);
    color: var( --e-global-color-6cbd519 ) !important;
    margin-bottom: var(--spacing-xs);
}

.product-title {
    font-family: var(--e-global-typography-primary-font-family);
    font-size: 18px;
    font-weight: 600;
    margin: var(--spacing-sm) 0;
    min-height: 40px;
}

/* Price Styles */
.product-price {
    font-family: var(--e-global-typography-primary-font-family);
    margin-bottom: var(--spacing-md);
}

.product-price .regular-price {
    font-family: var(--e-global-typography-primary-font-family);
    color: var(--color-text-muted);
    text-decoration: line-through;
    margin-right: var(--spacing-xs);
    font-size: var(--font-size-xl);
}

.product-price .sale-price {
    font-family: var(--e-global-typography-primary-font-family);
    color: var(--color-accent);
    font-weight: bold;
    font-size: var(--font-size-xl);
}

.product-price .normal-price {
    font-family: var(--e-global-typography-primary-font-family);
    color: inherit;
    font-weight: bold;
    font-size: var(--font-size-xl) !important;
}

/* Enhanced Add to Cart Button Styles */
.add-to-cart-wrapper .button {
    font-family: var(--e-global-typography-primary-font-family);
    width: 100%;
    padding: var(--spacing-sm);
    background-color: var(--color-primary) !important;
    color: var(--color-background) !important;
    text-align: center;
    text-decoration: none !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: var(--font-size-xs);
    border: none;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    text-transform: uppercase;
    transition: all var(--transition-default);
    position: relative;
    overflow: hidden;
}

/* Cart icon SVG */
.add-to-cart-wrapper .button::before {
    content: "";
    display: inline-block;
    width: 18px;
    height: 18px;
    margin-right: 4px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' class='lucide lucide-shopping-basket'%3E%3Cpath d='m15 11-1 9'/%3E%3Cpath d='m19 11-4-7'/%3E%3Cpath d='M2 11h20'/%3E%3Cpath d='m3.5 11 1.6 7.4a2 2 0 0 0 2 1.6h9.8a2 2 0 0 0 2-1.6l1.7-7.4'/%3E%3Cpath d='M4.5 15.5h15'/%3E%3Cpath d='m5 11 4-7'/%3E%3Cpath d='m9 11 1 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    transform: translateY(0);
    transition: transform 0.3s ease;
}

/* Loading state */
.add-to-cart-wrapper .button.loading {
    background-color: var(--color-primary) !important;
    pointer-events: none;
}

.add-to-cart-wrapper .button.loading::after {
    content: "";
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid transparent;
    border-top-color: var(--color-background);
    border-radius: 50%;
    animation: button-loading-spinner 0.8s ease infinite;
}

/* Success state - remove the checkmark, keep the color change */
.add-to-cart-wrapper .button.added {
    background-color: var(--color-success) !important;
    transform: scale(0.95);
}

.add-to-cart-wrapper .button.added::before {
    /* Keep the basket icon in success state */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' class='lucide lucide-shopping-basket'%3E%3Cpath d='m15 11-1 9'/%3E%3Cpath d='m19 11-4-7'/%3E%3Cpath d='M2 11h20'/%3E%3Cpath d='m3.5 11 1.6 7.4a2 2 0 0 0 2 1.6h9.8a2 2 0 0 0 2-1.6l1.7-7.4'/%3E%3Cpath d='M4.5 15.5h15'/%3E%3Cpath d='m5 11 4-7'/%3E%3Cpath d='m9 11 1 9'/%3E%3C/svg%3E");
    animation: success-scale 0.5s ease;
}

/* Hover effects */
.add-to-cart-wrapper .button:not(.loading):not(.added):hover {
    background-color: var(--color-secondary) !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.add-to-cart-wrapper .button:not(.loading):not(.added):hover::before {
    transform: translateY(-2px) scale(1.1);
}

/* Progress bar animation for loading state */
.add-to-cart-wrapper .button.loading::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.2),
        transparent
    );
    animation: loading-shimmer 1.5s infinite;
}

/* Animations */
@keyframes button-loading-spinner {
    from {
        transform: rotate(0turn);
    }
    to {
        transform: rotate(1turn);
    }
}

@keyframes success-scale {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
    }
}

@keyframes loading-shimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

/* Ripple effect on click */
.add-to-cart-wrapper .button .ripple {
    position: absolute;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.5);
    animation: ripple 0.6s linear;
    transform: scale(0);
}

@keyframes ripple {
    to {
        transform: scale(2.5);
        opacity: 0;
    }
}

/* Search and Filter Bar - Desktop Styles */
.product-search-filter {
    font-family: var(--e-global-typography-primary-font-family);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-lg);
    gap: 16px;
    background-color: var(--color-background-light);
    padding: var(--spacing-sm);
    border-radius: var(--border-radius-lg);
}

.search-wrapper {
    flex-grow: 1;
    display: flex;
    position: relative;
    background-color: var(--color-background);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius-md);
    overflow: hidden;
}

#product-search {
    font-family: var(--e-global-typography-primary-font-family);
    width: 80%;
    height: 40px;
    padding: 0 16px;
    background-color: transparent;
    border: none;
    font-size: var(--font-size-md);
    outline: none;
    color: var(--color-text);
}

#product-search::placeholder {
    font-family: var(--e-global-typography-primary-font-family);
    color: var(--color-text-light);
}

.search-category-wrapper {
    width: 40%;
    position: relative;
    border-left: 1px solid var(--color-border);
}

#search-category {
    font-family: var(--e-global-typography-primary-font-family);
    width: 100%;
    height: 40px;
    padding: 0 16px;
    border: none;
    background-color: transparent;
    font-size: var(--font-size-md);
    appearance: none;
    cursor: pointer;
    color: var(--color-text);
}

.filter-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 250px;
}

.filter-wrapper label {
    font-family: var(--e-global-typography-primary-font-family);
    font-size: var(--font-size-md);
    color: var(--color-text-light);
    white-space: nowrap;
}

#product-filter {
    font-family: var(--e-global-typography-primary-font-family);
    height: 40px;
    padding: 0 16px;
    background-color: var(--color-background);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius-md);
    font-size: var(--font-size-md);
    appearance: none;
    cursor: pointer;
    color: var(--color-text);
}

/* Custom Arrow for Select Elements */
.search-category-wrapper::after,
.filter-wrapper > select::after {
    content: "▼";
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    pointer-events: none;
    font-size: var(--font-size-xs);
    color: var(--color-text-light);
}

.search-category-wrapper,
.filter-wrapper {
    position: relative;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .product-search-filter {
        flex-direction: column;
        align-items: stretch;
        gap: var(--spacing-md);
    }

    .search-category-wrapper {
        display: none; /* Hide category filter on tablet and smaller */
    }

    .search-wrapper {
        width: 100%;
    }

    .filter-wrapper {
        justify-content: space-between;
        width: 100%;
    }
}

@media (max-width: 576px) {
    .product-search-filter {
        padding: var(--spacing-md);
    }

    #product-search {
        width: 100%; /* Full width for mobile */
        font-size: var(--font-size-sm);
    }

    #product-filter {
        font-size: var(--font-size-sm);
    }

    .filter-wrapper label {
        font-size: var(--font-size-sm);
    }
}


/* Remove any ::after pseudo-elements from the product grid */
.custom-product-grid::after,
.product-card::after {
    content: none;
}



/* Hide WooCommerce notices within the product grid */
.custom-product-grid .woocommerce-info,
.custom-product-grid .woocommerce-message,
.custom-product-grid .woocommerce-error {
    display: none !important;
}

a.added_to_cart.wc-forward {
    display: none !important;
}

.no-products-message {
    text-align: center;
    padding: 40px 20px;
    background-color: var(--color-background-light);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius-md);
    margin: 20px 0;
}

.no-products-message h2 {
    color: var(--color-text);
    font-size: var(--font-size-xl);
    margin: 0;
}

/* Responsive Styles */
@media (max-width: 1200px) {
    .custom-product-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 992px) {
    .custom-product-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .product-search-filter {
        flex-wrap: wrap;
    }

    .search-wrapper {
        width: 100%;
        margin-bottom: var(--spacing-sm);
    }

    .filter-wrapper {
        width: 100%;
        justify-content: space-between;
    }
}

@media (max-width: 768px) {
    .product-search-filter {
        flex-direction: column;
        align-items: stretch;
    }

    .search-wrapper,
    .filter-wrapper {
        width: 100%;
    }

    #product-search,
    .search-category-wrapper {
        width: 100%;
    }

    .search-category-wrapper {
        border-left: none;
        border-top: 1px solid var(--color-border);
    }

    .filter-wrapper {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-wrapper label {
        margin-bottom: var(--spacing-xs);
    }

    #product-filter {
        width: 100%;
    }
}

@media (max-width: 576px) {
    .custom-product-grid {
        grid-template-columns: 1fr;
    }

    .product-card {
        padding: var(--spacing-md);
    }

    .product-image img {
        height: 200px !important;
    }

    .product-title {
        font-size: var(--font-size-xl);
        min-height: auto;
        padding-bottom: 5px;
    }

    .product-price .regular-price,
    .product-price .sale-price,
    .product-price .normal-price {
        font-size: var(--font-size-md);
    }

    .add-to-cart-wrapper .button {
        font-size: var(--font-size-xs);
        padding: 8px;
    }

}

@media (max-width: 360px) {

    .stock-badge,
    .sale-badge {
        font-size: var(--font-size-xs);
        padding: 3px 6px;
    }

    .product-category,
    .stock-status {
        font-size: var(--font-size-xs);
    }

    .product-title {
        font-size: var(--font-size-md);
        min-height: auto;
        padding-bottom: 5px;
    }

    .product-price .regular-price,
    .product-price .sale-price,
    .product-price .normal-price {
        font-size: var(--font-size-sm);
    }
}

@media (max-width: 320px) {

    #product-search,
    #search-category,
    #product-filter {
        font-size: var(--font-size-xs);
    }

    .filter-wrapper label {
        font-size: var(--font-size-xs);
    }
}

#loading-spinner {
    display: flex;
    position: relative;
    background-color: transparent;
    padding: var(--spacing-md);
    border-radius: 6px;
    align-items: center;
    margin-top: var(--spacing-lg);
    border: 1px solid var(--color-border);
}

#loading-spinner .spinner {
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid var(--color-secondary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 10px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.grid-products-loaded {
    display: flex;
    position: relative;
    background-color: transparent;
    padding: var(--spacing-md);
    border-radius: 6px;
    align-items: center;
    margin-top: var(--spacing-lg);
    border: 1px solid var(--color-border);
}

.grid-products-loaded svg {
    margin-right: 8px;
    /* Space between icon and text */
    stroke: #28a745;
    /* Green color for success */
}

.grid-products-loaded span {
    font-weight: 400;
    /* Slightly bold text */
}




/* Load more products button */
.load-more-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: var(--spacing-lg) auto 0;
    padding: var(--spacing-md) var(--spacing-lg);
    background-color: var(--color-primary)!important;
    color: var(--color-background);
    border: none;
    border-radius: var(--border-radius-md);
    cursor: pointer;
    font-size: var(--font-size-md);
    transition: background-color var(--transition-default);
    font-family: var(--e-global-typography-primary-font-family) !important;
}

.load-more-button:hover {
    background-color: var(--color-secondary)!important;
}

.load-more-button:disabled {
    background-color: var(--color-text-muted);
    cursor: not-allowed;
}

.load-more-icon {
    transition: transform var(--transition-default);
}

.load-more-button:hover .load-more-icon {
    transform: rotate(90deg);
}