//
// Loading indicator
// --------------------------------------------------

.loading-indicator,
.progress-indicator {
  color: $text-muted;
  font-weight: $font-weight-bold;
  text-align: left;
  font-size: 16px;
  z-index: $zindex-fixed;
}

.progress-indicator-container {
  &.in-progress {
    position: relative;
  }
  
  .progress-indicator {
    background: transparent;
    border-radius: $border-radius;
    padding: 10px;
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;

    > div {
      display: inline-block;
    }

    > .ti-loading {
      margin-right: 10px;
    }
  }

  &.in-progress {
    > :not(.progress-indicator) {
      visibility: hidden;
    }

    .selectize-input.focus {
      box-shadow: none;
    }

    .btn:focus {
      box-shadow: none;
    }
  }
}

html.cssanimations {
  .progress-indicator > span {
    animation: "spin 1s linear infinite";
  }

  .progress-indicator.is-opaque,
  .progress-indicator-container.is-opaque .progress-indicator {
    > span {
    }
  }
}

// Centered

.progress-indicator.indicator-center,
.progress-indicator-container.indicator-center .progress-indicator {
  padding: 20px;

  > span {
    left: 50%;
    margin-left: -20px;
    margin-top: -20px;
  }

  > div {
    text-align: center;
    position: relative;
    margin-top: 30px;
  }
}

@mixin transition-delay($delay...) {
  -moz-transition-delay: $delay;
  -o-transition-delay: $delay;
  -webkit-transition-delay: $delay;
  transition-delay: $delay;
}

@mixin transform($transforms) {
  -moz-transform: $transforms;
  -o-transform: $transforms;
  -ms-transform: $transforms;
  -webkit-transform: $transforms;
  transform: $transforms;
}

//
// Bar loading indicator
// --------------------------------------------------

.bar-loading-indicator {
  height: 4px;
  background: transparent;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  overflow: hidden;
  z-index: $zindex-fixed+100;

  .bar, .bar-loaded {
    height: 4px;
    display: block;
    background: $primary;
    position: absolute;
    @include box-shadow(#{"inset 0 1px 1px -1px #FFF, inset 0 -1px 1px -1px #FFF"});
  }

  .bar {
    width: 100%;
    animation: "infinite-loader 60 s linear";
    -webkit-animation: "infinite-loader 60 s linear";
  }

  .bar-loaded {
    width: 0;
    opacity: 0;
  }

  &.loaded {
    opacity: 0;
    @include transition(opacity .4s linear);
    @include transition-delay(.3s);

    .bar-loaded {
      opacity: 1;
      @include transition(width .3s linear);
      width: 100% !important;
    }
  }

  &.hide {
    display: none;
  }
}

.ti-loading {
  &.spinner-border {
    opacity: .5;
  }

  &.fa-3x {
    width: 3rem;
    height: 3rem;
  }
}
