/// ========================================================================
/// Bootstrap: mixins.less
/// https://github.com/twbs/bootstrap/blob/master/less/mixins/
/// 
/// ZUI: The file has been changed in ZUI. It will not keep update with the
/// Bootsrap version in the future.
/// http://zui.sexy
/// ========================================================================
/// Bootrap: Copyright 2011-2016 Twitter, Inc. Licensed under MIT
/// ========================================================================


// Utilities
// =========


// Clearfix
// 
// Source: http://nicolasgallagher.com/micro-clearfix-hack/
// For modern browsers
// 1. The space content is one way to avoid an Opera bug when the
//    contenteditable attribute is included anywhere else in the document.
//    Otherwise it causes space to appear at the top and bottom of elements
//    that are clearfixed.
// 2. The use of `table` rather than `block` is only necessary if using
//    `:before` to contain the top-margins of child elements.

.clearfix() {
  &:before,
  &:after {
    content: " ";   /* 1 */
    display: table; /* 2 */
  }
  &:after { clear: both; }
}


// Webkit-style focus

.tab-focus() {
  // Default
  outline: thin dotted #333;
  // Webkit
  outline: 5px auto -webkit-focus-ring-color;
  outline-offset: -2px;
}


// Center-align a block level element

.center-block() {
  display: block;
  margin-left: auto;
  margin-right: auto;
}


// Placeholder text

.placeholder(@color: @input-color-placeholder) {
  &::placeholder { color: @color; }
}


// Text overflow
// Requires inline-block or block for proper styling

