/*---------------------------------------------------------------------------------------------
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/
@import '../style/index';

@mixin uicore-progress-bar($height: 4px) {
  text-align: left;
  display: block;
  height: $height;
  width: 100%;
  background: $buic-background-5;
  overflow: hidden;

  > * {
    display: inline-block;
    background: $buic-foreground-primary;
    height: 100%;
    vertical-align: top;
  }

  &.success {
    background: $buic-foreground-success;

    > * {
      background: $buic-foreground-success;
    }
  }

  &.warning {
    background: $buic-foreground-warning;

    > * {
      background: $buic-foreground-warning;
    }
  }

  &.error {
    background: $buic-foreground-alert;

    > * {
      background: $buic-foreground-alert;
    }
  }
}

@mixin uicore-progress-bar-determinate($speed: 2s) {
  transition: width $speed ease-in-out;
}

@mixin uicore-progress-bar-indeterminate() {
  @keyframes uicore-progress-bar-animate-indeterminate {
    0% {
      transform: translateX(-60%) scaleX(0);
    }

    40% {
      transform: translateX(-40%) scaleX(0.4);
    }

    100% {
      transform: translateX(100%) scaleX(0.5);
    }
  }
  width: 100%;
  animation: uicore-progress-bar-animate-indeterminate 1.5s infinite linear;
}

@mixin uicore-progress-bar-labeled() {
  width: 100%;

  > .uicore-label {
    text-align: center;
    width: 100%;
    overflow: hidden;
    margin-top: $uicore-xs;
    display: block;
    font-size: $uicore-font-size-small;

    > :first-child {
      float: left;
    }

    > :last-child {
      float: right;
      user-select: none;
    }
  }
}
