/**
 * Animaciones - Sistema de Enlaces
 * Versión: 3.0
 * Inspirado en AdminLTE y diseños modernos
 */

/* ============================================
   KEYFRAMES - Animaciones base
   ============================================ */

/* Fade In desde abajo */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Fade In desde arriba */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Fade In desde la izquierda */
@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Fade In desde la derecha */
@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Zoom In */
@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.85);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Zoom Out */
@keyframes zoomOut {
    from {
        opacity: 1;
        transform: scale(1);
    }
    to {
        opacity: 0;
        transform: scale(0.85);
    }
}

/* Bounce (rebote) */
@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

/* Pulse (latido) */
@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.9;
    }
}

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

/* Spinner de carga */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Shimmer effect (skeleton loading) */
@keyframes shimmer {
    0% {
        background-position: -468px 0;
    }
    100% {
        background-position: 468px 0;
    }
}

/* Progress bar animation */
@keyframes progress {
    from {
        width: 0%;
    }
}

/* Slide Down (para dropdowns) */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Flip (voltear) */
@keyframes flip {
    from {
        transform: perspective(400px) rotateY(90deg);
        opacity: 0;
    }
    to {
        transform: perspective(400px) rotateY(0deg);
        opacity: 1;
    }
}

/* Glow (brillo) */
@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(137, 79, 160, 0.5);
    }
    50% {
        box-shadow: 0 0 20px rgba(137, 79, 160, 0.8);
    }
}

/* ============================================
   CLASES DE ANIMACIÓN REUTILIZABLES
   ============================================ */

/* Fade animations */
.animate-fadeIn {
    animation: fadeInUp 0.5s ease-out;
}

.animate-fadeInUp {
    animation: fadeInUp 0.5s ease-out;
}

.animate-fadeInDown {
    animation: fadeInDown 0.5s ease-out;
}

.animate-fadeInLeft {
    animation: fadeInLeft 0.5s ease-out;
}

.animate-fadeInRight {
    animation: fadeInRight 0.5s ease-out;
}

/* Zoom animations */
.animate-zoomIn {
    animation: zoomIn 0.4s ease-out;
}

.animate-zoomOut {
    animation: zoomOut 0.4s ease-out;
}

/* Bounce */
.animate-bounce {
    animation: bounce 1s infinite;
}

/* Pulse */
.animate-pulse {
    animation: pulse 2s infinite;
}

/* Shake */
.animate-shake {
    animation: shake 0.5s ease-out;
}

/* Spin */
.animate-spin {
    animation: spin 1s linear infinite;
}

/* Flip */
.animate-flip {
    animation: flip 0.6s ease-out;
}

/* Glow */
.animate-glow {
    animation: glow 2s infinite;
}

/* ============================================
   DELAYS PARA ANIMACIONES ESCALONADAS
   ============================================ */
.delay-100 { animation-delay: 0.1s; }
.delay-200 { animation-delay: 0.2s; }
.delay-300 { animation-delay: 0.3s; }
.delay-400 { animation-delay: 0.4s; }
.delay-500 { animation-delay: 0.5s; }
.delay-600 { animation-delay: 0.6s; }
.delay-700 { animation-delay: 0.7s; }
.delay-800 { animation-delay: 0.8s; }

/* ============================================
   ANIMACIONES ESPECÍFICAS DE PÁGINAS
   ============================================ */

/* Login page */
.login-form-container {
    animation: fadeInRight 0.6s ease-out;
}

.brand-logo {
    animation: zoomIn 0.8s ease-out;
}

.brand-features .brand-feature {
    animation: fadeInLeft 0.6s ease-out;
    animation-fill-mode: both;
}

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

/* Dashboard cards */
.stat-card {
    animation: fadeInUp 0.5s ease-out;
    animation-fill-mode: both;
}

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

/* Alertas */
.alert {
    animation: fadeInDown 0.4s ease-out;
}

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

/* Tablas */
.table tbody tr {
    animation: fadeInUp 0.3s ease-out;
    animation-fill-mode: both;
}

/* Navbar */
.navbar {
    animation: fadeInDown 0.5s ease-out;
}

/* ============================================
   LOADING STATES
   ============================================ */

/* Skeleton loading */
.skeleton {
    background: linear-gradient(
        90deg,
        var(--border-color) 25%,
        var(--bg-card) 50%,
        var(--border-color) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 4px;
}

.skeleton-text {
    height: 1rem;
    margin-bottom: 0.5rem;
}

.skeleton-title {
    height: 1.5rem;
    width: 60%;
    margin-bottom: 1rem;
}

.skeleton-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
}

/* Spinner */
.spinner {
    animation: spin 1s linear infinite;
}

/* Loading overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeInUp 0.3s ease-out;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--color-icon);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* ============================================
   HOVER EFFECTS - Estilo AdminLTE
   ============================================ */

/* Lift effect (levantar) */
.hover-lift {
    transition: all 0.3s ease;
}

.hover-lift:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

/* Glow effect */
.hover-glow:hover {
    box-shadow: 0 0 15px rgba(137, 79, 160, 0.5);
}

/* Scale effect */
.hover-scale {
    transition: transform 0.3s ease;
}

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

/* Brightness effect */
.hover-brightness {
    transition: filter 0.3s ease;
}

.hover-brightness:hover {
    filter: brightness(1.1);
}

/* ============================================
   TRANSICIONES SUAVES
   ============================================ */

/* Smooth all */
.transition-all {
    transition: all 0.3s ease;
}

.transition-fast {
    transition: all 0.15s ease;
}

.transition-slow {
    transition: all 0.5s ease;
}

/* ============================================
   ANIMACIONES DE ENTRADA/SALIDA
   ============================================ */

/* Fade enter/leave */
.fade-enter {
    animation: fadeInUp 0.3s ease-out;
}

.fade-leave {
    animation: zoomOut 0.3s ease-out;
}

/* ============================================
   EFECTOS ESPECIALES
   ============================================ */

/* Typing effect (simulado con CSS) */
@keyframes typing {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

.typing-effect {
    overflow: hidden;
    white-space: nowrap;
    animation: typing 3s steps(40, end);
}

/* Gradient animation */
@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;
}

/* ============================================
   UTILITIES
   ============================================ */

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

/* Sin animación (para accesibilidad) */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

