/* ============================================
   ANIMACIONES Y MICROINTERACCIONES
   ============================================ */

/* Animaciones de entrada para slides */
@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 fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

/* Aplicar animaciones a elementos al aparecer */
.slide.active .content {
    animation: slideInUp 0.6s ease-out;
}

.slide.active .card-oneleven {
    animation: fadeIn 0.8s ease-out;
}

/* Animación para tarjetas de proyectos */
.project-card {
    animation: scaleIn 0.5s ease-out;
    animation-fill-mode: both;
}

.project-card:nth-child(1) { animation-delay: 0.1s; }
.project-card:nth-child(2) { animation-delay: 0.2s; }
.project-card:nth-child(3) { animation-delay: 0.3s; }
.project-card:nth-child(4) { animation-delay: 0.4s; }
.project-card:nth-child(5) { animation-delay: 0.5s; }

/* Animación para tarjetas de servicios */
.service-card {
    animation: scaleIn 0.5s ease-out;
    animation-fill-mode: both;
}

.service-card:nth-child(1) { animation-delay: 0.1s; }
.service-card:nth-child(2) { animation-delay: 0.2s; }
.service-card:nth-child(3) { animation-delay: 0.3s; }
.service-card:nth-child(4) { animation-delay: 0.4s; }
.service-card:nth-child(5) { animation-delay: 0.5s; }

/* Animación para stats del hero */
.stat-item {
    animation: slideInDown 0.6s ease-out;
    animation-fill-mode: both;
}

.stat-item:nth-child(1) { animation-delay: 0.2s; }
.stat-item:nth-child(2) { animation-delay: 0.4s; }
.stat-item:nth-child(3) { animation-delay: 0.6s; }

/* Animación para tech badges */
.tech-badge {
    animation: fadeIn 0.5s ease-out;
    animation-fill-mode: both;
}

.tech-badge:nth-child(1) { animation-delay: 0.1s; }
.tech-badge:nth-child(2) { animation-delay: 0.15s; }
.tech-badge:nth-child(3) { animation-delay: 0.2s; }
.tech-badge:nth-child(4) { animation-delay: 0.25s; }
.tech-badge:nth-child(5) { animation-delay: 0.3s; }
.tech-badge:nth-child(6) { animation-delay: 0.35s; }
.tech-badge:nth-child(7) { animation-delay: 0.4s; }
.tech-badge:nth-child(8) { animation-delay: 0.45s; }

/* Animación para workflow steps */
.workflow-step {
    animation: fadeIn 0.6s ease-out;
    animation-fill-mode: both;
}

.workflow-step:nth-child(1) { animation-delay: 0.1s; }
.workflow-step:nth-child(2) { animation-delay: 0.2s; }
.workflow-step:nth-child(3) { animation-delay: 0.3s; }
.workflow-step:nth-child(4) { animation-delay: 0.4s; }
.workflow-step:nth-child(5) { animation-delay: 0.5s; }

/* Microinteracciones en hover */
.project-card:hover,
.service-card:hover {
    animation: none;
}

/* Animación de pulso para CTAs */
@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 var(--color-primary-alpha-50);
    }
    50% {
        box-shadow: 0 0 0 8px transparent;
    }
}

.btn-primary:hover,
.project-cta:hover,
.service-cta:hover {
    animation: pulse 2s infinite;
}

/* Animación de carga para imágenes */
@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

.project-image img,
.modal-project-image {
    background: linear-gradient(90deg, var(--bg-secondary) 0%, var(--bg-tertiary) 50%, var(--bg-secondary) 100%);
    background-size: 1000px 100%;
    animation: shimmer 2s infinite;
}

.project-image img[src],
.modal-project-image[src] {
    animation: none;
}

/* Animación de entrada para filtros */
.filter-btn {
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
}

.filter-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: var(--border-radius-circle);
    background: var(--color-primary-alpha-30);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.filter-btn:hover::before,
.filter-btn.active::before {
    width: 300px;
    height: 300px;
}

.filter-btn span {
    position: relative;
    z-index: 1;
}

/* Animación de entrada para slider */
.projects-slider,
.services-slider {
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Animación para indicadores */
.slider-indicator {
    transition: all var(--transition-fast);
    position: relative;
}

.slider-indicator.active::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    border-radius: var(--border-radius-circle);
    background: var(--color-primary);
    transform: translate(-50%, -50%);
    animation: pulse 2s infinite;
}

/* Animación de entrada para hero */
.hero-section h1 {
    animation: slideInDown 0.8s ease-out;
}

.hero-subtitle {
    animation: fadeIn 1s ease-out 0.3s;
    animation-fill-mode: both;
}

.hero-stats {
    animation: fadeIn 1s ease-out 0.6s;
    animation-fill-mode: both;
}

.hero-ctas {
    animation: fadeIn 1s ease-out 0.9s;
    animation-fill-mode: both;
}

.tech-stack {
    animation: fadeIn 1s ease-out 1.2s;
    animation-fill-mode: both;
}

/* Animación de scroll reveal (se aplicará con JS) */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

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

/* Animación para el chat bubble */
#chat-bubble {
    animation: pulse 2s infinite;
}

/* Smooth transitions para todos los elementos interactivos */
a, button, .project-card, .service-card, .filter-btn, .slider-nav-btn {
    transition: all var(--transition-normal);
}

/* Reducir animaciones en dispositivos con preferencia de movimiento reducido */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

