/* Global background-task region — the out-of-the-way home for any action with a perceptible
   delay (emptying trash, bulk delete, archive import). Anchored bottom-LEFT so it never fights
   the toasts (bottom-right): a running task and its completion toast can both be visible.
   Rows reuse the .index-spinner whirligig (photo-grid.css). */
.progress-region {
    position: fixed;
    bottom: 24px;
    left: 24px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.progress-row {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 16px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
    min-width: 280px;
    max-width: 360px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    /* The row itself stays click-through (inherits the region's pointer-events: none) so it never
       blocks the UI it floats over; only its buttons opt back in (below). */
    animation: progress-in 0.2s ease-out;
}
@keyframes progress-in {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.progress-text { white-space: nowrap; flex: 1; }

/* Terminal-state leading icon (check / alert), in place of the spinner. */
.progress-icon { display: flex; flex-shrink: 0; }
.progress-row.is-success .progress-icon { color: var(--accent); }
.progress-row.is-error { border-color: #f87171; }
.progress-row.is-error .progress-icon { color: #f87171; }

/* Action button on a success row (e.g. Undo). */
.progress-action {
    background: none;
    border: none;
    color: var(--accent);
    font-size: 0.85rem;
    font-weight: 500;
    padding: 0;
    flex-shrink: 0;
    pointer-events: auto; /* opt back in — the row is click-through */
}
.progress-action:hover { color: var(--accent-hover); }

/* Dismiss (✕) on the sticky error rows. */
.progress-dismiss {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.85rem;
    padding: 0;
    line-height: 1;
    flex-shrink: 0;
    pointer-events: auto; /* opt back in — the row is click-through */
}
.progress-dismiss:hover { color: var(--text-primary); }

.progress-track {
    flex: 1;
    height: 4px;
    border-radius: 2px;
    background: var(--border);
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    width: 0;
    background: var(--accent);
    border-radius: 2px;
    transition: width 0.3s ease;
}

/* Until a job knows its total (e.g. an archive still being scanned) we sweep an indeterminate
   sliver instead of showing a misleading filled bar. */
.progress-row.indeterminate .progress-fill {
    width: 30% !important;
    transition: none;
    animation: progress-sweep 1.1s ease-in-out infinite;
}
@keyframes progress-sweep {
    0%   { margin-left: -30%; }
    100% { margin-left: 100%; }
}
