#top-progress-bar {
  position: fixed;
  inset: 0 0 auto 0;
  height: 3px;
  z-index: 3000;
  pointer-events: none;
  background: linear-gradient(
    90deg,
    transparent,
    var(--color-primary) 35%,
    var(--color-primary-hover) 50%,
    var(--color-primary) 65%,
    transparent
  );
  background-size: 200% 100%;
  opacity: 0;
  transform: scaleX(0.1);
  transform-origin: right; /* RTL: از راست شروع می‌شود */
  box-shadow: 0 0 8px var(--color-primary-soft);
  transition: opacity 220ms ease, transform 260ms ease;
}

#top-progress-bar.active {
  opacity: 1;
  transform: scaleX(1);
  animation: top-progress-sweep 1.1s ease-in-out infinite;
}

@keyframes top-progress-sweep {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

@media (prefers-reduced-motion: reduce) {
  #top-progress-bar.active { animation: none; }
}
