// create simple tabs from <a> unside <ul>
// $dir is 'bottom' for standard tabs
// 'top' for hanging tabs
// assumes placement on UL
@mixin tabs(
  $dir: top,
  $border-color: $base-color,
  $border-color-active: $white,
  $background-color: $darkgray,
  $background-color-active: $white,
  $spacing: 3px,
  $radius: 3px) {
  $from-the: bottom;
  @if $dir == bottom {
    $from-the: top;
  }
  @include horizontal-list($spacing);
  position: relative;
  li {
    border-#{$from-the}: 1px solid $border-color;
    margin-top: 1px;
    &.active {
      a {
        border-#{$from-the}: 1px solid $border-color-active;
        background-color: $background-color-active;
      }
    }
    a {
      border: {
        width: 1px;
        style: solid;
        color: $border-color;
      };
      background-color: $background-color;
      border-#{$from-the}-width: 0;
      position: relative;
      bottom: -0.25em;
      @if $from-the == bottom {
        @include border-top-radius($radius);
      }
      @else {
        @include border-bottom-radius($radius);
      }
      &:hover {
        background-color: $background-color-active;
        border-#{$from-the}: 1px solid $border-color-active;
      }
    }
  }
}

// remove drupal tab styling
// apply to <ul>
@mixin drupal-tab-reset {
  border-bottom: 0 solid transparent;
  li {
    a {
      background-color: transparent;
      border-style: none;
      border-color: transparent;
      border-width: 0;
      float: none;
      position: static;
      bottom: auto;
      padding: 0;
      margin-right: 0;
      &:hover {
        background-color: transparent;
        border-color: transparent;
        border-bottom-color: transparent;
      }
    }
    &.active {
      a {
        background-color: transparent;
        border-color: transparent;
        border-bottom-color: transparent;
      }
    }
  }
}

// assumes placement on UL
@mixin decending-z-order-tab($count: 20) {
  position: relative;
  li {
    position: relative;
    $t: 0;
    $i: $count;
    @while $i > 0 {
      &:nth-child(#{$t}) {
        z-index: #{$i};
      }
      $t: $t + 1;
      $i: $i - 1;
    }
  }
}

// universal transitions
@mixin transition-all($time: 0.2s, $ease: ease) {
  * {
    @include transition(all $time $ease);
  }
}

@mixin dropdown-menu($padding: false) {
  padding: 0;
  > li {
    @include inline-block-list-item($padding);
    position: relative;
    &:hover{
      ul {
        display: block;
      }
    }
  }
  ul {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 0;
    padding-left: 0;
    padding-right: 0;
    li {
      display: block;
      @if $padding != false {
        padding-left: $padding;
        padding-right: $padding;
      }
    }
  }
}

@mixin pretty-dropdown-menu(
    $padding: false,
    $background: false,
    $background-drop: false,
    $hover-color: false
    ) {
  @include dropdown-menu($padding);
  @if $background != false {
    background: $background;
  }
  > li {
    &:hover {
      @if $background-drop != false {
        background: $background-drop;
      }
    }
  }
  ul {
    @if $background-drop != false {
      background: $background-drop;
    }
    @else {
      @if $background != false {
        background: $background;
      }
    }
    li:hover {
      @if $hover-color != false {
        background: $hover-color;
      }
    }
  }
}
