/* =====================================================
   ANIMACIONES Y EFECTOS ESPECIALES - CORPTHIA
   Animaciones modernas con CSS puro y keyframes
   ===================================================== */

/* =====================================================
   1. ANIMACIÓN DE FLOTACIÓN
   Para elementos que flotan suavemente
   ===================================================== */
@keyframes float {
    0%, 100% {
        transform: translateY(0px) rotate(0deg);
    }
    25% {
        transform: translateY(-20px) rotate(2deg);
    }
    50% {
        transform: translateY(-10px) rotate(-2deg);
    }
    75% {
        transform: translateY(-25px) rotate(1deg);
    }
}

/* =====================================================
   2. ANIMACIÓN DE APARICIÓN (FADE IN)
   Para elementos que aparecen suavemente
   ===================================================== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.fade-in-delay {
    opacity: 0;
    animation: fadeIn 0.8s ease 0.2s forwards;
}

.fade-in-delay-2 {
    opacity: 0;
    animation: fadeIn 0.8s ease 0.4s forwards;
}

.fade-in-delay-3 {
    opacity: 0;
    animation: fadeIn 0.8s ease 0.6s forwards;
}

.fade-in-delay-4 {
    opacity: 0;
    animation: fadeIn 0.8s ease 0.8s forwards;
}

/* =====================================================
   3. ANIMACIÓN DE DESLIZAMIENTO
   Para elementos que entran desde los lados
   ===================================================== */
@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(50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.slide-in-left {
    animation: slideInLeft 0.6s ease forwards;
}

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

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

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

/* =====================================================
   4. ANIMACIÓN DE ESCALADO
   Para elementos que crecen al aparecer
   ===================================================== */
@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.scale-in {
    animation: scaleIn 0.5s ease forwards;
}

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

.scale-out {
    animation: scaleOut 0.3s ease forwards;
}

/* =====================================================
   5. ANIMACIÓN DE ROTACIÓN
   Para elementos giratorios
   ===================================================== */
@keyframes rotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.rotate {
    animation: rotate 2s linear infinite;
}

@keyframes rotateReverse {
    from {
        transform: rotate(360deg);
    }
    to {
        transform: rotate(0deg);
    }
}

.rotate-reverse {
    animation: rotateReverse 2s linear infinite;
}

/* =====================================================
   6. ANIMACIÓN DE PULSO
   Para elementos que laten
   ===================================================== */
@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.8;
    }
}

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

@keyframes pulseGlow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(99, 102, 241, 0.3);
    }
    50% {
        box-shadow: 0 0 40px rgba(99, 102, 241, 0.6);
    }
}

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

/* =====================================================
   7. ANIMACIÓN DE REBOTE
   Para elementos que rebotan
   ===================================================== */
@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    25% {
        transform: translateY(-10px);
    }
    50% {
        transform: translateY(0);
    }
    75% {
        transform: translateY(-5px);
    }
}

.bounce {
    animation: bounce 1s ease infinite;
}

@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.8s ease forwards;
}

/* =====================================================
   8. ANIMACIÓN DE ONDA / RIPPLE
   Para efectos de clic y expansión
   ===================================================== */
@keyframes ripple {
    0% {
        transform: scale(0);
        opacity: 1;
    }
    100% {
        transform: scale(4);
        opacity: 0;
    }
}

.ripple-effect {
    position: relative;
    overflow: hidden;
}

.ripple-effect::after {
    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;
}

.ripple-effect:active::after {
    width: 300px;
    height: 300px;
}

/* =====================================================
   9. ANIMACIÓN DE PARPADEO
   Para indicadores y notificaciones
   ===================================================== */
@keyframes blink {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.3;
    }
}

.blink {
    animation: blink 1.5s ease-in-out infinite;
}

/* =====================================================
   10. ANIMACIÓN DE GRADIENTE
   Para fondos con degradado animado
   ===================================================== */
@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

.gradient-animated {
    background-size: 200% 200%;
    animation: gradientShift 3s ease infinite;
}

/* =====================================================
   11. ANIMACIÓN DE CARGA / SPINNER
   Para indicadores de carga
   ===================================================== */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

@keyframes pulseCircle {
    0% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--color-gray-200);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* =====================================================
   12. ANIMACIÓN DE ENTRADA EN CASCADA
   Para elementos que aparecen en secuencia
   ===================================================== */
.stagger-animation > *:nth-child(1) { animation-delay: 0.1s; }
.stagger-animation > *:nth-child(2) { animation-delay: 0.2s; }
.stagger-animation > *:nth-child(3) { animation-delay: 0.3s; }
.stagger-animation > *:nth-child(4) { animation-delay: 0.4s; }
.stagger-animation > *:nth-child(5) { animation-delay: 0.5s; }
.stagger-animation > *:nth-child(6) { animation-delay: 0.6s; }
.stagger-animation > *:nth-child(7) { animation-delay: 0.7s; }
.stagger-animation > *:nth-child(8) { animation-delay: 0.8s; }
.stagger-animation > *:nth-child(9) { animation-delay: 0.9s; }
.stagger-animation > *:nth-child(10) { animation-delay: 1s; }

