/* ============================================================================
 * HarshGuruJi 5-Color Worm Loader (@ruixen.ui/components/worm-loader style)
 * Uses the 5 exact HarshGuruJi logo colors:
 *   #30B050 (Green), #1070F0 (Blue), #7030D0 (Purple), #F03030 (Red), #F0B010 (Gold)
 * Supports Fullscreen Overlay, Inline Section, and Button Micro modes.
 * ============================================================================ */

:root {
  --hg-worm-bg: rgba(233, 235, 233, 0.94);
  --hg-worm-text: #131A15;
  --hg-worm-sub: #646D67;
  --hg-worm-track: rgba(19, 26, 21, 0.08);
  --hg-worm-backdrop: blur(14px);
}

@media (prefers-color-scheme: dark) {
  :root {
    --hg-worm-bg: rgba(10, 14, 11, 0.94);
    --hg-worm-text: #E7EEE9;
    --hg-worm-sub: #9BA69F;
    --hg-worm-track: rgba(255, 255, 255, 0.08);
  }
}

html[data-theme="light"] {
  --hg-worm-bg: rgba(233, 235, 233, 0.94);
  --hg-worm-text: #131A15;
  --hg-worm-sub: #646D67;
  --hg-worm-track: rgba(19, 26, 21, 0.08);
}

html[data-theme="dark"], body.dark {
  --hg-worm-bg: rgba(10, 14, 11, 0.94);
  --hg-worm-text: #E7EEE9;
  --hg-worm-sub: #9BA69F;
  --hg-worm-track: rgba(255, 255, 255, 0.08);
}

/* --- FULLSCREEN CENTER OVERLAY --- */
.hg-loader-overlay {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 9999999;
  background: var(--hg-worm-bg);
  backdrop-filter: var(--hg-worm-backdrop);
  -webkit-backdrop-filter: var(--hg-worm-backdrop);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transition: opacity 0.25s cubic-bezier(0.22, 1, 0.36, 1), visibility 0.25s;
}

.hg-loader-overlay.active {
  opacity: 1;
  pointer-events: auto;
  visibility: visible;
}

/* --- WORM LOADER CONTAINER --- */
.hg-loading-lines-wrapper {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  user-select: none;
  padding: 1.5rem 2rem;
  box-sizing: border-box;
  text-align: center;
}

/* Ruixen Worm Track */
.hg-worm-loader {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--hg-worm-track);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

/* Individual 5-Color Worm Segments */
.hg-worm-seg {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--seg-c, #30B050);
  box-shadow: 0 0 12px var(--seg-c, #30B050);
  transform-origin: center;
  animation: hg-worm-wave 1.15s cubic-bezier(0.45, 0.05, 0.55, 0.95) infinite;
  animation-delay: var(--seg-d, 0s);
  will-change: transform, width, opacity;
}

@keyframes hg-worm-wave {
  0%, 100% {
    transform: translateY(0px) scale(0.85);
    height: 10px;
    opacity: 0.55;
  }
  35% {
    transform: translateY(-7px) scale(1.15);
    height: 20px;
    opacity: 1;
  }
  70% {
    transform: translateY(5px) scale(0.95);
    height: 12px;
    opacity: 0.85;
  }
}

/* Label */
.hg-loading-lines-label {
  font-family: 'Plus Jakarta Sans', 'Inter', system-ui, sans-serif;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--hg-worm-text);
  display: inline-flex;
  align-items: center;
  gap: 1px;
}

.hg-ll-char {
  display: inline-block;
  animation: hg-char-pulse 1.4s ease-in-out infinite;
  animation-delay: var(--char-d, 0s);
}

@keyframes hg-char-pulse {
  0%, 100% { opacity: 0.55; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(-2px); }
}

.hg-loading-subtitle {
  font-family: 'Plus Jakarta Sans', 'Inter', system-ui, sans-serif;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--hg-worm-sub);
  max-width: 320px;
}

/* Compact Mode */
.hg-loading-lines-wrapper.compact {
  padding: 0.75rem 1rem;
  gap: 8px;
}
.hg-loading-lines-wrapper.compact .hg-worm-loader {
  height: 28px;
  gap: 6px;
  padding: 0 10px;
}
.hg-loading-lines-wrapper.compact .hg-worm-seg {
  width: 7px;
  height: 7px;
}
.hg-loading-lines-wrapper.compact .hg-loading-lines-label {
  font-size: 0.85rem;
}

/* Button Micro Worm Spinner */
.hg-btn-loading-lines {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  vertical-align: middle;
}

.hg-btn-bar {
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 999px;
  animation: hg-btn-worm 0.9s ease-in-out infinite;
  animation-delay: var(--bar-d, 0s);
}

@keyframes hg-btn-worm {
  0%, 100% { transform: translateY(0) scale(0.8); opacity: 0.5; }
  50% { transform: translateY(-4px) scale(1.2); opacity: 1; }
}

/* ============================================================================
 * PROGRESSIVE FLUX UPLOAD LINE ANIMATION (@21st.dev progressive-flux-loader)
 * Used across Book, Music, APK, and Asset Uploads
 * ============================================================================ */
.hg-flux-track {
  position: relative;
  height: 16px !important;
  width: 100%;
  overflow: hidden;
  border-radius: 9999px !important;
  background: rgba(148, 163, 184, 0.16) !important;
  box-shadow: inset 0 2px 3px rgba(0, 0, 0, 0.35), inset 0 -1px 2px rgba(255, 255, 255, 0.06);
}

.hg-flux-fill {
  position: relative;
  height: 100% !important;
  border-radius: 9999px !important;
  background: linear-gradient(90deg, #1d6ffb 0%, #48a7fd 35%, #74e1ff 55%, #48a7fd 78%, #1d6ffb 100%) !important;
  box-shadow: 0 0 18px rgba(29, 111, 251, 0.55), 0 0 32px rgba(116, 225, 255, 0.4), inset 0 1.5px 0 rgba(255, 255, 255, 0.5), inset 0 -2px 3px rgba(0, 40, 120, 0.35) !important;
  transition: width 0.45s cubic-bezier(0.22, 1, 0.36, 1) !important;
  overflow: hidden;
}

.hg-flux-fill::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 50%;
  border-radius: 9999px;
  background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.6) 50%, transparent 100%);
  mix-blend-mode: screen;
  animation: hg-flux-sheen 1.5s linear infinite;
}

@keyframes hg-flux-sheen {
  0% { transform: translateX(-110%); }
  100% { transform: translateX(220%); }
}

@media (prefers-reduced-motion: reduce) {
  .hg-worm-seg, .hg-ll-char, .hg-btn-bar, .hg-flux-fill::after {
    animation: none !important;
  }
}
