/*
 * Animations du site vitrine
 * Solutions Numériques Professionnelles
 */

/* ========== ANIMATIONS AU CHARGEMENT ========== */
.animate__fadeInUp {
    animation: fadeInUp 0.8s ease forwards;
}

.animate__fadeIn {
    animation: fadeIn 0.8s ease forwards;
}

.animate__shakeX {
    animation: shakeX 0.8s ease forwards;
}

/* ========== ANIMATIONS AU DÉFILEMENT ========== */
.reveal-text {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s cubic-bezier(0.215, 0.61, 0.355, 1);
}

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

.reveal-opacity {
    opacity: 0;
    transition: opacity 0.8s ease;
}

.reveal-opacity.active {
    opacity: 1;
}

.reveal-slide-left {
    opacity: 0;
    transform: translateX(50px);
    transition: all 0.8s cubic-bezier(0.215, 0.61, 0.355, 1);
}

.reveal-slide-left.active {
    opacity: 1;
    transform: translateX(0);
}

.reveal-slide-right {
    opacity: 0;
    transform: translateX(-50px);
    transition: all 0.8s cubic-bezier(0.215, 0.61, 0.355, 1);
}

.reveal-slide-right.active {
    opacity: 1;
    transform: translateX(0);
}

.reveal-card {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.6s cubic-bezier(0.215, 0.61, 0.355, 1);
}

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

/* Animation décalée pour les cartes de service */
.services-cards .service-card:nth-child(1) {
    transition-delay: 0s;
}

.services-cards .service-card:nth-child(2) {
    transition-delay: 0.2s;
}

.services-cards .service-card:nth-child(3) {
    transition-delay: 0.4s;
}

.services-cards .service-card:nth-child(4) {
    transition-delay: 0.6s;
}

/* Animation pour les projets */
.project-reveal {
    opacity: 0;
    transform: translateY(50px);
    transition: all 0.8s cubic-bezier(0.215, 0.61, 0.355, 1);
}

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

.projects-grid .project-card:nth-child(1) {
    transition-delay: 0s;
}

.projects-grid .project-card:nth-child(2) {
    transition-delay: 0.2s;
}

.projects-grid .project-card:nth-child(3) {
    transition-delay: 0.4s;
}

.projects-grid .project-card:nth-child(4) {
    transition-delay: 0.6s;
}

/* ========== ANIMATIONS KEYFRAMES ========== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

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

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

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

@keyframes fadeInOut {
    0% {
        opacity: 0;
    }
    50% {
        opacity: 1;
    }
    100% {
        opacity: 0;
    }
}

/* ========== ANIMATIONS SPÉCIFIQUES ========== */

/* Animation du logo */
.logo img:hover {
    animation: pulse 1s infinite;
}

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

/* Animation du bouton de soumission */
.form-submit .btn-primary:hover .btn-icon {
    animation: spin 1s ease-in-out;
}

/* Animation des séparateurs */
.separator {
    position: relative;
    overflow: hidden;
}

.separator::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.5), transparent);
    animation: shine 3s infinite;
}

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

/* Animation du slider de témoignages */
.testimonial-slide {
    transition: opacity 0.5s ease;
    opacity: 0;
    display: none;
}

.testimonial-slide.active {
    opacity: 1;
    display: block;
    animation: fadeInScale 0.5s ease;
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Animation des projets */
.project-card {
    position: relative;
    overflow: hidden;
}

.project-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(44, 62, 80, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.project-card:hover .project-overlay {
    opacity: 1;
}

.btn-view {
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.btn-view::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: rgba(255, 255, 255, 0.1);
    transform: rotate(45deg);
    z-index: -1;
    transition: all 0.6s cubic-bezier(0.215, 0.61, 0.355, 1);
}

.btn-view:hover::after {
    transform: rotate(45deg) translate(0, 100%);
}

/* Animation des champs du formulaire */
.form-floating input:focus + label,
.form-floating textarea:focus + label,
.form-floating select:focus + label {
    transform: translateY(-20px) scale(0.8);
    color: var(--primary-color);
    transform-origin: left top;
}

.form-floating.focused label {
    transform: translateY(-20px) scale(0.8);
    color: var(--primary-color);
    transform-origin: left top;
}

/* Animation de la page d'accueil */
.projects-grid {
    perspective: 1000px;
}

.project-card {
    transform-style: preserve-3d;
    transition: transform 0.5s;
}

.project-card:hover {
    transform: translateY(-10px) rotateX(5deg);
}

/* Animation 3D pour les cartes */
.service-card, .advantage-card, .mini-faq-item {
    transition: all 0.3s ease;
    transform-style: preserve-3d;
    perspective: 1000px;
}

.service-card:hover, .advantage-card:hover, .mini-faq-item:hover {
    transform: translateY(-10px) rotateY(5deg);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1);
}

/* Animation pour le bouton de contact */
.btn-primary {
    position: relative;
    overflow: hidden;
}

.btn-primary::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: all 0.6s;
}

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

/* Animation pour le formulaire de contact */
.contact-form .form-group {
    opacity: 0;
    transform: translateY(20px);
    animation: formField 0.5s forwards;
}

