﻿/* Skeleton Loading Animations for MemberArea */

/* Animation de pulsation pour les skeletons - réduite pour éviter le clignotement */
@keyframes skeleton-pulse {
    0% {
        opacity: 1;
    }
    50% {
        opacity: 0.6;
    }
    100% {
        opacity: 1;
    }
}

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

/* Classe de base pour les skeletons */
.skeleton {
    animation: skeleton-pulse 2s ease-in-out infinite;
    background: linear-gradient(
        90deg,
        #f0f0f0 0px,
        #e0e0e0 40px,
        #f0f0f0 80px
    );
    background-size: 200%;
    border-radius: 4px;
}

[data-theme="dark"] .skeleton {
    background: linear-gradient(
        90deg,
        #2d2d30 0px,
        #3d3d40 40px,
        #2d2d30 80px
    );
    background-size: 200%;
}

.skeleton-shimmer {
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
}

/* Styles spécifiques pour les différents éléments */
.skeleton-welcome-card {
    height: 200px;
    border-radius: 15px;
    margin-bottom: 1.5rem;
}

.skeleton-advice-card {
    height: 180px;
    border-radius: 12px;
    margin-bottom: 1.5rem;
}

.skeleton-stat-card {
    height: 120px;
    border-radius: 8px;
}

.skeleton-nav-card {
    height: 400px;
    border-radius: 15px;
}

.skeleton-table-row {
    height: 40px;
    margin-bottom: 8px;
    border-radius: 4px;
}

.skeleton-text {
    height: 20px;
    margin-bottom: 10px;
    border-radius: 4px;
}

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

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

.skeleton-title {
    height: 32px;
    width: 40%;
    margin-bottom: 16px;
    border-radius: 6px;
}

.skeleton-circle {
    border-radius: 50%;
}

.skeleton-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    margin: 0 auto 1rem;
}

/* Skeleton spécifique pour les cartes de navigation */
.skeleton-nav-content {
    padding: 3rem 2rem;
    text-align: center;
}

.skeleton-nav-content .skeleton-icon {
    width: 100px;
    height: 100px;
}

/* Skeleton pour les tableaux */
.skeleton-table {
    width: 100%;
}

.skeleton-table-header {
    height: 45px;
    margin-bottom: 10px;
    border-radius: 8px 8px 0 0;
}

/* Animation progressive d'apparition */
.skeleton-stagger {
    animation: skeleton-pulse 2s ease-in-out infinite;
}

.skeleton-stagger:nth-child(1) { animation-delay: 0s; }
.skeleton-stagger:nth-child(2) { animation-delay: 0.1s; }
.skeleton-stagger:nth-child(3) { animation-delay: 0.2s; }
.skeleton-stagger:nth-child(4) { animation-delay: 0.3s; }
.skeleton-stagger:nth-child(5) { animation-delay: 0.4s; }

/* Optimisation des performances */
.skeleton-container {
    will-change: opacity;
    transform: translateZ(0);
}

/* Skeletons génériques pour toutes les pages */
.skeleton-card {
    height: 200px;
    border-radius: 12px;
    margin-bottom: 1.5rem;
}

.skeleton-hero {
    height: 400px;
    border-radius: 15px;
    margin-bottom: 2rem;
}

.skeleton-section {
    height: 300px;
    border-radius: 12px;
    margin-bottom: 1.5rem;
}

.skeleton-form-group {
    height: 60px;
    margin-bottom: 1rem;
    border-radius: 8px;
}

.skeleton-button {
    height: 50px;
    width: 200px;
    border-radius: 8px;
}

.skeleton-image {
    height: 200px;
    width: 100%;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.skeleton-list-item {
    height: 60px;
    margin-bottom: 0.5rem;
    border-radius: 6px;
}

/* Responsive */
@media (max-width: 768px) {
    .skeleton-nav-card {
        height: 350px;
    }
    
    .skeleton-welcome-card {
        height: 180px;
    }
    
    .skeleton-advice-card {
        height: 150px;
    }
    
    .skeleton-hero {
        height: 300px;
    }
    
    .skeleton-section {
        height: 250px;
    }
}

/* Style pour le message de chargement initial */
.loading-message {
    text-align: center;
    padding: 2rem;
    color: #667eea;
    font-weight: 600;
}

[data-theme="dark"] .loading-message {
    color: #8b9def;
}

.loading-spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid rgba(102, 126, 234, 0.3);
    border-radius: 50%;
    border-top-color: #667eea;
    animation: spinner 0.8s linear infinite;
    margin-right: 10px;
    vertical-align: middle;
}

@keyframes spinner {
    to { transform: rotate(360deg); }
}

/* Animation de chargement pour les images - simplifiée */
img[data-lazy] {
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

img[data-lazy].loaded {
    opacity: 1;
}

/* Skeleton pour grilles de cartes */
.skeleton-grid {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
}

.skeleton-grid-item {
    height: 300px;
    border-radius: 12px;
}
