/* 
===================================================
ANIMATIONS - Optimizadas para fluidez máxima
===================================================
Principios de optimización:
1. Solo animar transform y opacity (propiedades compositing del GPU)
2. Duraciones más cortas al cambiar de vista (150ms vs 500ms)
3. will-change aplicado solo donde se necesita
4. prefers-reduced-motion para accesibilidad
*/

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }  /* Reducido de 10px */
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInFast {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInRight {
    from { transform: translateX(12px); opacity: 0; } /* Reducido de 20px */
    to { transform: translateX(0); opacity: 1; }
}

@keyframes pulse-soft {
    0% { transform: scale(1); }
    50% { transform: scale(1.04); } /* Reducido de 1.05 */
    100% { transform: scale(1); }
}

/* Animación de entrada para vistas - RÁPIDA para sensación fluida */
.fade-in {
    animation: fadeInFast 0.18s ease-out forwards; /* Reducido de 0.5s */
}

/* Para contenido de página - sin delay innecesario */
#content-area {
    animation: none !important; /* Quitar animación del contenedor exterior */
}

#view-container {
    animation: fadeInFast 0.15s ease-out;
    will-change: opacity; /* Pre-promover para transiciones suaves */
}

/* Vista cargando: entrada suave del contenido nuevo */
.view-enter {
    animation: fadeInFast 0.18s ease-out forwards;
}

.slide-in {
    animation: slideInRight 0.22s ease-out forwards;
}

/* Delays mínimos para evitar sensación de lag */
.delay-1 { animation-delay: 0.05s; } /* Reducido de 0.1s */
.delay-2 { animation-delay: 0.1s; }  /* Reducido de 0.2s */
.delay-3 { animation-delay: 0.15s; } /* Reducido de 0.3s */

/* Loading skeleton */
@keyframes shimmer {
    0% { background-position: -800px 0; }
    100% { background-position: 800px 0; }
}

.skeleton {
    display: inline-block;
    height: 1em;
    position: relative;
    overflow: hidden;
    background-color: var(--bg-hover);
    border-radius: 4px;
}

.skeleton::after {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    transform: translateX(-100%);
    background-image: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0) 0,
        rgba(255, 255, 255, 0.2) 20%,
        rgba(255, 255, 255, 0.5) 60%,
        rgba(255, 255, 255, 0)
    );
    animation: shimmer 2s infinite;
    content: '';
}

.dark-mode .skeleton::after {
    background-image: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0) 0,
        rgba(255, 255, 255, 0.05) 20%,
        rgba(255, 255, 255, 0.1) 60%,
        rgba(255, 255, 255, 0)
    );
}

/* Interactive Card Micro-Animations */
.card-interactive {
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.3s ease;
    will-change: transform, box-shadow;
}

.card-interactive:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px -10px rgba(0, 0, 0, 0.15);
}

.btn-interactive {
    transition: all 0.2s ease;
}

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

/* Respetar preferencias 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;
    }
    body::before, body::after {
        animation: none !important;
    }
}
