/* Animations et transitions fluides pour mobile */

/* Variables d'animation */
:root {
    --animation-duration-fast: 0.2s;
    --animation-duration-normal: 0.3s;
    --animation-duration-slow: 0.5s;
    --animation-easing: cubic-bezier(0.4, 0, 0.2, 1);
    --animation-easing-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
    --animation-easing-elastic: cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Animations de base */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

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

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

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

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

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

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

/* Animations de like */
@keyframes heartBeat {
    0%, 100% { 
        transform: scale(1); 
    }
    14% { 
        transform: scale(1.3); 
    }
    28% { 
        transform: scale(1); 
    }
    42% { 
        transform: scale(1.3); 
    }
    70% { 
        transform: scale(1); 
    }
}

@keyframes heartFloat {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(-50px) scale(1.5);
    }
}

/* Animations de rotation */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes rotateIn {
    from {
        opacity: 0;
        transform: rotate(-180deg) scale(0.8);
    }
    to {
        opacity: 1;
        transform: rotate(0deg) scale(1);
    }
}

/* Animations de bounce */
@keyframes bounce {
    0%, 20%, 53%, 80%, 100% {
        transform: translateY(0);
    }
    40%, 43% {
        transform: translateY(-10px);
    }
    70% {
        transform: translateY(-5px);
    }
    90% {
        transform: translateY(-2px);
    }
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

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

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

@keyframes pulseGlow {
    0% {
        box-shadow: 0 0 0 0 rgba(24, 119, 242, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(24, 119, 242, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(24, 119, 242, 0);
    }
}

/* Animations de wiggle */
@keyframes wiggle {
    0%, 7% { transform: rotateZ(0); }
    15% { transform: rotateZ(-15deg); }
    20% { transform: rotateZ(10deg); }
    25% { transform: rotateZ(-10deg); }
    30% { transform: rotateZ(6deg); }
    35% { transform: rotateZ(-4deg); }
    40%, 100% { transform: rotateZ(0); }
}

/* Animations de typing */
@keyframes typing {
    from { width: 0; }
    to { width: 100%; }
}

@keyframes blink {
    0%, 50% { border-color: transparent; }
    51%, 100% { border-color: currentColor; }
}

/* Animations de loading */
@keyframes loadingDots {
    0%, 20% {
        color: rgba(0, 0, 0, 0);
        text-shadow: 0.25em 0 0 rgba(0, 0, 0, 0),
                     0.5em 0 0 rgba(0, 0, 0, 0);
    }
    40% {
        color: currentColor;
        text-shadow: 0.25em 0 0 rgba(0, 0, 0, 0),
                     0.5em 0 0 rgba(0, 0, 0, 0);
    }
    60% {
        text-shadow: 0.25em 0 0 currentColor,
                     0.5em 0 0 rgba(0, 0, 0, 0);
    }
    80%, 100% {
        text-shadow: 0.25em 0 0 currentColor,
                     0.5em 0 0 currentColor;
    }
}

/* Animations de swipe */
@keyframes swipeLeft {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(-100%);
        opacity: 0;
    }
}

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

/* Animations de zoom */
@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.3);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes zoomOut {
    from {
        opacity: 1;
        transform: scale(1);
    }
    to {
        opacity: 0;
        transform: scale(0.3);
    }
}

/* Animations de flip */
@keyframes flipInX {
    from {
        transform: perspective(400px) rotateX(90deg);
        opacity: 0;
    }
    to {
        transform: perspective(400px) rotateX(0deg);
        opacity: 1;
    }
}

@keyframes flipInY {
    from {
        transform: perspective(400px) rotateY(90deg);
        opacity: 0;
    }
    to {
        transform: perspective(400px) rotateY(0deg);
        opacity: 1;
    }
}

/* Classes d'animation utilitaires */
.animate-fade-in {
    animation: fadeIn var(--animation-duration-normal) var(--animation-easing);
}

.animate-fade-out {
    animation: fadeOut var(--animation-duration-normal) var(--animation-easing);
}

.animate-slide-in-up {
    animation: slideInUp var(--animation-duration-normal) var(--animation-easing);
}

.animate-slide-in-down {
    animation: slideInDown var(--animation-duration-normal) var(--animation-easing);
}

.animate-slide-in-left {
    animation: slideInLeft var(--animation-duration-normal) var(--animation-easing);
}

.animate-slide-in-right {
    animation: slideInRight var(--animation-duration-normal) var(--animation-easing);
}

.animate-scale-in {
    animation: scaleIn var(--animation-duration-normal) var(--animation-easing);
}

.animate-scale-out {
    animation: scaleOut var(--animation-duration-normal) var(--animation-easing);
}

.animate-bounce-in {
    animation: bounceIn var(--animation-duration-slow) var(--animation-easing-bounce);
}

.animate-heart-beat {
    animation: heartBeat 0.6s var(--animation-easing);
}

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

.animate-pulse-glow {
    animation: pulseGlow 2s infinite;
}

.animate-shake {
    animation: shake 0.5s var(--animation-easing);
}

.animate-wiggle {
    animation: wiggle 1s var(--animation-easing);
}

.animate-spin {
    animation: spin 1s linear infinite;
}

.animate-rotate-in {
    animation: rotateIn var(--animation-duration-normal) var(--animation-easing-elastic);
}

.animate-zoom-in {
    animation: zoomIn var(--animation-duration-normal) var(--animation-easing);
}

.animate-zoom-out {
    animation: zoomOut var(--animation-duration-normal) var(--animation-easing);
}

.animate-flip-in-x {
    animation: flipInX var(--animation-duration-normal) var(--animation-easing);
}

.animate-flip-in-y {
    animation: flipInY var(--animation-duration-normal) var(--animation-easing);
}

.animate-swipe-left {
    animation: swipeLeft var(--animation-duration-normal) var(--animation-easing);
}

.animate-swipe-right {
    animation: swipeRight var(--animation-duration-normal) var(--animation-easing);
}

/* Animations de chargement */
.loading-dots::after {
    content: '...';
    animation: loadingDots 1.5s infinite;
}

/* Animations de transition de page */
.page-transition-enter {
    animation: slideInRight var(--animation-duration-normal) var(--animation-easing);
}

.page-transition-exit {
    animation: slideOutLeft var(--animation-duration-normal) var(--animation-easing);
}

@keyframes slideOutLeft {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(-100%);
        opacity: 0;
    }
}

