/* styles/animations.css - Animations et effets */

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

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

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

@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 10px rgba(76, 175, 80, 0.3);
    }
    50% {
        box-shadow: 0 0 20px rgba(76, 175, 80, 0.6), 0 0 30px rgba(76, 175, 80, 0.4);
    }
}

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

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

@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 zoomIn {
    from {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        opacity: 1;
    }
}

@keyframes flipInX {
    from {
        transform: perspective(400px) rotateX(90deg);
        opacity: 0;
    }
    40% {
        transform: perspective(400px) rotateX(-20deg);
    }
    60% {
        transform: perspective(400px) rotateX(10deg);
        opacity: 1;
    }
    80% {
        transform: perspective(400px) rotateX(-5deg);
    }
    to {
        transform: perspective(400px);
    }
}

/* Animations spécifiques aux éléments du jeu */

/* Animation des citoyens */
.citizen {
    animation: float 3s ease-in-out infinite;
}

.citizen.working {
    animation: pulse 2s ease-in-out infinite;
}

.citizen.happy {
    animation: bounce 2s ease-in-out infinite;
}

.citizen.unhappy {
    animation: shake 0.5s ease-in-out infinite;
}

/* Animation des bâtiments */
.building {
    transition: all 0.3s ease;
}

.building.active {
    animation: glow 3s ease-in-out infinite;
}

.building.construction {
    animation: pulse 1s ease-in-out infinite;
}

.building.producing {
    animation: float 4s ease-in-out infinite;
}

/* Animation des ressources */
.resource-item.increasing .resource-value {
    animation: pulse 0.5s ease-in-out;
}

.resource-item.decreasing .resource-value {
    animation: shake 0.3s ease-in-out;
}

.resource-popup {
    animation: slideUp 0.5s ease, fadeOut 0.5s ease 2s;
    animation-fill-mode: forwards;
}

/* Animation des notifications */
.notification {
    animation: slideInDown 0.5s ease, fadeOut 0.5s ease 4.5s;
    animation-fill-mode: forwards;
}

.notification.urgent {
    animation: slideInDown 0.5s ease, pulse 0.5s ease 1s infinite;
}

/* Animation des boutons */
.btn-hover-effect {
    position: relative;
    overflow: hidden;
}

.btn-hover-effect::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-effect:hover::before {
    left: 100%;
}

/* Animation des panneaux */
.panel-slide-in {
    animation: slideInLeft 0.3s ease;
}

.panel-slide-out {
    animation: slideInRight 0.3s ease reverse;
}

/* Animation de construction */
.construction-preview {
    animation: pulse 0.8s ease-in-out infinite;
    opacity: 0.7;
}

.construction-valid {
    filter: drop-shadow(0 0 10px rgba(76, 175, 80, 0.8));
}

.construction-invalid {
    filter: drop-shadow(0 0 10px rgba(244, 67, 54, 0.8));
    animation: shake 0.3s ease-in-out infinite;
}

/* Animation des particules */
@keyframes particle-rise {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(-30px) scale(0.5);
    }
}

.particle {
    animation: particle-rise 2s ease-out forwards;
}

/* Animation des flammes (feu de camp) */
@keyframes flame-flicker {
    0%, 100% {
        transform: scaleY(1) scaleX(1);
        opacity: 1;
    }
    25% {
        transform: scaleY(1.1) scaleX(0.9);
        opacity: 0.8;
    }
    50% {
        transform: scaleY(0.9) scaleX(1.1);
        opacity: 1;
    }
    75% {
        transform: scaleY(1.05) scaleX(0.95);
        opacity: 0.9;
    }
}

.fire-flame {
    animation: flame-flicker 0.5s ease-in-out infinite;
}

/* Animation de l'eau */
@keyframes water-flow {
    0%, 100% {
        transform: translateX(0);
    }
    50% {
        transform: translateX(2px);
    }
}

.water-animation {
    animation: water-flow 2s ease-in-out infinite;
}

/* Animation des outils de travail */
@keyframes tool-swing {
    0%, 100% {
        transform: rotate(0deg);
    }
    50% {
        transform: rotate(-15deg);
    }
}

