@charset "UTF-8";

/**
 * Product Skeleton Loader - Apple-Inspired
 * 
 * Purpose: Skeleton loading states for product cards during initial load
 * Dependencies: variables.css, reset.css
 * 
 * Features:
 * - Product card skeleton matching actual card layout
 * - Shimmer animation effect
 * - Responsive grid skeleton
 * - Smooth fade-in/out transitions
 * 
 * @version 1.0.0
 * @date 2026-01-27
 */

/* ============================================================
   PRODUCT SKELETON CONTAINER
   ============================================================ */

.nx-product-skeleton-container {
    display: flex !important;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0;
    margin: 0;
    width: 100%;
    opacity: 1;
    transition: opacity 0.3s ease;
    position: relative;
    z-index: 1;
}

.nx-product-skeleton-container.hidden {
    opacity: 0;
    pointer-events: none;
    display: none !important;
}

/* Hide product area only when it's the sibling of a visible skeleton (no .hidden) */
.nx-product-skeleton-container:not(.hidden) ~ .row.nx-products-loading:not(.category-product-area--visible) {
    display: none !important;
}

/* When we have products, always show the product row (home + category) */
.nx-product-skeleton-container ~ .row.nx-products-loading.category-product-area--visible,
.row.nx-products-loading.category-product-area--visible {
    display: flex !important;
}

/* ============================================================
   PRODUCT SKELETON CARD
   ============================================================ */

.nx-product-skeleton {
    flex: 0 0 calc(50% - 0.25rem);
    max-width: calc(50% - 0.25rem);
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    min-height: 320px;
}

@media (min-width: 576px) {
    .nx-product-skeleton {
        flex: 0 0 calc(50% - 0.5rem);
        max-width: calc(50% - 0.5rem);
        min-height: 340px;
    }
}

@media (min-width: 768px) {
    .nx-product-skeleton {
        flex: 0 0 calc(50% - 0.5rem);
        max-width: calc(50% - 0.5rem);
        min-height: 360px;
    }
}

@media (min-width: 992px) {
    .nx-product-skeleton {
        flex: 0 0 calc(25% - 0.5rem);
        max-width: calc(25% - 0.5rem);
        min-height: 380px;
    }
}

/* ============================================================
   SKELETON IMAGE AREA
   ============================================================ */

.nx-skeleton-image {
    width: 100%;
    height: 170px;
    background: linear-gradient(
        90deg,
        #f5f5f7 0%,
        #e9ecef 20%,
        #f5f5f7 40%,
        #f5f5f7 100%
    );
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    position: relative;
    overflow: hidden;
}

@media (min-width: 576px) {
    .nx-skeleton-image {
        height: 180px;
    }
}

@media (min-width: 768px) {
    .nx-skeleton-image {
        height: 200px;
    }
}

@media (min-width: 992px) {
    .nx-skeleton-image {
        height: 220px;
    }
}

/* ============================================================
   SKELETON CONTENT AREA
   ============================================================ */

.nx-skeleton-content {
    padding: 1rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    flex: 1;
}

.nx-skeleton-title {
    height: 16px;
    background: linear-gradient(
        90deg,
        #f5f5f7 0%,
        #e9ecef 20%,
        #f5f5f7 40%,
        #f5f5f7 100%
    );
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    border-radius: 4px;
    width: 85%;
}

.nx-skeleton-title-line-2 {
    height: 16px;
    background: linear-gradient(
        90deg,
        #f5f5f7 0%,
        #e9ecef 20%,
        #f5f5f7 40%,
        #f5f5f7 100%
    );
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite 0.2s;
    border-radius: 4px;
    width: 60%;
}

.nx-skeleton-price {
    height: 20px;
    background: linear-gradient(
        90deg,
        #f5f5f7 0%,
        #e9ecef 20%,
        #f5f5f7 40%,
        #f5f5f7 100%
    );
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite 0.4s;
    border-radius: 4px;
    width: 50%;
    margin-top: 0.5rem;
}

.nx-skeleton-buttons {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding: 0 0.75rem;
}

.nx-skeleton-button {
    flex: 1;
    height: 36px;
    background: linear-gradient(
        90deg,
        #f5f5f7 0%,
        #e9ecef 20%,
        #f5f5f7 40%,
        #f5f5f7 100%
    );
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite 0.6s;
    border-radius: 8px;
}

.nx-skeleton-button-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(
        90deg,
        #f5f5f7 0%,
        #e9ecef 20%,
        #f5f5f7 40%,
        #f5f5f7 100%
    );
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite 0.8s;
    border-radius: 8px;
    flex-shrink: 0;
}

/* ============================================================
   SHIMMER ANIMATION
   ============================================================ */

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

/* ============================================================
   RESPONSIVE ADJUSTMENTS
   ============================================================ */

@media (max-width: 575px) {
    .nx-product-skeleton {
        min-height: 300px;
    }
    
    .nx-skeleton-image {
        height: 160px;
    }
    
    .nx-skeleton-content {
        padding: 0.875rem 0.625rem;
    }
    
    .nx-skeleton-title,
    .nx-skeleton-title-line-2 {
        height: 14px;
    }
    
    .nx-skeleton-price {
        height: 18px;
    }
    
    .nx-skeleton-button,
    .nx-skeleton-button-icon {
        height: 32px;
    }
}

/* ============================================================
   REDUCED MOTION
   ============================================================ */

@media (prefers-reduced-motion: reduce) {
    .nx-skeleton-image,
    .nx-skeleton-title,
    .nx-skeleton-title-line-2,
    .nx-skeleton-price,
    .nx-skeleton-button,
    .nx-skeleton-button-icon {
        animation: none;
        background: #f5f5f7;
    }
}

