// @import "./variables.scss";

.#{$namespace}bar {
  background: $bar-bg;
  border-radius: calc($bar-height * 0.5);
  display: flex;
  flex-wrap: nowrap;
  height: $bar-height;
  width: 100%;

  &.#{$namespace}bar-sm {
    height: $bar-height-sm;
    .#{$namespace}bar-item {
      &:first-child {
        border-bottom-left-radius: calc($bar-height-sm * 0.5);
        border-top-left-radius: calc($bar-height-sm * 0.5);
      }
      &:last-child {
        border-bottom-right-radius: calc($bar-height-sm * 0.5);
        border-top-right-radius: calc($bar-height-sm * 0.5);
      }
    }
  }

  // TODO: attr() support
  .#{$namespace}bar-item {
    background: $bar-item-bg;
    color: $bar-item-color;
    display: block;
    font-size: $bar-item-font-size;
    flex-shrink: 0;
    line-height: $bar-item-line-height;
    height: 100%;
    position: relative;
    text-align: center;
    width: 0;

    &:first-child {
      border-bottom-left-radius: calc($bar-height * 0.5);
      border-top-left-radius: calc($bar-height * 0.5);
    }
    &:last-child {
      border-bottom-right-radius: calc($bar-height * 0.5);
      border-top-right-radius: calc($bar-height * 0.5);
      flex-shrink: 1;
    }
  }
}

// Slider bar
.#{$namespace}bar-slider {
  height: $bar-slider-height;
  margin: $bar-slider-margin;
  position: relative;

  .#{$namespace}bar-item {
    left: 0;
    padding: 0;
    position: absolute;
    &:not(:last-child):first-child {
      background: $bar-slider-item-first-child-bg;
      z-index: 1;
    }
  }

  .#{$namespace}bar-slider-btn {
    background: $bar-slider-btn-bg;
    border: 0;
    border-radius: 50%;
    height: $bar-slider-btn-height;
    width: $bar-slider-btn-width;
    padding: 0;
    position: absolute;
    right: 0;
    top: 50%;
    box-shadow: $bar-slider-btn-box-shadow;
    transform: translate(50%, -50%);
    content: '';
    cursor: pointer;

    &:active {
      box-shadow: $bar-slider-btn-active-box-shadow;
    }
  }
}

.#{$namespace}linearProgress {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  height: $linearProgress-default-height;
  color: $linearProgress-default-color;
  &.#{$namespace}linearProgress-sm {
    height: $linearProgress-sm-height;
    .#{$namespace}linearProgress-label {
      line-height: $linearProgress-sm-height;    
    }
  }
  &.#{$namespace}linearProgress-xs {
    height: $linearProgress-xs-height;
    .#{$namespace}linearProgress-label {
      line-height: $linearProgress-xs-height;    
    }
  }
  .#{$namespace}linearProgress-item {
    flex: 1;
    display: inline-flex;
    align-items: center;
    height: 100%;
    background-color: $linearProgress-item-default-bg-color;
    border-radius: $linearProgress-default-height;
    overflow: hidden;

    .#{$namespace}linearProgress-item-content {
      height: 100%;
      color: $linearProgress-item-default-color;
      background-color: $linearProgress-item-content-default-bg-color;
      border-top-right-radius: $linearProgress-default-height;
      border-bottom-right-radius: $linearProgress-default-height;
      text-align: center;

      &.#{$namespace}linearProgress-item-primary {
        background-color: $linearProgress-item-primary-bg-color;
      }
      &.#{$namespace}linearProgress-item-success {
        background-color: $linearProgress-item-success-bg-color;
      }
      &.#{$namespace}linearProgress-item-warning {
        background-color: $linearProgress-item-warning-bg-color;
      }
      &.#{$namespace}linearProgress-item-error {
        background-color: $linearProgress-item-error-bg-color;
      }
      &.#{$namespace}linearProgress-item-info {
        background-color: $linearProgress-item-info-bg-color;
      }
      .#{$namespace}linearProgress-label {
        min-width: none;
      }
    }
  }
  .#{$namespace}linearProgress-label {
    min-width: 4em;
    height: 100%;
    line-height: $linearProgress-default-height;    
    padding: 0 .5em;
    text-align: center;
  }
}