.tool-working {
    animation: tool-swing 0.8s ease-in-out infinite;
}

/* Animation des véhicules */
@keyframes vehicle-move {
    0%, 100% {
        transform: translateX(0);
    }
    50% {
        transform: translateX(3px);
    }
}

.vehicle-moving {
    animation: vehicle-move 1s ease-in-out infinite;
}

/* Animation de la fumée */
@keyframes smoke-rise {
    0% {
        opacity: 0.8;
        transform: translateY(0) scale(0.5);
    }
    100% {
        opacity: 0;
        transform: translateY(-20px) scale(1);
    }
}

.smoke-particle {
    animation: smoke-rise 3s ease-out infinite;
}

/* Animation de progression */
@keyframes progress-fill {
    from {
        width: 0%;
    }
    to {
        width: var(--progress-width);
    }
}

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

/* Animation des statistiques */
@keyframes counter-up {
    from {
        transform: translateY(10px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.stat-counter {
    animation: counter-up 0.5s ease-out;
}

/* Animation de mise en surbrillance */
.highlight {
    animation: glow 1s ease-in-out 3;
}

/* Animation de disparition */
@keyframes vanish {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    100% {
        opacity: 0;
        transform: scale(0.3);
    }
}

.vanish {
    animation: vanish 0.5s ease-in-out forwards;
}

/* Animation d'apparition */
@keyframes appear {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.appear {
    animation: appear 0.5s ease-in-out forwards;
}

/* Animation de recherche terminée */
@keyframes research-complete {
    0% {
        background: linear-gradient(135deg, var(--background-light) 0%, var(--background-medium) 100%);
    }
    50% {
        background: linear-gradient(135deg, var(--primary-color) 0%, #45a049 100%);
        transform: scale(1.05);
    }
    100% {
        background: linear-gradient(135deg, var(--primary-color) 0%, #45a049 100%);
        transform: scale(1);
    }
}

.research-completed {
    animation: research-complete 1s ease-in-out forwards;
}

/* Animation de niveau supérieur */
@keyframes level-up {
    0% {
        transform: scale(1);
    }
    25% {
        transform: scale(1.1);
    }
    50% {
        transform: scale(1);
    }
    75% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

.level-up {
    animation: level-up 0.8s ease-in-out;
}

/* Animation de clignotement */
@keyframes blink {
    0%, 50% {
        opacity: 1;
    }
    51%, 100% {
        opacity: 0.3;
    }
}

.blink {
    animation: blink 1s ease-in-out infinite;
}

/* Classes utilitaires pour les animations */
.animate-delay-1 { animation-delay: 0.1s; }
.animate-delay-2 { animation-delay: 0.2s; }
.animate-delay-3 { animation-delay: 0.3s; }
.animate-delay-4 { animation-delay: 0.4s; }
.animate-delay-5 { animation-delay: 0.5s; }

.animate-duration-fast { animation-duration: 0.3s; }
.animate-duration-normal { animation-duration: 0.5s; }
.animate-duration-slow { animation-duration: 1s; }

/* Effets de transition personnalisés */
.transition-all {
    transition: all 0.3s ease;
}

.transition-fast {
    transition: all 0.15s ease;
}

.transition-slow {
    transition: all 0.5s ease;
}

/* Effets visuels pour les états de jeu */
.game-paused {
    filter: grayscale(50%) brightness(0.7);
}

.game-fast {
    filter: hue-rotate(30deg) saturate(120%);
}

.game-turbo {
    filter: hue-rotate(60deg) saturate(150%) brightness(110%);
}

/* Animation de chargement personnalisée */
@keyframes loading-dots {
    0%, 20% {
        color: rgba(255,255,255,0.4);
    }
    40% {
        color: rgba(255,255,255,1);
    }
    100% {
        color: rgba(255,255,255,0.4);
    }
}

.loading-dots span {
    animation: loading-dots 1.4s ease-in-out infinite both;
}

.loading-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.loading-dots span:nth-child(3) {
    animation-delay: 0.4s;
}