/* =============================================================
   Shimmer (skeleton) loading placeholders — shared across areas.
   Markup is generated by wwwroot/js/shimmer.js (window.WorkTrackShimmer)
   or authored directly with the .shimmer-* classes below.
   ============================================================= */

:root {
    --shimmer-base: var(--slate-200);
    --shimmer-highlight: var(--slate-100);
    --shimmer-duration: 1.4s;
}

.shimmer,
.shimmer-line,
.shimmer-circle,
.shimmer-block {
    display: block;
    background: linear-gradient(90deg,
        var(--shimmer-base) 0%,
        var(--shimmer-highlight) 40%,
        var(--shimmer-base) 80%) 0 0 / 300% 100%;
    border-radius: var(--radius-xs);
    animation: shimmer-sweep var(--shimmer-duration) var(--ease) infinite;
}

.shimmer-line {
    width: 100%;
    height: 12px;
    max-width: 100%;
}

.shimmer-line.is-sm { height: 9px; }
.shimmer-line.is-lg { height: 18px; }
.shimmer-line.is-xl { height: 28px; }

.shimmer-line.w-25 { width: 25%; }
.shimmer-line.w-40 { width: 40%; }
.shimmer-line.w-60 { width: 60%; }
.shimmer-line.w-75 { width: 75%; }
.shimmer-line.w-90 { width: 90%; }

.shimmer-circle {
    flex: none;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-circle);
}

.shimmer-block {
    width: 100%;
    min-height: 120px;
    border-radius: var(--radius-md);
}

.shimmer-stack {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

.shimmer-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
}

.shimmer-item + .shimmer-item {
    border-top: 1px solid var(--line);
}

.shimmer-item > .shimmer-stack { gap: 8px; }

.shimmer-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface);
}

.shimmer-card + .shimmer-card { margin-top: 12px; }

/* Table rows */
tr.shimmer-row td {
    padding-top: 14px;
    padding-bottom: 14px;
    vertical-align: middle;
}

tr.shimmer-row:hover,
tr.shimmer-row:hover td {
    background: transparent !important;
}

/* Inline text placeholder: keeps layout, hides "Loading…" text behind a bar. */
.shimmer-text {
    display: inline-block;
    min-width: 8ch;
    color: transparent !important;
    background: linear-gradient(90deg,
        var(--shimmer-base) 0%,
        var(--shimmer-highlight) 40%,
        var(--shimmer-base) 80%) 0 0 / 300% 100%;
    border-radius: var(--radius-xs);
    animation: shimmer-sweep var(--shimmer-duration) var(--ease) infinite;
    user-select: none;
}

/* Opt-in values inside a busy region: <strong data-shimmer-value>—</strong> inside [aria-busy="true"]. */
[aria-busy="true"] [data-shimmer-value] {
    display: inline-block;
    min-width: 3ch;
    color: transparent !important;
    background: linear-gradient(90deg,
        var(--shimmer-base) 0%,
        var(--shimmer-highlight) 40%,
        var(--shimmer-base) 80%) 0 0 / 300% 100% !important;
    border-radius: var(--radius-xs);
    animation: shimmer-sweep var(--shimmer-duration) var(--ease) infinite;
}

[aria-busy="true"] [data-shimmer-value] * { visibility: hidden; }

/* Hide original children of a container while a shimmer overlay is shown. */
[data-shimmer-active] > :not(.shimmer-host) { visibility: hidden; }
[data-shimmer-active] { position: relative; }

[data-shimmer-active] > .shimmer-host {
    position: absolute;
    inset: 0;
    z-index: 2;
    padding: inherit;
    overflow: hidden;
    background: var(--surface);
    border-radius: inherit;
}

@keyframes shimmer-sweep {
    from { background-position: 100% 0; }
    to { background-position: 0 0; }
}

@media (prefers-reduced-motion: reduce) {
    .shimmer,
    .shimmer-line,
    .shimmer-circle,
    .shimmer-block,
    .shimmer-text,
    [aria-busy="true"] [data-shimmer-value] {
        animation: none;
    }
}

/* Data-only placeholders matching the MCO dashboard: labels stay visible, values/charts/lists shimmer.
   Server-rendered via Views/Shared/_ShimmerLines.cshtml and the ViewData["Loading"] flag in section partials. */
.shimmer.shimmer-value {
    display: inline-block;
    width: 3.5ch;
    height: 0.9em;
    vertical-align: middle;
}

.shimmer.shimmer-kpi {
    width: 70%;
    height: 30px;
    margin-top: 10px;
}

.shimmer.shimmer-chart {
    height: 170px;
    margin-top: 8px;
}

.shimmer.shimmer-circle-lg {
    flex: none;
    width: 126px;
    height: 126px;
    margin: auto;
    border-radius: var(--radius-circle);
}

.shimmer-lines {
    display: grid;
    gap: 14px;
    width: 100%;
    padding: 6px 0;
}

.shimmer-lines > .shimmer {
    height: 14px;
}

.shimmer-lines > .shimmer:nth-child(3n + 2) { width: 85%; }
.shimmer-lines > .shimmer:nth-child(3n) { width: 65%; }
