.loader {
  box-sizing: border-box;

  /**
  * `overflow` and `position` are required steps to make sure
  * the component respects the specified dimensions
  * given via `theme` object @Input attribute
  */
  overflow: hidden;
  position: relative;

  background: rgb(239, 241, 246) no-repeat;

  border-radius: 4px;
  width: 100%;
  height: 20px;
  display: inline-block;
  margin-bottom: 10px;

  // More details about CSS `will-change` property
  // in https://developer.mozilla.org/en-US/docs/Web/CSS/will-change
  will-change: transform;

  &:after,
  &:before {
    box-sizing: border-box;
  }

  /**
  * Added only when `appearance` attribute is `circle`
  * at component level. So that we can use it only if needed
  */
  &.circle {
    width: 40px;
    height: 40px;
    margin: 5px;
    border-radius: 50%;
  }

  /**
  * Added only when `animation` attribute is `progress`
  * at component level. So that we can load the
  * animations only if needed
  */
  &.progress,
  &.progress-dark {
    animation: progress 2s ease-in-out infinite;
    background-size: 200px 100%;
  }

  &.progress {
    background-image: linear-gradient(
      90deg,
      rgba(255, 255, 255, 0),
      rgba(255, 255, 255, 0.6),
      rgba(255, 255, 255, 0)
    );
  }

  &.progress-dark {
    background-image: linear-gradient(
      90deg,
      transparent,
      rgba(0, 0, 0, 0.2),
      transparent
    );
  }

  /**
  * Added only when `animation` attribute is `pulse`
  * at component level. So that we can load the
  * animations only if needed
  */
  &.pulse {
    animation: pulse 1.5s ease-in-out infinite;
    animation-delay: 0.5s;
  }

  // Removing animation if user enabled the `Reduce Motion` option
  // via operational system and/or browser
  // More details about `prefers-reduced-motion` in https://web.dev/prefers-reduced-motion/
  @media (prefers-reduced-motion: reduce) {
    &.pulse,
    &.progress-dark,
    &.progress {
      animation: none;
    }

    &.progress,
    &.progress-dark {
      background-image: none;
    }
  }
}

// CSS Animation Keyframes
@keyframes progress {
  0% {
    background-position: -200px 0;
  }
  100% {
    background-position: calc(200px + 100%) 0;
  }
}

@keyframes pulse {
  0% {
    opacity: 1;
  }
  50% {
    opacity: 0.4;
  }
  100% {
    opacity: 1;
  }
}