/* =====================================================
   13. EFECTO HOVER 3D
   Para tarjetas con efecto de profundidad
   ===================================================== */
.hover-3d {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    transform-style: preserve-3d;
}

.hover-3d:hover {
    transform: perspective(1000px) rotateX(5deg) rotateY(-5deg) translateZ(10px);
    box-shadow: -10px 10px 30px rgba(0, 0, 0, 0.2);
}

/* =====================================================
   14. EFECTO DE BRILLO
   Para elementos brillantes
   ===================================================== */
@keyframes shine {
    0% {
        background-position: -100%;
    }
    100% {
        background-position: 200%;
    }
}

.shine-effect {
    position: relative;
    overflow: hidden;
}

.shine-effect::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    animation: shine 2s infinite;
}

/* =====================================================
   15. ANIMACIÓN DE SACUDIDA
   Para errores o alertas
   ===================================================== */
@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;
}

/* =====================================================
   16. EFECTO DE ENFOQUE
   Para resaltar elementos
   ===================================================== */
@keyframes focusGlow {
    0%, 100% {
        filter: brightness(1);
    }
    50% {
        filter: brightness(1.2);
    }
}

.focus-glow {
    animation: focusGlow 2s ease infinite;
}

/* =====================================================
   17. ANIMACIÓN DE CAÍDA
   Para elementos que caen
   ===================================================== */
@keyframes dropIn {
    from {
        opacity: 0;
        transform: translateY(-100px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.drop-in {
    animation: dropIn 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
}

/* =====================================================
   18. EFECTO DE NEÓN
   Para texto o bordes brillantes
   ===================================================== */
@keyframes neonGlow {
    0%, 100% {
        text-shadow: 
            0 0 5px #fff,
            0 0 10px #fff,
            0 0 20px var(--color-primary),
            0 0 40px var(--color-primary),
            0 0 80px var(--color-primary);
    }
    50% {
        text-shadow: 
            0 0 10px #fff,
            0 0 20px var(--color-primary),
            0 0 40px var(--color-primary),
            0 0 80px var(--color-primary),
            0 0 120px var(--color-primary);
    }
}

.neon-text {
    animation: neonGlow 1.5s ease-in-out infinite;
}

/* =====================================================
   19. ANIMACIÓN DE PARTÍCULAS
   Para efectos decorativos
   ===================================================== */
@keyframes particleFloat {
    0%, 100% {
        transform: translate(0, 0) rotate(0deg);
        opacity: 1;
    }
    33% {
        transform: translate(30px, -30px) rotate(120deg);
        opacity: 0.7;
    }
    66% {
        transform: translate(-20px, 20px) rotate(240deg);
        opacity: 0.5;
    }
}

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

/* =====================================================
   20. CLASES DE UTILIDAD PARA ANIMACIONES
   Clases para controlar animaciones
   ===================================================== */

/* Pausar animación */
.animation-paused {
    animation-play-state: paused;
}

/* Repetir animación */
.animation-infinite {
    animation-iteration-count: infinite;
}

/* Velocidades */
.animation-slow {
    animation-duration: 1s;
}

.animation-fast {
    animation-duration: 0.3s;
}

/* Retrasos */
.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;
}

/* =====================================================
   21. ANIMACIONES DE SCROLL (INTERSECTION OBSERVER)
   Clases para activar animaciones al hacer scroll
   ===================================================== */
.animate-on-scroll {
    opacity: 0;
    transform: translateY(50px);
    transition: all 0.8s ease;
}

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

/* Variantes de dirección */
.animate-on-scroll.from-left {
    transform: translateX(-100px);
}

.animate-on-scroll.from-right {
    transform: translateX(100px);
}

.animate-on-scroll.from-bottom {
    transform: translateY(100px);
}

.animate-on-scroll.from-top {
    transform: translateY(-100px);
}

.animate-on-scroll.visible.from-left,
.animate-on-scroll.visible.from-right,
.animate-on-scroll.visible.from-bottom,
.animate-on-scroll.visible.from-top {
    transform: translate(0);
}

/* =====================================================
   22. EFECTO PARALLAX
   Para elementos con efecto de profundidad al scroll
   ===================================================== */
.parallax {
    transition: transform 0.1s ease-out;
}

/* =====================================================
   23. TRANSICIONES SUAVES
   Para todos los elementos interactivos
   ===================================================== */
a,
button,
.card,
.input {
    transition: all 0.3s ease;
}

/* =====================================================
   24. EFECTO GLASSMORPHISM
   Para elementos con efecto de vidrio
   ===================================================== */
.glass-effect {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.glass-dark {
    background: rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* =====================================================
   25. EFECTO DE SKEUOMORFISMO MODERNO
   Para botones y elementos táctiles
   ===================================================== */
.soft-shadow {
    box-shadow: 
        0 10px 15px -3px rgba(0, 0, 0, 0.1),
        0 4px 6px -2px rgba(0, 0, 0, 0.05),
        inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.pressed {
    transform: scale(0.98);
    box-shadow: 
        0 2px 4px rgba(0, 0, 0, 0.1),
        inset 0 2px 4px rgba(0, 0, 0, 0.1);
}
