/**
 * Animations et Transitions - Photos-Book.fr
 * Animations fluides et engageantes pour l'expérience utilisateur
 */

/* ===== ANIMATIONS GÉNÉRALES ===== */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes slideInUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

/* ===== ANIMATIONS SPÉCIFIQUES ===== */

/* Animation de rebond pour le scroll indicator */
@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

/* Animation de pulsation */
@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 flottement */
@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

/* Animation de vibration subtile */
@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(-2px);
    }
    75% {
        transform: translateX(2px);
    }
}

/* Animation de typing/writing */
@keyframes typewriter {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

/* Animation de gradient animé */
@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* Animation de particules flottantes */
@keyframes particleFloat {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(-100px) rotate(360deg);
        opacity: 0;
    }
}

/* ===== CLASSES D'ANIMATION ===== */

/* Classes d'apparition */
.animate-fadeIn {
    animation: fadeIn 0.6s ease-out;
}

.animate-fadeInUp {
    animation: fadeInUp 0.8s ease-out;
}

.animate-fadeInDown {
    animation: fadeInDown 0.8s ease-out;
}

.animate-fadeInLeft {
    animation: fadeInLeft 0.8s ease-out;
}

.animate-fadeInRight {
    animation: fadeInRight 0.8s ease-out;
}

.animate-scaleIn {
    animation: scaleIn 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Classes avec délais */
.animate-delay-100 {
    animation-delay: 0.1s;
}

.animate-delay-200 {
    animation-delay: 0.2s;
}

.animate-delay-300 {
    animation-delay: 0.3s;
}

.animate-delay-400 {
    animation-delay: 0.4s;
}

.animate-delay-500 {
    animation-delay: 0.5s;
}

/* ===== ANIMATIONS AU SCROLL ===== */

/* Éléments invisibles par défaut pour l'animation au scroll */
.scroll-animate {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.scroll-animate.animate {
    opacity: 1;
    transform: translateY(0);
}

.scroll-animate-left {
    opacity: 0;
    transform: translateX(-30px);
    transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.scroll-animate-left.animate {
    opacity: 1;
    transform: translateX(0);
}

.scroll-animate-right {
    opacity: 0;
    transform: translateX(30px);
    transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.scroll-animate-right.animate {
    opacity: 1;
    transform: translateX(0);
}

.scroll-animate-scale {
    opacity: 0;
    transform: scale(0.9);
    transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.scroll-animate-scale.animate {
    opacity: 1;
    transform: scale(1);
}

/* ===== ANIMATIONS SPÉCIFIQUES AU HERO ===== */

/* Éléments flottants du hero */
.floating-qr {
    animation: float 3s ease-in-out infinite;
    animation-delay: 0s;
}

.floating-notification {
    animation: float 3s ease-in-out infinite;
    animation-delay: 1s;
}

.photo-item {
    animation: float 4s ease-in-out infinite;
}

.photo-1 {
    animation-delay: 0s;
}

.photo-2 {
    animation-delay: 1s;
}

.photo-3 {
    animation-delay: 2s;
}

/* Formes d'arrière-plan animées */
.hero-shapes .shape {
    animation: float 6s ease-in-out infinite;
}

.shape-1 {
    animation-delay: 0s;
}

.shape-2 {
    animation-delay: 2s;
}

.shape-3 {
    animation-delay: 4s;
}

/* ===== ANIMATIONS DE NAVIGATION ===== */

/* Menu hamburger animé */
.nav-toggle.active .hamburger-line:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px);
}

.nav-toggle.active .hamburger-line:nth-child(2) {
    opacity: 0;
}

.nav-toggle.active .hamburger-line:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
}

/* Animation du menu mobile */
.nav-menu {
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.nav-menu.active {
    transform: translateX(0);
}

/* Animation des liens de navigation */
.nav-link {
    position: relative;
    overflow: hidden;
}

.nav-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(37, 99, 235, 0.1), transparent);
    transition: left 0.5s;
}

.nav-link:hover::before {
    left: 100%;
}

/* ===== ANIMATIONS DES CARTES ===== */

/* Animation au survol des cartes de fonctionnalités */
.feature-card {
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    position: relative;
    overflow: hidden;
}

.feature-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(37, 99, 235, 0.05), transparent);
    transform: rotate(45deg);
    transition: all 0.5s;
    opacity: 0;
}

