/**
 * Product Card Loading Spinner
 * Provides visual feedback when clicking on product cards
 */

/* Loading spinner overlay */
.wfs-product-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    border-radius: 8px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.wfs-product-loading-overlay.active {
    opacity: 1;
    pointer-events: all;
}

/* Run spinner animation only when overlay is active (improves mobile performance) */
.wfs-product-loading-overlay .wfs-loading-spinner {
    animation-play-state: paused;
    -webkit-animation-play-state: paused;
}
.wfs-product-loading-overlay.active .wfs-loading-spinner {
    animation-play-state: running;
    -webkit-animation-play-state: running;
}

/* Spinner animation */
.wfs-loading-spinner {
    width: 48px;
    height: 48px;
    border: 5px solid rgba(0, 0, 0, 0.1);
    border-top-color: var(--wfs-primary-color, #4d9ce0);
    border-right-color: var(--wfs-primary-color, #4d9ce0);
    border-radius: 50%;
    animation: wfs-spin 0.8s linear infinite;
    -webkit-animation: wfs-spin 0.8s linear infinite;
    will-change: transform;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

@keyframes wfs-spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

@-webkit-keyframes wfs-spin {
    0% {
        -webkit-transform: rotate(0deg);
        transform: rotate(0deg);
    }
    100% {
        -webkit-transform: rotate(360deg);
        transform: rotate(360deg);
    }
}

/* Ensure the product containers have relative positioning for the overlay */
.wfs-food-item-container,
.custom-food-item,
.wfs-product-layout,
.custom-product-layout {
    position: relative !important;
}

/* Prevent multiple clicks while loading */
.wfs-food-item-container.loading,
.custom-food-item.loading,
.wfs-product-layout.loading,
.custom-product-layout.loading {
    pointer-events: none;
}