/* Animations de notification */
.notification-enter {
    animation: slideInDown var(--animation-duration-normal) var(--animation-easing);
}

.notification-exit {
    animation: slideOutUp var(--animation-duration-normal) var(--animation-easing);
}

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

/* Animations de modale */
.modal-enter {
    animation: scaleIn var(--animation-duration-normal) var(--animation-easing);
}

.modal-exit {
    animation: scaleOut var(--animation-duration-normal) var(--animation-easing);
}

/* Animations de bouton */
.btn-press {
    animation: scaleIn 0.1s var(--animation-easing);
}

.btn-release {
    animation: scaleOut 0.1s var(--animation-easing);
}

/* Animations de hover */
.hover-lift {
    transition: transform var(--animation-duration-fast) var(--animation-easing);
}

.hover-lift:hover {
    transform: translateY(-2px);
}

.hover-scale {
    transition: transform var(--animation-duration-fast) var(--animation-easing);
}

.hover-scale:hover {
    transform: scale(1.05);
}

.hover-rotate {
    transition: transform var(--animation-duration-fast) var(--animation-easing);
}

.hover-rotate:hover {
    transform: rotate(5deg);
}

/* Animations de focus */
.focus-glow {
    transition: box-shadow var(--animation-duration-fast) var(--animation-easing);
}

.focus-glow:focus {
    box-shadow: 0 0 0 3px rgba(24, 119, 242, 0.3);
}

/* Animations de skeleton loading */
@keyframes skeleton {
    0% {
        background-position: -200px 0;
    }
    100% {
        background-position: calc(200px + 100%) 0;
    }
}

.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200px 100%;
    animation: skeleton 1.5s infinite;
}

/* Animations de particules */
@keyframes particle-float {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(-100px) scale(0.5);
    }
}

.particle {
    position: absolute;
    pointer-events: none;
    animation: particle-float 1s ease-out forwards;
}

/* Animations de typing */
.typing-indicator {
    display: inline-block;
    position: relative;
}

.typing-indicator::after {
    content: '';
    position: absolute;
    right: -10px;
    top: 0;
    width: 2px;
    height: 100%;
    background: currentColor;
    animation: blink 1s infinite;
}

/* Animations de progress */
@keyframes progress {
    from {
        width: 0%;
    }
    to {
        width: 100%;
    }
}

.progress-bar {
    animation: progress 2s ease-out;
}

/* Animations de stagger */
.stagger-item {
    opacity: 0;
    transform: translateY(20px);
    animation: slideInUp var(--animation-duration-normal) var(--animation-easing) forwards;
}

.stagger-item:nth-child(1) { animation-delay: 0.1s; }
.stagger-item:nth-child(2) { animation-delay: 0.2s; }
.stagger-item:nth-child(3) { animation-delay: 0.3s; }
.stagger-item:nth-child(4) { animation-delay: 0.4s; }
.stagger-item:nth-child(5) { animation-delay: 0.5s; }
.stagger-item:nth-child(6) { animation-delay: 0.6s; }
.stagger-item:nth-child(7) { animation-delay: 0.7s; }
.stagger-item:nth-child(8) { animation-delay: 0.8s; }
.stagger-item:nth-child(9) { animation-delay: 0.9s; }
.stagger-item:nth-child(10) { animation-delay: 1.0s; }

/* Optimisations de performance */
.animate-fade-in,
.animate-slide-in-up,
.animate-scale-in,
.animate-bounce-in {
    will-change: transform, opacity;
}

.animate-spin,
.animate-pulse {
    will-change: transform;
}

/* Mode sombre */
@media (prefers-color-scheme: dark) {
    .skeleton {
        background: linear-gradient(90deg, #2a2a2a 25%, #3a3a3a 50%, #2a2a2a 75%);
    }
}

/* Réduction des animations pour l'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;
    }
}

/* Animations spécifiques aux interactions tactiles */
.touch-feedback {
    transition: transform 0.1s ease-out;
}

.touch-feedback:active {
    transform: scale(0.95);
}

.touch-ripple {
    position: relative;
    overflow: hidden;
}

.touch-ripple::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.touch-ripple:active::before {
    width: 300px;
    height: 300px;
}

/* Animations de swipe */
.swipe-container {
    position: relative;
    overflow: hidden;
}

.swipe-item {
    transition: transform 0.3s ease-out;
}

.swipe-item.swipe-left {
    transform: translateX(-100%);
}

.swipe-item.swipe-right {
    transform: translateX(100%);
}

/* Animations de pull-to-refresh */
.pull-to-refresh {
    transition: transform 0.3s ease-out;
}

.pull-to-refresh.pulling {
    transform: translateY(20px);
}

.pull-to-refresh.refreshing {
    animation: pulse 1s infinite;
}
