/**
 * ════════════════════════════════════════════════════════════════════════════════
 * LOADING SPINNER - Animation de chargement
 * ════════════════════════════════════════════════════════════════════════════════
 */

.loading {
    position: fixed;
    display: none;
    z-index: 9999;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease-out;
}

/* Overlay avec effet blur moderne */
.loading::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(3, 130, 201, 0.1) 0%, rgba(1, 87, 155, 0.15) 100%);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    animation: fadeIn 0.3s ease-out;
}

/* Container du spinner */
.loading::after {
    content: '';
    position: relative;
    width: 60px;
    height: 60px;
    border: 4px solid rgba(3, 130, 201, 0.2);
    border-top: 4px solid #0382C9;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    box-shadow: 
        0 0 20px rgba(3, 130, 201, 0.3),
        inset 0 0 20px rgba(3, 130, 201, 0.1);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   SPINNER ALTERNATIF
   ═══════════════════════════════════════════════════════════════════════════════ */

.loading.loading-elegant {
    display: flex !important;
}

.loading.loading-elegant::after {
    width: 80px;
    height: 80px;
    border: none;
    border-radius: 50%;
    background: 
        linear-gradient(135deg, transparent 40%, #0382C9 40%, #0382C9 60%, transparent 60%),
        linear-gradient(90deg, transparent 40%, #2196F3 40%, #2196F3 60%, transparent 60%);
    background-size: 100% 100%;
    animation: spin 1.2s cubic-bezier(0.68, -0.55, 0.265, 1.55) infinite;
    box-shadow: 0 10px 30px rgba(3, 130, 201, 0.4);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   ANIMATIONS FLUIDES
   ═══════════════════════════════════════════════════════════════════════════════ */

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

/* Pulse pour effet de respiration */
@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.8;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════════
   VARIANTES DE SPINNERS
   ═══════════════════════════════════════════════════════════════════════════════ */

/* Spinner avec dots */
.loading.loading-dots::after {
    content: '';
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: #0382C9;
    box-shadow: 
        30px 0 #0382C9,
        60px 0 #0382C9;
    animation: loadingDots 1s ease-in-out infinite;
}

@keyframes loadingDots {
    0%, 100% {
        box-shadow: 
            30px 0 #0382C9,
            60px 0 #0382C9;
    }
    33% {
        box-shadow: 
            30px -10px #0382C9,
            60px 0 #0382C9;
    }
    66% {
        box-shadow: 
            30px 0 #0382C9,
            60px -10px #0382C9;
    }
}

/* Spinner avec pulse */
.loading.loading-pulse::after {
    border: none;
    background: linear-gradient(135deg, #0382C9 0%, #2196F3 100%);
    animation: pulse 1.5s ease-in-out infinite;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   TEXTE DE CHARGEMENT (Optionnel)
   ═══════════════════════════════════════════════════════════════════════════════ */

.loading[data-text]::before {
    content: attr(data-text);
    position: absolute;
    top: 60%;
    left: 50%;
    transform: translateX(-50%);
    color: #0382C9;
    font-weight: 600;
    font-size: 1.1rem;
    letter-spacing: 1px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
    animation: fadeIn 0.5s ease-out 0.3s both;
    z-index: 1;
    margin-top: 40px;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   TAILLES
   ═══════════════════════════════════════════════════════════════════════════════ */

.loading.loading-sm::after {
    width: 40px;
    height: 40px;
    border-width: 3px;
}

.loading.loading-lg::after {
    width: 100px;
    height: 100px;
    border-width: 5px;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   UTILITIES
   ═══════════════════════════════════════════════════════════════════════════════ */

/* Classes pour show/hide avec transitions */
.loading.show {
    display: flex !important;
    animation: fadeIn 0.3s ease-out;
}

.loading.hide {
    animation: fadeOut 0.3s ease-out;
    pointer-events: none;
}

/* Désactiver le scroll quand le loading est actif */
body.loading-active {
    overflow: hidden;
}