.text-overflow() {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nobr() {
  white-space:nowrap;
  overflow:hidden;
}


// Text background

.bg-default() {
  color: #fff;
  background-color: @state-default-inverse-bg;
  a&:hover {
    background-color: darken(@state-default-inverse-bg, 10%);
  }
}

.bg-primary() {
  color: #fff;
  background-color: @state-primary-inverse-bg;
  a&:hover {
    background-color: darken(@state-primary-inverse-bg, 10%);
  }
}

.bg-success() {
  color: #fff;
  background-color: @state-success-inverse-bg;
  a&:hover {
    background-color: darken(@state-success-inverse-bg, 10%);
  }
}

.bg-info() {
  color: #fff;
  background-color: @state-info-inverse-bg;
  a&:hover {
    background-color: darken(@state-info-inverse-bg, 10%);
  }
}

.bg-warning() {
  color: #fff;
  background-color: @state-warning-inverse-bg;
  a&:hover {
    background-color: darken(@state-warning-inverse-bg, 10%);
  }
}

.bg-danger() {
  color: #fff;
  background-color: @state-danger-inverse-bg;
  a&:hover {
    background-color: darken(@state-danger-inverse-bg, 10%);
  }
}

.bg-important() {
  color: #fff;
  background-color: @state-important-inverse-bg;
  a&:hover {
    background-color: darken(@state-important-inverse-bg, 10%);
  }
}


.bg-special() {
  color: #fff;
  background-color: @state-special-inverse-bg;
  a&:hover {
    background-color: darken(@state-special-inverse-bg, 10%);
  }
}

// CSS image replacement
//
// Heads up! v3 launched with with only `.hide-text()`, but per our pattern for
// mixins being reused as classes with the same name, this doesn't hold up. As
// of v3.0.1 we have added `.text-hide()` and deprecated `.hide-text()`. Note
// that we cannot chain the mixins together in Less, so they are repeated.
//
// Source: https://github.com/h5bp/html5-boilerplate/commit/aa0396eae757

.text-hide() {
  font: ~"0/0" a;
  color: transparent;
  text-shadow: none;
  background-color: transparent;
  border: 0;
}


// CSS3 PROPERTIES
// ===============


// Single side border-radius

.border-top-radius(@radius) {
  border-top-right-radius: @radius;
  border-top-left-radius: @radius;
}
.border-right-radius(@radius) {
  border-bottom-right-radius: @radius;
  border-top-right-radius: @radius;
}
.border-bottom-radius(@radius) {
  border-bottom-right-radius: @radius;
  border-bottom-left-radius: @radius;
}
.border-left-radius(@radius) {
  border-bottom-left-radius: @radius;
  border-top-left-radius: @radius;
}


// Transitions

.transition(@transition) { transition: @transition;}
.transition-property(@transition-property) { transition-property: @transition-property; }
.transition-delay(@transition-delay) {transition-delay: @transition-delay; }
.transition-duration(@transition-duration) { transition-duration: @transition-duration; }
.transition-transform(@transition) { transition: transform @transition; }

.transition(@target; @speed; @type) {
  .transition(@target @speed @type);
}

.transition-none() {
  .transition(none);
}

.transition-fast(@target) {
  .transition(@target @animation-speed-fast @animation-type);
}

.transition-fast(@target1; @target2) {
  .transition(~"@{target1} @{animation-speed-fast} @{animation-type}, @{target2} @{animation-speed-fast} @{animation-type}");
}

.transition-fast(@target1; @target2; @target3) {
  .transition(~"@{target1} @{animation-speed-fast} @{animation-type}, @{target2} @{animation-speed-fast} @{animation-type}, @{target3} @{animation-speed-fast} @{animation-type}");
}

.transition-fast(@target1; @target2; @target3; @target4) {
  .transition(~"@{target1} @{animation-speed-fast} @{animation-type}, @{target2} @{animation-speed-fast} @{animation-type}, @{target3} @{animation-speed-fast} @{animation-type}, @{target4} @{animation-speed-fast} @{animation-type}");
}

.transition-fast(@target1; @target2; @target3; @target4; @target5;) {
  .transition(~"@{target1} @{animation-speed-fast} @{animation-type}, @{target2} @{animation-speed-fast} @{animation-type}, @{target3} @{animation-speed-fast} @{animation-type}, @{target4} @{animation-speed-fast} @{animation-type}, @{target5} @{animation-speed-fast} @{animation-type}");
}

.transition-fast(@target1; @target2; @target3; @target4; @target5; @target6) {
  .transition(~"@{target1} @{animation-speed-fast} @{animation-type}, @{target2} @{animation-speed-fast} @{animation-type}, @{target3} @{animation-speed-fast} @{animation-type}, @{target4} @{animation-speed-fast} @{animation-type}, @{target5} @{animation-speed-fast} @{animation-type}, @{target6} @{animation-speed-fast} @{animation-type}");
}

.transition-fast() {
  .transition-fast(all);
}

.transition-slow(@target) {
  .transition(@target @animation-speed-slow @animation-type);
}

.transition-slow() {
  .transition-slow(all);
}

.transition-normal(@target) {
  .transition(@target @animation-speed-normal @animation-type);
}

.transition-normal(@target1; @target2) {
  .transition(~"@{target1} @{animation-speed-normal} @{animation-type}, @{target2} @{animation-speed-normal} @{animation-type}");
}

.transition-normal(@target1; @target2; @target3) {
  .transition(~"@{target1} @{animation-speed-normal} @{animation-type}, @{target2} @{animation-speed-normal} @{animation-type}, @{target3} @{animation-speed-normal} @{animation-type}");
}

.transition-normal(@target1; @target2; @target3; @target4) {
  .transition(~"@{target1} @{animation-speed-normal} @{animation-type}, @{target2} @{animation-speed-normal} @{animation-type}, @{target3} @{animation-speed-normal} @{animation-type}, @{target4} @{animation-speed-normal} @{animation-type}");
}

.transition-normal() {
  .transition-normal(all);
}

.transition() {
  .transition-normal();
}


// Transformations

.scale(@ratio) {
  transform: scale(@ratio);
}
.translate(@x; @y) {
  transform: translate(@x, @y);
}
.translate3d(@x; @y; @z) {
  transform: translate3d(@x, @y, @z);
}


// Opacity

.opacity(@opacity) {
  opacity: @opacity;
  // IE8 filter
  @opacity-ie: (@opacity * 100);
  filter: ~"alpha(opacity=@{opacity-ie})";
}

.opacity-important(@opacity) {
  opacity: @opacity!important;
  // IE8 filter
  @opacity-ie: (@opacity * 100);
  filter: ~"alpha(opacity=@{opacity-ie})"!important;
}


// gradient

#gradient {

  // Horizontal gradient, from left to right
  //
  // Creates two color stops, start and end, by specifying a color and position for each color stop.
  // Color stops are not available in IE9 and below.
  .horizontal(@start-color: #555; @end-color: #333; @start-percent: 0%; @end-percent: 100%) {
    background-image:  linear-gradient(to right, @start-color @start-percent, @end-color @end-percent); // Standard, IE10
    background-repeat: repeat-x;
    filter: e(%("progid:DXImageTransform.Microsoft.gradient(startColorstr='%d', endColorstr='%d', GradientType=1)",argb(@start-color),argb(@end-color))); // IE9 and down
  }

  // Vertical gradient, from top to bottom
  //
  // Creates two color stops, start and end, by specifying a color and position for each color stop.
  // Color stops are not available in IE9 and below.
  .vertical(@start-color: #555; @end-color: #333; @start-percent: 0%; @end-percent: 100%) {
    background-image: linear-gradient(to bottom, @start-color @start-percent, @end-color @end-percent); // Standard, IE10
    background-repeat: repeat-x;
    filter: e(%("progid:DXImageTransform.Microsoft.gradient(startColorstr='%d', endColorstr='%d', GradientType=0)",argb(@start-color),argb(@end-color))); // IE9 and down
  }

  .directional(@start-color: #555; @end-color: #333; @deg: 45deg) {
    background-repeat: repeat-x;
    background-image: linear-gradient(@deg, @start-color, @end-color); // Standard, IE10
  }
  .horizontal-three-colors(@start-color: #00b3ee; @mid-color: #7a43b6; @color-stop: 50%; @end-color: #c3325f) {
    background-image: linear-gradient(to right, @start-color, @mid-color @color-stop, @end-color);
    background-repeat: no-repeat;
    filter: e(%("progid:DXImageTransform.Microsoft.gradient(startColorstr='%d', endColorstr='%d', GradientType=1)",argb(@start-color),argb(@end-color))); // IE9 and down, gets no color-stop at all for proper fallback
  }
  .vertical-three-colors(@start-color: #00b3ee; @mid-color: #7a43b6; @color-stop: 50%; @end-color: #c3325f) {
    background-image: linear-gradient(@start-color, @mid-color @color-stop, @end-color);
    background-repeat: no-repeat;
    filter: e(%("progid:DXImageTransform.Microsoft.gradient(startColorstr='%d', endColorstr='%d', GradientType=0)",argb(@start-color),argb(@end-color))); // IE9 and down, gets no color-stop at all for proper fallback
  }
  .radial(@inner-color: #555; @outer-color: #333) {
    background-image: radial-gradient(circle, @inner-color, @outer-color);
    background-repeat: no-repeat;
  }
  .striped(@color: rgba(255,255,255,.15); @angle: 45deg) {
    background-image: linear-gradient(@angle, @color 25%, transparent 25%, transparent 50%, @color 50%, @color 75%, transparent 75%, transparent);
  }
}


