/* ── Global loading indicators (spinner / progress bar / shimmer) ─────────────
   One consistent, brand-styled, theme-aware busy state for the whole platform,
   replacing bare "Loading…" / "Searching…" placeholder text.

   Markup (or use the JS helpers in ui-loading.js — uiLoading / uiSpinner / uiBar):
     <div class="ui-loading"><span class="ui-spinner"></span><span class="ui-ld-txt">Loading…</span></div>
     <span class="ui-spinner"></span>                      inline ring (buttons, status)
     <div class="ui-loading-bar"><span class="ui-ld-txt">Searching…</span><div class="ui-bar"></div></div>

   Honours prefers-reduced-motion (slows spin, freezes shimmer). Colours come from
   CSS vars so a host card can retint locally if ever needed. */
:root{
  --ui-ld-track:  rgba(70,95,255,.16);
  --ui-ld-accent: #465FFF;
  --ui-ld-txt:    #9ca3af;
  --ui-ld-shim:   rgba(255,255,255,.55);
}
html.dark{
  --ui-ld-track:  rgba(124,139,255,.24);
  --ui-ld-accent: #8b9bff;
  --ui-ld-txt:    #8b93a7;
  --ui-ld-shim:   rgba(255,255,255,.10);
}

/* ── Spinner ring ── */
@keyframes ui-spin{ to{ transform:rotate(360deg); } }
.ui-spinner{
  box-sizing:border-box; display:inline-block; flex:none;
  width:16px; height:16px; vertical-align:-3px;
  border:2px solid var(--ui-ld-track); border-top-color:var(--ui-ld-accent);
  border-radius:50%; animation:ui-spin .68s linear infinite;
}
.ui-spinner.ui-sp-sm{ width:13px; height:13px; }
.ui-spinner.ui-sp-lg{ width:26px; height:26px; border-width:3px; }

/* ── Spinner + centred caption block ── */
.ui-loading{
  display:flex; align-items:center; justify-content:center; gap:9px;
  padding:18px 12px; color:var(--ui-ld-txt);
  font-size:12.5px; line-height:1.35; text-align:center;
}
.ui-loading.ui-ld-tight{ padding:10px 8px; }
.ui-loading.ui-ld-flush{ padding:0; }
.ui-ld-txt{ letter-spacing:.01em; }

/* ── Indeterminate progress bar (with optional caption above) ── */
@keyframes ui-bar-slide{ 0%{ left:-40%; } 100%{ left:100%; } }
.ui-bar{
  position:relative; width:100%; height:3px; border-radius:3px;
  background:var(--ui-ld-track); overflow:hidden;
}
.ui-bar::before{
  content:""; position:absolute; top:0; bottom:0; left:-40%; width:40%;
  border-radius:3px; background:var(--ui-ld-accent);
  animation:ui-bar-slide 1.05s cubic-bezier(.4,0,.2,1) infinite;
}
.ui-loading-bar{
  display:flex; flex-direction:column; gap:8px; padding:16px 14px;
  color:var(--ui-ld-txt); font-size:12.5px;
}

/* ── Shimmer skeleton block (opt-in; for content-shaped placeholders) ── */
@keyframes ui-shim{ 100%{ background-position:-160% 0; } }
.ui-skel{
  border-radius:8px;
  background:linear-gradient(90deg,var(--ui-ld-track) 25%,var(--ui-ld-shim) 37%,var(--ui-ld-track) 63%);
  background-size:280% 100%;
  animation:ui-shim 1.25s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce){
  .ui-spinner{ animation-duration:1.6s; }
  .ui-bar::before{ animation-duration:2.6s; }
  .ui-skel{ animation:none; }
}

/* ── Content-shaped skeletons (compose on .ui-skel; theme-aware via the vars above) ──────
   Realistic placeholders instead of a bare spinner. Use the ui-loading.js helpers
   (uiSkelList / uiSkelTableRows / uiSkelCards), or hand-roll with .ui-skel + a shape class:
     <span class="ui-skel ui-skel-line" style="width:60%"></span>
   Every shaded box needs BOTH .ui-skel (the shimmer) and a shape class (the dimensions). */
.ui-skel-line{ height:12px; border-radius:6px; display:block; }
.ui-skel-line.sk-sm{ height:9px; }
.ui-skel-line.sk-lg{ height:16px; }
.ui-skel-list{ display:flex; flex-direction:column; }
.ui-skel-row{ display:flex; align-items:center; gap:10px; padding:11px 12px; border-bottom:1px solid var(--ui-ld-track); }
.ui-skel-row:last-child{ border-bottom:0; }
.ui-skel-row .sk-ava{ width:34px; height:34px; border-radius:8px; flex:none; }
.ui-skel-row .sk-body{ flex:1; min-width:0; display:flex; flex-direction:column; gap:6px; }
.ui-skel-row .sk-pill{ width:40px; height:20px; border-radius:9999px; flex:none; }
.ui-skel-cards{ display:grid; grid-template-columns:repeat(auto-fill,minmax(150px,1fr)); gap:12px; }
.ui-skel-card{ height:120px; border-radius:14px; }
