/* =============================================
   LOADER - Pantalla de Carga
   ============================================= */

   .loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--royal-blue);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: var(--z-loader);
    transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Estado oculto */
.loader.hidden {
    opacity: 0;
    pointer-events: none;
}

/* Contenedor del contenido */
.loader-content {
    text-align: center;
    position: relative;
}

/* Logo del loader */
.loader-logo {
    width: 360px;
    height: 360px;
    margin: 0 auto 20px;
    opacity: 0;
    animation: fadeInLogo 1s ease forwards;
    position: relative;
}

@keyframes fadeInLogo {
    to { 
        opacity: 1;
    }
}

.loader-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 10px 30px rgba(104, 175, 181, 0.3));
    animation: softGlow 3s ease-in-out infinite;
}

@keyframes softGlow {
    0%, 100% {
        filter: drop-shadow(0 0 20px rgba(104, 175, 181, 0.4))
                drop-shadow(0 0 40px rgba(21, 113, 112, 0.3))
                brightness(1);
    }
    50% {
        filter: drop-shadow(0 0 30px rgba(104, 175, 181, 0.7))
                drop-shadow(0 0 60px rgba(21, 113, 112, 0.5))
                brightness(1.1);
    }
}

/* Efecto de pulso en el logo */
.loader-logo::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 150%;
    height: 150%;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle, 
        rgba(104, 175, 181, 0.1) 0%, 
        transparent 70%
    );
    animation: pulse-ring 2s ease infinite;
}

@keyframes pulse-ring {
    0% {
        transform: translate(-50%, -50%) scale(0.8);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(1.5);
        opacity: 0;
    }
}

/* Texto del loader */
.loader-text {
    color: var(--soft-aqua);
    font-family: var(--font-secondary);
    font-size: 1.2rem;
    letter-spacing: 3px;
    text-transform: uppercase;
    opacity: 0;
    animation: fadeInText 1s ease 0.5s forwards;
    position: relative;
}

@keyframes fadeInText {
    to { 
        opacity: 1;
    }
}

/* Animación de puntos de carga */
.loader-text::after {
    content: '';
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    margin-left: 5px;
    animation: loadingDots 1.5s infinite;
}

@keyframes loadingDots {
    0% { content: ''; }
    25% { content: '.'; }
    50% { content: '..'; }
    75% { content: '...'; }
    100% { content: ''; }
}

/* Barra de progreso opcional */
.loader-progress {
    width: 200px;
    height: 2px;
    background: rgba(255, 255, 255, 0.1);
    margin: 20px auto 0;
    position: relative;
    overflow: hidden;
    opacity: 0;
    animation: fadeIn 0.5s ease 1s forwards;
}

.loader-progress-bar {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: var(--soft-aqua);
    animation: progress 2s ease-in-out infinite;
}

@keyframes progress {
    0% {
        width: 0;
        left: 0;
    }
    50% {
        width: 100%;
        left: 0;
    }
    100% {
        width: 0;
        left: 100%;
    }
}

/* Versión mínima del loader */
.loader-minimal {
    background: rgba(0, 0, 0, 0.9);
}

.loader-minimal .loader-content {
    width: 50px;
    height: 50px;
}

.loader-minimal .loader-logo,
.loader-minimal .loader-text {
    display: none;
}

.loader-minimal::after {
    content: '';
    width: 50px;
    height: 50px;
    border: 3px solid transparent;
    border-top-color: var(--soft-aqua);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

@keyframes spin {
    from { transform: translate(-50%, -50%) rotate(0deg); }
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Loader con porcentaje */
.loader-percentage {
    margin-top: 15px;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.5);
    font-family: monospace;
    opacity: 0;
    animation: fadeIn 0.5s ease 0.8s forwards;
}

/* =============================================
   RESPONSIVE
   ============================================= */

@media (max-width: 768px) {
    .loader-logo {
        width: 200px;
        height: 200px;
    }
    
    .loader-text {
        font-size: 1rem;
        letter-spacing: 2px;
    }
    
    .loader-progress {
        width: 150px;
    }
}

@media (max-width: 480px) {
    .loader-logo {
        width: 160px;
        height: 160px;
    }
    
    .loader-text {
        font-size: 0.9rem;
    }
}

/* =============================================
   SKELETON LOADERS - Para carga de contenido
   ============================================= */

.skeleton {
    position: relative;
    overflow: hidden;
    background: var(--dim-gray);
}

.skeleton::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.05),
        transparent
    );
    animation: skeleton-loading 2s ease-in-out infinite;
}

@keyframes skeleton-loading {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* Variantes de skeleton */
.skeleton-text {
    height: 14px;
    margin-bottom: 8px;
    border-radius: 4px;
}

.skeleton-title {
    height: 24px;
    margin-bottom: 12px;
    width: 60%;
    border-radius: 4px;
}

.skeleton-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.skeleton-button {
    width: 120px;
    height: 36px;
    border-radius: 0;
}

.skeleton-card {
    height: 200px;
    border-radius: 0;
    margin-bottom: 20px;
}