/* Skeleton Loader Styles for CLS Optimization */

/* Base skeleton animation */
@keyframes skeleton-loading {
    0% {
        background-position: -200px 0;
    }

    100% {
        background-position: calc(200px + 100%) 0;
    }
}

.skeleton {
    background: linear-gradient(90deg, #f0f0f0 0%, #e0e0e0 50%, #f0f0f0 100%);
    background-size: 200px 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: 4px;
}

/* Product Grid Skeleton */
.skeleton-product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    padding: 20px;
    width: 100%;
}

.skeleton-product-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px;
    min-height: 400px;
}

.skeleton-product-image {
    width: 100%;
    height: 250px;
    aspect-ratio: 1/1;
    margin-bottom: 15px;
}

.skeleton-product-title {
    width: 80%;
    height: 20px;
    margin-bottom: 10px;
}

.skeleton-product-price {
    width: 40%;
    height: 24px;
    margin-bottom: 10px;
}

.skeleton-product-button {
    width: 100%;
    height: 40px;
    margin-top: 10px;
}

/* Banner Skeleton */
.skeleton-banner {
    width: 100%;
    height: 400px;
    aspect-ratio: 16/5;
    margin-bottom: 20px;
}

@media (max-width: 1024px) {
    .skeleton-banner {
        height: 250px;
        aspect-ratio: 16/9;
    }
}

/* Product List Skeleton */
.skeleton-product-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding: 20px;
}

.skeleton-product-list-item {
    display: flex;
    gap: 15px;
    background: #fff;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    min-height: 150px;
}

.skeleton-product-list-image {
    width: 120px;
    height: 120px;
    flex-shrink: 0;
}

.skeleton-product-list-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.skeleton-text-line {
    height: 16px;
    border-radius: 4px;
}

.skeleton-text-line.short {
    width: 60%;
}

.skeleton-text-line.medium {
    width: 80%;
}

.skeleton-text-line.long {
    width: 95%;
}

/* Category Grid Skeleton */
.skeleton-category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    padding: 20px;
}

.skeleton-category-card {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #e0e0e0;
}

.skeleton-category-image {
    width: 100%;
    height: 200px;
    aspect-ratio: 1/1;
}

.skeleton-category-title {
    width: 70%;
    height: 18px;
    margin: 15px;
}

/* Hide skeleton when content loads */
.skeleton-container.loaded {
    display: none;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .skeleton-product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        padding: 10px;
    }

    .skeleton-product-card {
        min-height: 350px;
        padding: 10px;
    }

    .skeleton-product-image {
        height: 180px;
    }

    .skeleton-category-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        padding: 10px;
    }
}

/* Search Result Skeleton */
.skeleton-search-result {
    padding: 10px;
    border-bottom: 1px solid #e0e0e0;
}

.skeleton-search-image {
    width: 60px;
    height: 60px;
    display: inline-block;
    margin-right: 10px;
    vertical-align: middle;
}

.skeleton-search-text {
    display: inline-block;
    width: calc(100% - 80px);
    vertical-align: middle;
}

/* Widget Skeleton */
.skeleton-widget {
    min-height: 200px;
    width: 100%;
    border-radius: 8px;
    margin: 20px 0;
}

/* Utility classes */
.skeleton-circle {
    border-radius: 50%;
}

.skeleton-rounded {
    border-radius: 8px;
}

.skeleton-square {
    border-radius: 0;
}