/* ===================================
   ANIMACIONES Y TRANSICIONES
   =================================== */

/* ===================================
   ANIMACIONES DE ENTRADA (SCROLL)
   =================================== */

/* Base para animaciones scroll */
.animate-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.animate-on-scroll.animated {
    opacity: 1;
    transform: translateY(0);
}

/* Variaciones de dirección */
.animate-from-left {
    transform: translateX(-50px);
}

.animate-from-left.animated {
    transform: translateX(0);
}

.animate-from-right {
    transform: translateX(50px);
}

.animate-from-right.animated {
    transform: translateX(0);
}

.animate-from-top {
    transform: translateY(-50px);
}

.animate-from-top.animated {
    transform: translateY(0);
}

.animate-scale {
    transform: scale(0.9);
}

.animate-scale.animated {
    transform: scale(1);
}

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

.animate-rotate.animated {
    transform: rotate(0);
}

/* ===================================
   ANIMACIONES DE HERO
   =================================== */

/* Título hero con typewriter effect */
@keyframes typewriter {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

@keyframes blink {
    50% {
        border-color: transparent;
    }
}

.hero-title.typewriter {
    overflow: hidden;
    white-space: nowrap;
    border-right: 3px solid var(--primary-color);
    animation: typewriter 3s steps(40) 1s forwards, blink 0.75s step-end infinite;
}

/* Fade in hero */
@keyframes fadeInHero {
    from {
        opacity: 0;
        transform: translateY(50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hero-content > * {
    animation: fadeInHero 0.8s ease-out forwards;
}

.hero-title {
    animation-delay: 0.2s;
}

.hero-subtitle {
    animation-delay: 0.4s;
}

.hero-cta {
    animation-delay: 0.6s;
}

.hero-image {
    animation: fadeInHero 1s ease-out 0.8s forwards;
}

/* ===================================
   ANIMACIONES DE BOTONES
   =================================== */

/* Botón con ripple effect */
@keyframes ripple {
    0% {
        transform: scale(0);
        opacity: 1;
    }
    100% {
        transform: scale(4);
        opacity: 0;
    }
}

.btn {
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

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

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn:active {
    transform: scale(0.95);
}

/* Botón flotante */
@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

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

/* ===================================
   ANIMACIONES DE TARJETAS
   =================================== */

/* Tarjetas con hover effect */
.content-card,
.product-card {
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.content-card:hover,
.product-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

/* Brillo en hover */
.content-card::before,
.product-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s;
}

.content-card:hover::before,
.product-card:hover::before {
    left: 100%;
}

/* ===================================
   ANIMACIONES DE NAVEGACIÓN
   =================================== */

/* Dropdown smooth */
.dropdown-menu {
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.dropdown:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Nav link underline animation */
.nav-link {
    position: relative;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary-color);
    transition: width 0.3s ease;
}

.nav-link:hover::after {
    width: 100%;
}

/* ===================================
   ANIMACIONES DE INDICADORES
   =================================== */

/* Contadores animados */
@keyframes countUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.trust-item {
    animation: countUp 0.6s ease-out forwards;
}

.trust-item:nth-child(1) { animation-delay: 0.1s; }
.trust-item:nth-child(2) { animation-delay: 0.2s; }
.trust-item:nth-child(3) { animation-delay: 0.3s; }
.trust-item:nth-child(4) { animation-delay: 0.4s; }

/* Números contando */
@keyframes numberCount {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.trust-number {
    position: relative;
    animation: numberCount 0.5s ease-out forwards;
}

/* ===================================
   ANIMACIONES DE FAQ
   =================================== */

/* FAQ toggle rotation */
.faq-icon {
    transition: transform 0.3s ease;
}

.faq-toggle[aria-expanded="true"] .faq-icon {
    transform: rotate(45deg);
}

/* FAQ answer slide */
.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94), 
                padding 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.faq-answer.active {
    max-height: 500px;
}

/* ===================================
   ANIMACIONES DE CARGA
   =================================== */

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

.loading-spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-left-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.skeleton {
    display: inline-block;
    height: 20px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200px 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 4px;
}

/* ===================================
   ANIMACIONES DE SCROLL
   =================================== */

/* Parallax suave */
.parallax-element {
    transform: translateY(0);
    transition: transform 0.1s ease-out;
}

/* Scroll indicator */
@keyframes scrollIndicator {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(10px);
    }
}

.scroll-indicator {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 50px;
    border: 2px solid white;
    border-radius: 15px;
    opacity: 0.7;
}

.scroll-indicator::before {
    content: '';
    position: absolute;
    top: 8px;
    left: 50%;
    width: 6px;
    height: 6px;
    background: white;
    border-radius: 50%;
    transform: translateX(-50%);
    animation: scrollIndicator 2s infinite;
}

/* ===================================
   ANIMACIONES DE ENTRADA COMPLEJAS
   =================================== */

/* Stagger animation para listas */
@keyframes staggerIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.stagger-list > * {
    opacity: 0;
    animation: staggerIn 0.5s ease-out forwards;
}

.stagger-list > *:nth-child(1) { animation-delay: 0.1s; }
.stagger-list > *:nth-child(2) { animation-delay: 0.2s; }
.stagger-list > *:nth-child(3) { animation-delay: 0.3s; }
.stagger-list > *:nth-child(4) { animation-delay: 0.4s; }
.stagger-list > *:nth-child(5) { animation-delay: 0.5s; }

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

.bounce-in {
    animation: bounceIn 0.6s ease-out;
}

/* ===================================
   ANIMACIONES DE ERROR/SUCCESS
   =================================== */

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

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

/* Pulse para éxito */
@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

.pulse-success {
    animation: pulse 0.5s ease-in-out;
}

/* ===================================
   ANIMACIONES DE PULSACIÓN
   =================================== */

/* CTA Button pulse */
@keyframes ctaPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 107, 53, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(255, 107, 53, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(255, 107, 53, 0);
    }
}

.btn-primary {
    animation: ctaPulse 2s infinite;
}

.btn-primary:hover {
    animation: none;
}

/* ===================================
   ANIMACIONES DE GRÁFICOS
   =================================== */

/* Barra progresiva */
@keyframes progressBar {
    from {
        width: 0%;
    }
    to {
        width: var(--progress-width);
    }
}

.progress-bar {
    height: 20px;
    background: var(--primary-color);
    border-radius: 10px;
    animation: progressBar 1.5s ease-out forwards;
}

/* Circular progress */
@keyframes circularProgress {
    from {
        stroke-dashoffset: 339.292;
    }
    to {
        stroke-dashoffset: var(--circular-offset);
    }
}

.circular-progress {
    transform: rotate(-90deg);
    transform-origin: center;
}

.circular-progress circle {
    stroke-dasharray: 339.292;
    stroke-dashoffset: 339.292;
    animation: circularProgress 1.5s ease-out forwards;
}

/* ===================================
   ANIMACIONES DE HOVER CREATIVAS
   =================================== */

/* 3D card flip */
.flip-card {
    perspective: 1000px;
}

.flip-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

.flip-card:hover .flip-card-inner {
    transform: rotateY(180deg);
}

.flip-card-front, .flip-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
}

.flip-card-back {
    transform: rotateY(180deg);
}

/* Morphing button */
.morphing-btn {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

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

.morphing-btn:hover::before {
    width: 300px;
    height: 300px;
}

/* ===================================
   ANIMACIONES DE CONFETTI/CELEBRACIÓN
   =================================== */

@keyframes confetti-fall {
    0% {
        transform: translateY(-100vh) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

.confetti {
    position: fixed;
    width: 10px;
    height: 10px;
    background: var(--primary-color);
    animation: confetti-fall 3s linear infinite;
}

.confetti:nth-child(odd) {
    background: var(--accent-color);
    animation-duration: 4s;
}

.confetti:nth-child(3n) {
    background: var(--secondary-color);
    animation-duration: 2.5s;
}

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

/* Delay utilities */
.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.2s; }
.delay-3 { animation-delay: 0.3s; }
.delay-4 { animation-delay: 0.4s; }
.delay-5 { animation-delay: 0.5s; }

/* Duration utilities */
.duration-fast { animation-duration: 0.3s; }
.duration-normal { animation-duration: 0.6s; }
.duration-slow { animation-duration: 1s; }

/* Infinite animations */
.infinite { animation-iteration-count: infinite; }

/* Fill modes */
.fill-forwards { animation-fill-mode: forwards; }
.fill-backwards { animation-fill-mode: backwards; }
.fill-both { animation-fill-mode: both; }

/* ===================================
   MEDIA QUERIES PARA ANIMACIONES
   =================================== */

/* Reducir animaciones en móvil */
@media (max-width: 768px) {
    .animate-on-scroll {
        transition-duration: 0.4s;
    }
    
    .hero-content > * {
        animation-duration: 0.6s;
    }
    
    .btn-primary {
        animation: none;
    }
}

/* Respetar preferencia de reduced motion */
@media (prefers-reduced-motion: reduce) {
    .animate-on-scroll,
    .hero-content > *,
    .trust-item,
    .btn,
    .content-card,
    .product-card {
        animation: none !important;
        transition: none !important;
    }
    
    .btn-primary {
        animation: none !important;
    }
}
