/* ═══════════════════════════════════════════════════════════════════════════
   UI EFFECTS — minimal motion & loading primitives.

   Companion to modern-ui.css. Intentionally small after the v2 overhaul
   broke things — only the effects that are SAFE (don't touch positioning,
   don't override Rise's layout, don't inject DOM into interactive elements)
   are kept. All animations respect prefers-reduced-motion.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ─── Top loading bar — fires on every AJAX request ──────────────────────── */
#ui-progress {
    position: fixed;
    top: 0; left: 0;
    height: 2.5px;
    width: 0%;
    background: linear-gradient(90deg,
        var(--ui-primary) 0%,
        #60A5FA 50%,
        #93C5FD 100%);
    box-shadow: 0 0 12px rgba(37, 99, 235, 0.5);
    z-index: 10000;
    opacity: 0;
    transition: width 0.25s cubic-bezier(0.2, 0, 0, 1), opacity 0.2s linear;
    pointer-events: none;
}
#ui-progress.active { opacity: 1; }

/* ─── Skeleton loader — pulse animation utility ──────────────────────────── */
.skeleton, .skeleton-line, .skeleton-circle {
    background: linear-gradient(90deg,
        var(--ui-bg-hover) 25%,
        var(--ui-border-soft) 50%,
        var(--ui-bg-hover) 75%);
    background-size: 200% 100%;
    animation: ui-skeleton-shimmer 1.4s infinite linear;
    border-radius: var(--ui-radius-sm);
}
.skeleton-line   { height: 14px; margin: 6px 0; }
.skeleton-line.lg { height: 22px; }
.skeleton-line.sm { height: 10px; }
.skeleton-line.w-25 { width: 25%; }
.skeleton-line.w-50 { width: 50%; }
.skeleton-line.w-75 { width: 75%; }
.skeleton-circle { width: 40px; height: 40px; border-radius: 50%; }
@keyframes ui-skeleton-shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ─── Inline button spinner ──────────────────────────────────────────────── */
.btn.is-loading {
    color: transparent !important;
    pointer-events: none;
    position: relative;
}
.btn.is-loading::after {
    content: '';
    position: absolute;
    width: 16px; height: 16px;
    top: 50%; left: 50%;
    margin-top: -8px;
    margin-left: -8px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    color: white;
    animation: ui-spin 0.6s linear infinite;
}
@keyframes ui-spin { to { transform: rotate(360deg); } }

/* ─── Refined focus ring (accessible, branded) ───────────────────────────── */
*:focus-visible {
    outline: 2px solid var(--ui-primary);
    outline-offset: 2px;
    border-radius: var(--ui-radius-xs);
}

/* ─── Pulsing live-status dot (.ui-pulse-dot — opt-in) ───────────────────── */
.ui-pulse-dot {
    position: relative;
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--ui-success);
    display: inline-block;
}
.ui-pulse-dot::before {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    background: var(--ui-success);
    opacity: 0.4;
    animation: ui-pulse 1.6s ease-in-out infinite;
}
@keyframes ui-pulse {
    0%, 100% { transform: scale(1); opacity: 0.4; }
    50%      { transform: scale(2); opacity: 0; }
}

/* ─── prefers-reduced-motion ─────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    .skeleton, .skeleton-line, .skeleton-circle {
        animation: none;
        background: var(--ui-bg-hover);
    }
}

/* ─── Disabled: page fade-in (was hiding content under some conditions) ──── */
.ui-page-fade-in { /* intentionally empty no-op */ }
