/* Animations pour la Mutuelle UDM */

/* ===== ANIMATIONS DE BASE ===== */

/* Animation de fade-in */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Animation de slide-in depuis la gauche */
@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Animation de slide-in depuis la droite */
@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Animation de zoom-in */
@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Animation de bounce */
@keyframes bounce {
    0%, 20%, 53%, 80%, 100% {
        transform: translate3d(0, 0, 0);
    }
    40%, 43% {
        transform: translate3d(0, -15px, 0);
    }
    70% {
        transform: translate3d(0, -7px, 0);
    }
    90% {
        transform: translate3d(0, -2px, 0);
    }
}

/* Animation de pulse */
@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

/* Animation de rotation */
@keyframes rotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Animation de shake */
@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-5px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(5px);
    }
}

/* Animation de glow */
@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(46, 125, 50, 0.5);
    }
    50% {
        box-shadow: 0 0 20px rgba(46, 125, 50, 0.8), 0 0 30px rgba(46, 125, 50, 0.6);
    }
}

/* Animation de typing */
@keyframes typing {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

/* Animation de blink */
@keyframes blink {
    0%, 50% {
        opacity: 1;
    }
    51%, 100% {
        opacity: 0;
    }
}

/* ===== CLASSES D'ANIMATION SÉCURISÉES ===== */

/* Animations d'entrée - Version sécurisée */
.animate-fade-in {
    animation: fadeIn 0.8s ease-out forwards;
}

.animate-slide-in-left {
    animation: slideInLeft 0.6s ease-out forwards;
}

.animate-slide-in-right {
    animation: slideInRight 0.6s ease-out forwards;
}

.animate-zoom-in {
    animation: zoomIn 0.5s ease-out forwards;
}

.animate-bounce {
    animation: bounce 1s ease-out;
}

/* Classes pour animations au scroll uniquement */
.fade-in-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s ease;
}

.fade-in-on-scroll.visible {
    opacity: 1;
    transform: translateY(0);
}

.slide-in-on-scroll {
    opacity: 0;
    transform: translateX(-50px);
    transition: all 0.6s ease;
}

.slide-in-on-scroll.visible {
    opacity: 1;
    transform: translateX(0);
}

/* Animations continues */
.animate-pulse {
    animation: pulse 2s infinite;
}

.animate-rotate {
    animation: rotate 2s linear infinite;
}

.animate-glow {
    animation: glow 2s ease-in-out infinite;
}

/* Animations au hover */
.hover-scale {
    transition: transform 0.3s ease;
}

.hover-scale:hover {
    transform: scale(1.05);
}

.hover-lift {
    transition: all 0.3s ease;
}

.hover-lift:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}

.hover-rotate {
    transition: transform 0.3s ease;
}

.hover-rotate:hover {
    transform: rotate(5deg);
}

.hover-shake:hover {
    animation: shake 0.5s ease-in-out;
}

/* ===== ANIMATIONS SPÉCIFIQUES AUX ÉLÉMENTS ===== */

/* Animation pour les cartes */
.card-animate {
    /* Pas d'opacity: 0 par défaut pour éviter la disparition */
    transform: translateY(0);
    transition: all 0.6s ease;
}

.card-animate.animate-on-scroll {
    opacity: 0;
    transform: translateY(30px);
}

.card-animate.animate-on-scroll.visible {
    opacity: 1;
    transform: translateY(0);
}

.card-animate:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 35px rgba(0,0,0,0.2);
}

/* Animation pour les boutons */
.btn-animate {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.btn-animate::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s ease;
}

.btn-animate:hover::before {
    left: 100%;
}

.btn-animate:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.3);
}

/* Animation pour les icônes */
.icon-animate {
    transition: all 0.3s ease;
}

.icon-animate:hover {
    transform: scale(1.2) rotate(10deg);
    color: #2e7d32;
}

/* Animation pour le texte qui s'écrit */
.typing-text {
    overflow: hidden;
    border-right: 2px solid #2e7d32;
    white-space: nowrap;
    animation: typing 3s steps(40, end), blink 0.75s step-end infinite;
}

/* Animation pour les statistiques */
.stat-counter {
    font-size: 2.5rem;
    font-weight: bold;
    color: #2e7d32;
}

.stat-animate {
    animation: zoomIn 0.8s ease-out;
}

/* Animation pour la navigation */
.nav-item {
    transition: all 0.3s ease;
}

.nav-item:hover {
    transform: translateY(-2px);
}

.nav-link {
    position: relative;
    transition: all 0.3s ease;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 50%;
    width: 0;
    height: 2px;
    background: #2e7d32;
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

.nav-link:hover::after {
    width: 100%;
}

/* Animation pour le hero */
.hero-title {
    animation: fadeIn 1s ease-out 0.2s both;
}

.hero-subtitle {
    animation: fadeIn 1s ease-out 0.4s both;
}

.hero-buttons {
    animation: fadeIn 1s ease-out 0.6s both;
}

/* Animation pour les sections */
.section-animate {
    /* Pas d'opacity: 0 par défaut */
    transform: translateY(0);
    transition: all 0.8s ease;
}

.section-animate.animate-on-scroll {
    opacity: 0;
    transform: translateY(50px);
}

.section-animate.animate-on-scroll.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Animation pour les formulaires */
.form-group {
    animation: slideInLeft 0.6s ease-out forwards;
}

.form-group:nth-child(2) {
    animation-delay: 0.1s;
}

.form-group:nth-child(3) {
    animation-delay: 0.2s;
}

.form-group:nth-child(4) {
    animation-delay: 0.3s;
}

.form-control {
    transition: all 0.3s ease;
}

.form-control:focus {
    transform: scale(1.02);
    box-shadow: 0 0 15px rgba(46, 125, 50, 0.3);
}

/* Animation pour les alertes */
.alert-animate {
    animation: slideInRight 0.5s ease-out;
}

/* Animation pour le footer */
.footer-animate {
    animation: fadeIn 1s ease-out;
}

/* ===== ANIMATIONS RESPONSIVES ===== */
@media (max-width: 768px) {
    /* Réduire les animations sur mobile pour les performances */
    .card-animate:hover {
        transform: translateY(-5px);
    }
    
    .hover-lift:hover {
        transform: translateY(-3px);
    }
    
    .btn-animate:hover {
        transform: translateY(-1px);
    }
}

/* ===== ANIMATIONS DE CHARGEMENT ===== */
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #2e7d32;
    border-radius: 50%;
    animation: rotate 1s linear infinite;
    margin: 20px auto;
}

.loading-dots::after {
    content: '';
    animation: blink 1.5s infinite;
}

/* Animation pour les notifications */
.notification-slide {
    animation: slideInRight 0.5s ease-out;
}

.notification-fade-out {
    animation: fadeIn 0.5s ease-out reverse;
}

/* ===== UTILITAIRES D'ANIMATION ===== */
.animate-delay-1 { animation-delay: 0.1s; }
.animate-delay-2 { animation-delay: 0.2s; }
.animate-delay-3 { animation-delay: 0.3s; }
.animate-delay-4 { animation-delay: 0.4s; }
.animate-delay-5 { animation-delay: 0.5s; }

.animate-duration-fast { animation-duration: 0.3s; }
.animate-duration-normal { animation-duration: 0.6s; }
.animate-duration-slow { animation-duration: 1s; }

/* Désactiver les animations pour les utilisateurs qui préfèrent */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