.contact-form .form-group:nth-child(1) {
    animation-delay: 0.1s;
}

.contact-form .form-group:nth-child(2) {
    animation-delay: 0.2s;
}

.contact-form .form-group:nth-child(3) {
    animation-delay: 0.3s;
}

.contact-form .form-group:nth-child(4) {
    animation-delay: 0.4s;
}

.contact-form .form-group:nth-child(5) {
    animation-delay: 0.5s;
}

.contact-form .form-group:nth-child(6) {
    animation-delay: 0.6s;
}

.contact-form .form-submit {
    opacity: 0;
    transform: translateY(20px);
    animation: formField 0.5s 0.7s forwards;
}

@keyframes formField {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Animation du menu mobile */
@media screen and (max-width: 768px) {
    .main-nav {
        position: fixed;
        top: 0;
        right: -100%;
        width: 80%;
        max-width: 300px;
        height: 100vh;
        background-color: white;
        z-index: 1000;
        transition: right 0.3s ease;
        box-shadow: -5px 0 15px rgba(0, 0, 0, 0.1);
        padding: 60px 20px;
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
    }

    .main-nav.active {
        right: 0;
    }

    .main-nav ul {
        flex-direction: column;
        align-items: flex-start;
    }

    .main-nav li {
        margin: 10px 0;
        width: 100%;
    }

    .menu-toggle {
        display: flex;
        z-index: 1001;
    }
}

/* Animation du défilement de page */
html {
    scroll-behavior: smooth;
}

/* Animation pour la navigation */
.main-nav ul li {
    position: relative;
    overflow: hidden;
}

.main-nav ul li a::before {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: var(--primary-color);
    transform: scaleX(0);
    transform-origin: right;
    transition: transform 0.4s cubic-bezier(0.86, 0, 0.07, 1);
}

.main-nav ul li a:hover::before,
.main-nav ul li a.active::before {
    transform: scaleX(1);
    transform-origin: left;
}

/* Animation pour les sections avec parallax */
.parallax-section {
    background-attachment: fixed;
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
    transition: background-position 0.5s ease;
}

/* Animation pour les icônes sociales */
.social-icons a {
    position: relative;
    overflow: hidden;
}

.social-icons a::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--primary-color);
    border-radius: 50%;
    transform: scale(0);
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    z-index: -1;
}

.social-icons a:hover::before {
    transform: scale(1);
}

.social-icons a:hover i {
    animation: bounce 0.5s;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

/* Animation pour les steps du processus */
.process-step {
    position: relative;
}

.process-step::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background-color: rgba(52, 152, 219, 0.1);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    z-index: -1;
    transition: all 0.5s ease;
}

.process-step:hover::before {
    width: 200px;
    height: 200px;
}

.step-number {
    transition: all 0.3s ease;
}

.process-step:hover .step-number {
    transform: scale(1.2);
    box-shadow: 0 0 0 5px white, 0 0 0 10px rgba(52, 152, 219, 0.3);
}

/* Animation pour la FAQ */
.faq-question {
    cursor: pointer;
    transition: all 0.3s ease;
}

.faq-question:hover {
    background-color: var(--gray-light);
}

.faq-toggle {
    transition: transform 0.3s ease;
}

.faq-question.active .faq-toggle {
    transform: rotate(45deg);
}

.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.5s ease;
}

.faq-answer.active {
    max-height: 500px;
}

/* Animation pour les particules */
#particles-js {
    position: absolute;
    width: 100%;
    height: 100%;
    z-index: -1;
}

/* Animation des tooltips */
.tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 5px 10px;
    background-color: var(--secondary-color);
    color: white;
    border-radius: 3px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 10;
}

.tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: var(--secondary-color);
}

.tooltip.show {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -5px);
}

/* Animation de chargement */
.loading {
    display: inline-block;
    position: relative;
    width: 80px;
    height: 80px;
}

.loading div {
    position: absolute;
    top: 33px;
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: var(--primary-color);
    animation-timing-function: cubic-bezier(0, 1, 1, 0);
}

.loading div:nth-child(1) {
    left: 8px;
    animation: loading1 0.6s infinite;
}

.loading div:nth-child(2) {
    left: 8px;
    animation: loading2 0.6s infinite;
}

.loading div:nth-child(3) {
    left: 32px;
    animation: loading2 0.6s infinite;
}

.loading div:nth-child(4) {
    left: 56px;
    animation: loading3 0.6s infinite;
}

@keyframes loading1 {
    0% {
        transform: scale(0);
    }
    100% {
        transform: scale(1);
    }
}

@keyframes loading3 {
    0% {
        transform: scale(1);
    }
    100% {
        transform: scale(0);
    }
}

@keyframes loading2 {
    0% {
        transform: translate(0, 0);
    }
    100% {
        transform: translate(24px, 0);
    }
}

/* Animation pour le hover des cartes */
.service-card, .advantage-card, .mini-faq-item {
    position: relative;
    overflow: hidden;
}

.service-card::after, .advantage-card::after, .mini-faq-item::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(225deg, transparent 98%, var(--primary-color) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.service-card:hover::after, .advantage-card:hover::after, .mini-faq-item:hover::after {
    opacity: 1;
}