/* Animations CSS pour un design moderne et professionnel */

/* Keyframes pour les animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes slideInUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes bounce {
    0%, 20%, 53%, 80%, 100% {
        animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000);
        transform: translate3d(0,0,0);
    }
    40%, 43% {
        animation-timing-function: cubic-bezier(0.755, 0.050, 0.855, 0.060);
        transform: translate3d(0, -30px, 0);
    }
    70% {
        animation-timing-function: cubic-bezier(0.755, 0.050, 0.855, 0.060);
        transform: translate3d(0, -15px, 0);
    }
    90% {
        transform: translate3d(0,-4px,0);
    }
}

@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-20px); }
    100% { transform: translateY(0px); }
}

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

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-10px); }
    20%, 40%, 60%, 80% { transform: translateX(10px); }
}

@keyframes rotateIn {
    from {
        transform-origin: center;
        transform: rotate3d(0, 0, 1, -200deg);
        opacity: 0;
    }
    to {
        transform-origin: center;
        transform: translate3d(0, 0, 0);
        opacity: 1;
    }
}

@keyframes flipInX {
    from {
        transform: perspective(400px) rotate3d(1, 0, 0, 90deg);
        animation-timing-function: ease-in;
        opacity: 0;
    }
    40% {
        transform: perspective(400px) rotate3d(1, 0, 0, -20deg);
        animation-timing-function: ease-in;
    }
    60% {
        transform: perspective(400px) rotate3d(1, 0, 0, 10deg);
        opacity: 1;
    }
    80% {
        transform: perspective(400px) rotate3d(1, 0, 0, -5deg);
    }
    to {
        transform: perspective(400px);
    }
}

@keyframes slideInDown {
    from {
        transform: translate3d(0, -100%, 0);
        visibility: visible;
    }
    to {
        transform: translate3d(0, 0, 0);
    }
}

@keyframes heartBeat {
    0% {
        transform: scale(1);
    }
    14% {
        transform: scale(1.3);
    }
    28% {
        transform: scale(1);
    }
    42% {
        transform: scale(1.3);
    }
    70% {
        transform: scale(1);
    }
}

/* Classes d'animation de base */
.fade-in-up {
    animation: fadeInUp 0.8s ease-out forwards;
    opacity: 0;
}

.fade-in-down {
    animation: fadeInDown 0.8s ease-out forwards;
    opacity: 0;
}

.fade-in-left {
    animation: fadeInLeft 0.8s ease-out forwards;
    opacity: 0;
}

.fade-in-right {
    animation: fadeInRight 0.8s ease-out forwards;
    opacity: 0;
}

.zoom-in {
    animation: zoomIn 0.8s ease-out forwards;
    opacity: 0;
}

.slide-in-up {
    animation: slideInUp 0.8s ease-out forwards;
}

.bounce {
    animation: bounce 2s infinite;
}

.float {
    animation: float 3s ease-in-out infinite;
}

.pulse {
    animation: pulse 2s infinite;
}

.rotate-in {
    animation: rotateIn 0.8s ease-out forwards;
    opacity: 0;
}

.flip-in-x {
    animation: flipInX 0.8s ease-out forwards;
    opacity: 0;
}

.slide-in-down {
    animation: slideInDown 0.8s ease-out forwards;
}

.heart-beat {
    animation: heartBeat 1.3s ease-in-out infinite;
}

/* Délais d'animation */
.delay-1 { animation-delay: 0.2s; }
.delay-2 { animation-delay: 0.4s; }
.delay-3 { animation-delay: 0.6s; }
.delay-4 { animation-delay: 0.8s; }
.delay-5 { animation-delay: 1s; }

