/* ============================================================================
   LOADING SKELETON SCREENS - Universal Styles
   ============================================================================ */

/* Base Skeleton Styles */
.skeleton {
    background: linear-gradient(
        90deg,
        #f0f0f0 0%,
        #e0e0e0 20%,
        #f0f0f0 40%,
        #f0f0f0 100%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: 4px;
    display: inline-block;
    position: relative;
    overflow: hidden;
}

/* Dark theme skeleton */
.skeleton-dark {
    background: linear-gradient(
        90deg,
        #2a2a2a 0%,
        #3a3a3a 20%,
        #2a2a2a 40%,
        #2a2a2a 100%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
}

/* Shimmer Animation */
@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Pulse Animation (Alternative) */
.skeleton-pulse {
    animation: skeleton-pulse 1.5s ease-in-out infinite;
}

@keyframes skeleton-pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* Wave Animation (Alternative) */
.skeleton-wave {
    position: relative;
    overflow: hidden;
}

.skeleton-wave::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    animation: skeleton-wave 1.5s ease-in-out infinite;
}

@keyframes skeleton-wave {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

/* ============================================================================
   SKELETON COMPONENTS
   ============================================================================ */

/* Text Skeletons */
.skeleton-text {
    height: 1em;
    margin-bottom: 0.5em;
    width: 100%;
}

.skeleton-text-short {
    width: 60%;
}

.skeleton-text-medium {
    width: 80%;
}

.skeleton-text-long {
    width: 100%;
}

.skeleton-title {
    height: 2em;
    margin-bottom: 1em;
    width: 70%;
}

.skeleton-heading {
    height: 1.5em;
    margin-bottom: 0.8em;
    width: 50%;
}

/* Image Skeletons */
.skeleton-image {
    width: 100%;
    height: 100%;
    min-height: 200px;
}

.skeleton-avatar {
    border-radius: 50%;
    width: 48px;
    height: 48px;
}

.skeleton-avatar-large {
    border-radius: 50%;
    width: 96px;
    height: 96px;
}

/* Card Skeleton */
.skeleton-card {
    background: #fff;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.skeleton-card-image {
    width: 100%;
    height: 200px;
    margin-bottom: 1rem;
    border-radius: 8px;
}

.skeleton-card-title {
    height: 1.5em;
    width: 80%;
    margin-bottom: 0.5rem;
}

.skeleton-card-text {
    height: 1em;
    width: 100%;
    margin-bottom: 0.5rem;
}

.skeleton-card-text:last-child {
    width: 60%;
}

/* Button Skeleton */
.skeleton-button {
    height: 40px;
    width: 120px;
    border-radius: 4px;
}

.skeleton-button-large {
    height: 48px;
    width: 160px;
}

/* Badge Skeleton */
.skeleton-badge {
    height: 24px;
    width: 60px;
    border-radius: 12px;
    display: inline-block;
}

/* ============================================================================
   PRODUCT GRID SKELETON
   ============================================================================ */

.skeleton-product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
    padding: 2rem 0;
}

.skeleton-product-item {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
}

.skeleton-product-image {
    width: 100%;
    height: 280px;
    background: linear-gradient(
        90deg,
        #f0f0f0 0%,
        #e0e0e0 20%,
        #f0f0f0 40%,
        #f0f0f0 100%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
}

.skeleton-product-content {
    padding: 1.5rem;
}

.skeleton-product-category {
    height: 18px;
    width: 100px;
    margin-bottom: 0.8rem;
}

.skeleton-product-title {
    height: 24px;
    width: 90%;
    margin-bottom: 0.5rem;
}

.skeleton-product-title-short {
    height: 24px;
    width: 60%;
    margin-bottom: 1rem;
}

.skeleton-product-description {
    height: 14px;
    width: 100%;
    margin-bottom: 0.5rem;
}

.skeleton-product-description:last-of-type {
    width: 70%;
    margin-bottom: 1rem;
}

.skeleton-product-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1rem;
    border-top: 1px solid #f0f0f0;
}

.skeleton-product-button {
    height: 36px;
    width: 100px;
    border-radius: 6px;
}

/* ============================================================================
   PRODUCT DETAIL PAGE SKELETON
   ============================================================================ */

.skeleton-product-detail {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.skeleton-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    margin-bottom: 3rem;
}

/* Gallery Skeleton */
.skeleton-gallery {
    position: relative;
}

.skeleton-main-image {
    width: 100%;
    height: 500px;
    border-radius: 12px;
    margin-bottom: 1rem;
}

.skeleton-thumbnails {
    display: flex;
    gap: 0.5rem;
}

.skeleton-thumbnail {
    width: 80px;
    height: 80px;
    border-radius: 8px;
}

/* Product Info Skeleton */
.skeleton-product-info {
    padding: 2rem 0;
}

.skeleton-breadcrumb {
    height: 16px;
    width: 300px;
    margin-bottom: 1.5rem;
}

.skeleton-product-detail-title {
    height: 36px;
    width: 80%;
    margin-bottom: 1rem;
}

.skeleton-product-meta {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
}

.skeleton-meta-item {
    height: 24px;
    width: 100px;
}

.skeleton-divider {
    height: 1px;
    background: #e0e0e0;
    margin: 2rem 0;
}

.skeleton-description {
    margin-bottom: 1rem;
}

.skeleton-description-line {
    height: 16px;
    width: 100%;
    margin-bottom: 0.8rem;
}

.skeleton-description-line:nth-child(4) {
    width: 85%;
}

.skeleton-description-line:last-child {
    width: 60%;
}

.skeleton-action-buttons {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

.skeleton-action-button {
    height: 48px;
    width: 180px;
    border-radius: 8px;
}

/* ============================================================================
   IMAGE GALLERY SKELETON
   ============================================================================ */

.skeleton-image-gallery {
    position: relative;
    width: 100%;
    height: 600px;
    border-radius: 12px;
    overflow: hidden;
}

.skeleton-gallery-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    z-index: 10;
}

.skeleton-gallery-nav-left {
    left: 1rem;
}

.skeleton-gallery-nav-right {
    right: 1rem;
}

.skeleton-gallery-indicators {
    position: absolute;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 0.5rem;
}

.skeleton-gallery-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

/* ============================================================================
   DASHBOARD STATISTICS SKELETON
   ============================================================================ */

.skeleton-dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.skeleton-stat-card {
    background: #fff;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.skeleton-stat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.skeleton-stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 8px;
}

.skeleton-stat-title {
    height: 16px;
    width: 100px;
    margin-bottom: 0.5rem;
}

.skeleton-stat-value {
    height: 32px;
    width: 120px;
    margin-bottom: 0.5rem;
}

.skeleton-stat-change {
    height: 20px;
    width: 80px;
}

/* ============================================================================
   DASHBOARD TABLE SKELETON
   ============================================================================ */

.skeleton-table {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.skeleton-table-header {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 1rem;
    padding: 1rem 1.5rem;
    background: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
}

.skeleton-table-heading {
    height: 20px;
    width: 80%;
}

.skeleton-table-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 1rem;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #f0f0f0;
}

.skeleton-table-row:last-child {
    border-bottom: none;
}

.skeleton-table-cell {
    height: 18px;
}

.skeleton-table-cell-short {
    width: 60%;
}

.skeleton-table-cell-long {
    width: 90%;
}

/* ============================================================================
   DASHBOARD CHART SKELETON
   ============================================================================ */

.skeleton-chart {
    background: #fff;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.skeleton-chart-header {
    margin-bottom: 1.5rem;
}

.skeleton-chart-title {
    height: 24px;
    width: 200px;
    margin-bottom: 0.5rem;
}

.skeleton-chart-subtitle {
    height: 16px;
    width: 150px;
}

.skeleton-chart-canvas {
    height: 300px;
    width: 100%;
    background: linear-gradient(
        90deg,
        #f8f9fa 0%,
        #e9ecef 20%,
        #f8f9fa 40%,
        #f8f9fa 100%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: 8px;
}

/* ============================================================================
   LOADING PROGRESS INDICATOR
   ============================================================================ */

.skeleton-progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: #f0f0f0;
    z-index: 9999;
    overflow: hidden;
}

.skeleton-progress-bar-fill {
    height: 100%;
    background: linear-gradient(
        90deg,
        #4F46E5,
        #7C3AED,
        #4F46E5
    );
    background-size: 200% 100%;
    animation: progress-bar-loading 1.5s ease-in-out infinite;
    width: 0%;
    transition: width 0.3s ease;
}

@keyframes progress-bar-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* ============================================================================
   FADE-IN TRANSITIONS (Content Loading)
   ============================================================================ */

.skeleton-fade-out {
    animation: skeleton-fade-out 0.3s ease-out forwards;
}

@keyframes skeleton-fade-out {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
        display: none;
    }
}

.content-fade-in {
    animation: content-fade-in 0.5s ease-in forwards;
    opacity: 0;
}

@keyframes content-fade-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================================================
   RESPONSIVE ADJUSTMENTS
   ============================================================================ */

@media (max-width: 768px) {
    .skeleton-product-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 1rem;
    }
    
    .skeleton-detail-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .skeleton-main-image {
        height: 300px;
    }
    
    .skeleton-dashboard-stats {
        grid-template-columns: 1fr;
    }
    
    .skeleton-table-header,
    .skeleton-table-row {
        grid-template-columns: 1fr;
    }
}

/* ============================================================================
   UTILITY CLASSES
   ============================================================================ */

.skeleton-container {
    width: 100%;
    padding: 2rem;
}

.skeleton-section {
    margin-bottom: 3rem;
}

.skeleton-hidden {
    display: none !important;
}

.skeleton-visible {
    display: block !important;
}

/* Prevent layout shift */
.skeleton-preserve-space {
    min-height: 400px;
}