/* Global Loading Spinner */

/* Top progress bar — thin animated bar at top of viewport */
#global-loading-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 0;
    height: 3px;
    background: linear-gradient(90deg, #3b82f6, #8b5cf6, #ec4899);
    z-index: 99999;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
}

#global-loading-bar.active {
    opacity: 1;
    animation: loading-bar 1.8s ease-in-out infinite;
}

#global-loading-bar.done {
    width: 100%;
    opacity: 0;
    transition: width 0.2s, opacity 0.3s 0.15s;
}

@keyframes loading-bar {
    0%   { width: 0;   left: 0;   }
    50%  { width: 60%;  left: 20%; }
    100% { width: 0;   left: 100%; }
}

/* Full-page overlay — for form submissions */
#global-loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 99998;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s;
}

#global-loading-overlay.active {
    opacity: 1;
    pointer-events: all;
}

/* Spinner ring */
.spinner-ring {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}
