/**
 * ==============================================================================
 * Just For Beauty - Premium Shimmer Skeleton Loader System
 * Supports Product Cards, Image Placeholders, Grids, Text, and Admin Tables
 * ==============================================================================
 */

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

@keyframes jfbSkeletonPulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.6;
    }
}

/* Base Skeleton Class */
.skeleton,
.skeleton-box,
.skeleton-shimmer {
    background: linear-gradient(
        90deg,
        #f2ebf4 0%,
        #fdf8fc 30%,
        #f4e9f5 50%,
        #fdf8fc 70%,
        #f2ebf4 100%
    );
    background-size: 250% 100%;
    animation: jfbSkeletonShimmer 1.6s cubic-bezier(0.4, 0, 0.2, 1) infinite;
    position: relative;
    overflow: hidden;
}

/* Dark Mode Skeleton variant */
.skeleton-dark {
    background: linear-gradient(
        90deg,
        #2a2228 0%,
        #382d36 30%,
        #443541 50%,
        #382d36 70%,
        #2a2228 100%
    );
    background-size: 250% 100%;
    animation: jfbSkeletonShimmer 1.6s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

/* Skeleton Image Container (Shimmers until <img> is loaded) */
.skeleton-img-wrapper,
.new-product-image,
.jfb-product-image,
.shop-product-image,
.main-product-image,
.product-thumbnail {
    position: relative;
    overflow: hidden;
    background: linear-gradient(
        90deg,
        #f3edf5 0%,
        #fcf8fb 30%,
        #f5ebf6 50%,
        #fcf8fb 70%,
        #f3edf5 100%
    );
    background-size: 250% 100%;
    animation: jfbSkeletonShimmer 1.6s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

.skeleton-img-wrapper > img,
.new-product-image > img,
.jfb-product-image > img,
.shop-product-image img,
.main-product-image > img,
.product-thumbnail > img {
    opacity: 0;
    transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1), transform 0.35s ease;
}

.skeleton-img-wrapper.loaded,
.new-product-image.loaded,
.jfb-product-image.loaded,
.shop-product-image.loaded,
.main-product-image.loaded,
.product-thumbnail.loaded,
.skeleton-img-wrapper > img.loaded,
.new-product-image > img.loaded,
.jfb-product-image > img.loaded,
.shop-product-image img.loaded,
.main-product-image > img.loaded,
.product-thumbnail > img.loaded {
    animation: none !important;
    background: transparent !important;
}

.skeleton-img-wrapper.loaded > img,
.new-product-image.loaded > img,
.jfb-product-image.loaded > img,
.shop-product-image.loaded img,
.main-product-image.loaded > img,
.product-thumbnail.loaded > img,
.skeleton-img-wrapper > img.loaded,
.new-product-image > img.loaded,
.jfb-product-image > img.loaded,
.shop-product-image img.loaded,
.main-product-image > img.loaded,
.product-thumbnail > img.loaded {
    opacity: 1 !important;
}

/* Skeleton Atomic Helpers */
.skeleton-text {
    height: 12px;
    margin-bottom: 8px;
    border-radius: 6px;
    display: inline-block;
    width: 100%;
}

.skeleton-title {
    height: 18px;
    margin-bottom: 10px;
    border-radius: 8px;
    width: 75%;
}

.skeleton-badge {
    height: 20px;
    width: 60px;
    border-radius: 12px;
    display: inline-block;
}

.skeleton-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.skeleton-btn {
    height: 38px;
    border-radius: 10px;
    width: 100%;
    display: inline-block;
}

/* ==============================================================================
   Skeleton Product Card Component
   Matches .jfb-product-card and .shop-product-card dimensions
   ============================================================================== */
.skeleton-product-card {
    background: #ffffff;
    border: 1px solid #f2e9f4;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(117, 65, 200, 0.04);
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 0;
    transition: all 0.3s ease;
}

.skeleton-product-card .card-img-placeholder {
    width: 100%;
    aspect-ratio: 1 / 1;
    position: relative;
    border-bottom: 1px solid #f6f0f8;
}

.skeleton-product-card .card-body-placeholder {
    padding: 16px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.skeleton-product-card .card-tag-placeholder {
    width: 70px;
    height: 14px;
    border-radius: 6px;
    margin-bottom: 10px;
}

.skeleton-product-card .card-title-line-1 {
    width: 90%;
    height: 14px;
    border-radius: 6px;
    margin-bottom: 6px;
}

.skeleton-product-card .card-title-line-2 {
    width: 60%;
    height: 14px;
    border-radius: 6px;
    margin-bottom: 14px;
}

.skeleton-product-card .card-rating-placeholder {
    width: 95px;
    height: 12px;
    border-radius: 6px;
    margin-bottom: 14px;
}

.skeleton-product-card .card-price-placeholder {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}

.skeleton-product-card .card-price-val {
    width: 65px;
    height: 18px;
    border-radius: 6px;
}

.skeleton-product-card .card-mrp-val {
    width: 45px;
    height: 14px;
    border-radius: 6px;
}

.skeleton-product-card .card-btn-placeholder {
    height: 40px;
    border-radius: 12px;
    width: 100%;
    margin-top: auto;
}

/* ==============================================================================
   Admin Table Skeleton Loader
   ============================================================================== */
.skeleton-table-row td {
    padding: 14px 12px;
}
.skeleton-table-cell {
    height: 14px;
    border-radius: 6px;
    width: 80%;
}

/* ==============================================================================
   Container helper for dynamic ajax loading
   ============================================================================== */
.skeleton-loading-container {
    transition: opacity 0.25s ease;
}

.skeleton-hidden {
    display: none !important;
}
