/**
 * global_loader.css
 * ------------------------------------------------------------------
 * Visual styling for the global loading overlay defined in
 * global_loader.js. Colors map 1:1 to CLIENT_COLORS in the Python
 * source — update the variables below if that dict changes and
 * nothing else needs to be touched.
 * ------------------------------------------------------------------
 */

:root {
    --gl-yellow-light: #fce5b0;
    --gl-yellow-base: #fcbb4e;
    --gl-yellow-dark: #b07d10;

    --gl-orange-light: #fbd9be;
    --gl-orange-base: #f28c38;
    --gl-orange-dark: #b86416;

    --gl-white-light: #ffffff;
    --gl-white-base: #faf7f2;
    --gl-white-dark: #e4e0d9;

    --gl-black-light: #514f59;
    --gl-black-base: #1e1b18;
    --gl-black-dark: #141318;
}

#global-loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 999998; /* one below the notification container's 999999 */
    display: flex;
    align-items: center;
    justify-content: center;

    background: rgba(250, 247, 242, 0.72); /* white.base, translucent */
    backdrop-filter: blur(5px) saturate(120%);
    -webkit-backdrop-filter: blur(5px) saturate(120%);

    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 300ms cubic-bezier(0.4, 0, 0.2, 1),
        visibility 0s linear 300ms;
}

#global-loading-overlay.gl-visible {
    opacity: 1;
    visibility: visible;
    pointer-events: all;
    transition: opacity 260ms cubic-bezier(0.4, 0, 0.2, 1), visibility 0s linear 0s;
}

/* ---- Card ------------------------------------------------------- */

.gl-card {
    position: relative;
    width: 288px;
    padding: 24px 24px 20px;
    border-radius: 14px;
    background: var(--gl-white-light);
    border: 1px solid var(--gl-white-dark);
    box-shadow: 0 12px 32px rgba(30, 27, 24, 0.10);
    overflow: hidden;

    transform: translateY(6px) scale(0.98);
    transition: transform 320ms cubic-bezier(0.16, 1, 0.3, 1);
}

#global-loading-overlay.gl-visible .gl-card {
    transform: translateY(0) scale(1);
}

/* ---- Header row: dot grid "activity" indicator ------------------ */

.gl-dots {
    display: flex;
    gap: 6px;
    margin-bottom: 16px;
}

.gl-dots span {
    width: 6px;
    height: 6px;
    border-radius: 2px;
    background: var(--gl-orange-base);
    opacity: 0.3;
    animation: gl-dot-pulse 1.2s ease-in-out infinite;
}

.gl-dots span:nth-child(1) {
    animation-delay: 0ms;
}
.gl-dots span:nth-child(2) {
    animation-delay: 120ms;
}
.gl-dots span:nth-child(3) {
    animation-delay: 240ms;
}
.gl-dots span:nth-child(4) {
    animation-delay: 360ms;
}
.gl-dots span:nth-child(5) {
    animation-delay: 480ms;
}

@keyframes gl-dot-pulse {
    0%,
    100% {
        opacity: 0.25;
        transform: scaleY(1);
    }
    50% {
        opacity: 1;
        transform: scaleY(1.8);
    }
}

/* ---- Status line (rotating messages) ------------------------------ */

.gl-status-row {
    display: flex;
    align-items: baseline;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.005em;
    color: var(--gl-black-base);
    min-height: 16px;
}

#global-loading-status {
    transition: opacity 180ms ease;
}

#global-loading-status.gl-status--fading {
    opacity: 0;
}

/* ---- Indeterminate progress bar ---------------------------------- */

.gl-progress-track {
    position: relative;
    margin-top: 14px;
    width: 100%;
    height: 3px;
    border-radius: 2px;
    background: var(--gl-white-dark);
    overflow: hidden;
}

.gl-progress-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 38%;
    border-radius: 2px;
    background: linear-gradient(
        90deg,
        var(--gl-yellow-light),
        var(--gl-orange-base),
        var(--gl-yellow-light)
    );
    animation: gl-progress-sweep 1.35s ease-in-out infinite;
}

@keyframes gl-progress-sweep {
    0% {
        left: -38%;
    }
    100% {
        left: 100%;
    }
}

/* ---- Fine print --------------------------------------------------- */

.gl-subtext {
    margin-top: 12px;
    font-size: 9.5px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--gl-black-light);
}

/* Respect reduced-motion preferences */
@media (prefers-reduced-motion: reduce) {
    .gl-dots span,
    .gl-progress-fill {
        animation: none !important;
    }
}
