/* 
=============================================================================
loader.css — Componente de loading moderno y profesional
Pautas:
  - [KEEP] No altera estilos existentes, solo añade el componente loader
  - [A11Y] Loader accesible con ARIA attributes
  - [PERF] Animaciones CSS optimizadas
=============================================================================
*/

/* Overlay semitransparente que cubre toda la pantalla */
.loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

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

/* Spinner moderno con gradiente */
.modern-spinner {
    width: 80px;
    height: 80px;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

.spinner-core {
    width: 60px;
    height: 60px;
    border: 4px solid transparent;
    border-top: 4px solid #3498db;
    border-right: 4px solid #2ecc71;
    border-bottom: 4px solid #e74c3c;
    border-left: 4px solid #f39c12;
    border-radius: 50%;
    animation: spin 1.2s cubic-bezier(0.68, -0.55, 0.265, 1.55) infinite;
    position: relative;
}

.spinner-core::before {
    content: '';
    position: absolute;
    top: -8px;
    left: -8px;
    right: -8px;
    bottom: -8px;
    border: 2px solid transparent;
    border-top: 2px solid #9b59b6;
    border-radius: 50%;
    animation: spinReverse 1.5s ease-in-out infinite;
}

.spinner-pulse {
    position: absolute;
    width: 80px;
    height: 80px;
    border: 2px solid rgba(52, 152, 219, 0.3);
    border-radius: 50%;
    animation: pulse 2s ease-out infinite;
}

/* Logo o icono central (opcional) */
.spinner-logo {
    position: absolute;
    width: 30px;
    height: 30px;
    background: url('../img/svg/icono.svg') center/contain no-repeat;
    z-index: 2;
}

/* Estados de carga */
.loader-dots::after {
    content: '';
    animation: dots 1.5s steps(5, end) infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes spinReverse {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(-720deg); }
}

@keyframes pulse {
    0% {
        transform: scale(0.8);
        opacity: 1;
    }
    70% {
        transform: scale(1.2);
        opacity: 0;
    }
    100% {
        transform: scale(0.8);
        opacity: 0;
    }
}

@keyframes dots {
    0%, 20% { content: ''; }
    40% { content: '.'; }
    60% { content: '..'; }
    80%, 100% { content: '...'; }
}

/* Variantes de color para diferentes vistas */
.loader-overlay.dashboard-theme {
    background: rgba(248, 250, 252, 0.98);
}

.loader-overlay.transfer-theme {
    background: rgba(240, 248, 255, 0.98);
}

.loader-overlay.dashboard-theme .spinner-core {
    border-top: 4px solid #0d6efd;
    border-right: 4px solid #198754;
    border-bottom: 4px solid #ffc107;
    border-left: 4px solid #0dcaf0;
}

/* Responsive */
@media (max-width: 768px) {
    .modern-spinner {
        width: 60px;
        height: 60px;
    }
    
    .spinner-core {
        width: 45px;
        height: 45px;
        border-width: 3px;
    }
    
    .spinner-pulse {
        width: 60px;
        height: 60px;
    }
    
    .spinner-logo {
        width: 24px;
        height: 24px;
    }
}