/* Lightning Design System 0.9.1 */
// Copyright (c) 2015, salesforce.com, inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
// Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
// Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
// Neither the name of salesforce.com, inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.



@mixin focus {
  outline: thin dotted;
  outline: 5px auto $color-brand;
  outline-offset: -2px;
}

@mixin focus-button {
  outline: 0;
  box-shadow: $shadow-button-focus;
}

@mixin focus-inverse {
  outline: none;
  box-shadow: $shadow-button-focus-inverse;
}



@mixin placeholder($color: $color-text-placeholder, $weight: $font-weight-regular, $size: $font-size-medium) {

  &::-webkit-input-placeholder {
    color: $color;
    font-weight: $weight;
    font-size: $size;
  }

  &:-moz-placeholder{
    color: $color;
    font-weight: $weight;
    font-size: $size;
  }

  &::-moz-placeholder {
    color: $color;
    font-weight: $weight;
    font-size: $size;
  }

  &:-ms-input-placeholder {
    color: $color;
    font-weight: $weight;
    font-size: $size;
  }
}



@mixin button {
  padding: {
    left: $spacing-medium;
    right: $spacing-medium;
  }
  text-align: center;
  vertical-align: middle;
}

@mixin button-base {
  border: $border-width-thin solid $color-border-button-default;

  &:hover,
  &:focus {
    background-color: $color-background-button-default-hover;
  }

  &:active {
    background-color: $color-background-button-default-active;
  }
}

@mixin button-brand {
  background-color: $color-background-button-brand;
  border: $border-width-thin solid $color-border-button-brand;
  color: $color-text-button-brand;

  &:link,
  &:visited,
  &:active {
    color: $color-text-button-brand;
  }

  &:hover,
  &:focus {
    background-color: $color-background-button-brand-hover;
    color: $color-text-button-brand-hover;
  }

  &:active {
    background-color: $color-background-button-brand-active;
  }
}



@mixin nubbin($position: bottom, $location: "after", $color: $color-background-alt) {

  &:#{$location} {
    @include square($square-tooltip-nubbin);
    position: absolute;
    transform: rotate(45deg);
    content: "";
    background-color: $color;

    @if $position == top {
      left: 50%;
      top: (($square-tooltip-nubbin / 2) * -1);
      margin-left: (($square-tooltip-nubbin / 2) * -1);
    }

    @elseif $position == bottom {
      left: 50%;
      bottom: (($square-tooltip-nubbin / 2) * -1);
      margin-left: (($square-tooltip-nubbin / 2) * -1);
    }

    @elseif $position == left  {
      top: 50%;
      left: (($square-tooltip-nubbin / 2) * -1);
      margin-top: (($square-tooltip-nubbin / 2) * -1);
    }

    @elseif $position == right  {
      top: 50%;
      right: (($square-tooltip-nubbin / 2) * -1);
      margin-top: (($square-tooltip-nubbin / 2) * -1);
    }
  }
}



@mixin form-states {
  background-color: $color-background-input;
  color: $color-text-default;
  border: $border-width-thin solid $color-border-input {
    radius: $border-radius-medium;
  };
  width: 100%;
  transition: border $duration-quickly linear, background-color $duration-quickly linear;

  &:focus,
  &:active {
    outline: 0;
    border-color: $color-border-input-active;
    background-color: $color-background-input-active;
    box-shadow: $shadow-button-focus;
  }

  &[disabled] {
    background-color: $color-background-input-disabled;
    border-color: #a8b7c7; // This is throwing an error as if it doesn't exist $color-border-input-disabled;
    cursor: not-allowed;
    user-select: none;

    &:focus,
    &:active {
      box-shadow: none;
    }
  }

  .#{$css-prefix}has-error & {
    background-color: $color-background-input;
    border-color: $color-border-error;
    box-shadow: $color-border-error 0 0 0 $border-width-thin inset;
    background-clip: padding-box;

    &:focus,
    &:active {
      box-shadow: $color-border-error 0 0 0 $border-width-thin inset, $shadow-button-focus;
    }
  }
}



@mixin calendar-selection-fill {
  content: '';
  position: absolute;
  background: $color-background-button-brand-hover;
  top: 0;
  left: -50%;
  height: 100%;
  width: $square-icon-medium-boundary + $spacing-x-small;
  transform: translateX($spacing-x-small * -1);
  z-index: -1;
}



@mixin tree-item-hover {
  background: $color-background-row-hover;
  cursor: pointer;
}



@mixin tree-item-selected {
  background: $color-background-row-selected;
  box-shadow: $color-background-button-brand 4px 0 0 inset;
}



@mixin scrollbar($size: 10px,$thumb: $color-background-scrollbar,$track: $color-background-scrollbar-track) {

  &::-webkit-scrollbar {
    width:  $size;
    height: $size;

    &:window-inactive {
      opacity: 0;
    }
  }

  &::-webkit-scrollbar-thumb {
    background: $thumb;
    border-radius: $border-radius-large;
    box-shadow: $track 0 0 0 $border-width-thin inset;
  }

  &::-webkit-scrollbar-track {
    background: $track;
  }
}
