/**
 * Skeleton Loader Styles
 * Untuk progressive loading home page
 */

.loading-skeleton {
    position: relative;
    overflow: hidden;
    background-color: #f0f0f0;
    border-radius: 4px;
}

.loading-skeleton::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.5),
        transparent
    );
    animation: skeleton-loading 1.5s infinite;
}

@keyframes skeleton-loading {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

/* Skeleton untuk slider */
#slider-home-container.loading-skeleton {
    min-height: 400px;
    width: 100%;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite;
}

/* Skeleton untuk official store */
#official-store-container.loading-skeleton {
    min-height: 150px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
}

#official-store-container.loading-skeleton::after {
    content: '';
    display: block;
    height: 120px;
    background: #f0f0f0;
    border-radius: 8px;
}

/* Skeleton untuk product grid */
#produk-unggulan-container.loading-skeleton,
#produk-terlaris-container.loading-skeleton,
#produk-rekomendasi-container.loading-skeleton {
    min-height: 300px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
}

.product-card-skeleton {
    background: #f0f0f0;
    border-radius: 8px;
    padding: 10px;
}

.product-card-skeleton .skeleton-image {
    height: 150px;
    background: #e0e0e0;
    border-radius: 4px;
    margin-bottom: 10px;
}

.product-card-skeleton .skeleton-text {
    height: 16px;
    background: #e0e0e0;
    border-radius: 4px;
    margin-bottom: 8px;
}

.product-card-skeleton .skeleton-price {
    height: 20px;
    width: 60%;
    background: #e0e0e0;
    border-radius: 4px;
}

/* Skeleton untuk categories */
#categories-container.loading-skeleton,
#categories-ppob-container.loading-skeleton {
    min-height: 200px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 10px;
}

/* Skeleton category items - display horizontally */
.skeleton-categories-wrapper {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: flex-start;
    justify-content: flex-start;
}

.skeleton-categories-wrapper .skeleton-category-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-right: 30px;
    text-align: center;
    flex-shrink: 0;
}

.skeleton-categories-wrapper .skeleton-category-item:last-child {
    margin-right: 0;
}


/* Shimmer animation */
@keyframes skeleton-shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

/* Fade in animation untuk konten yang sudah di-load */
.fade-in {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Loading spinner (optional) */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Responsive adjustments */
@media (max-width: 768px) {
    #slider-home-container.loading-skeleton {
        min-height: 200px;
    }

    #produk-unggulan-container.loading-skeleton,
    #produk-terlaris-container.loading-skeleton,
    #produk-rekomendasi-container.loading-skeleton {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    #slider-home-container.loading-skeleton {
        min-height: 200px;
    }

    #categories-container.loading-skeleton,
    #categories-ppob-container.loading-skeleton {
        grid-template-columns: repeat(4, 1fr);
    }
}
