/* ================================================
   LOADERS MODERNOS PARA DREAMSPOS
   ================================================ */

/* ================================================
   1. LOADER PRINCIPAL (Pantalla Completa)
   ================================================ */
.page-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.page-loader.hidden {
    opacity: 0;
    pointer-events: none;
}

/* Spinner circular moderno */
.spinner-modern {
    width: 60px;
    height: 60px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #556ee6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Loader con puntos */
.dots-loader {
    display: flex;
    gap: 10px;
}

.dots-loader .dot {
    width: 15px;
    height: 15px;
    background: #556ee6;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

.dots-loader .dot:nth-child(1) { animation-delay: -0.32s; }
.dots-loader .dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce {
    0%, 80%, 100% { 
        transform: scale(0);
        opacity: 0.5;
    }
    40% { 
        transform: scale(1);
        opacity: 1;
    }
}

/* Loader tipo barras */
.bars-loader {
    display: flex;
    gap: 5px;
    align-items: flex-end;
    height: 50px;
}

.bars-loader .bar {
    width: 8px;
    background: #556ee6;
    animation: grow 1.2s ease-in-out infinite;
}

.bars-loader .bar:nth-child(1) { animation-delay: -0.4s; }
.bars-loader .bar:nth-child(2) { animation-delay: -0.3s; }
.bars-loader .bar:nth-child(3) { animation-delay: -0.2s; }
.bars-loader .bar:nth-child(4) { animation-delay: -0.1s; }

@keyframes grow {
    0%, 100% { height: 10px; }
    50% { height: 50px; }
}

/* ================================================
   2. LOADER PARA BOTONES
   ================================================ */
.btn-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.btn-loading::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid transparent;
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.btn-loading .btn-text {
    visibility: hidden;
}

/* ================================================
   3. LOADER PARA LOGIN
   ================================================ */
.login-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.5s ease;
}

.login-loader.fade-out {
    opacity: 0;
    pointer-events: none;
}

.login-loader-content {
    text-align: center;
    color: white;
}

.login-loader-content h2 {
    margin-top: 20px;
    font-weight: 300;
    font-size: 24px;
}

/* Loader circular con brillo */
.circle-loader {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 8px solid rgba(255, 255, 255, 0.2);
    border-top-color: #fff;
    animation: spin 1s linear infinite;
    position: relative;
}

.circle-loader::after {
    content: "";
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 8px solid transparent;
    border-top-color: rgba(255, 255, 255, 0.5);
    top: -8px;
    left: -8px;
    animation: spin 1.5s linear infinite reverse;
}

/* ================================================
   4. LOADER PARA TABLAS
   ================================================ */
.table-loading {
    position: relative;
}

.table-loading::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    z-index: 10;
}

.table-loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #556ee6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 11;
}

/* ================================================
   5. SKELETON LOADER (Efecto de carga de contenido)
   ================================================ */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: 4px;
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-text {
    height: 12px;
    margin-bottom: 8px;
}

.skeleton-title {
    height: 20px;
    width: 60%;
    margin-bottom: 16px;
}

.skeleton-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
}

/* ================================================
   6. PROGRESS BAR LOADER
   ================================================ */
.progress-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: #f3f3f3;
    z-index: 9999;
    overflow: hidden;
}

.progress-loader-bar {
    height: 100%;
    background: linear-gradient(90deg, #556ee6, #34c38f, #556ee6);
    background-size: 200% 100%;
    animation: progress-slide 2s ease-in-out infinite;
}

@keyframes progress-slide {
    0% { 
        transform: translateX(-100%);
        width: 30%;
    }
    50% {
        width: 50%;
    }
    100% { 
        transform: translateX(400%);
        width: 30%;
    }
}

/* ================================================
   7. LOADER TIPO PULSO
   ================================================ */
.pulse-loader {
    width: 80px;
    height: 80px;
    position: relative;
}

.pulse-loader .pulse-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 4px solid #556ee6;
    border-radius: 50%;
    animation: pulse 2s ease-out infinite;
}

.pulse-loader .pulse-ring:nth-child(2) {
    animation-delay: 0.5s;
}

.pulse-loader .pulse-ring:nth-child(3) {
    animation-delay: 1s;
}

@keyframes pulse {
    0% {
        transform: scale(0.5);
        opacity: 1;
    }
    100% {
        transform: scale(1.2);
        opacity: 0;
    }
}

/* ================================================
   8. LOADER CON TEXTO ANIMADO
   ================================================ */
.typing-loader {
    display: flex;
    align-items: center;
    gap: 10px;
}

.typing-loader span {
    font-size: 18px;
    color: #556ee6;
    animation: typing 1.4s infinite;
}

.typing-loader span:nth-child(2) { animation-delay: 0.2s; }
.typing-loader span:nth-child(3) { animation-delay: 0.4s; }
.typing-loader span:nth-child(4) { animation-delay: 0.6s; }

@keyframes typing {
    0%, 60%, 100% { opacity: 0.3; }
    30% { opacity: 1; }
}

/* ================================================
   9. LOADER TIPO SPINNER DUAL
   ================================================ */
.dual-spinner {
    width: 60px;
    height: 60px;
    position: relative;
}

.dual-spinner::before,
.dual-spinner::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    border: 3px solid transparent;
}

.dual-spinner::before {
    width: 100%;
    height: 100%;
    border-top-color: #556ee6;
    animation: spin 1.5s linear infinite;
}

.dual-spinner::after {
    width: 70%;
    height: 70%;
    top: 15%;
    left: 15%;
    border-top-color: #34c38f;
    animation: spin 1s linear infinite reverse;
}

/* ================================================
   10. UTILIDADES
   ================================================ */
.overlay-dark {
    background: rgba(0, 0, 0, 0.7) !important;
}

.overlay-light {
    background: rgba(255, 255, 255, 0.95) !important;
}

.loader-sm {
    transform: scale(0.7);
}

.loader-lg {
    transform: scale(1.3);
}

/* Centrar loader en contenedor */
.loader-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 200px;
}

/* ================================================
   11. ANIMACIONES DE ENTRADA/SALIDA
   ================================================ */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-20px);
    }
}

.fade-in {
    animation: fadeIn 0.3s ease;
}

.fade-out {
    animation: fadeOut 0.3s ease;
}

/* ================================================
   12. LOADER ESPECÍFICO PARA DREAMSPOS
   ================================================ */
.dreamspos-loader {
    text-align: center;
}

.dreamspos-loader .logo {
    width: 100px;
    height: 100px;
    margin-bottom: 20px;
    animation: pulse-logo 2s ease-in-out infinite;
}

@keyframes pulse-logo {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.dreamspos-loader p {
    color: #666;
    font-size: 14px;
    margin-top: 10px;
}