// Reset filters for IE
//
// When you need to remove a gradient background, do not forget to use this to reset
// the IE filter for IE9 and below.
.reset-filter() {
  filter: e(%("progid:DXImageTransform.Microsoft.gradient(enabled = false)"));
}


// Responsive image
//
// Keep images from scaling beyond the width of their parents.

.img-responsive(@display: block;) {
  display: @display;
  max-width: 100%; // Part 1: Set a maximum relative to the parent
  height: auto; // Part 2: Scale the height according to the width, otherwise you get stretching
}


// COMPONENT MIXINS
// ================


// Horizontal dividers
// Dividers (basically an hr) within dropdowns and nav lists

.nav-divider(@color: #e5e5e5) {
  height: 1px;
  margin: ((@line-height-computed / 2) - 1) 0;
  overflow: hidden;
  background-color: @color;
}


// Panels

.panel-variant(@border; @heading-text-color; @heading-bg-color; @heading-border;) {
  border-color: @border;
  & > .panel-heading {
    color: @heading-text-color;
    background-color: @heading-bg-color;
    border-color: @heading-border;
    + .panel-collapse .panel-body {
      border-top-color: @border;
    }
  }
  & > .panel-footer {
    + .panel-collapse .panel-body {
      border-bottom-color: @border;
    }
  }
}


// Alerts

