/**
 * Animations au survol et au scroll optimisées
 * Utilise transform et opacity pour les performances GPU
 */

/* ========== ANIMATIONS AU SCROLL ========== */

/* Classes d'animation de base */
.fade-in,
.fade-in-up,
.fade-in-down,
.fade-in-left,
.fade-in-right,
.scale-in,
.rotate-in {
    will-change: transform, opacity;
}

/* État animé */
.animated {
    animation-fill-mode: both !important;
}

/* Animations spécifiques pour les sections */
.section {
    overflow: hidden; /* Empêche le débordement pendant les animations */
}

/* ========== ANIMATIONS AU SURVOL ========== */

/* Value cards - Animation de levitation */
.value-card {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.value-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at center, rgba(234, 93, 111, 0.1) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.4s ease;
    z-index: 0;
}

.value-card:hover::before {
    opacity: 1;
}

.value-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

.value-card:hover .value-icon {
    transform: rotate(360deg) scale(1.1);
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Service cards - Animation de glissement */
.service-link {
    position: relative;
    overflow: hidden;
}

.service-link::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.5s ease;
}

.service-link:hover::after {
    left: 100%;
}

.service-link:hover .service-icon {
    animation: bounce 0.6s ease;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

/* Tab buttons - Animation de soulignement */
.tab-button {
    position: relative;
    overflow: hidden;
}

.tab-button::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 3px;
    background: var(--accent-red);
    transform: translateX(-50%);
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.tab-button:hover::before {
    width: 80%;
}

/* Stat numbers - Animation de pulsation */
.stat-number {
    transition: transform 0.3s ease;
    display: inline-block;
}

.stat-card:hover .stat-number {
    transform: scale(1.1);
    animation: pulse 1s ease infinite;
}

@keyframes pulse {
    0% { transform: scale(1.1); }
    50% { transform: scale(1.15); }
    100% { transform: scale(1.1); }
}

/* Client logos - Animation de zoom et couleur */
.client-logo {
    position: relative;
    overflow: hidden;
}

.client-logo::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(234, 93, 111, 0.1);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.4s ease, height 0.4s ease;
}

.client-logo:hover::before {
    width: 150%;
    height: 150%;
}

/* Testimonial cards - Animation de bordure */
.testimonial-card {
    position: relative;
    background: var(--bg);
}

.testimonial-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, var(--accent-red), var(--accent-yellow));
    border-radius: 1.5rem;
    opacity: 0;
    z-index: -1;
    transition: opacity 0.3s ease;
}

.testimonial-card::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    right: 2px;
    bottom: 2px;
    background: var(--bg);
    border-radius: 1.3rem;
    z-index: -1;
}

.testimonial-card:hover::before {
    opacity: 1;
}

/* CTA buttons - Animation d'onde */
.cta-buttons .btn {
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.cta-buttons .btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease;
    z-index: -1;
}

.cta-buttons .btn:hover::before {
    width: 300px;
    height: 300px;
}

/* Footer links - Animation de glissement */
.footer-nav a {
    position: relative;
    display: inline-block;
    transition: transform 0.3s ease;
}

.footer-nav a::after {
    content: '→';
    position: absolute;
    right: -20px;
    opacity: 0;
    transition: all 0.3s ease;
}

.footer-nav a:hover {
    transform: translateX(5px);
}

.footer-nav a:hover::after {
    opacity: 1;
    right: -15px;
}

/* Social links - Animation de rotation */
.social-link {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.social-link:hover {
    transform: translateY(-5px) rotate(360deg);
    background: var(--accent-red);
    color: white;
}

/* Header navigation - Animation subtile */
.main-menu a {
    position: relative;
}

.main-menu a::before {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--accent-red);
    transform: scaleX(0);
    transform-origin: right;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.main-menu a:hover::before {
    transform: scaleX(1);
    transform-origin: left;
}

/* Amélioration de l'animation existante des why-cards */
.why-card {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.why-card:hover {
    transform: translateY(-12px) scale(1.02);
}

.why-card:hover .why-icon {
    animation: float-rotate 2s ease-in-out infinite;
}

@keyframes float-rotate {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-10px) rotate(10deg); }
}

/* Animation pour les images au survol */
.service-visual img,
.hero-device img,
.cta-device img {
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.service-visual:hover img {
    transform: scale(1.05) rotate(1deg);
}

/* ========== OPTIMISATIONS PERFORMANCE ========== */

/* Réduction des animations pour les préférences utilisateur */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .fade-in,
    .fade-in-up,
    .fade-in-down,
    .fade-in-left,
    .fade-in-right,
    .scale-in,
    .rotate-in {
        opacity: 1 !important;
        transform: none !important;
    }
}

/* GPU acceleration hints pour les éléments fréquemment animés */
.value-card,
.service-link,
.why-card,
.stat-card,
.client-logo {
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000px;
}

/* Limiter will-change aux moments nécessaires */
.value-card:hover,
.service-link:hover,
.why-card:hover {
    will-change: transform, box-shadow;
}

/* Optimisation des animations de texte */
.section-title,
.section-intro {
    transform: translateZ(0);
}

/* ========== ANIMATIONS SPÉCIALES ========== */

/* Effet de parallaxe léger sur les devices */
.hero-device,
.cta-device {
    transition: transform 0.1s ease-out;
}

/* Animation de typing pour les titres (optionnel) */
@keyframes typing {
    from { width: 0; }
    to { width: 100%; }
}

/* Animation de gradient */
.gradient-text {
    background-size: 200% 200%;
    animation: gradient-shift 3s ease infinite;
}

@keyframes gradient-shift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}