/* =====================================================
   SKELETON LOADERS - Performance & UX Enhancement
   ===================================================== */

/* Base skeleton animation */
@keyframes skeleton-loading {
    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-loading 1.5s infinite;
    border-radius: 4px;
}

/* Dark mode skeleton */
@media (prefers-color-scheme: dark) {
    .skeleton {
        background: linear-gradient(90deg, #2a2a2a 25%, #3a3a3a 50%, #2a2a2a 75%);
        background-size: 200px 100%;
    }
}

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

.skeleton-product-card {
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 16px;
    background: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 300px;
}

.skeleton-product-image {
    width: 100%;
    height: 200px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200px 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 8px;
    margin-bottom: 12px;
}

.skeleton-product-title {
    width: 80%;
    height: 20px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200px 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 4px;
    margin-bottom: 8px;
}

.skeleton-product-price {
    width: 40%;
    height: 18px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200px 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 4px;
    margin-bottom: 12px;
}

.skeleton-product-button {
    width: 100%;
    height: 40px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200px 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 6px;
}

/* =====================================================
   BLOG CARD SKELETON
   ===================================================== */

.skeleton-blog-card {
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 16px;
    background: white;
    margin-bottom: 20px;
}

.skeleton-blog-image {
    width: 100%;
    height: 180px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200px 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 8px;
    margin-bottom: 12px;
}

.skeleton-blog-title {
    width: 90%;
    height: 22px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200px 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 4px;
    margin-bottom: 8px;
}

.skeleton-blog-excerpt {
    width: 100%;
    height: 16px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200px 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 4px;
    margin-bottom: 6px;
}

.skeleton-blog-excerpt:last-child {
    width: 70%;
}

.skeleton-blog-date {
    width: 30%;
    height: 14px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200px 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 4px;
    margin-top: 12px;
}

/* =====================================================
   TABLE SKELETON
   ===================================================== */

.skeleton-table {
    width: 100%;
    border-collapse: collapse;
}

.skeleton-table td {
    padding: 12px;
    border-bottom: 1px solid #e9ecef;
}

.skeleton-table-cell {
    width: 100%;
    height: 16px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200px 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 4px;
}

.skeleton-table-cell--small {
    width: 60%;
}

.skeleton-table-cell--large {
    width: 100%;
}

/* =====================================================
   TEXT SKELETON
   ===================================================== */

.skeleton-text {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200px 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 4px;
    margin-bottom: 8px;
}

.skeleton-text--title {
    height: 24px;
    width: 60%;
}

.skeleton-text--subtitle {
    height: 20px;
    width: 40%;
}

.skeleton-text--line {
    height: 16px;
    width: 100%;
}

.skeleton-text--line:last-child {
    width: 70%;
}

.skeleton-text--short {
    width: 30%;
}

.skeleton-text--medium {
    width: 60%;
}

.skeleton-text--long {
    width: 90%;
}

/* =====================================================
   AVATAR SKELETON
   ===================================================== */

.skeleton-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200px 100%;
    animation: skeleton-loading 1.5s infinite;
}

.skeleton-avatar--small {
    width: 24px;
    height: 24px;
}

.skeleton-avatar--large {
    width: 60px;
    height: 60px;
}

/* =====================================================
   BUTTON SKELETON
   ===================================================== */

.skeleton-button {
    height: 40px;
    border-radius: 6px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200px 100%;
    animation: skeleton-loading 1.5s infinite;
    border: none;
}

.skeleton-button--small {
    height: 32px;
    width: 80px;
}

.skeleton-button--medium {
    height: 40px;
    width: 120px;
}

.skeleton-button--large {
    height: 48px;
    width: 160px;
}

.skeleton-button--full {
    width: 100%;
}

/* =====================================================
   GRID SKELETON LAYOUTS
   ===================================================== */

.skeleton-grid {
    display: grid;
    gap: 20px;
    padding: 20px 0;
}

.skeleton-grid--products {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
}

.skeleton-grid--blog {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

.skeleton-grid--2-col {
    grid-template-columns: repeat(2, 1fr);
}

.skeleton-grid--3-col {
    grid-template-columns: repeat(3, 1fr);
}

.skeleton-grid--4-col {
    grid-template-columns: repeat(4, 1fr);
}

/* Mobile responsive */
@media (max-width: 768px) {
    .skeleton-grid--products,
    .skeleton-grid--blog,
    .skeleton-grid--2-col,
    .skeleton-grid--3-col,
    .skeleton-grid--4-col {
        grid-template-columns: 1fr;
    }
    
    .skeleton-product-card {
        max-width: 100%;
    }
}

@media (max-width: 1024px) and (min-width: 769px) {
    .skeleton-grid--3-col,
    .skeleton-grid--4-col {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* =====================================================
   FORM SKELETON
   ===================================================== */

.skeleton-form-field {
    margin-bottom: 20px;
}

.skeleton-form-label {
    width: 25%;
    height: 16px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200px 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 4px;
    margin-bottom: 8px;
}

.skeleton-form-input {
    width: 100%;
    height: 42px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200px 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 6px;
}

/* =====================================================
   UTILITY CLASSES
   ===================================================== */

.skeleton-hide {
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

.skeleton-show {
    opacity: 1;
    transition: opacity 0.3s ease-in-out;
}

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

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

/* Reduced motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    .skeleton,
    .skeleton-loading,
    .skeleton-product-image,
    .skeleton-product-title,
    .skeleton-product-price,
    .skeleton-product-button,
    .skeleton-blog-image,
    .skeleton-blog-title,
    .skeleton-blog-excerpt,
    .skeleton-blog-date,
    .skeleton-table-cell,
    .skeleton-text,
    .skeleton-avatar,
    .skeleton-button,
    .skeleton-form-label,
    .skeleton-form-input {
        animation: none;
        background: #f0f0f0;
    }
    
    .fade-in {
        animation: none;
    }
} 