.alert-variant(@background; @border; @text-color) {
  background-color: @background;
  // border-color: @border;
  color: darken(@text-color, 5%);
  hr {
    border-top-color: @border;
  }
  .alert-link {
    color: darken(@text-color, 12%);
  }
}

.alert-inverse-variant(@color;) {
  background-color: @color;
  border-color: @color;
  color: @color-white;
  hr {
    border-top-color: @color-gray-light; // fallback color
    border-top-color: fade(@color-gray-light, 25%);
  }
  .alert-link {
    color: fade(@color-white, 80%);
  }
}


// Tables

.table-row-variant(@state; @background; @border) {
  // Exact selectors below required to override `.table-striped` and prevent
  // inheritance to nested tables.
  .table > thead > tr,
  .table > tbody > tr,
  .table > tfoot > tr {
    > td.@{state},
    > th.@{state},
    &.@{state} > td,
    &.@{state} > th {
      background-color: @background;
      border-color: @border;
    }
  }

  // Hover states for `.table-hover`
  // Note: this is not available for cells or rows within `thead` or `tfoot`.
  .table-hover > tbody > tr {
    > td.@{state}:hover,
    > th.@{state}:hover,
    &.@{state}:hover > td,
    &.@{state}:hover > th {
      background-color: darken(@background, 5%);
      border-color: darken(@border, 5%);
    }
  }
}


// Button variants

// Easily pump out default styles, as well as :hover, :focus, :active,
// and disabled options for all buttons
.button-variant(@color; @background; @border) {
  color: @color;
  background-color: @background;
  border-color: @border;

  &:hover,
  &:focus,
  &:active,
  &.active,
  .open .dropdown-toggle& {
    color: @color;
    background-color: darken(@background, 8%);
        border-color: darken(@border, 12%);
    box-shadow: 0 2px 1px rgba(0, 0, 0, 0.1);

  }
  &:active,
  &.active,
  .open .dropdown-toggle& {
    background-image: none;
    background-color: darken(@background, 15%);
    border-color: darken(@border, 10%);
    box-shadow: inset 0 4px 6px rgba(0,0,0,0.15);

  }
  &.disabled,
  &[disabled],
  fieldset[disabled] & {
    &,
    &:hover,
    &:focus,
    &:active,
    &.active {
      background-color: @background;
          border-color: @border;
    }
  }
}


// button-styles
// Mixin for generating new styles

.button-styles(@btn-color: #555;) {
  #gradient > .vertical(@start-color: @btn-color; @end-color: darken(@btn-color, 4%));


  &:hover{
    #gradient > .vertical(@start-color: lighten(@btn-color, 1%); @end-color: lighten(@btn-color, 3%));
    border-color: darken(@btn-color, 15%);
  }

  &:active,
  &.active {
    background-color: darken(@btn-color, 10%);
    border-color: darken(@btn-color, 12%);
  }
}


// Button sizes

.button-size(@padding-vertical; @padding-horizontal; @font-size; @line-height; @border-radius) {
  padding: @padding-vertical @padding-horizontal;
  font-size: @font-size;
  line-height: @line-height;
  border-radius: @border-radius;
}


// Pagination

.pager-size(@padding-vertical; @padding-horizontal; @font-size; @border-radius) {
  > li {
    > a,
    > span {
      padding: @padding-vertical @padding-horizontal;
      font-size: @font-size;
    }
    &:first-child {
      > a,
      > span {
        .border-left-radius(@border-radius);
      }
    }
    &:last-child {
      > a,
      > span {
        .border-right-radius(@border-radius);
      }
    }
  }
}


// Labels

.label-variant(@color) {
  background-color: @color;
  &[href] {
    &:hover,
    &:focus {
      color: #fff;
      background-color: darken(@color, 10%);
    }
  }

  &.label-circle
  {
    background: none;
    border:1px solid @color;
    color: @color;
  }
}


// Navbar vertical align

// Vertically center elements in the navbar.
// Example: an element has a height of 30px, so write out `.navbar-vertical-align(30px);` to calculate the appropriate top margin.
.navbar-vertical-align(@element-height) {
  margin-top: ((@navbar-height - @element-height) / 2);
  margin-bottom: ((@navbar-height - @element-height) / 2);
}



