/* =========================================
   CODEIA SOLUTIONS - ANIMACIONES CSS
   ========================================= */

/* =========================================
   KEYFRAMES - ANIMACIONES BASE
   ========================================= */

/* Fade Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@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);
    }
}

/* Slide Animations - Copiadas del original */
@keyframes slideInLeft {
    from { 
        opacity: 0; 
        transform: translateX(-50px); 
    }
    to { 
        opacity: 1; 
        transform: translateX(0); 
    }
}

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

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

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

/* Float Animation - Del original */
@keyframes float {
    0%, 100% { 
        transform: translateY(0px) rotate(0deg); 
    }
    50% { 
        transform: translateY(-20px) rotate(180deg); 
    }
}

/* Pulse Animation - Del original */
@keyframes pulse {
    0% {
        box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    }
    50% {
        box-shadow: 0 4px 20px rgba(0,0,0,0.3), 0 0 0 10px rgba(124, 179, 66, 0.2);
    }
    100% {
        box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    }
}

/* Blink Animation - Del original */
@keyframes blink {
    0%, 50% { 
        opacity: 1; 
    }
    51%, 100% { 
        opacity: 0.3; 
    }
}

/* Bounce Animation */
@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-/* =========================================
   CODEIA SOLUTIONS - ANIMACIONES CSS
   ========================================= */

/* =========================================
   KEYFRAMES - ANIMACIONES BASE
   ========================================= */

/* Fade Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@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);
    }
}

/* Slide Animations */
@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

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

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

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

@keyframes zoomInUp {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(50px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

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

/* Bounce Animations */
@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);
    }
}

@keyframes bounceInUp {
    0% {
        opacity: 0;
        transform: translateY(100px);
    }
    60% {
        opacity: 1;
        transform: translateY(-10px);
    }
    80% {
        transform: translateY(5px);
    }
    100% {
        transform: translateY(0);
    }
}

/* Rotate Animations */
@keyframes rotateIn {
    from {
        opacity: 0;
        transform: rotate(-200deg) scale(0.8);
    }
    to {
        opacity: 1;
        transform: rotate(0deg) scale(1);
    }
}

@keyframes rotateInDownLeft {
    from {
        opacity: 0;
        transform: rotate(-45deg) translateY(-50px) translateX(-50px);
    }
    to {
        opacity: 1;
        transform: rotate(0deg) translateY(0) translateX(0);
    }
}

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

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

/* =========================================
   ANIMACIONES ESPECIALES
   ========================================= */

/* Pulse Animation */
@keyframes pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(124, 179, 66, 0.7);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 0 10px rgba(124, 179, 66, 0);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(124, 179, 66, 0);
    }
}

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

/* Wobble Animation */
@keyframes wobble {
    0% {
        transform: translateX(0%);
    }
    15% {
        transform: translateX(-25%) rotate(-5deg);
    }
    30% {
        transform: translateX(20%) rotate(3deg);
    }
    45% {
        transform: translateX(-15%) rotate(-3deg);
    }
    60% {
        transform: translateX(10%) rotate(2deg);
    }
    75% {
        transform: translateX(-5%) rotate(-1deg);
    }
    100% {
        transform: translateX(0%);
    }
}

/* Rubber Band Animation */
@keyframes rubberBand {
    0% {
        transform: scale(1);
    }
    30% {
        transform: scaleX(1.25) scaleY(0.75);
    }
    40% {
        transform: scaleX(0.75) scaleY(1.25);
    }
    50% {
        transform: scaleX(1.15) scaleY(0.85);
    }
    65% {
        transform: scaleX(0.95) scaleY(1.05);
    }
    75% {
        transform: scaleX(1.05) scaleY(0.95);
    }
    100% {
        transform: scale(1);
    }
}

/* Float Animation */
@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-20px);
    }
}

/* Glow Animation */
@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(124, 179, 66, 0.5);
    }
    50% {
        box-shadow: 0 0 20px rgba(124, 179, 66, 0.8), 0 0 30px rgba(124, 179, 66, 0.6);
    }
}

