/* ============================================
   États de Chargement Visuels
   ============================================ */

/* ============================================
   1. Skeleton Screens avec Animation Shimmer
   ============================================ */

.skeleton-container {
    width: 100%;
}

.skeleton-card {
    background: #fff;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

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

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

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

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

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

.skeleton-button {
    height: 40px;
    width: 120px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 4px;
    margin-top: 1rem;
}

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

.skeleton-table-row {
    display: flex;
    padding: 1rem;
    border-bottom: 1px solid #e0e0e0;
}

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

.skeleton-table-cell:last-child {
    margin-right: 0;
}

.skeleton-table-cell.short {
    width: 100px;
    flex: 0 0 100px;
}

/* Animation Shimmer */
@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

/* ============================================
   2. Progress Bars Contextuelles
   ============================================ */

.loading-progress-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 9999;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(5px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    padding: 1rem;
    display: none;
}

.loading-progress-container.show {
    display: block;
}

.loading-progress-content {
    max-width: 600px;
    margin: 0 auto;
}

.loading-progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.loading-progress-title {
    font-weight: 600;
    color: #333;
    font-size: 1rem;
}

.loading-progress-percentage {
    font-weight: 700;
    color: #22376e;
    font-size: 1rem;
}

.loading-progress-bar {
    width: 100%;
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.loading-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #22376e 0%, #3a5a9e 50%, #22376e 100%);
    background-size: 200% 100%;
    border-radius: 4px;
    transition: width 0.3s ease;
    animation: progress-shimmer 2s infinite;
}

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

.loading-progress-message {
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: #666;
    text-align: center;
}

.loading-progress-cancel {
    margin-top: 1rem;
    text-align: center;
}

.loading-progress-cancel button {
    background: transparent;
    border: 1px solid #dc3545;
    color: #dc3545;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.3s ease;
}

.loading-progress-cancel button:hover {
    background: #dc3545;
    color: #fff;
}

/* Progress bar inline (dans un conteneur) */
.loading-progress-inline {
    width: 100%;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    margin: 1rem 0;
}

/* ============================================
   3. Spinners Contextuels dans les Boutons
   ============================================ */

.btn-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.btn-loading::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #fff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.btn-loading .btn-text {
    opacity: 0;
}

.btn-loading .btn-spinner {
    display: inline-block;
    margin-right: 0.5rem;
}

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

/* Spinner personnalisé */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.spinner-sm {
    width: 16px;
    height: 16px;
    border-width: 2px;
}

.spinner-lg {
    width: 32px;
    height: 32px;
    border-width: 3px;
}

/* ============================================
   4. Lazy Loading pour Images
   ============================================ */

.lazy-image-container {
    position: relative;
    overflow: hidden;
    background: #f0f0f0;
}

.lazy-image {
    width: 100%;
    height: auto;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.lazy-image.loaded {
    opacity: 1;
}

.lazy-image-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

.lazy-image-placeholder.hidden {
    display: none;
}

.lazy-image-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(34, 55, 110, 0.2);
    border-top-color: #22376e;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* ============================================
   5. États de Chargement pour Conteneurs
   ============================================ */

.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    backdrop-filter: blur(2px);
}

.loading-overlay.hidden {
    display: none;
}

.loading-overlay-content {
    text-align: center;
}

.loading-overlay-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(34, 55, 110, 0.2);
    border-top-color: #22376e;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 1rem;
}

.loading-overlay-message {
    color: #666;
    font-size: 0.875rem;
}

/* ============================================
   6. Skeleton pour Cartes Client/Véhicule
   ============================================ */

.skeleton-list-card {
    background: #fff;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.skeleton-list-card-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    flex-shrink: 0;
}

.skeleton-list-card-content {
    flex: 1;
}

.skeleton-list-card-title {
    height: 20px;
    width: 60%;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 4px;
    margin-bottom: 0.5rem;
}

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

/* ============================================
   7. Responsive
   ============================================ */

@media (max-width: 768px) {
    .loading-progress-container {
        padding: 0.75rem;
    }
    
    .loading-progress-title {
        font-size: 0.875rem;
    }
    
    .skeleton-card {
        padding: 1rem;
    }
}