// Progress bars

.progress-bar-variant(@color) {
  background-color: @color;
}


// Grid System

// Centered container element
.make-container(@gutter: @grid-gutter-width) {
  margin-right: auto;
  margin-left: auto;
  padding-left:  floor((@gutter / 2));
  padding-right: ceil((@gutter / 2));
  &:extend(.clearfix all);
}


// Responsive utilities

// More easily include all the states for responsive-utilities.less.
.responsive-visibility() {
  display: block !important;
  
  .inline& { display: inline !important; }
  .inline-block& { display: inline-block !important; }
  tr& { display: table-row !important; }
  th&,
  td& { display: table-cell !important; }
}

.responsive-invisibility() {
  &,
  .inline&,
  .inline-block&,
  tr&,
  th&,
  td& { display: none !important; }
}


// Creates a wrapper for a series of columns
.make-row(@gutter: @grid-gutter-width) {
  margin-left: ceil((@gutter / -2));
  margin-right: floor((@gutter / -2));
  &:extend(.clearfix all);
}


// Form validation states

// Used in forms.less to generate the form validation CSS for warnings, errors,
// and successes.

.form-control-validation(@text-color: #555; @border-color: #ccc; @background-color: #f5f5f5) {
  // Color the label and help text
  .help-block, > label { color: @text-color; }

  // Set the border and box shadow on specific inputs to match
  .form-control {
    border-color: @border-color;
    box-shadow: inset 0 1px 1px rgba(0,0,0,.075);
    // Redeclare so transitions work
    &:focus {
      border-color: darken(@border-color, 10%);
      @shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 6px lighten(@border-color, 20%);
      box-shadow: @shadow;
    }
  }
  // Set validation states also for addons
  .input-group-addon { color: @text-color; border-color: @border-color; background-color: @background-color; }
}

// Form control focus state
//
// Generate a customized focus state and for any input with the specified color,
// which defaults to the `@input-focus-border` variable.
//
// We highly encourage you to not customize the default value, but instead use
// this to tweak colors on an as-needed basis. This aesthetic change is based on
// WebKit's default styles, but applicable to a wider range of browsers. Its
// usability and accessibility should be taken into account with any change.
//
// Example usage: change the default blue border and shadow to white for better
// contrast against a dark gray background.

.form-control-focus(@color: @input-border-focus) {
  @color-rgba: rgba(red(@color), green(@color), blue(@color), .6);
  &:focus {
    border-color: @color;
    outline: 0;
    box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px @color-rgba;
  }
}

// Form control sizing
//
// Relative text size, padding, and border-radii changes for form controls. For
// horizontal sizing, wrap controls in the predefined grid classes. `<select>`
// element gets special love because it's special, and that's a fact!

.input-size(@input-height; @padding-vertical; @padding-horizontal; @font-size; @line-height; @border-radius) {
  height: @input-height;
  padding: @padding-vertical @padding-horizontal;
  font-size: @font-size;
  line-height: @line-height;
  border-radius: @border-radius;

  select& {
    height: @input-height;
    line-height: @input-height;
  }

  textarea& { height: auto; }
}


// Dropdown arrow/caret

.caret() {
  display: inline-block;
  width: 0;
  height: 0;
  margin-left: 2px;
  margin-bottom: 2px; // Fix vertical aligment
  vertical-align: middle;
  border-top:   @caret-width-base dashed;
  border-top:   @caret-width-base solid ~"\9"; // IE8
  border-right: @caret-width-base solid transparent;
  border-left:  @caret-width-base solid transparent;
}

// Reverse the caret
.caret-reverse() {
  // Firefox fix for https://github.com/twbs/bootstrap/issues/9538. Once this
  // gets fixed, restore `border-top: 0;`.
  border-top: 0 dotted;
  border-bottom: 4px solid;
  content: "";
}


// Icons

.icon-zenicon() {
  font-family: @icon-font-name;
  speak: none;
  font-size: 14px;
  font-style: normal;
  font-weight: normal;
  font-variant: normal;
  text-transform: none;
  line-height: 1;

  // Better Font Rendering
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.icon(@icon) {
  .icon-zenicon();

  &:before { content: @icon; }
}
