/* =====================================
   ANIMACIONES DE SCROLL OPTIMIZADAS
   ===================================== */

/* Configuración base para rendimiento */
* {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

html {
    scroll-behavior: smooth;
}

@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;
    }
}

/* =====================================
   KEYFRAMES PRINCIPALES
   ===================================== */

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-40px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(40px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(60px);
    }
    50% {
        opacity: 0.8;
        transform: translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes rotateIn {
    from {
        opacity: 0;
        transform: rotate(-10deg) scale(0.8);
    }
    to {
        opacity: 1;
        transform: rotate(0deg) scale(1);
    }
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        opacity: 1;
        transform: scale(1.1);
    }
    70% {
        transform: scale(0.95);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.9;
    }
}

@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

/* =====================================
   CLASES DE ANIMACIÓN
   ===================================== */

.animate-fade-in-up {
    animation: fadeInUp 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.animate-fade-in-down {
    animation: fadeInDown 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.animate-fade-in-left {
    animation: fadeInLeft 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.animate-fade-in-right {
    animation: fadeInRight 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.animate-scale-in {
    animation: scaleIn 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.animate-slide-in-up {
    animation: slideInUp 1s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.animate-rotate-in {
    animation: rotateIn 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.animate-bounce-in {
    animation: bounceIn 1.2s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Clase para compatibilidad con código existente */
.fade-in {
    animation: fadeInUp 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* =====================================
   EFECTOS AVANZADOS
   ===================================== */

/* Efecto de brillo en hover */
.shimmer-effect {
    position: relative;
    overflow: hidden;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    background-size: 200% 100%;
    animation: shimmer 2s infinite;
}

/* Efecto parallax suave */
.parallax-element {
    transition: transform 0.1s ease-out;
    will-change: transform;
}

/* Hover mejorado para cards */
.enhanced-card {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: center;
}

.enhanced-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

/* Efecto de loading skeleton */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

/* =====================================
   BARRAS DE PROGRESO ANIMADAS
   ===================================== */

.progress-container {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--primary-gold), var(--primary-warm-gold));
    border-radius: 4px;
    transition: width 2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: shimmer 2s infinite;
}

/* =====================================
   CONTADORES NUMÉRICOS
   ===================================== */

.counter {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-gold);
    transition: all 0.3s ease;
}

.counter.counting {
    color: var(--primary-warm-gold);
    text-shadow: 0 0 20px rgba(212, 175, 55, 0.3);
}

/* =====================================
   EFECTOS ESPECÍFICOS POR TIPO
   ===================================== */

/* Cards mejoradas */
.method-card,
.impact-card,
.group-card,
.product-card,
.testimonial-card,
.service-card {
    opacity: 0;
    transform: translateY(40px);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform, opacity;
}

.method-card:hover,
.impact-card:hover,
.group-card:hover,
.product-card:hover,
.testimonial-card:hover,
.service-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
}

/* Formularios */
.registration-form {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Contenido informativo */
.info-content {
    opacity: 0;
    transform: translateX(-30px);
    transition: all 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

/* =====================================
   EFECTOS DE STAGGER
   ===================================== */

.stagger-item {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.stagger-container .stagger-item:nth-child(1) { animation-delay: 0ms; }
.stagger-container .stagger-item:nth-child(2) { animation-delay: 100ms; }
.stagger-container .stagger-item:nth-child(3) { animation-delay: 200ms; }
.stagger-container .stagger-item:nth-child(4) { animation-delay: 300ms; }
.stagger-container .stagger-item:nth-child(5) { animation-delay: 400ms; }
.stagger-container .stagger-item:nth-child(6) { animation-delay: 500ms; }

/* =====================================
   ANIMACIONES PARA TEXTO
   ===================================== */

.text-reveal {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.text-reveal.delay-1 { animation-delay: 0.2s; }
.text-reveal.delay-2 { animation-delay: 0.4s; }
.text-reveal.delay-3 { animation-delay: 0.6s; }

/* Efecto de escritura */
@keyframes typewriter {
    from { width: 0; }
    to { width: 100%; }
}

.typewriter {
    overflow: hidden;
    border-right: 2px solid var(--primary-gold);
    white-space: nowrap;
    animation: typewriter 3s steps(40) 1s 1 normal both;
}

/* =====================================
   EFECTOS DE BACKGROUND
   ===================================== */

.animated-background {
    position: relative;
    overflow: hidden;
}

.animated-background::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent, rgba(212, 175, 55, 0.1), transparent);
    transform: translateX(-100%) translateY(-100%) rotate(45deg);
    animation: shimmer 3s infinite;
}

/* =====================================
   OPTIMIZACIONES DE RENDIMIENTO
   ===================================== */

/* Usar transform3d para activar aceleración de hardware */
.gpu-accelerated {
    transform: translate3d(0, 0, 0);
    backface-visibility: hidden;
    perspective: 1000px;
}

/* Reducir repaints */
.will-change-transform {
    will-change: transform;
}

.will-change-opacity {
    will-change: opacity;
}

/* =====================================
   RESPONSIVE ADJUSTMENTS
   ===================================== */

@media (max-width: 768px) {
    /* Reducir intensidad de animaciones en móviles */
    .animate-fade-in-up,
    .animate-fade-in-down,
    .animate-fade-in-left,
    .animate-fade-in-right {
        animation-duration: 0.6s;
    }
    
    .animate-slide-in-up {
        animation-duration: 0.8s;
    }
    
    /* Reducir transforms en móviles para mejor rendimiento */
    .enhanced-card:hover {
        transform: translateY(-4px) scale(1.01);
    }
    
    /* Simplificar parallax en móviles */
    .parallax-element {
        transform: none !important;
    }
}

@media (max-width: 480px) {
    /* Animaciones muy suaves en pantallas pequeñas */
    .animate-fade-in-up,
    .animate-fade-in-down,
    .animate-fade-in-left,
    .animate-fade-in-right,
    .animate-scale-in,
    .animate-slide-in-up,
    .animate-rotate-in,
    .animate-bounce-in {
        animation-duration: 0.4s;
    }
}

/* =====================================
   UTILIDADES
   ===================================== */

.animation-delay-100 { animation-delay: 100ms; }
.animation-delay-200 { animation-delay: 200ms; }
.animation-delay-300 { animation-delay: 300ms; }
.animation-delay-400 { animation-delay: 400ms; }
.animation-delay-500 { animation-delay: 500ms; }

.animation-duration-fast { animation-duration: 0.3s; }
.animation-duration-normal { animation-duration: 0.6s; }
.animation-duration-slow { animation-duration: 1.2s; }

.no-animation {
    animation: none !important;
    transition: none !important;
}

.pause-animation {
    animation-play-state: paused !important;
}