/**
 * EFECTOS DE CARGA MODERNOS
 * Spinners, skeletons y animaciones de carga
 */

/* ============================================
   PRELOADER GLOBAL
   ============================================ */
.page-preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.page-preloader.hidden {
    opacity: 0;
    visibility: hidden;
}

.preloader-content {
    text-align: center;
    color: white;
}

.preloader-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

.preloader-text {
    font-size: 1.2rem;
    font-weight: 600;
    margin-top: 20px;
    animation: pulse 2s ease-in-out infinite;
}

/* ============================================
   SPINNERS VARIADOS
   ============================================ */
.spinner-dots {
    display: inline-flex;
    gap: 8px;
}

.spinner-dots div {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #667eea;
    animation: bounce 1.4s ease-in-out infinite both;
}

.spinner-dots div:nth-child(1) {
    animation-delay: -0.32s;
}

.spinner-dots div:nth-child(2) {
    animation-delay: -0.16s;
}

.spinner-dots div:nth-child(3) {
    animation-delay: 0;
}

@keyframes bounce {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1);
    }
}

.spinner-bars {
    display: inline-flex;
    gap: 4px;
    align-items: center;
}

.spinner-bars div {
    width: 4px;
    height: 40px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 2px;
    animation: barAnimation 1.2s ease-in-out infinite;
}

.spinner-bars div:nth-child(1) {
    animation-delay: -1.1s;
}

.spinner-bars div:nth-child(2) {
    animation-delay: -1.0s;
}

.spinner-bars div:nth-child(3) {
    animation-delay: -0.9s;
}

.spinner-bars div:nth-child(4) {
    animation-delay: -0.8s;
}

.spinner-bars div:nth-child(5) {
    animation-delay: -0.7s;
}

@keyframes barAnimation {
    0%, 40%, 100% {
        transform: scaleY(0.4);
    }
    20% {
        transform: scaleY(1);
    }
}

.spinner-pulse {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    animation: pulseScale 1.5s ease-in-out infinite;
}

@keyframes pulseScale {
    0%, 100% {
        transform: scale(0.8);
        opacity: 1;
    }
    50% {
        transform: scale(1.2);
        opacity: 0.7;
    }
}

/* ============================================
   SKELETON LOADERS MEJORADOS
   ============================================ */
.skeleton-wrapper {
    animation: fadeIn 0.3s ease;
}

.skeleton-card {
    background: white;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    margin-bottom: 20px;
}

.skeleton-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

.skeleton-line {
    height: 16px;
    border-radius: 8px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    margin-bottom: 12px;
}

.skeleton-line-short {
    width: 60%;
}

.skeleton-line-medium {
    width: 80%;
}

.skeleton-line-long {
    width: 100%;
}

.skeleton-image {
    width: 100%;
    height: 200px;
    border-radius: 12px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    margin-bottom: 16px;
}

/* ============================================
   LOADING OVERLAY
   ============================================ */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.loading-overlay.active {
    opacity: 1;
    visibility: visible;
}

.loading-overlay-content {
    background: white;
    border-radius: 20px;
    padding: 32px;
    text-align: center;
    box-shadow: 0 12px 40px rgba(0,0,0,0.2);
    animation: scaleIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================
   BUTTON LOADING STATE
   ============================================ */
.btn-loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.btn-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.btn-loading.btn-outline-primary::after {
    border-color: rgba(102,126,234,0.3);
    border-top-color: #667eea;
}

/* ============================================
   PROGRESS INDICATOR
   ============================================ */
.progress-indicator {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    z-index: 10000;
    transition: width 0.3s ease;
    box-shadow: 0 2px 8px rgba(102,126,234,0.4);
}

/* ============================================
   INFINITE SCROLL LOADER
   ============================================ */
.infinite-scroll-loader {
    text-align: center;
    padding: 40px 20px;
}

.infinite-scroll-loader .spinner {
    margin: 0 auto;
}

.infinite-scroll-loader p {
    margin-top: 16px;
    color: #6b7280;
    font-weight: 500;
}

/* ============================================
   LAZY LOAD PLACEHOLDER
   ============================================ */
.lazy-load-placeholder {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9ca3af;
    font-size: 0.875rem;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .preloader-spinner {
        width: 40px;
        height: 40px;
    }
    
    .preloader-text {
        font-size: 1rem;
    }
    
    .loading-overlay-content {
        padding: 24px;
    }
}
