.feature-card:hover::before {
    animation: shimmer 1s ease-in-out;
    opacity: 1;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%) translateY(-100%) rotate(45deg);
    }
    100% {
        transform: translateX(100%) translateY(100%) rotate(45deg);
    }
}

/* Animation des icônes */
.feature-icon {
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.feature-card:hover .feature-icon {
    transform: scale(1.1) rotate(5deg);
}

/* ===== ANIMATIONS DES BOUTONS ===== */

/* Effet de vague au clic */
.btn {
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transition: all 0.3s;
    transform: translate(-50%, -50%);
}

.btn:active::before {
    width: 300px;
    height: 300px;
}

/* Animation de chargement pour les boutons */
.btn-loading {
    pointer-events: none;
    opacity: 0.7;
}

.btn-loading::after {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: rotate 1s linear infinite;
    margin-left: 10px;
}

/* ===== ANIMATIONS DE COMPTEURS ===== */

/* Animation des statistiques */
.stat-number,
.counter-number {
    transition: all 0.3s ease;
}

.counting {
    animation: pulse 0.1s ease-in-out;
}

/* ===== ANIMATIONS DE NOTIFICATIONS ===== */

/* Animation d'apparition des notifications */
.notification-card {
    animation: slideInUp 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Animation de success/check */
@keyframes checkmark {
    0% {
        stroke-dashoffset: 100;
    }
    100% {
        stroke-dashoffset: 0;
    }
}

.success-icon svg {
    animation: checkmark 0.6s ease-in-out;
}

/* ===== ANIMATIONS DE PARTICULES ===== */

/* Particules d'arrière-plan */
.decoration-particles {
    position: absolute;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
}

.decoration-particles::before,
.decoration-particles::after {
    content: '';
    position: absolute;
    width: 4px;
    height: 4px;
    background: var(--color-primary);
    border-radius: 50%;
    animation: particleFloat 8s linear infinite;
}

.decoration-particles::before {
    left: 20%;
    animation-delay: 0s;
}

.decoration-particles::after {
    left: 80%;
    animation-delay: 4s;
}

/* ===== ANIMATIONS DE TEXTE ===== */

/* Animation de soulignement progressif */
.progressive-underline {
    position: relative;
    display: inline-block;
}

.progressive-underline::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--color-primary), var(--color-accent));
    transition: width 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.progressive-underline.animate::after {
    width: 100%;
}

/* Animation de révélation de texte */
.text-reveal {
    overflow: hidden;
}

.text-reveal span {
    display: inline-block;
    transform: translateY(100%);
    transition: transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.text-reveal.animate span {
    transform: translateY(0);
}

/* ===== OPTIMISATIONS PERFORMANCE ===== */

/* Isolation des animations coûteuses */
.feature-card,
.btn,
.floating-qr,
.floating-notification,
.photo-item {
    will-change: transform;
    backface-visibility: hidden;
    perspective: 1000px;
}

/* Réduction des animations sur mobile pour les performances */
@media (max-width: 767px) {
    .hero-shapes .shape,
    .floating-qr,
    .floating-notification,
    .photo-item {
        animation: none;
    }

    .feature-card::before {
        display: none;
    }

    .decoration-particles::before,
    .decoration-particles::after {
        animation: none;
    }
}

/* Respect des préférences d'accessibilité */
@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;
    }

    .scroll-animate,
    .scroll-animate-left,
    .scroll-animate-right,
    .scroll-animate-scale {
        opacity: 1;
        transform: none;
    }
}