/* ============================================================
   loading.css — global loading experience system
   Route progress bar, page/section overlays, button spinners,
   skeleton shimmer, and fade-in-on-render utilities.
   Injected on every page alongside loadingUI.js.
   ============================================================ */

:root {
  --loading-accent: #4f46e5;
}

/* ---------------- Route progress bar (YouTube-style) ---------------- */
.lu-route-bar {
  position: fixed;
  top: 0; left: 0;
  height: 3px;
  width: 0%;
  background: linear-gradient(90deg, #6366f1, #818cf8);
  box-shadow: 0 0 8px rgba(99,102,241,.6);
  z-index: 9998;
  opacity: 0;
  transition: width .25s ease, opacity .2s ease;
}
.lu-route-bar.lu-active { opacity: 1; }
.lu-route-bar.lu-indeterminate {
  width: 40% !important;
  animation: lu-route-slide 1.1s ease-in-out infinite;
}
@keyframes lu-route-slide {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(250%); }
}

/* ---------------- Full-page / section overlay ---------------- */
.lu-overlay {
  position: fixed;
  inset: 0;
  z-index: 9500;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: rgba(247, 248, 251, 0.92);
  backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity .25s ease;
  pointer-events: none;
}
.lu-overlay.lu-show { opacity: 1; pointer-events: auto; }

/* Scoped variant: absolutely fills whatever container it's appended to
   (container needs position:relative, which .lu-scope-host sets). */
.lu-scope-host { position: relative; }
.lu-overlay--scoped {
  position: absolute;
  border-radius: inherit;
}

.lu-spinner {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid rgba(79,70,229,.15);
  border-top-color: var(--loading-accent);
  animation: lu-spin .7s linear infinite;
}
.lu-spinner--sm { width: 16px; height: 16px; border-width: 2px; }
@keyframes lu-spin { to { transform: rotate(360deg); } }

.lu-overlay-text {
  font-family: var(--font-family-base, 'Segoe UI', system-ui, sans-serif);
  font-size: 13.5px;
  font-weight: 600;
  color: #374151;
}

/* ---------------- Button loading state ---------------- */
.lu-btn-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,.45);
  border-top-color: #fff;
  animation: lu-spin .7s linear infinite;
  margin-right: 7px;
  vertical-align: -2px;
  flex-shrink: 0;
}
.lu-btn-spinner--dark {
  border-color: rgba(17,24,39,.2);
  border-top-color: #111827;
}
[data-lu-loading="1"] {
  opacity: .85;
  cursor: wait !important;
  pointer-events: none;
}
[data-lu-success="1"] {
  transition: background-color .3s ease;
}

/* ---------------- Skeleton shimmer (generic, page-agnostic) ---------------- */
.lu-skeleton {
  border-radius: 6px;
  background: linear-gradient(90deg, #eef0f5 25%, #e2e5ee 50%, #eef0f5 75%);
  background-size: 800px 100%;
  animation: lu-shimmer 1.4s infinite;
}
@keyframes lu-shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}

.lu-skel-cell { height: 12px; margin: 3px 0; }
.lu-skel-row td { padding: 12px 14px; }
.lu-skel-caption {
  text-align: center;
  color: #9ca3af;
  font-size: 12.5px;
  font-style: italic;
}

.lu-skel-card {
  height: 84px;
  border-radius: 12px;
}

/* ---------------- Smooth data rendering ---------------- */
.lu-fade-in {
  animation: lu-fade-in-up .3s ease both;
}
@keyframes lu-fade-in-up {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .lu-route-bar, .lu-overlay, .lu-fade-in, .lu-skeleton, .lu-spinner, .lu-btn-spinner {
    animation-duration: .001ms !important;
    transition-duration: .001ms !important;
  }
}

/* ==== DARK THEME: generated by scripts/theme/generate-dark.js — do not edit by hand; run `npm run theme:dark` after changing the styles above. ==== */
@media screen {
  :root[data-theme="dark"] .lu-overlay:not(:where(.theme-paper, .theme-paper *)) {
    background: rgba(24, 27, 45, 0.92);
  }
  :root[data-theme="dark"] .lu-overlay-text:not(:where(.theme-paper, .theme-paper *)) {
    color: #b7b9c9;
  }
  :root[data-theme="dark"] .lu-btn-spinner:not(:where(.theme-paper, .theme-paper *)) {
    border: 2px solid rgba(24, 27, 45, 0.45);
    border-top-color: #282b3e;
  }
  :root[data-theme="dark"] .lu-btn-spinner--dark:not(:where(.theme-paper, .theme-paper *)) {
    border-color: rgba(255, 255, 255, 0.18);
    border-top-color: #4e5374;
  }
  :root[data-theme="dark"] .lu-skeleton:not(:where(.theme-paper, .theme-paper *)) {
    background: linear-gradient(90deg, #222538 25%, #25283d 50%, #222538 75%);
  }
  :root[data-theme="dark"] .lu-skel-caption:not(:where(.theme-paper, .theme-paper *)) {
    color: #7c809c;
  }
}
/* ==== END DARK THEME ==== */
