/* ========================================
   Global Loader - Full Screen Loading Overlay
   ======================================== */

/**
 * Usage:
 * 1. Include this CSS file in your layout: <link rel="stylesheet" href="/css/global-loader.css" asp-append-version="true" />
 * 2. Add the HTML markup (see _AdminLayout.cshtml or master.cshtml)
 * 3. Use JavaScript API: GlobalLoader.show('Message'), GlobalLoader.hide()
 */

/* Main loader container - Full screen overlay */
.global-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

/* When visible, show the loader */
.global-loader.visible {
    opacity: 1;
    visibility: visible;
}

/* Dark semi-transparent overlay background */
.global-loader-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(2px);
}

/* Content container - Centered white box with spinner and message */
.global-loader-content {
    position: relative;
    z-index: 10000;
    background: white;
    padding: 2rem 3rem;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    min-width: 300px;
    max-width: 90%;
}

/* Spinning loader animation */
.global-loader-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #e5e7eb;
    border-top-color: #065f46; /* emerald-800 */
    border-radius: 50%;
    animation: global-loader-spin 0.8s linear infinite;
}

/* Spinner animation keyframes */
@keyframes global-loader-spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* Loading message text */
.global-loader-message {
    color: #1f2937;
    font-size: 1rem;
    font-weight: 500;
    text-align: center;
    line-height: 1.5;
}

/* Prevent body scroll when loader is active */
body.loader-active {
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
}

/* Responsive adjustments for mobile devices */
@media (max-width: 640px) {
    .global-loader-content {
        padding: 1.5rem 2rem;
        min-width: 250px;
    }

    .global-loader-spinner {
        width: 40px;
        height: 40px;
        border-width: 3px;
    }

    .global-loader-message {
        font-size: 0.875rem;
    }
}

/* Accessibility: Respect user's motion preferences */
@media (prefers-reduced-motion: reduce) {
    .global-loader {
        transition: none;
    }

    .global-loader-spinner {
        animation-duration: 1.5s;
    }
}
