/* ==========================================================================
   SYSTEM BUSY LOADER COMPONENT
   ========================================================================== */

/* Fullscreen translucent backdrop that prevents clicking background elements */
.system-loader-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 10000; /* Stays above modals, headers, and inputs */
    background-color: rgba(255, 255, 255, 0.7); /* Translucent light mask */
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto; /* Blocks background clicks */
    backdrop-filter: blur(2px); /* Optional: subtle professional glass blur */
}

/* Dark-mode alternative backdrop (uncomment if your UI is dark) */
/* 
.system-loader-backdrop {
    background-color: rgba(17, 24, 39, 0.7); 
} 
*/

/* Hiding class used by your JavaScript state toggles */
/*.system-loader-backdrop.style-hidden {
    display: none !important;
}*/

/* Centered content bounding box */
.loader-central-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

/* Pure CSS Central Spinner */
.system-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--rm-border); /* Light grey track (Grey-200) */
    border-top-color: var(--rm-text); /* Dark grey active segment (Grey-800) */
    border-radius: 50%;
    animation: spinRefresh 0.8s linear infinite;
}

/* Simple Busy Text styling */
.loader-status-text {
    color: var(--rm-text);
    font-size: 0.9rem;
    font-weight: 500;
    font-family: system-ui, -apple-system, sans-serif;
    letter-spacing: 0.05em;
}

/* Continuous rotation animation loop */
@keyframes spinRefresh {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}
/* Base state: Hidden completely at startup */
.system-loader-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 10000;
    background-color: rgba(255, 255, 255, 0.6) !important;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
}

/* Active state: Triggered via JavaScript */
.system-loader-backdrop.active {
    display: flex !important;
}

/* ========================================================================== 
   VIDEO CLIP CREATION / DOWNLOAD PROGRESS
   ========================================================================== */

body.mu-video-download-active {
    overflow: hidden !important;
}

.video-download-progress-backdrop[hidden] {
    display: none !important;
}

.video-download-progress-backdrop {
    position: fixed;
    inset: 0;
    z-index: 10050;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(244, 244, 239, 0.84);
    backdrop-filter: blur(8px);
    pointer-events: auto;
}

.video-download-progress-card {
    width: min(430px, calc(100vw - 32px));
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 16px;
    align-items: center;
    padding: 22px 24px;
    border: 1px solid var(--rm-border);
    border-radius: 15px;
    background: var(--rm-surface);
    color: var(--rm-text);
    box-shadow: 0 22px 60px rgba(13, 40, 24, 0.22);
    outline: none;
}

.video-download-progress-card .system-spinner {
    width: 44px;
    height: 44px;
    flex: 0 0 auto;
    border-top-color: var(--rm-primary);
}

.video-download-progress-copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.video-download-progress-title {
    display: block;
    color: var(--rm-text);
    font-size: 0.98rem;
    font-weight: 800;
    line-height: 1.25;
}

.video-download-progress-message {
    display: block;
    color: var(--rm-text-secondary);
    font-size: 0.82rem;
    line-height: 1.45;
}

.video-download-progress-elapsed {
    display: block;
    color: var(--rm-primary);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.03em;
}

.video-download-progress-bar {
    grid-column: 1 / -1;
    position: relative;
    width: 100%;
    height: 6px;
    overflow: hidden;
    border-radius: 999px;
    background: var(--rm-border);
}

.video-download-progress-value {
    position: absolute;
    inset: 0 auto 0 0;
    width: 0;
    border-radius: inherit;
    background: var(--rm-primary);
    transition: width 0.18s ease-out;
}

.video-download-progress-bar.is-indeterminate .video-download-progress-value {
    width: 42%;
    animation: motionUnseenVideoProgress 1.25s ease-in-out infinite;
}

.mu-video-download-control-busy {
    cursor: wait !important;
    opacity: 0.65 !important;
}

#btnPlayerDownloadVideo.mu-video-download-control-busy {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.mu-inline-download-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    flex: 0 0 auto;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spinRefresh 0.75s linear infinite;
}

.mu-icon-action .mu-inline-download-spinner {
    width: 13px;
    height: 13px;
}

@keyframes motionUnseenVideoProgress {
    0% {
        transform: translateX(-110%);
    }

    100% {
        transform: translateX(340%);
    }
}

@media (max-width: 520px) {
    .video-download-progress-backdrop {
        padding: 16px;
    }

    .video-download-progress-card {
        grid-template-columns: 1fr;
        justify-items: center;
        text-align: center;
        padding: 22px 18px;
    }

    .video-download-progress-bar {
        grid-column: 1;
    }
}

@media (prefers-reduced-motion: reduce) {
    .video-download-progress-bar.is-indeterminate .video-download-progress-value,
    .system-spinner {
        animation-duration: 2s;
    }
}
