// Name:                     Progress
//
// Description:              Define style for progress
//
// Component:                `.am-progress`
//
// Modifiers:                `.am-progress-striped`
//                           `.am-progress-sm`
//                           `.am-progress-xs`
//
// States:                   `.am-active`
//
// =============================================================================

// Progress bar mixin
// =============================================================================

.progress-bar-variant(@color) {
  background-color: @color;
  .@{ns}progress-striped & {
    .gradient-striped();
  }
}


/* ==========================================================================
   Component: Progress
 ============================================================================ */

/* Progress bar animation */
@keyframes progress-bar-stripes {
  from  {
    background-position: 36px 0;
  }

  to    {
    background-position: 0 0;
  }
}


/*  Progress container */
.@{ns}progress {
  overflow: hidden;
  height: @progress-height;
  margin-bottom: @line-height-computed;
  background-color: @progress-bg;
  border-radius: @global-radius;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .1);

  .hook-progress;
}


/* Progress bar */

.@{ns}progress-bar {
  float: left;
  width: 0;
  height: 100%;
  font-size: @progress-bar-font-size;
  line-height: @progress-height;
  color: @progress-bar-color;
  text-align: center;
  background-color: @progress-bar-bg;
  box-shadow: inset 0 -1px 0 rgba(0,0,0,.15);
  transition: width .6s ease;

  .hook-progress-bar;

  // Striped bar
  .@{ns}progress-striped & {
    .gradient-striped();
    background-size: 36px 36px;
    .hook-progress-striped;
  }

  // Active animation
  .@{ns}progress.@{ns}active & {
    animation: progress-bar-stripes 2s linear infinite;
  }

  // Lower value
  &[aria-valuenow="1"],
  &[aria-valuenow="2"] {
    min-width: 30px;
  }

  &[aria-valuenow="0"] {
    color: @gray-light;
    min-width: 30px;
    background: none;
    box-shadow: none;
  }
}


// Modifiers
// =============================================================================

.@{ns}progress-bar-secondary {
  .progress-bar-variant(@progress-bar-secondary-bg);
  .hook-progress-bar-secondary;
}

.@{ns}progress-bar-success {
  .progress-bar-variant(@progress-bar-success-bg);
  .hook-progress-bar-success;
}

.@{ns}progress-bar-warning {
  .progress-bar-variant(@progress-bar-warning-bg);
  .hook-progress-bar-warning;
}

.@{ns}progress-bar-danger {
  .progress-bar-variant(@progress-bar-danger-bg);
  .hook-progress-bar-danger;
}


// Size
// =============================================================================

.@{ns}progress-xs {
  height: @progress-height-xs;
}

.@{ns}progress-sm {
  height: @progress-height-sm;
}


// Hooks
// =============================================================================

.hook-progress() {}
.hook-progress-striped() {}
.hook-progress-bar() {}
.hook-progress-bar-secondary() {}
.hook-progress-bar-success() {}
.hook-progress-bar-warning() {}
.hook-progress-bar-danger() {}
