/* ========================
   FICHIER : animations.css
   VERSION AMELIOREE PAR EXPERT UI DESIGNER
   Description :
   Ajout d'animations fluides, modernes et réactives pour une UX dynamique
   incluant des effets au survol et des transitions
   optimisées.
   ======================== */

/* ------------------------
   ANIMATIONS GENERIQUES
------------------------ */
.animate-on-scroll {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.6s ease-out;
}

.animate-on-scroll.animated {
    opacity: 1;
    transform: translateY(0);
}

/* Effet fade-in avec scaling subtil */
.fade-in {
    opacity: 0;
    transform: scale(0.95);
    transition: all 0.6s ease-out;
}

.fade-in.animated {
    opacity: 1;
    transform: scale(1);
}

/* Effet de glissement gauche-droite */
.slide-in-left {
    opacity: 0;
    transform: translateX(-50px);
    transition: all 0.6s ease-out;
}

.slide-in-right {
    opacity: 0;
    transform: translateX(50px);
    transition: all 0.6s ease-out;
}

.animated {
    opacity: 1;
    transform: translate(0, 0);
}

/* ------------------------
   EFFETS DE SURVOL
------------------------ */
.hover-effect {
    transition: transform 0.3s ease-in-out, box-shadow 0.3s ease-in-out;
    cursor: pointer;
}

.hover-effect:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

/* Zoom subtil pour les icônes */
.icon-animate {
    transition: all 0.3s ease-in-out;
}

.icon-animate:hover {
    transform: scale(1.1);
    color: var(--primary-color);
}

/* Effet de pulse pour un bouton */
.pulse-button {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

/* ------------------------
   ANIMATION D'OVERLAY
------------------------ */
.card-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(33, 150, 243, 0.85);
    opacity: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.4s ease-in-out;
    border-radius: 12px;
}

.overlay-text {
    color: white;
    font-size: 1.2rem;
    font-weight: bold;
    text-align: center;
}

/* ------------------------
   ANIMATIONS DE BOUTON LOADING AMELIOREES
------------------------ */

.loading-button {
    position: relative;
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-full, 9999px);
    background: linear-gradient(45deg, var(--primary-color, #0d6efd), var(--secondary-color, #6610f2));
    color: #fff;
    font-weight: 600;
    font-size: 1rem;
    text-align: center;
    border: none;
    cursor: pointer;
    transition: background 0.3s ease, transform 0.3s ease, opacity 0.3s ease;
    will-change: background, transform, opacity;
    overflow: hidden;
    line-height: 1;
}

/* État normal : le bouton peut avoir un léger effet de survol */
.loading-button:hover:not(.loading) {
    transform: translateY(-1px) scale(1.02);
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

/* Lors du chargement : désactivation et style atténué */
.loading-button.loading {
    background: #ccc;
    cursor: not-allowed;
    pointer-events: none;
    opacity: 0.8;
    /* Ajouter un aria-busy pour l’accessibilité */
    /* En HTML : <button class="loading-button loading" aria-busy="true">... */
}

/* On fait disparaître visuellement le texte derrière le spinner, sans le retirer pour accessibilité */
.loading-button.loading span {
    opacity: 0.3;
}

/* Spinner amélioré */
.loading-button.loading::after {
    content: '';
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    width: 1.25rem;
    height: 1.25rem;
    border-radius: 50%;
    border: 2px solid #fff;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
    /* Effet glow autour du spinner */
    box-shadow: 0 0 8px rgba(255,255,255,0.4);
}

/* Pour aller plus loin, on peut ajouter un double spinner avec un pseudo-élément supplémentaire */
.loading-button.loading::before {
    content: '';
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    width: 1.25rem;
    height: 1.25rem;
    border-radius: 50%;
    border: 2px dashed rgba(255,255,255,0.6);
    border-top-color: transparent;
    animation: spinReverse 1.5s linear infinite;
    opacity: 0.7;
}

/* Animation du spinner principal */
@keyframes spin {
    to {
        transform: translateY(-50%) rotate(360deg);
    }
}

/* Animation du spinner secondaire (inverse) */
@keyframes spinReverse {
    to {
        transform: translateY(-50%) rotate(-360deg);
    }
}


/* ------------------------
   RESPONSIVE OPTIMISATION
------------------------ */
@media (max-width: 768px) {
    .hover-effect {
        transform: none !important;
        box-shadow: none !important;
    }

    .card-overlay {
        opacity: 1;
    }
}


/* ------------------------
 vision-animations
------------------------ */

/* Animations génériques d’apparition */
.animate-on-scroll {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.animate-on-scroll.animated {
    opacity: 1;
    transform: translateY(0);
}

