/**
 * Skeleton Loader Styles
 * Provides shimmer loading states for various components
 */

/* Base Shimmer Animation */
@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* Base Skeleton Element */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 1000px 100%;
    animation: shimmer 2s infinite linear;
    border-radius: 4px;
}

.skeleton-pulse {
    background: #f0f0f0;
    animation: pulse 1.5s infinite ease-in-out;
    border-radius: 4px;
}

/* Product Card Skeleton */
.skeleton-product-card {
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.skeleton-product-card .skeleton-image {
    width: 100%;
    padding-top: 100%; /* 1:1 aspect ratio */
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 1000px 100%;
    animation: shimmer 2s infinite linear;
}

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

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

.skeleton-product-card .skeleton-text {
    height: 12px;
    width: 60%;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 1000px 100%;
    animation: shimmer 2s infinite linear;
    border-radius: 4px;
}

.skeleton-product-card .skeleton-price {
    height: 20px;
    width: 40%;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 1000px 100%;
    animation: shimmer 2s infinite linear;
    border-radius: 4px;
    margin-top: auto;
}

.skeleton-product-card .skeleton-button {
    height: 36px;
    width: 100%;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 1000px 100%;
    animation: shimmer 2s infinite linear;
    border-radius: 4px;
    margin-top: 8px;
}

/* Category Circle Skeleton */
.skeleton-category-circle {
    display: inline-block;
    text-align: center;
}

.skeleton-category-circle .skeleton-circle {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 1000px 100%;
    animation: shimmer 2s infinite linear;
    margin: 0 auto;
}

.skeleton-category-circle.skeleton-small .skeleton-circle {
    width: 80px;
    height: 80px;
}

.skeleton-category-circle.skeleton-large .skeleton-circle {
    width: 120px;
    height: 120px;
}

.skeleton-category-circle .skeleton-label {
    height: 14px;
    width: 80px;
    margin: 10px auto 0;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 1000px 100%;
    animation: shimmer 2s infinite linear;
    border-radius: 4px;
}

/* Banner Skeleton */
.skeleton-banner {
    width: 100%;
    height: 400px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 1000px 100%;
    animation: shimmer 2s infinite linear;
    border-radius: 8px;
}

.skeleton-banner.skeleton-small {
    height: 200px;
}

.skeleton-banner.skeleton-large {
    height: 500px;
}

/* Grid Layouts */
.skeleton-grid {
    display: grid;
    gap: 20px;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
}

.skeleton-carousel-container {
    display: flex;
    gap: 15px;
    overflow: hidden;
}

/* Text Skeletons */
.skeleton-text-line {
    height: 16px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 1000px 100%;
    animation: shimmer 2s infinite linear;
    border-radius: 4px;
    margin-bottom: 8px;
}

.skeleton-text-line.skeleton-heading {
    height: 24px;
    width: 40%;
}

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

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

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

/* Responsive Adjustments */
@media (max-width: 768px) {
    .skeleton-category-circle .skeleton-circle {
        width: 85px;
        height: 85px;
    }
    
    .skeleton-category-circle.skeleton-small .skeleton-circle {
        width: 70px;
        height: 70px;
    }
    
    .skeleton-category-circle.skeleton-large .skeleton-circle {
        width: 100px;
        height: 100px;
    }
    
    .skeleton-banner {
        height: 250px;
    }
    
    .skeleton-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 15px;
    }
}

@media (max-width: 576px) {
    .skeleton-category-circle .skeleton-circle {
        width: 75px;
        height: 75px;
    }
    
    .skeleton-category-circle.skeleton-small .skeleton-circle {
        width: 60px;
        height: 60px;
    }
    
    .skeleton-category-circle.skeleton-large .skeleton-circle {
        width: 90px;
        height: 90px;
    }
    
    .skeleton-banner {
        height: 200px;
    }
    
    .skeleton-product-card .skeleton-content {
        padding: 8px;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .skeleton,
    .skeleton-product-card .skeleton-image,
    .skeleton-product-card .skeleton-title,
    .skeleton-product-card .skeleton-text,
    .skeleton-product-card .skeleton-price,
    .skeleton-product-card .skeleton-button,
    .skeleton-category-circle .skeleton-circle,
    .skeleton-category-circle .skeleton-label,
    .skeleton-banner,
    .skeleton-text-line {
        background: linear-gradient(90deg, #2a2a2a 25%, #3a3a3a 50%, #2a2a2a 75%);
        background-size: 1000px 100%;
    }
    
    .skeleton-product-card {
        background: #1a1a1a;
        border-color: #3a3a3a;
    }
    
    .skeleton-pulse {
        background: #2a2a2a;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .skeleton,
    .skeleton-product-card .skeleton-image,
    .skeleton-product-card .skeleton-title,
    .skeleton-product-card .skeleton-text,
    .skeleton-product-card .skeleton-price,
    .skeleton-product-card .skeleton-button,
    .skeleton-category-circle .skeleton-circle,
    .skeleton-category-circle .skeleton-label,
    .skeleton-banner,
    .skeleton-text-line {
        animation: none;
        background: #f0f0f0;
    }
    
    .skeleton-pulse {
        animation: none;
    }
}

/* Performance Optimizations */
.skeleton-container {
    content-visibility: auto;
    contain-intrinsic-size: auto 500px;
}

.skeleton,
.skeleton-product-card,
.skeleton-category-circle,
.skeleton-banner {
    will-change: auto;
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* Fade-in animation for content replacing skeletons */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.skeleton-fade-in {
    animation: fadeIn 0.3s ease-in;
}

/* Hide skeletons when content is loaded */
.skeleton-hidden {
    display: none !important;
}