/* =========================================
   ANIMACIONES DE LOADING
   ========================================= */

/* Spinner Animation */
@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* Dots Loading Animation */
@keyframes dots {
    0%, 20% {
        color: rgba(124, 179, 66, 0);
        text-shadow: 0.25em 0 0 rgba(124, 179, 66, 0),
                     0.5em 0 0 rgba(124, 179, 66, 0);
    }
    40% {
        color: rgba(124, 179, 66, 1);
        text-shadow: 0.25em 0 0 rgba(124, 179, 66, 0),
                     0.5em 0 0 rgba(124, 179, 66, 0);
    }
    60% {
        text-shadow: 0.25em 0 0 rgba(124, 179, 66, 1),
                     0.5em 0 0 rgba(124, 179, 66, 0);
    }
    80%, 100% {
        text-shadow: 0.25em 0 0 rgba(124, 179, 66, 1),
                     0.5em 0 0 rgba(124, 179, 66, 1);
    }
}

/* Progress Bar Animation */
@keyframes progress {
    0% {
        background-position: 0 0;
    }
    100% {
        background-position: 20px 0;
    }
}

/* Skeleton Loading Animation */
@keyframes skeleton {
    0% {
        background-position: -200px 0;
    }
    100% {
        background-position: calc(200px + 100%) 0;
    }
}

/* Ripple Effect Animation */
@keyframes ripple {
    0% {
        transform: scale(0);
        opacity: 1;
    }
    100% {
        transform: scale(4);
        opacity: 0;
    }
}

/* =========================================
   ANIMACIONES DE TEXTO
   ========================================= */

