/* Whirly Loader Styles */
.whirly-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    pointer-events: none; /* Deshabilitar clics cuando está oculto */
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.whirly-loader.show {
    opacity: 1;
    visibility: visible;
    pointer-events: auto; /* Habilitar clics cuando está visible */
}

.whirly-loader-content {
    background: white;
    border-radius: 10px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    text-align: center;
    min-width: 200px;
}

.whirly-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007bff;
    border-radius: 50%;
    animation: whirly-spin 1s linear infinite;
    margin: 0 auto 20px;
}

.whirly-loader-text {
    color: #333;
    font-size: 16px;
    font-weight: 500;
    margin: 0;
}

@keyframes whirly-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Variantes de color */
.whirly-loader.primary .whirly-spinner {
    border-top-color: #007bff;
}

.whirly-loader.success .whirly-spinner {
    border-top-color: #28a745;
}

.whirly-loader.warning .whirly-spinner {
    border-top-color: #ffc107;
}

.whirly-loader.danger .whirly-spinner {
    border-top-color: #dc3545;
}

.whirly-loader.info .whirly-spinner {
    border-top-color: #17a2b8;
}

/* Loader pequeño para botones */
.whirly-loader-small {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007bff;
    border-radius: 50%;
    animation: whirly-spin 1s linear infinite;
    margin-right: 8px;
}

/* Loader para overlays de contenido específico */
.whirly-loader-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.whirly-loader-overlay.show {
    opacity: 1;
    visibility: visible;
}

.whirly-loader-overlay .whirly-spinner {
    width: 40px;
    height: 40px;
    border-width: 3px;
    margin-bottom: 15px;
}

.whirly-loader-overlay .whirly-loader-text {
    font-size: 14px;
}


/* Asegurar que el page-wrapper tenga posición relativa */
.page-wrapper {
    position: relative;
}

/* Loader inicial de página */
#page-loader {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(5px);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.5s ease-out, visibility 0.5s ease-out;
}

/* Ocultar el loader cuando la página esté completamente cargada */
body.loaded #page-loader {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

#page-loader .whirly-loader-content {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    min-width: 120px;
    display: flex;
    justify-content: center;
    align-items: center;
}

#page-loader .whirly-spinner {
    border-color: #e3f2fd;
    border-top-color: #2196f3;
    width: 50px;
    height: 50px;
    border-width: 4px;
    margin: 0;
}

/* Animación de entrada para el loader inicial */
#page-loader {
    animation: pageLoaderFadeIn 0.5s ease-out;
}

@keyframes pageLoaderFadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Responsive */
@media (max-width: 768px) {
    .whirly-loader-content {
        padding: 20px;
        min-width: 150px;
    }
    
    .whirly-spinner {
        width: 40px;
        height: 40px;
        border-width: 3px;
    }
    
    .whirly-loader-text {
        font-size: 14px;
    }
    
    #page-loader .whirly-loader-content {
        padding: 25px;
        min-width: 100px;
    }
    
    #page-loader .whirly-spinner {
        width: 40px;
        height: 40px;
        border-width: 3px;
        margin: 0;
    }
}
