/* components/loading.css — Loading feedback with a percentage, so a slow step never looks like a hang.
   Two pieces, both in templates/partials/shell/loading.html and driven by static/js/shared/loading.js:
     .vcb-boot      a full-page screen while a page is being prepared (start-up, reloads, page changes)
     .vcb-loadbar / .vcb-loadpill   a thin bar and a pill in the command bar while a request is running
   Neither shows for waits shorter than about a third of a second. Linked by base.html for every page. */

/* ── Full-page loading screen ─────────────────────────────────────────────── */
.vcb-boot {
    position: fixed; inset: 0; z-index: 2147483000;
    display: flex; align-items: center; justify-content: center;
    background: var(--nccr-bg);
    opacity: 0;
    animation: vcb-boot-in 0.25s var(--ui-ease) 0.35s forwards;   /* stays invisible on a fast load */
}
.vcb-boot[hidden] { display: none; }
.vcb-boot.is-done { animation: none; opacity: 0; transition: opacity 0.2s var(--ui-ease); pointer-events: none; }
@keyframes vcb-boot-in { to { opacity: 1; } }

.vcb-boot-card { width: min(380px, 84vw); text-align: center; }
.vcb-boot-logo { height: 56px; width: auto; }
:root[data-theme="dark"] .vcb-boot-logo { filter: invert(1) hue-rotate(180deg) saturate(1.25) brightness(1.08); }
/* What is being done on the left, how far it is on the right, the bar underneath */
.vcb-boot-row { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin: 22px 0 8px; }
.vcb-boot-label { color: var(--nccr-fg-muted); font-size: var(--fs-md); text-align: left; }
.vcb-boot-pct {
    color: var(--nccr-fg);
    font-family: var(--nccr-font-mono); font-size: var(--fs-md); font-weight: 700; font-variant-numeric: tabular-nums;
}
.vcb-boot-foot { margin-top: 14px; min-height: 1px; }

/* The bar itself: a track, a fill whose width is the percentage, and a highlight that keeps travelling */
.vcb-progress { height: 6px; background: var(--nccr-inset); border: 1px solid var(--nccr-border); border-radius: 4px; overflow: hidden; }
.vcb-progress-fill {
    position: relative; height: 100%; width: 0;
    background: var(--nccr-primary-emph);
    transition: width 0.25s linear;
    overflow: hidden;
}
.vcb-progress-fill::after {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.45), transparent);
    transform: translateX(-100%);
    animation: vcb-sheen 1.3s linear infinite;
}
@keyframes vcb-sheen { to { transform: translateX(100%); } }

/* ── In-app requests: a bar under the command bar and a pill inside it ── */
/* The bar runs along the lower edge of the command bar (the top edge of the page carries the NCCR stripe). */
.vcb-loadbar { position: fixed; top: calc(var(--shell-h) - 2px); left: 0; right: 0; height: 3px; z-index: 2147482500; pointer-events: none; }
.vcb-loadbar[hidden] { display: none; }
.vcb-loadbar-fill {
    height: 100%; width: 0;
    background: var(--shell-accent);
    box-shadow: 0 0 8px rgba(var(--shell-accent-rgb), 0.75);
    transition: width 0.25s linear;
}
.vcb-loadpill {
    position: fixed; top: calc((var(--shell-h) - 28px) / 2 + 2px); left: 50%; transform: translateX(-50%);
    z-index: 2147482500;
    display: inline-flex; align-items: center; gap: 8px;
    height: 28px; padding: 0 14px 0 12px;
    background: var(--shell-bg-2); color: var(--shell-fg);
    border: 1px solid var(--shell-border); border-radius: var(--ui-radius-pill);
    font-size: var(--fs-sm); white-space: nowrap;
    pointer-events: none;
}
@media (max-width: 760px) {      /* no room between brand and tabs: hang it just below the bar */
    .vcb-loadpill { top: calc(var(--shell-h) + 8px); box-shadow: var(--ui-shadow-2); }
}
.vcb-loadpill[hidden] { display: none; }
.vcb-loadpill .ti { color: var(--shell-accent); }
.vcb-loadpill-pct {
    min-width: 3.1em; text-align: right;
    color: var(--shell-accent);
    font-family: var(--nccr-font-mono); font-variant-numeric: tabular-nums;
}

/* The same percentage next to a spinner inside a panel: <span data-loading-pct></span> */
[data-loading-pct] {
    margin-left: 4px;
    color: var(--nccr-primary-emph);
    font-family: var(--nccr-font-mono); font-size: 0.95em; font-variant-numeric: tabular-nums;
}

@media (prefers-reduced-motion: reduce) {
    .vcb-progress-fill::after { animation: none; }
    .vcb-progress-fill, .vcb-loadbar-fill { transition: none; }
}
