/* Skeleton Loaders - Sprint 2 Performance Enhancement */

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

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

/* Dark mode skeleton */
[data-theme="dark"] .skeleton {
    background: linear-gradient(90deg, #2a2a2a 25%, #3a3a3a 50%, #2a2a2a 75%);
    background-size: 200% 100%;
}

/* Product Card Skeleton */
.product-card-skeleton {
    background: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 12px;
    height: 100%;
    display: flex;
    flex-direction: column;
}

[data-theme="dark"] .product-card-skeleton {
    background: #1a1a1a;
    border-color: #333;
}

.product-card-skeleton .skeleton-image {
    width: 100%;
    height: 220px;
    margin-bottom: 12px;
    border-radius: 4px;
}

.product-card-skeleton .skeleton-title {
    width: 100%;
    height: 16px;
    margin-bottom: 8px;
    border-radius: 4px;
}

.product-card-skeleton .skeleton-price {
    width: 60%;
    height: 18px;
    margin-bottom: 12px;
    border-radius: 4px;
}

.product-card-skeleton .skeleton-button {
    width: 100%;
    height: 36px;
    border-radius: 4px;
    margin-top: auto;
}

.product-card-skeleton .skeleton-badge {
    width: 80px;
    height: 20px;
    border-radius: 4px;
    margin-bottom: 8px;
}

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

@media (max-width: 992px) {
    .skeleton-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 15px;
    }
}

@media (max-width: 576px) {
    .skeleton-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        padding: 10px;
    }
}

/* Cart Item Skeleton */
.cart-item-skeleton {
    display: flex;
    gap: 15px;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 4px;
    margin-bottom: 15px;
}

[data-theme="dark"] .cart-item-skeleton {
    background: #1a1a1a;
}

.cart-item-skeleton .skeleton-cart-image {
    width: 100px;
    height: 100px;
    border-radius: 4px;
    flex-shrink: 0;
}

.cart-item-skeleton .skeleton-cart-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cart-item-skeleton .skeleton-cart-name {
    width: 80%;
    height: 16px;
    border-radius: 4px;
}

.cart-item-skeleton .skeleton-cart-price {
    width: 60px;
    height: 16px;
    border-radius: 4px;
}

.cart-item-skeleton .skeleton-cart-qty {
    width: 100px;
    height: 30px;
    border-radius: 4px;
    margin-top: 8px;
}

/* Testimonial Skeleton */
.testimonial-skeleton {
    background: #f9f9f9;
    border-radius: 4px;
    padding: 20px;
    text-align: center;
}

[data-theme="dark"] .testimonial-skeleton {
    background: #1a1a1a;
}

.testimonial-skeleton .skeleton-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    margin: 0 auto 12px;
}

.testimonial-skeleton .skeleton-name {
    width: 120px;
    height: 16px;
    border-radius: 4px;
    margin: 0 auto 8px;
}

.testimonial-skeleton .skeleton-text {
    width: 100%;
    height: 14px;
    border-radius: 4px;
    margin-bottom: 8px;
}

.testimonial-skeleton .skeleton-text:last-child {
    width: 85%;
    margin-left: auto;
    margin-right: auto;
    margin-bottom: 0;
}

/* Utility classes for quick skeleton creation */
.skeleton-text {
    height: 14px;
    margin-bottom: 8px;
}

.skeleton-heading {
    height: 24px;
    margin-bottom: 12px;
}

.skeleton-button {
    height: 40px;
    border-radius: 4px;
}

/* Fade-out animation for skeleton removal */
.skeleton-fade-out {
    animation: skeleton-fade-out 0.3s ease-out forwards;
}

@keyframes skeleton-fade-out {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

/* Hidden real content that will replace skeleton */
.skeleton-content {
    display: none;
}

.skeleton-content.loaded {
    display: block;
    animation: content-fade-in 0.3s ease-in;
}

@keyframes content-fade-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}