/* Typewriter Animation */
@keyframes typewriter {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

/* Blink Cursor Animation */
@keyframes blink {
    0%, 50% {
        opacity: 1;
    }
    51%, 100% {
        opacity: 0;
    }
}

/* Text Focus In Animation */
@keyframes textFocusIn {
    0% {
        filter: blur(12px);
        opacity: 0;
    }
    100% {
        filter: blur(0px);
        opacity: 1;
    }
}

/* Text Slide Up Animation */
@keyframes textSlideUp {
    0% {
        transform: translateY(100%);
        opacity: 0;
    }
    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

/* =========================================
   ANIMACIONES DE BACKGROUND
   ========================================= */

/* Gradient Animation */
@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* Particle Float Animation */
@keyframes particleFloat {
    0%, 100% {
        transform: translateY(0px) rotate(0deg);
        opacity: 1;
    }
    33% {
        transform: translateY(-30px) rotate(120deg);
        opacity: 0.8;
    }
    66% {
        transform: translateY(-60px) rotate(240deg);
        opacity: 0.6;
    }
}

/* Wave Animation */
@keyframes wave {
    0% {
        transform: translateX(0) translateZ(0) scaleY(1);
    }
    50% {
        transform: translateX(-25%) translateZ(0) scaleY(0.55);
    }
    100% {
        transform: translateX(-50%) translateZ(0) scaleY(1);
    }
}

/* =========================================
   CLASES DE ANIMACIÓN
   ========================================= */

/* Fade Animations Classes */
.fade-in {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.6s ease;
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

.fade-in-up {
    animation: fadeInUp 0.8s ease forwards;
}

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

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

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

/* Slide Animations Classes */
.slide-in-left {
    animation: slideInLeft 0.8s ease forwards;
}

.slide-in-right {
    animation: slideInRight 0.8s ease forwards;
}

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

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

/* Zoom Animations Classes */
.zoom-in {
    animation: zoomIn 0.6s ease forwards;
}

.zoom-in-up {
    animation: zoomInUp 0.8s ease forwards;
}

/* Bounce Animations Classes */
.bounce-in {
    animation: bounceIn 0.8s ease forwards;
}

.bounce-in-up {
    animation: bounceInUp 0.8s ease forwards;
}

/* Rotate Animations Classes */
.rotate-in {
    animation: rotateIn 0.8s ease forwards;
}

.rotate-in-down-left {
    animation: rotateInDownLeft 0.8s ease forwards;
}

/* Flip Animations Classes */
.flip-in-x {
    animation: flipInX 0.8s ease forwards;
}

.flip-in-y {
    animation: flipInY 0.8s ease forwards;
}

/* Special Effect Classes */
.pulse {
    animation: pulse 2s infinite;
}

.shake {
    animation: shake 0.82s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

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

.rubber-band {
    animation: rubberBand 1s ease;
}

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

.glow {
    animation: glow 2s ease-in-out infinite alternate;
}

/* Loading Classes */
.spinner {
    animation: spin 1s linear infinite;
}

.dots-loading::after {
    content: '...';
    animation: dots 1.5s steps(5, end) infinite;
}

.progress-bar {
    background: linear-gradient(
        90deg,
        var(--primary-green) 25%,
        transparent 25%,
        transparent 50%,
        var(--primary-green) 50%,
        var(--primary-green) 75%,
        transparent 75%
    );
    background-size: 20px 20px;
    animation: progress 1s linear infinite;
}

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

/* Text Animation Classes */
.typewriter {
    overflow: hidden;
    border-right: 0.15em solid var(--primary-green);
    white-space: nowrap;
    margin: 0 auto;
    letter-spacing: 0.15em;
    animation: typewriter 3.5s steps(40, end),
               blink 0.75s step-end infinite;
}

.text-focus-in {
    animation: textFocusIn 1s cubic-bezier(0.55, 0.085, 0.68, 0.53) both;
}

.text-slide-up {
    animation: textSlideUp 0.8s ease forwards;
}

/* Background Animation Classes */
.gradient-bg {
    background: linear-gradient(-45deg, #7CB342, #2E4339, #A5D26A, #4CAF50);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
}

.particle-bg::before {
    content: '';
    position: absolute;
    width: 10px;
    height: 10px;
    background: rgba(124, 179, 66, 0.5);
    border-radius: 50%;
    animation: particleFloat 6s ease-in-out infinite;
}

/* =========================================
   DELAYS Y DURACIONES
   ========================================= */

/* Animation Delays */
.delay-100 { animation-delay: 0.1s; }
.delay-200 { animation-delay: 0.2s; }
.delay-300 { animation-delay: 0.3s; }
.delay-400 { animation-delay: 0.4s; }
.delay-500 { animation-delay: 0.5s; }
.delay-600 { animation-delay: 0.6s; }
.delay-700 { animation-delay: 0.7s; }
.delay-800 { animation-delay: 0.8s; }
.delay-900 { animation-delay: 0.9s; }
.delay-1000 { animation-delay: 1s; }

/* Animation Durations */
.duration-fast { animation-duration: 0.3s; }
.duration-normal { animation-duration: 0.6s; }
.duration-slow { animation-duration: 1s; }
.duration-slower { animation-duration: 1.5s; }

/* =========================================
   HOVER ANIMATIONS
   ========================================= */

/* Hover Effects */
.hover-float:hover {
    transform: translateY(-5px);
    transition: transform 0.3s ease;
}

.hover-scale:hover {
    transform: scale(1.05);
    transition: transform 0.3s ease;
}

.hover-rotate:hover {
    transform: rotate(5deg);
    transition: transform 0.3s ease;
}

.hover-glow:hover {
    box-shadow: 0 0 20px rgba(124, 179, 66, 0.6);
    transition: box-shadow 0.3s ease;
}

.hover-shake:hover {
    animation: shake 0.5s ease-in-out;
}

.hover-pulse:hover {
    animation: pulse 1s ease-in-out;
}

/* Button Hover Animations */
.btn-hover-slide {
    position: relative;
    overflow: hidden;
}

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

.btn-hover-bounce:hover {
    animation: bounceIn 0.6s ease;
}

/* =========================================
   SCROLL ANIMATIONS
   ========================================= */

/* Parallax Animation */
.parallax {
    transform: translateZ(0);
    will-change: transform;
}

/* Scroll Reveal Animations */
.reveal-fade {
    opacity: 0;
    transform: translateY(50px);
    transition: all 0.8s ease;
}

.reveal-fade.revealed {
    opacity: 1;
    transform: translateY(0);
}

.reveal-slide-left {
    opacity: 0;
    transform: translateX(-50px);
    transition: all 0.8s ease;
}

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

.reveal-slide-right {
    opacity: 0;
    transform: translateX(50px);
    transition: all 0.8s ease;
}

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

.reveal-zoom {
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.8s ease;
}

.reveal-zoom.revealed {
    opacity: 1;
    transform: scale(1);
}

/* =========================================
   ESTADOS DE ANIMACIÓN
   ========================================= */

/* Animation States */
.animate-paused {
    animation-play-state: paused;
}

.animate-running {
    animation-play-state: running;
}

.animate-infinite {
    animation-iteration-count: infinite;
}

.animate-once {
    animation-iteration-count: 1;
}

.animate-twice {
    animation-iteration-count: 2;
}

/* =========================================
   RESPONSIVE ANIMATIONS
   ========================================= */

/* Disable animations on mobile if preferred */
@media (max-width: 768px) {
    .mobile-no-animation,
    .mobile-no-animation * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Reduce motion for accessibility */
@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;
    }
    
    .fade-in {
        opacity: 1;
        transform: none;
    }
    
    .parallax {
        transform: none !important;
    }
}

/* =========================================
   ANIMACIONES ESPECÍFICAS DE CODEIA
   ========================================= */

/* Logo Animation */
.logo-bounce {
    animation: bounceIn 1s ease-out;
}

.logo-icon-rotate {
    animation: rotateIn 0.8s ease-out;
}

/* Hero Text Animation */
.hero-title {
    animation: fadeInUp 1s ease-out;
}

.hero-subtitle {
    animation: fadeInUp 1s ease-out 0.2s both;
}

.hero-buttons {
    animation: fadeInUp 1s ease-out 0.4s both;
}

/* Service Card Animation */
.service-card-entrance {
    animation: zoomInUp 0.8s ease-out;
}

.service-icon-bounce {
    animation: bounceIn 0.6s ease-out 0.2s both;
}

/* Stats Counter Animation */
.stat-number {
    animation: zoomIn 0.8s ease-out;
}

/* Chat Widget Animation */
.chat-message-in {
    animation: slideInLeft 0.4s ease-out;
}

.chat-message-out {
    animation: slideInRight 0.4s ease-out;
}

.chat-typing {
    animation: pulse 1.5s ease-in-out infinite;
}

/* Floating Button Animation */
.floating-btn-entrance {
    animation: bounceInUp 0.8s ease-out;
}

.floating-btn-attention {
    animation: pulse 2s ease-in-out infinite;
}

/* Loading States */
.page-loading {
    animation: fadeIn 0.5s ease-out;
}

.content-loading {
    animation: skeleton 1.5s ease-in-out infinite;
}

/* Success States */
.success-checkmark {
    animation: zoomIn 0.5s ease-out;
}

.success-message {
    animation: slideInDown 0.6s ease-out;
}

/* Error States */
.error-shake {
    animation: shake 0.5s ease-in-out;
}

.error-message {
    animation: slideInUp 0.6s ease-out;
}

/* =========================================
   OPTIMIZACIONES DE PERFORMANCE
   ========================================= */

/* Will-change para optimizar animaciones */
.animate-optimized {
    will-change: transform, opacity;
}

.animate-optimized.animation-complete {
    will-change: auto;
}

/* GPU Acceleration */
.gpu-accelerated {
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000px;
}

/* Contenimento para animaciones */
.animation-container {
    contain: layout style paint;
}

/* =========================================
   UTILIDADES DE ANIMACIÓN
   ========================================= */

/* Play/Pause Controls */
.animation-paused * {
    animation-play-state: paused !important;
}

.animation-slow * {
    animation-duration: 2s !important;
}

.animation-fast * {
    animation-duration: 0.5s !important;
}

/* Visibility Controls */
.animate-hidden {
    opacity: 0;
    pointer-events: none;
}

.animate-visible {
    opacity: 1;
    pointer-events: auto;
}