/* Animations au scroll (fallback pour AOS) */
@media (prefers-reduced-motion: no-preference) {
    .animate-on-scroll {
        opacity: 0;
        transform: translateY(30px);
        transition: all 0.8s ease;
    }
    
    .animate-on-scroll.animated {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Animations spécifiques aux éléments */
.hero-title {
    animation: fadeInUp 1s ease-out 0.3s forwards;
    opacity: 0;
}

.hero-description {
    animation: fadeInUp 1s ease-out 0.6s forwards;
    opacity: 0;
}


.hero-stats {
    animation: fadeInUp 1s ease-out 1.2s forwards;
    opacity: 0;
}

/* Animation de la navigation au scroll */
.navbar {
    transform: translateY(-100%);
    animation: slideInDown 0.5s ease-out 0.1s forwards;
}

/* Animations des cartes de service */
.service-card {
    transition: all 0.3s ease;
    transform: translateY(0);
}

.service-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

.service-card:hover .service-icon {
    animation: bounce 0.6s ease;
}

/* Animations des éléments technologiques */
.tech-item {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.tech-item:hover {
    transform: translateY(-5px) scale(1.05);
}

/* Animation des éléments du portfolio */
.portfolio-item {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.portfolio-item:hover {
    transform: translateY(-8px);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.2);
}

.portfolio-overlay {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.portfolio-item:hover .portfolio-overlay {
    backdrop-filter: blur(10px);
}

/* Animations des boutons */
.btn {
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.btn:hover::before {
    left: 100%;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.btn:active {
    transform: translateY(0);
}

/* Animation du formulaire */
.contact-form input,
.contact-form select,
.contact-form textarea {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.contact-form input:focus,
.contact-form select:focus,
.contact-form textarea:focus {
    transform: translateY(-2px);
}

/* Animations des liens sociaux */
.social-link {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.social-link:hover {
    transform: translateY(-3px) rotate(5deg);
}

/* Animation de typing pour le hero */
@keyframes typing {
    from { width: 0 }
    to { width: 100% }
}

@keyframes blink-caret {
    from, to { border-color: transparent }
    50% { border-color: #f59e0b; }
}

.typing-effect {
    overflow: hidden;
    border-right: .15em solid #f59e0b;
    white-space: nowrap;
    margin: 0 auto;
    letter-spacing: .15em;
    animation: 
        typing 3.5s steps(40, end),
        blink-caret .75s step-end infinite;
}

/* Parallax effect pour les sections */
.parallax-section {
    background-attachment: fixed;
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
}

/* Animation de chargement */
.loader {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 3px solid rgba(99, 102, 241, 0.3);
    border-radius: 50%;
    border-top-color: #6366f1;
    animation: spin 1s ease-in-out infinite;
}

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

/* Animations des compteurs */
.counter {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
}

/* Animation de progress bar */
.progress-bar {
    background: linear-gradient(90deg, #6366f1, #8b5cf6);
    height: 4px;
    border-radius: 2px;
    overflow: hidden;
    position: relative;
}

.progress-bar::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* Animation des icônes */
.icon-float {
    animation: float 4s ease-in-out infinite;
}

.icon-bounce {
    animation: bounce 2s infinite;
}

.icon-pulse {
    animation: pulse 2s infinite;
}

/* Animation de reveal au scroll */
.reveal {
    opacity: 0;
    transform: translateY(50px);
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.reveal.active {
    opacity: 1;
    transform: translateY(0);
}

/* Animations de masonry pour le portfolio */
.masonry-item {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.masonry-item.filtered {
    transform: scale(0);
    opacity: 0;
}

.masonry-item.visible {
    transform: scale(1);
    opacity: 1;
}

/* Animation de particle background */
@keyframes particle-float {
    0%, 100% {
        transform: translate(0, 0) rotate(0deg);
    }
    33% {
        transform: translate(30px, -30px) rotate(120deg);
    }
    66% {
        transform: translate(-20px, 20px) rotate(240deg);
    }
}

.particle {
    position: absolute;
    background: rgba(99, 102, 241, 0.1);
    border-radius: 50%;
    animation: particle-float 6s ease-in-out infinite;
}

.particle:nth-child(2) { animation-delay: -2s; }
.particle:nth-child(3) { animation-delay: -4s; }

/* Responsive animations */
@media (max-width: 768px) {
    .hero-title,
    .hero-description,
    .hero-stats {
        animation-duration: 0.6s;
    }
    
    .service-card:hover {
        transform: translateY(-5px);
    }
    
    .portfolio-item:hover {
        transform: translateY(-4px);
    }
}

/* Préférence de mouvement réduit */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    
    .parallax-section {
        background-attachment: scroll;
    }
}

/* Animation de focus pour l'accessibilité */
.focus-visible {
    outline: 2px solid #6366f1;
    outline-offset: 2px;
    border-radius: 4px;
    animation: focus-ring 0.2s ease-out;
}

@keyframes focus-ring {
    from {
        outline-width: 0;
        outline-offset: 0;
    }
    to {
        outline-width: 2px;
        outline-offset: 2px;
    }
}