/* ============================================
   MIRACOLLO LOADER SYSTEM
   Global loading overlay with spinner
   
   @version 1.0.0
   @date 2025-12-25
   @author Cervella 🧠
   ============================================ */

/* ========== LOADER OVERLAY ========== */
.loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-toast, 3000);
    /* Same or higher than toast */
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.loader-overlay.active {
    opacity: 1;
    pointer-events: all;
}

/* ========== LOADER CONTENT ========== */
.loader-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

/* ========== SPINNER (3 Rings Animation) ========== */
.loader-spinner {
    position: relative;
    width: 80px;
    height: 80px;
}

.spinner-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 3px solid transparent;
    border-top-color: var(--accent-primary, #6366f1);
    border-radius: 50%;
    animation: spin 1.5s cubic-bezier(0.5, 0, 0.5, 1) infinite;
}

.spinner-ring:nth-child(1) {
    animation-delay: -0.45s;
    border-top-color: var(--accent-primary, #6366f1);
}

.spinner-ring:nth-child(2) {
    animation-delay: -0.3s;
    border-top-color: var(--accent-secondary, #818cf8);
    width: 70%;
    height: 70%;
    top: 15%;
    left: 15%;
}

.spinner-ring:nth-child(3) {
    animation-delay: -0.15s;
    border-top-color: rgba(99, 102, 241, 0.5);
    width: 40%;
    height: 40%;
    top: 30%;
    left: 30%;
}

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

    100% {
        transform: rotate(360deg);
    }
}

/* ========== LOADER MESSAGE ========== */
.loader-message {
    font-size: 1.1rem;
    color: var(--text-primary, #ffffff);
    font-weight: 500;
    text-align: center;
    max-width: 300px;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.6;
    }
}

/* ========== ACCESSIBILITY ========== */
@media (prefers-reduced-motion: reduce) {
    .spinner-ring {
        animation: none;
        border-top-color: var(--accent-primary, #6366f1);
    }

    .loader-message {
        animation: none;
    }
}