/* Global busy indicator — styles for src/ts/busy-indicator.ts, injected with it into
   every Razor page's <head> (BusyIndicatorTagHelperComponent). Not every page loads
   theme.css, so each token carries its light-theme value as a fallback. */

.bg-activity-bar {
    --bg-activity-duration: 1.1s;
    position: fixed;
    /* Below the status bar in the iOS/Android standalone shells, not under it. */
    top: env(safe-area-inset-top, 0px);
    left: 0;
    right: 0;
    height: 3px;
    z-index: 10010; /* above every overlay and modal in wwwroot/css (highest: 10002) */
    overflow: hidden;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.bg-activity-bar.is-active {
    opacity: 1;
}

.bg-activity-bar::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 40%;
    background: var(--brand-blue, #0078d4);
    border-radius: 0 2px 2px 0;
    animation: bg-activity-slide var(--bg-activity-duration) ease-in-out infinite;
}

/* translateX is relative to the segment (40% of the bar): -100% starts it fully off
   the left edge, 250% ends it fully off the right. */
@keyframes bg-activity-slide {
    from { transform: translateX(-100%); }
    to   { transform: translateX(250%); }
}

/* The button the user clicked, while its requests are in flight. */
.bg-busy {
    cursor: progress;
}

.bg-busy-spinner {
    --bg-busy-duration: 0.8s;
    display: inline-block;
    flex: none;
    width: 0.9em;
    height: 0.9em;
    margin-inline-start: 0.5em;
    vertical-align: -0.125em;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: bg-busy-spin var(--bg-busy-duration) linear infinite;
}

@keyframes bg-busy-spin {
    to { transform: rotate(360deg); }
}

/* Reduced motion: slow both to a gentle movement that still reads as "working",
   the same choice the shared .spinner makes (components.css). */
@media (prefers-reduced-motion: reduce) {
    .bg-activity-bar { --bg-activity-duration: 2.5s; }
    .bg-busy-spinner { --bg-busy-duration: 2.5s; }
}
