/* ===== ANIMACIONES Y EFECTOS AVANZADOS ===== */

/* ===== ANIMACIONES DE ENTRADA ===== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

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

/* ===== STAGGER ANIMATIONS ===== */
.stagger-item {
    animation: fadeInUp 0.6s ease forwards;
    opacity: 0;
}

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

/* ===== EFECTOS HOVER AVANZADOS ===== */

/* Glow Effect */
.glow-hover {
    transition: all 0.3s ease;
    position: relative;
}

.glow-hover::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, var(--course-primary), var(--course-secondary));
    border-radius: inherit;
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.glow-hover:hover::before {
    opacity: 1;
}

/* Lift Effect */
.lift-hover {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.lift-hover:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(68, 229, 255, 0.3);
}

/* Magnetic Effect */
.magnetic {
    transition: transform 0.3s ease;
}

.magnetic:hover {
    transform: scale(1.05);
}

/* ===== ANIMACIONES CONTINUAS ===== */

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

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

/* Pulse Animation */
@keyframes pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(68, 229, 255, 0.7);
    }
    70% {
        transform: scale(1.05);
        box-shadow: 0 0 0 10px rgba(68, 229, 255, 0);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(68, 229, 255, 0);
    }
}

.pulse {
    animation: pulse 2s infinite;
}

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

.animated-gradient {
    background: linear-gradient(-45deg, var(--course-primary), var(--course-secondary), var(--course-success), var(--course-primary));
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
}

/* ===== ANIMACIONES DE PARTÍCULAS ===== */
.particles-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: var(--course-primary);
    border-radius: 50%;
    opacity: 0.6;
    animation: particleFloat 15s linear infinite;
}

@keyframes particleFloat {
    0% {
        transform: translateY(100vh) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 0.6;
    }
    90% {
        opacity: 0.6;
    }
    100% {
        transform: translateY(-100px) rotate(360deg);
        opacity: 0;
    }
}

/* ===== ANIMACIONES DE SCROLL ===== */
.animate-on-scroll {
    opacity: 0;
    transform: translateY(50px);
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* Stagger animations para contenedores */
.stagger-container .animate-on-scroll:nth-child(1) { transition-delay: 0.1s; }
.stagger-container .animate-on-scroll:nth-child(2) { transition-delay: 0.2s; }
.stagger-container .animate-on-scroll:nth-child(3) { transition-delay: 0.3s; }
.stagger-container .animate-on-scroll:nth-child(4) { transition-delay: 0.4s; }
.stagger-container .animate-on-scroll:nth-child(5) { transition-delay: 0.5s; }
.stagger-container .animate-on-scroll:nth-child(6) { transition-delay: 0.6s; }

/* ===== ANIMACIONES DE TEXTO ===== */
@keyframes typewriter {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

@keyframes blinkCursor {
    from, to {
        border-color: transparent;
    }
    50% {
        border-color: var(--course-primary);
    }
}

.typewriter {
    overflow: hidden;
    border-right: 3px solid var(--course-primary);
    white-space: nowrap;
    margin: 0 auto;
    letter-spacing: .15em;
    animation: 
        typewriter 3.5s steps(40, end),
        blinkCursor .75s step-end infinite;
}

/* ===== ANIMACIONES DE BOTONES ===== */
@keyframes buttonPulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

.btn-animate {
    animation: buttonPulse 2s ease-in-out infinite;
}

/* ===== ANIMACIONES DE ICONOS ===== */
@keyframes iconSpin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.icon-spin {
    animation: iconSpin 2s linear infinite;
}

@keyframes iconBounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

.icon-bounce {
    animation: iconBounce 2s ease infinite;
}

/* ===== ANIMACIONES DE CARGA ===== */
@keyframes shimmer {
    0% {
        background-position: -200px 0;
    }
    100% {
        background-position: calc(200px + 100%) 0;
    }
}

.shimmer {
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    background-size: 200px 100%;
    animation: shimmer 2s ease-in-out infinite;
}

/* ===== ANIMACIONES DE TRANSICIÓN ===== */
.slide-in-left {
    transform: translateX(-100%);
    transition: transform 0.5s ease-in-out;
}

.slide-in-left.active {
    transform: translateX(0);
}

.slide-in-right {
    transform: translateX(100%);
    transition: transform 0.5s ease-in-out;
}

.slide-in-right.active {
    transform: translateX(0);
}

.zoom-in {
    transform: scale(0);
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.zoom-in.active {
    transform: scale(1);
}

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

.shake {
    animation: shake 0.82s cubic-bezier(.36,.07,.19,.97) both;
}

/* ===== ANIMACIONES DE CONTADOR ===== */
@keyframes countUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.count-animation {
    animation: countUp 0.5s ease forwards;
}

/* ===== MEDIA QUERIES PARA ANIMACIONES ===== */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ===== ANIMACIONES RESPONSIVAS ===== */
@media (max-width: 768px) {
    .animate-on-scroll {
        transform: translateY(30px);
    }
    
    .lift-hover:hover {
        transform: translateY(-4px);
    }
    
    .floating {
        animation-duration: 8s;
    }
}