/**
 * Peuwl Infinite Scroll Styles
 */

/* Loading indicator container - DISKRET */
.peuwl-loading {
    display: none;
    text-align: center;
    padding: 15px 0;
    margin: 15px 0;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.peuwl-loading.is-loading {
    display: block !important;
    opacity: 1 !important;
}

/* Loading spinner - DISKRET */
.peuwl-loading-spinner {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
}

.peuwl-loading-spinner .spinner {
    width: 28px !important;
    height: 28px !important;
    border: 3px solid #e8e8e8 !important;      /* Ljusgrå ring */
    border-top-color: #999 !important;         /* Mediumgrå topp */
    border-radius: 50% !important;
    animation: peuwl-spin 0.8s linear infinite !important;
    opacity: 0.1 !important;                   /* Diskret - 10% synlighet */
}

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

/* Loading text - DOLD (diskret) */
.peuwl-loading .loading-text {
    display: none !important;
}

/* Load More button - HIDDEN (automatic scroll only) */
.peuwl-load-more {
    display: none !important;
}

/* Hide pagination completely - pure automatic infinite scroll */
.woocommerce-pagination,
.wp-block-query-pagination {
    display: none !important;
}

/* Support for WordPress block-based product templates */
.wp-block-post-template .wp-block-post.product,
.products-block-post-template .wp-block-post.product {
    list-style: none;
}

/* Ensure loaded products maintain grid layout */
.wp-block-post-template .pwl-loop-item,
.products-block-post-template .pwl-loop-item {
    /* Let the existing theme CSS handle the layout */
}

/* Don't override theme grid - let the theme CSS handle it */

/* Product fade-in animation */
.products li.product {
    animation: peuwl-fade-in-up 0.4s ease;
}

@keyframes peuwl-fade-in-up {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .peuwl-loading-spinner .spinner {
        width: 20px !important;
        height: 20px !important;
        border-width: 2px !important;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .peuwl-loading-spinner .spinner {
        border-color: #444 !important;
        border-top-color: #999 !important;
    }
}

/* Smooth scroll behavior */
html {
    scroll-behavior: smooth;
}

/* Loading state for products container */
.products.is-loading {
    opacity: 0.7;
    pointer-events: none;
}
