/* ========================================
   CAROUSEL SKELETON LOADER
   Modern, animated placeholder for product carousel
   ======================================== */

.carousel-skeleton {
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 20px;
    padding: 0;
    animation: fadeIn 0.3s ease-in-out;
}

@media (max-width: 991px) {
    .carousel-skeleton {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 767px) {
    .carousel-skeleton {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr;
    }
}

.carousel-skeleton-item {
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    max-height: 200px;
}

.carousel-skeleton-image {
    width: 100%;
    height: 120px;
    background: linear-gradient(
        90deg,
        #f0f0f0 25%,
        #e0e0e0 50%,
        #f0f0f0 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    position: relative;
}

.carousel-skeleton-content {
    padding: 12px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.carousel-skeleton-title {
    width: 80%;
    height: 16px;
    background: linear-gradient(
        90deg,
        #f0f0f0 25%,
        #e0e0e0 50%,
        #f0f0f0 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite 0.2s;
    border-radius: 4px;
}

.carousel-skeleton-price {
    width: 30%;
    height: 20px;
    background: linear-gradient(
        90deg,
        #f0f0f0 25%,
        #e0e0e0 50%,
        #f0f0f0 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite 0.4s;
    border-radius: 4px;
}

.carousel-skeleton-supplier {
    width: 50%;
    height: 12px;
    background: linear-gradient(
        90deg,
        #f0f0f0 25%,
        #e0e0e0 50%,
        #f0f0f0 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite 0.6s;
    border-radius: 4px;
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .carousel-skeleton-item {
        background: #1a1a1a;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    }

    .carousel-skeleton-image,
    .carousel-skeleton-title,
    .carousel-skeleton-price,
    .carousel-skeleton-supplier {
        background: linear-gradient(
            90deg,
            #2a2a2a 25%,
            #3a3a3a 50%,
            #2a2a2a 75%
        );
        background-size: 200% 100%;
    }
}

/* Smooth fade out when loading completes */
.carousel-skeleton.fade-out {
    animation: fadeOut 0.3s ease-in-out forwards;
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

/* Progressive image loading */
.product-image {
    transition: filter 0.3s ease-in-out;
    filter: blur(0);
}

.product-image[data-loading="true"] {
    filter: blur(10px);
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

/* Error state styling */
.carousel-error-state {
    animation: fadeIn 0.3s ease-in-out;
}

/* Empty state styling */
.carousel-empty-state {
    animation: fadeIn 0.3s ease-in-out;
}
