@import './../../../styles/_base';

$background-color: #d6d6d6;
$background-color-light: lighten($background-color, 5%);

.ngx-loading-bar-dark {
  background-color: $color-grey;
}

.ngx-loading-bar-light {
  background-color: $color-grey-light;
}

:host {
  display: block;
  height: 8px;
  overflow: hidden;
  position: relative;
  margin-bottom: 12px;

  &.loader-bar--fixed {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 999;
    width: 100%;
  }
}

.ngx-loading-bar {
  margin: 0 auto 3rem auto;
  overflow: hidden;
  width: 100%;
  height: 0.5rem;

  &__row {
    transform: scaleX(1);
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 100%;
    animation: loading-bar 2s infinite backwards ease-out;

    &:nth-child(1) {
      animation-delay: -1.5s;
    }

    &:nth-child(2) {
      animation-delay: -1s;
    }

    &:nth-child(3) {
      animation-delay: -0.5s;
    }

    &:nth-child(4) {
      animation-delay: 0s;
    }
  }
}

@keyframes loading-bar {
  0% {
    transform: scaleX(0);
    z-index: 15;
  }
  22% {
    transform: scaleX(0);
    z-index: 15;
  }
  50% {
    transform: scaleX(1);
  }
  90% {
    transform: scaleX(1);
    z-index: 1;
  }
  100% {
    transform: scaleX(1);
    z-index: 0;
  }
}
