/**
 * Infinite Scrolling - Styles
 * Loading states and animations
 */

/* Loading Container */
.infinite-scroll-loader {
    display: block;
    text-align: center;
    padding: 40px 20px;
    margin: 20px 0;
    clear: both;
}

/* Spinner Animation */
.infinite-scroll-spinner {
    display: inline-block;
    width: 50px;
    height: 50px;
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-left-color: #000;
    border-radius: 50%;
    animation: infinite-scroll-spin 1s linear infinite;
}

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

/* Loading Text */
.infinite-scroll-loading-text {
    margin: 15px 0 0 0;
    font-size: 16px;
    color: #666;
    font-weight: 500;
}

/* No More Products Message */
.infinite-scroll-no-more {
    display: block;
    text-align: center;
    padding: 30px 20px;
    margin: 20px 0;
    background: #f8f8f8;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    clear: both;
}

.infinite-scroll-no-more p {
    margin: 0;
    font-size: 16px;
    color: #666;
    font-weight: 500;
}

/* Error Message */
.infinite-scroll-error {
    display: block;
    text-align: center;
    padding: 30px 20px;
    margin: 20px 0;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 4px;
    clear: both;
}

.infinite-scroll-error p {
    margin: 0;
    font-size: 16px;
    color: #856404;
    font-weight: 500;
}

/* Pagination will be hidden via JavaScript once infinite scroll initializes */

/* Product fade-in animation */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Apply fade-in to newly loaded products */
.products .product {
    animation: fadeInUp 0.5s ease-out;
}

/* Responsive adjustments */
@media screen and (max-width: 768px) {
    .infinite-scroll-loader {
        padding: 30px 15px;
    }

    .infinite-scroll-spinner {
        width: 40px;
        height: 40px;
        border-width: 3px;
    }

    .infinite-scroll-loading-text,
    .infinite-scroll-no-more p,
    .infinite-scroll-error p {
        font-size: 14px;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .infinite-scroll-spinner {
        border-color: rgba(255, 255, 255, 0.1);
        border-left-color: #fff;
    }

    .infinite-scroll-loading-text {
        color: #ccc;
    }

    .infinite-scroll-no-more {
        background: #2a2a2a;
        border-color: #444;
    }

    .infinite-scroll-no-more p {
        color: #ccc;
    }
}

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

/* Loading state for product container */
.infinite-scroll-loading .products {
    opacity: 1;
    pointer-events: auto;
}

/* Prevent layout shift */
.products {
    min-height: 200px;
}
