/* ===========================
   ANIMATED LOADING SKELETONS FOR MARKETPLACE
   =========================== */

/* Base skeleton animation */
@keyframes skeleton-pulse {
    0% {
        background-position: -200px 0;
    }
    100% {
        background-position: calc(200px + 100%) 0;
    }
}

.skeleton {
    display: inline-block;
    height: 1em;
    position: relative;
    overflow: hidden;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200px 100%;
    animation: skeleton-pulse 1.5s ease-in-out infinite;
    border-radius: 4px;
}

/* Product Card Skeleton */
.product-card-skeleton {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    overflow: hidden;
    margin-bottom: 1.5rem;
    min-height: 350px;
}

.product-image-skeleton {
    width: 100%;
    height: 200px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200px 100%;
    animation: skeleton-pulse 1.5s ease-in-out infinite;
}

.product-content-skeleton {
    padding: 1.5rem;
}

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

.product-vendor-skeleton {
    width: 60%;
    height: 16px;
    margin-bottom: 0.5rem;
}

.product-description-skeleton {
    width: 100%;
    height: 14px;
    margin-bottom: 0.25rem;
}

.product-description-skeleton:nth-child(2) {
    width: 85%;
}

.product-description-skeleton:nth-child(3) {
    width: 70%;
}

.product-price-skeleton {
    width: 40%;
    height: 18px;
    margin-top: 1rem;
    margin-bottom: 1rem;
}

.product-button-skeleton {
    width: 100%;
    height: 36px;
    border-radius: 6px;
}

/* Category Card Skeleton */
.category-card-skeleton {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    padding: 2rem;
    text-align: center;
    margin-bottom: 2rem;
}

.category-icon-skeleton {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    margin: 0 auto 1.5rem;
}

.category-title-skeleton {
    width: 70%;
    height: 24px;
    margin: 0 auto 1rem;
}

.category-description-skeleton {
    width: 100%;
    height: 16px;
    margin-bottom: 0.5rem;
}

.category-stats-skeleton {
    width: 50%;
    height: 20px;
    margin: 1.5rem auto;
}

.category-button-skeleton {
    width: 60%;
    height: 40px;
    margin: 0 auto;
    border-radius: 20px;
}

/* Hero Section Skeleton */
.hero-skeleton {
    background: #f8f9fa;
    padding: 4rem 0;
    margin-bottom: 3rem;
}

.hero-title-skeleton {
    width: 60%;
    height: 48px;
    margin-bottom: 1rem;
}

.hero-subtitle-skeleton {
    width: 80%;
    height: 20px;
    margin-bottom: 2rem;
}

.hero-button-skeleton {
    width: 150px;
    height: 48px;
    border-radius: 6px;
    margin-right: 1rem;
    display: inline-block;
}

/* Stats Section Skeleton */
.stats-skeleton {
    background: #f8f9fa;
    padding: 3rem 0;
    margin: 3rem 0;
}

.stat-item-skeleton {
    text-align: center;
    padding: 1rem;
}

.stat-number-skeleton {
    width: 80px;
    height: 40px;
    margin: 0 auto 0.5rem;
}

.stat-label-skeleton {
    width: 100px;
    height: 16px;
    margin: 0 auto;
}

/* Featured Products Grid Skeleton */
.products-grid-skeleton {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

/* Section Title Skeleton */
.section-title-skeleton {
    width: 300px;
    height: 32px;
    margin: 0 auto 1rem;
}

.section-subtitle-skeleton {
    width: 400px;
    height: 18px;
    margin: 0 auto 3rem;
}

/* Vendor Storefront Skeleton */
.vendor-header-skeleton {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 3rem 0;
    border-bottom: 3px solid #FFD700;
}

.vendor-avatar-skeleton {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    margin: 0 auto 1rem;
}

.vendor-name-skeleton {
    width: 250px;
    height: 28px;
    margin-bottom: 0.5rem;
}

.vendor-type-skeleton {
    width: 150px;
    height: 18px;
    margin-bottom: 1rem;
}

.vendor-description-skeleton {
    width: 100%;
    height: 16px;
    margin-bottom: 0.5rem;
}

/* Browse Products Filter Skeleton */
.filter-sidebar-skeleton {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.filter-title-skeleton {
    width: 80%;
    height: 20px;
    margin-bottom: 1rem;
}

.filter-option-skeleton {
    width: 100%;
    height: 16px;
    margin-bottom: 0.75rem;
}

.filter-button-skeleton {
    width: 100%;
    height: 40px;
    border-radius: 6px;
    margin-top: 1rem;
}

/* Dark mode skeleton adjustments */
@media (prefers-color-scheme: dark) {
    .skeleton {
        background: linear-gradient(90deg, #2a2a2a 25%, #3a3a3a 50%, #2a2a2a 75%);
        background-size: 200px 100%;
    }
    
    .product-card-skeleton,
    .category-card-skeleton,
    .filter-sidebar-skeleton {
        background: #1e1e1e;
        box-shadow: 0 4px 20px rgba(255,255,255,0.1);
    }
}

/* Loading overlay for sections */
.loading-overlay {
    position: relative;
}

.loading-overlay::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #FFD700;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Fade-in animation for loaded content */
.fade-in {
    animation: fadeIn 0.5s ease-in-out;
}

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

/* Responsive adjustments */
@media (max-width: 768px) {
    .products-grid-skeleton {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 1rem;
    }
    
    .hero-title-skeleton {
        width: 90%;
        height: 36px;
    }
    
    .hero-subtitle-skeleton {
        width: 95%;
        height: 18px;
    }
    
    .section-title-skeleton {
        width: 250px;
        height: 28px;
    }
    
    .section-subtitle-skeleton {
        width: 300px;
        height: 16px;
    }
}