/*
Copyright (c) 2010-2012 Ivan Vanderbyl
Originally found at http://ivan.ly/ui

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

*/

$background-color: #abb2bc;
$bar-color: #74d04c;
$height: 25px;
$border-width: 1px;
$border-color: #4c8932;
$border-radius: $height;

@import "compass/css3";

/* Webkit animation keyframes */
@-webkit-keyframes animate-stripes {
  from {
    background-position: 0 0; 
  }
  to {
    background-position: 44px 0; 
  }
}

@-moz-keyframes animate-stripes {
  from {
    background-position: 0 0; 
  }
  to {
    background-position: 36px 0;
  }
}

/* Bar which is placed behind the progress */
.ui-progress-bar {
  /* Usual setup stuff */
  position: relative;
  height: $height;
  /* Pad right so we don't cover the borders when fully progressed */
  padding-right: ($border-width * 2);
  /* For browser that don't support gradients, we'll set a blanket background colour */
  background-color: $background-color;
  
  /* Rounds the ends, we specify an excessive amount to make sure they are completely rounded */
  /* Adjust to your liking, and don't forget to adjust to the same amount in .ui-progress */
  @include border-radius($border-radius);
  
  /* Background gradient */  
  @include background(linear-gradient(darken($background-color, 8%) 0%, $background-color 100%));
  
  /* Give it the inset look by adding some shadows and highlights */
  @include box-shadow(inset 0px 1px 2px 0px rgba(0, 0, 0, 0.5), 0px 1px 0px 0px white);
  
  /* Alt colours */
  &.blue {
    .ui-progress {
      background-color: #339BB9!important;
      border: 1px solid darken(#339BB9, 10%);
    }
  }
  
  &.error {
    .ui-progress {
      background-color: #C43C35 !important;
      border: 1px solid darken(#C43C35, 10%);
    }
  }
  
  &.warning {
    .ui-progress {
      background-color: #D9B31A!important;
      border: 1px solid darken(#D9B31A, 10%);
    }
  }
  
  &.success {
    .ui-progress {
      background-color: #57A957!important;
      border: 1px solid darken(#57A957, 10%);
    }
  }
  
  &.transition .ui-progress {
    @include transition(background-color 0.5s ease-in, 
                        border-color 1.5s ease-out,
                        width .6s ease,
                        box-shadow 1.5s ease-out);
  }
  /* Progress part of the progress bar */
  .ui-progress {
    /* Usual setup stuff */
    position: relative;
    display: block;
    overflow: hidden;
    /* Height should be 2px less than .ui-progress-bar so as to not cover borders and give it a look of being inset */
    height: $height - ($border-width * 2);
    
    /* Rounds the ends, we specify an excessive amount to make sure they are completely rounded */
    /* Adjust to your liking, and don't forget to adjust to the same amount in .ui-progress-bar */
    @include border-radius($border-radius);
    
    /* Webkit */
    /* For browser that don't support gradients, we'll set a base background colour */
    background-color: $bar-color;
    
    /* Webkit background stripes and gradient */
    background: -webkit-gradient(linear, 0 0, 44 44,
      color-stop(0.00, rgba(255,255,255,0.17)),
      color-stop(0.25, rgba(255,255,255,0.17)),
      color-stop(0.26, rgba(255,255,255,0)),
      color-stop(0.50, rgba(255,255,255,0)),
      color-stop(0.51, rgba(255,255,255,0.17)),
      color-stop(0.75, rgba(255,255,255,0.17)),
      color-stop(0.76, rgba(255,255,255,0)),
      color-stop(1.00, rgba(255,255,255,0))
    ), -webkit-gradient(linear, left bottom, left top, color-stop(0, rgba(white, 0)), color-stop(1, rgba(white, 0.35))), $bar-color;
  
    /* Mozilla (Firefox etc) background stripes */
    /* Note: Mozilla's support for gradients is more true to the original design, allowing gradients at 30 degrees, as apposed to 45 degress in webkit. */
    background: -moz-repeating-linear-gradient(top left -30deg, 
      rgba(255,255,255,0.17), 
      rgba(255,255,255,0.17) 15px, 
      rgba(255,255,255,0) 15px, 
      rgba(255,255,255,0) 30px
    ), -moz-linear-gradient(rgba(white, 0.25) 0%, rgba(white, 0) 100%), $bar-color;

    /* Set the background size so the stripes work correctly */
    -webkit-background-size: 44px 44px;
    -moz-background-size: 36px 36px;
    
    @include box-shadow(inset 0px 1px 0px 0px rgba(white, 0.4), inset 0px -1px 1px rgba(black, 0.2));
        
    /* Give it a higher contrast outline */
    border: 1px solid $border-color;
    
    /* Animate */
    @include experimental(animation, animate-stripes 2s linear infinite);
    
    /* Style status label */
    span.ui-label {
      @include experimental(font-smoothing, antialiased);
      font-size: 13px;
      position: absolute;
      right: 0;
      line-height: $height - (2 * $border-width);
      padding-right: 12px;
      color: rgba(0, 0, 0, 0.6);
      text-shadow: rgba(255, 255, 255, 0.45) 0 1px 0px;
      white-space: nowrap; 
      
      b {
        font-weight: bold;
      }
    } 
  }
}
