/* clubmix busy indicators (21.11.2026; www/js/clubmix-busy.mjs, docs/clubmix/BUSY.md). Loaded on every page by
   cfg/clubmix_busy.php (Shell cfg/header.php and tool heads clubmix_hdr_theme_head()). Colours only from the tokens of
   www/css/clubmix-theme.css: acid on dark, ink/ice blue on light. No violet. prefers-reduced-motion: pulse instead of
   rotation, static stripes instead of sliding. */
:root, html.dark {
    --cm-busy-accent: var(--cm-acid, #eeff70);      /* spinner and bar fill on dark */
    --cm-busy-track: rgba(255, 255, 255, .12);
    --cm-busy-scrim: rgba(15, 15, 17, .72);
    --cm-busy-box: var(--cm-panel, #18181b);
    --cm-busy-box-fg: var(--cm-fg, #f8f6ef);
    --cm-busy-line: var(--cm-line-strong, #3f3f46);
}
html.light {
    --cm-busy-accent: var(--cm-ice, #0b6e75);        /* acid is never text/thin line on light */
    --cm-busy-track: rgba(17, 17, 19, .1);
    --cm-busy-scrim: rgba(247, 247, 244, .78);
    --cm-busy-box: var(--cm-panel, #ffffff);
    --cm-busy-box-fg: var(--cm-fg, #111113);
    --cm-busy-line: var(--cm-line-strong, #cfcfc8);
}

@keyframes cm-busy-spin { to { transform: rotate(360deg); } }
@keyframes cm-busy-pulse { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }
@keyframes cm-busy-slide { 0% { transform: translateX(-100%); } 100% { transform: translateX(250%); } }

.cm-busy-sr { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
    clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Spinner: a ring with a gap, currentColor unless inside an overlay/job line. */
.cm-spin { display: inline-block; flex: none; box-sizing: border-box; width: 1em; height: 1em; border-radius: 50%;
    border: 2px solid currentColor; border-right-color: transparent; vertical-align: -.15em;
    animation: cm-busy-spin .75s linear infinite; }
.cm-spin[hidden] { display: none; }
.cm-spin-inline { margin-right: .45em; color: var(--cm-busy-accent); }

/* Button state: own content hidden, spinner + label drawn by pseudo elements (no DOM change inside the button). */
.cm-busy-rel { position: relative; }
.cm-busy-btn[data-cm-busy-state="on"] { cursor: progress; min-width: var(--cm-busy-w, auto); }
/* :not(#cm-busy-none) hebt die Gewichtung ueber die CTA-Farbregel (clubmix-brand.css, html:not(.light) .bg-accent-600...), 21.11.2026 Preisseite */
.cm-busy-btn[data-cm-busy-state="on"]:not(.cm-busy-keep):not(#cm-busy-none) { color: transparent !important; }
.cm-busy-btn[data-cm-busy-state="on"]:not(.cm-busy-keep) > * { visibility: hidden; }
.cm-busy-btn[data-cm-busy-state="on"]::before { content: ""; box-sizing: border-box; width: 1em; height: 1em; border-radius: 50%;
    border: 2px solid var(--cm-busy-fg, currentColor); border-right-color: transparent;
    animation: cm-busy-spin .75s linear infinite; }
.cm-busy-btn[data-cm-busy-state="on"]:not(.cm-busy-keep)::before { position: absolute; top: 50%; left: .75em; margin-top: -.5em; }
.cm-busy-btn[data-cm-busy-state="on"]:not(.cm-busy-keep)::after { content: attr(data-cm-busy-label); position: absolute; top: 50%; left: 2.1em;
    right: .6em; transform: translateY(-50%); display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
    text-align: center; line-height: 1.3; color: var(--cm-busy-fg, currentColor); font: inherit; pointer-events: none; }
.cm-busy-btn[data-cm-busy-state="on"][data-cm-busy-pct]:not(.cm-busy-keep)::after { content: attr(data-cm-busy-label) " " attr(data-cm-busy-pct) " %"; }
.cm-busy-btn.cm-busy-keep[data-cm-busy-state="on"]::before { display: inline-block; margin-right: .45em; vertical-align: -.15em; }
.cm-busy-btn[data-cm-busy-state="on"][aria-disabled="true"] { opacity: .92; }

/* A measured button fills from its left edge while its text and spinner stay readable. */
.cm-busy-btn[data-cm-busy-state="on"][data-cm-busy-pct] {
    --cm-busy-progress-ink: var(--cm-ink, #111113);
    --cm-busy-progress-track: color-mix(in srgb, var(--cm-busy-progress-ink) 18%, white);
    --cm-busy-progress-start: var(--cm-acid-hover, #f5ffa6);
    --cm-busy-progress-end: var(--cm-acid, #eeff70);
    background-image: linear-gradient(to right, var(--cm-busy-progress-start), var(--cm-busy-progress-end)),
        linear-gradient(var(--cm-busy-progress-track), var(--cm-busy-progress-track)) !important;
    background-size: var(--cm-busy-p, 0%) 100%, 100% 100%;
    background-position: left center;
    background-repeat: no-repeat;
    transition: background-size .2s ease-out;
}
html.light .cm-busy-btn[data-cm-busy-state="on"][data-cm-busy-pct] {
    --cm-busy-progress-start: color-mix(in srgb, var(--cm-ice) 20%, white);
    --cm-busy-progress-end: color-mix(in srgb, var(--cm-ice) 46%, white);
}
.cm-busy-btn[data-cm-busy-state="on"][data-cm-busy-pct]::before {
    border-color: var(--cm-busy-progress-ink);
    border-right-color: transparent;
}
.cm-busy-btn[data-cm-busy-state="on"][data-cm-busy-pct]::after {
    color: var(--cm-busy-progress-ink);
}
.cm-busy-btn.cm-busy-keep[data-cm-busy-state="on"][data-cm-busy-pct],
input.cm-busy-btn[data-cm-busy-state="on"][data-cm-busy-pct] {
    color: var(--cm-busy-progress-ink) !important;
}

/* A prepared export keeps the format and size with its download action. */
.cm-export-size { font-size: .8em; font-weight: 500; white-space: nowrap; margin-inline-start: .35em; }

/* Area overlay over a working surface. */
.cm-busy-host { isolation: isolate; }
.cm-busy-overlay { position: absolute; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center;
    padding: 12px; background: var(--cm-busy-scrim); border-radius: inherit; cursor: progress; }
.cm-busy-box { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 8px 10px; max-width: min(92%, 360px);
    padding: 10px 14px; border: 1px solid var(--cm-busy-line); border-radius: 10px; background: var(--cm-busy-box);
    color: var(--cm-busy-box-fg); font-size: 14px; line-height: 1.35; box-shadow: 0 8px 24px rgba(0, 0, 0, .25); }
.cm-busy-box .cm-spin { width: 1.25em; height: 1.25em; color: var(--cm-busy-accent); border-width: 3px; }
.cm-busy-text { min-width: 0; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.cm-busy-box .cm-busy-bar { grid-column: 1 / -1; }
.cm-busy-overlay:not([data-determinate]) .cm-busy-bar { display: none; }

/* Bar: determinate with width, indeterminate as a sliding segment. */
.cm-busy-bar { position: relative; display: block; height: 6px; min-width: 120px; overflow: hidden; border-radius: 999px;
    background: var(--cm-busy-track); }
.cm-busy-fill { position: absolute; inset: 0 auto 0 0; width: 0; border-radius: inherit; background: var(--cm-busy-accent);
    transition: width .2s ease; }
.cm-busy-bar[data-indeterminate] .cm-busy-fill { width: 40%; animation: cm-busy-slide 1.3s ease-in-out infinite; transition: none; }

/* Job status line: spinner, phase, elapsed time. */
.cm-job { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 8px 0 0; font-size: 14px;
    font-variant-numeric: tabular-nums; }
.cm-job .cm-spin { color: var(--cm-busy-accent); }
.cm-job-phase { font-weight: 600; }
.cm-job-time { color: var(--cm-muted, #a1a1aa); }
.cm-job .cm-busy-bar { flex: 1 0 100%; }
.cm-job[data-phase="failed"] .cm-job-phase { color: #f87171; }
html.light .cm-job[data-phase="failed"] .cm-job-phase { color: #b42318; }

/* Inline status with spinner. */
.cm-busy-inline { display: inline-flex; align-items: center; }

@media (prefers-reduced-motion: reduce) {
    .cm-spin, .cm-busy-btn[data-cm-busy-state="on"]::before { animation: cm-busy-pulse 1.6s ease-in-out infinite;
        border-right-color: currentColor; border-style: dotted; }
    .cm-busy-btn[data-cm-busy-state="on"]::before { border-right-color: var(--cm-busy-fg, currentColor); }
    .cm-busy-bar[data-indeterminate] .cm-busy-fill { animation: cm-busy-pulse 1.6s ease-in-out infinite; width: 100%; opacity: .5; }
    .cm-busy-btn[data-cm-busy-state="on"][data-cm-busy-pct]::before { border-right-color: var(--cm-busy-progress-ink); }
    .cm-busy-fill, .cm-busy-btn[data-cm-busy-state="on"][data-cm-busy-pct] { transition: none; }
}

.cm-busy-bar[hidden], .cm-job[hidden] { display: none; }
.cmf-stage-bar { margin: 8px 0 0; }
.cm-job.cm-job-own { margin: 0; }
.cm-job.cm-job-own .cm-job-phase { flex: 1 1 12rem; min-width: 0; }
