/**
 * Loading Indicators - Visual feedback for user actions
 * Incluye: Overlays, Skeletons, Progress bars, Spinners modernos
 */

/* ========================================
   LOADING OVERLAY CON BLUR
   ======================================== */
.loading-overlay-blur {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeIn 0.2s ease;
}

.loading-overlay-blur.dark {
    background: rgba(0, 0, 0, 0.7);
    color: white;
}

/* ========================================
   MODERN SPINNER
   ======================================== */
.modern-spinner {
    width: 60px;
    height: 60px;
    position: relative;
}

.modern-spinner-ring {
    width: 60px;
    height: 60px;
    border: 4px solid transparent;
    border-top-color: #0a5fb3;
    border-right-color: #4a90e2;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.modern-spinner-ring::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 3px solid transparent;
    border-top-color: #00c9ff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite reverse;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ========================================
   LOADING TEXT ANIMATOR
   ======================================== */
.loading-text {
    margin-top: 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    color: #0a5fb3;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.loading-text.dark {
    color: white;
}

.loading-dots::after {
    content: '...';
    display: inline-block;
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

/* ========================================
   PROGRESS BAR CON PORCENTAJE
   ======================================== */
.loading-progress-container {
    width: 300px;
    margin-top: 1rem;
}

.loading-progress-bar {
    height: 6px;
    background: #e9ecef;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.loading-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #0a5fb3, #4a90e2, #00c9ff);
    background-size: 200% 100%;
    border-radius: 10px;
    transition: width 0.3s ease;
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.loading-progress-text {
    text-align: center;
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: #6c757d;
    font-weight: 500;
}

/* ========================================
   SKELETON LOADING PARA CARDS
   ======================================== */
.skeleton-card {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 0.85rem;
    margin-bottom: 0.75rem;
    animation: pulse 1.5s ease-in-out infinite;
}

.skeleton-line {
    height: 12px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    border-radius: 4px;
    margin-bottom: 0.5rem;
    animation: shimmer 1.5s infinite;
}

.skeleton-line.title {
    height: 16px;
    width: 70%;
    margin-bottom: 0.75rem;
}

.skeleton-line.text {
    width: 100%;
}

.skeleton-line.text-short {
    width: 85%;
}

.skeleton-line.meta {
    height: 10px;
    width: 40%;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* ========================================
   MINI LOADER PARA TABS
   ======================================== */
.tab-loading-indicator {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    margin-left: 0.5rem;
}

/* ========================================
   TOAST NOTIFICATION DE PROGRESO
   ======================================== */
.progress-toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    padding: 1.25rem 1.5rem;
    min-width: 320px;
    z-index: 10000;
    animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.progress-toast-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.progress-toast-icon {
    width: 24px;
    height: 24px;
    color: #0a5fb3;
}

.progress-toast-title {
    font-weight: 600;
    font-size: 0.9rem;
    color: #212529;
    flex-grow: 1;
}

.progress-toast-close {
    background: none;
    border: none;
    color: #6c757d;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
}

.progress-toast-close:hover {
    color: #212529;
}

.progress-toast-body {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.progress-toast-message {
    font-size: 0.8rem;
    color: #6c757d;
}

.progress-toast-bar {
    height: 4px;
    background: #e9ecef;
    border-radius: 2px;
    overflow: hidden;
}

.progress-toast-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #0a5fb3, #00c9ff);
    border-radius: 2px;
    transition: width 0.3s ease;
}

/* ========================================
   INLINE LOADING (para tabs)
   ======================================== */
.inline-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    gap: 0.75rem;
}

.inline-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid #e9ecef;
    border-top-color: #0a5fb3;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.inline-loading-text {
    font-size: 0.85rem;
    color: #6c757d;
    font-weight: 500;
}

/* ========================================
   SUCCESS ANIMATION
   ======================================== */
.success-checkmark {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #10b981;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: scaleIn 0.3s ease;
}

.success-checkmark i {
    width: 32px;
    height: 32px;
    color: white;
}

@keyframes scaleIn {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* ========================================
   PULSING DOT (para indicar actividad)
   ======================================== */
.pulsing-dot {
    width: 8px;
    height: 8px;
    background: #0a5fb3;
    border-radius: 50%;
    animation: pulse-dot 1.5s ease-in-out infinite;
}

@keyframes pulse-dot {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.5;
        transform: scale(1.3);
    }
}

/* ========================================
   FADE ANIMATIONS
   ======================================== */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

.fade-in {
    animation: fadeIn 0.3s ease;
}

.fade-out {
    animation: fadeOut 0.3s ease;
}

/* ========================================
   SHIMMER EFFECT
   ======================================== */
.shimmer {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 768px) {
    .progress-toast {
        bottom: 1rem;
        right: 1rem;
        left: 1rem;
        min-width: auto;
    }
    
    .loading-progress-container {
        width: 100%;
        max-width: 250px;
    }
}

