/**
 * ============================================================================
 * HarshGuruJi Loading Lines Stylesheet (@ruhith369 / 21st.dev)
 * ============================================================================
 * Universal, responsive, zero-dependency loading animation system.
 * Features:
 *   - Oscillating vertical rainbow equalizer spectrum lines
 *   - Synchronized letter-wave luminous text
 *   - Auto adapts to Light and Dark mode
 *   - Supports Fullscreen Overlay, Inline Section, and Button Micro modes
 * ============================================================================
 */

:root {
  --hg-ll-bg-overlay: rgba(255, 255, 255, 0.94);
  --hg-ll-text-base: #64748b;
  --hg-ll-text-active: #0f172a;
  --hg-ll-subtext: #64748b;
  --hg-ll-glow: rgba(99, 102, 241, 0.35);
  --hg-ll-backdrop: blur(14px);
}

@media (prefers-color-scheme: dark) {
  :root {
    --hg-ll-bg-overlay: rgba(9, 13, 22, 0.94);
    --hg-ll-text-base: #94a3b8;
    --hg-ll-text-active: #ffffff;
    --hg-ll-subtext: #94a3b8;
    --hg-ll-glow: rgba(255, 255, 255, 0.7);
  }
}

body.dark, [data-theme="dark"] {
  --hg-ll-bg-overlay: rgba(9, 13, 22, 0.94);
  --hg-ll-text-base: #94a3b8;
  --hg-ll-text-active: #ffffff;
  --hg-ll-subtext: #94a3b8;
  --hg-ll-glow: rgba(255, 255, 255, 0.7);
}

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

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

/* --- MAIN LOADING WRAPPER --- */
.hg-loading-lines-wrapper {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  user-select: none;
  padding: 1.5rem;
  box-sizing: border-box;
  text-align: center;
}

/* Container for vertical oscillating spectrum lines */
.hg-loading-lines-cluster {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  pointer-events: none;
  z-index: 1;
}

/* Individual vertical spectrum line */
.hg-ll-bar {
  width: 2.5px;
  height: var(--bar-h, 84px);
  border-radius: 9999px;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.05) 0%,
    var(--bar-c) 25%,
    var(--bar-c) 75%,
    rgba(255, 255, 255, 0.05) 100%
  );
  transform-origin: center;
  animation: hg-bar-pulse 1.3s ease-in-out infinite;
  animation-delay: var(--bar-d, 0s);
  opacity: 0.85;
  will-change: transform, opacity;
}

@keyframes hg-bar-pulse {
  0%, 100% {
    transform: scaleY(0.48);
    opacity: 0.35;
  }
  50% {
    transform: scaleY(1.08);
    opacity: 0.98;
  }
}

/* Foreground Animated Label */
.hg-loading-lines-label {
  position: relative;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Inter", sans-serif;
  font-size: 2.75rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1;
  pointer-events: none;
}

.hg-ll-char {
  display: inline-block;
  color: var(--hg-ll-text-base);
  opacity: 0.55;
  animation: hg-char-wave 1.4s ease-in-out infinite;
  animation-delay: var(--char-d, 0s);
  transition: color 0.2s, opacity 0.2s, transform 0.2s;
}

@keyframes hg-char-wave {
  0%, 100% {
    opacity: 0.5;
    color: var(--hg-ll-text-base);
    transform: translateY(0);
  }
  40% {
    opacity: 1;
    color: var(--hg-ll-text-active);
    transform: translateY(-1.5px);
    text-shadow: 0 0 16px var(--hg-ll-glow);
  }
  70% {
    opacity: 0.65;
    color: var(--hg-ll-text-base);
  }
}

/* Subtitle for contextual description */
.hg-loading-subtitle {
  position: relative;
  z-index: 2;
  margin-top: 1.1rem;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Inter", sans-serif;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--hg-ll-subtext);
  letter-spacing: -0.01em;
  max-width: 380px;
  line-height: 1.4;
  text-align: center;
}

/* --- COMPACT VARIATION (FOR CARDS / SECTIONS / MODALS) --- */
.hg-loading-lines-wrapper.compact {
  padding: 1rem;
}
.hg-loading-lines-wrapper.compact .hg-loading-lines-cluster {
  gap: 4.5px;
}
.hg-loading-lines-wrapper.compact .hg-ll-bar {
  width: 2px;
  height: calc(var(--bar-h, 84px) * 0.62);
}
.hg-loading-lines-wrapper.compact .hg-loading-lines-label {
  font-size: 1.7rem;
}
.hg-loading-lines-wrapper.compact .hg-loading-subtitle {
  font-size: 0.85rem;
  margin-top: 0.75rem;
}

/* --- MICRO / BUTTON SPINNER REPLACEMENT --- */
.hg-btn-loading-lines {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  vertical-align: middle;
  height: 20px;
  padding: 0 4px;
  box-sizing: border-box;
}

.hg-btn-bar {
  width: 2px;
  border-radius: 9999px;
  transform-origin: center;
  animation: hg-bar-pulse 1s ease-in-out infinite;
  animation-delay: var(--bar-d, 0s);
}

/* Legacy .spinner upgrade */
.spinner.hg-spectrum-spinner {
  width: auto !important;
  height: 20px !important;
  border: none !important;
  border-radius: 0 !important;
  animation: none !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 3px !important;
  vertical-align: middle !important;
}

/* Media query for mobile responsive scaling */
@media (max-width: 640px) {
  .hg-loading-lines-label {
    font-size: 2.2rem;
  }
  .hg-loading-lines-cluster {
    gap: 4.5px;
  }
  .hg-ll-bar {
    width: 2px;
    height: calc(var(--bar-h, 84px) * 0.8);
  }
  .hg-loading-lines-wrapper.compact .hg-loading-lines-label {
    font-size: 1.4rem;
  }
}
