/* ============================================
   PAGE LOADER Y LIST LOADER - ESTILOS CORPORATIVOS
   Paleta: #AF87BC, #BF98C6, #815491, #4A3B4F
   ============================================ */

/* ------------------------------
   PAGE LOADER (Full Screen)
   ------------------------------ */
.page-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--gradient-loader) !important;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.5s ease-in-out, visibility 0.5s ease-in-out;
}

.page-loader.fade-out {
    opacity: 0;
    visibility: hidden;
}

.loader-content {
    position: relative;
    text-align: center;
}

/* Logo animado */
.logo-loader {
    margin-bottom: 2rem;
    animation: pulseLogo 1.5s ease-in-out infinite;
}

.logo-loader img {
    width: 80px;
    height: auto;
    filter: drop-shadow(0 0 10px rgba(175, 135, 188, 0.5));
}

/* Spinner principal */
.loader-spinner {
    position: relative;
    width: 80px;
    height: 80px;
    margin: 0 auto 1.5rem;
}

.loader-spinner .circle {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 3px solid transparent;
    border-top-color: var(--accent-primary);
    border-right-color: var(--accent-primary-light);
    animation: spin 1s linear infinite;
}

.loader-spinner .circle-2 {
    width: 70%;
    height: 70%;
    top: 15%;
    left: 15%;
    border-top-color: var(--accent-secondary);
    border-right-color: var(--accent-tertiary);
    animation: spin 1.5s linear infinite reverse;
}

/* Texto de carga */
.loader-text {
    margin-top: 1.5rem;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-weight: 500;
    letter-spacing: 2px;
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-primary-light) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    font-size: 0.9rem;
    animation: fadeText 1.2s ease-in-out infinite;
}

/* Puntos animados */
.loader-dots {
    display: inline-flex;
    gap: 4px;
    margin-left: 5px;
}

.loader-dots span {
    width: 6px;
    height: 6px;
    background: var(--accent-primary);
    border-radius: 50%;
    display: inline-block;
    animation: bounce 1.4s ease-in-out infinite;
}

.loader-dots span:nth-child(1) { animation-delay: 0s; }
.loader-dots span:nth-child(2) { animation-delay: 0.2s; }
.loader-dots span:nth-child(3) { animation-delay: 0.4s; }

/* ------------------------------
   LIST LOADER (Componentes)
   ------------------------------ */
.list-loader {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 2rem;
}

.list-loader span {
    width: 10px;
    height: 10px;
    background: var(--accent-primary);
    border-radius: 50%;
    display: inline-block;
    animation: pulseScale 1.2s ease-in-out infinite;
}

.list-loader span:nth-child(1) { animation-delay: 0s; }
.list-loader span:nth-child(2) { animation-delay: 0.1s; }
.list-loader span:nth-child(3) { animation-delay: 0.2s; }
.list-loader span:nth-child(4) { animation-delay: 0.3s; }
.list-loader span:nth-child(5) { animation-delay: 0.4s; }
.list-loader span:nth-child(6) { animation-delay: 0.5s; }

/* Variante para tablas */
.table-loader {
    position: relative;
    min-height: 200px;
}

.table-loader .list-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* Skeleton Loader para tarjetas */
.skeleton-card {
    background: linear-gradient(
        90deg,
        rgba(175, 135, 188, 0.05) 25%,
        rgba(175, 135, 188, 0.1) 50%,
        rgba(175, 135, 188, 0.05) 75%
    );
    background-size: 200% 100%;
    animation: skeletonLoading 1.5s infinite;
    border-radius: 16px;
}

.skeleton-text {
    height: 12px;
    background: rgba(175, 135, 188, 0.1);
    border-radius: 6px;
    margin-bottom: 8px;
}

.skeleton-text-sm {
    width: 60%;
    height: 10px;
}

.skeleton-text-lg {
    width: 80%;
    height: 16px;
}

.skeleton-circle {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(175, 135, 188, 0.1);
}

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

@keyframes pulseLogo {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }
}

@keyframes fadeText {
    0%, 100% {
        opacity: 0.6;
    }
    50% {
        opacity: 1;
    }
}

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

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

@keyframes skeletonLoading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* ------------------------------
   UTILIDADES PARA LOADER
   ------------------------------ */
.no-scroll {
    overflow: hidden;
}

/* Loader transparente para contenido dinámico */
.loader-overlay {
    position: relative;
}

.loader-overlay::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 12, 16, 0.7);
    backdrop-filter: blur(4px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Loader tipo onda (alternativo) */
.loader-wave {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.loader-wave span {
    width: 4px;
    height: 30px;
    background: var(--accent-primary);
    border-radius: 2px;
    animation: wave 1s ease-in-out infinite;
}

.loader-wave span:nth-child(1) { animation-delay: 0s; height: 20px; }
.loader-wave span:nth-child(2) { animation-delay: 0.1s; height: 35px; }
.loader-wave span:nth-child(3) { animation-delay: 0.2s; height: 45px; }
.loader-wave span:nth-child(4) { animation-delay: 0.3s; height: 35px; }
.loader-wave span:nth-child(5) { animation-delay: 0.4s; height: 20px; }

@keyframes wave {
    0%, 100% {
        transform: scaleY(0.6);
        opacity: 0.5;
    }
    50% {
        transform: scaleY(1);
        opacity: 1;
    }
}

/* Loader tipo círculos rotatorios (alternativo) */
.loader-rings {
    position: relative;
    width: 60px;
    height: 60px;
}

.loader-rings div {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 3px solid transparent;
    border-radius: 50%;
    animation: ringsRotate 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
}

.loader-rings div:nth-child(1) {
    border-top-color: var(--accent-primary);
    animation-delay: -0.45s;
}

.loader-rings div:nth-child(2) {
    border-right-color: var(--accent-primary-light);
    animation-delay: -0.3s;
}

.loader-rings div:nth-child(3) {
    border-bottom-color: var(--accent-secondary);
    animation-delay: -0.15s;
}

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

/* Responsive */
@media (max-width: 768px) {
    .logo-loader img {
        width: 60px;
    }
    
    .loader-spinner {
        width: 60px;
        height: 60px;
    }
    
    .loader-text {
        font-size: 0.8rem;
    }
}

/* Texto del logo en loader */
.logo-loader-text {
    font-size: 2rem;
    font-weight: 800;
    background: linear-gradient(135deg, #fff 0%, var(--accent-primary) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: pulseLogo 1.5s ease-in-out infinite;
    margin-bottom: 1rem;
}