/**
 * Tabs
 * http://www.google.com/design/spec/components/tabs.html
 */

$am-tabs-padding: 0 24px !default;
$am-tabs-background: am-color(primary) !default;
$am-tabs-border-width: 3px !default;
$am-tabs-color: rgba(#fff, 0.6) !default;
$am-tabs-color-focus: #fff !default;
$am-tabs-btn-background: inherit !default;
$am-tabs-btn-background-focus: inherit !default;
$am-tabs-btn-border-color: inherit !default;
$am-tabs-font: $am-font-weight-regular 14px/16px $am-font-sans !default;

@keyframes am-tabs-error-throb {
  from {
    text-shadow: none;
    transform: translateY(1px);
  }

  to {
    text-shadow: 0 0 5px rgba($am-theme-error, 0.8);
    transform: translateY(-1px);
  }
}

@mixin am-tabs {
  color: $am-tabs-color;
  background: $am-tabs-background;
  box-shadow: inset 0 -1px 1px rgba(#000, 0.15);
  line-height: 0;
  margin: 0;
  padding: $am-tabs-padding;
}

@mixin am-tabs-list {
  list-style: none;
}

@mixin am-tabs-list-item {
  display: inline-block;
  border-color: $am-tabs-btn-border-color;
}

@mixin am-tabs-btn {
  background: $am-tabs-btn-background;
  color: $am-tabs-color;
  cursor: pointer;
  display: block;
  font: $am-tabs-font;
  letter-spacing: 0.08em;
  padding: am-unit(2);
  position: relative;
  text-transform: uppercase;
  transition: 0.2s color;
  -moz-appearance: none;
  -webkit-appearance: none;

  &:after {
    @include am-fill(secondary-text-light);
    bottom: 0;
    box-shadow: 0 -1px 1px rgba(#000, 0.1);
    content: "";
    height: $am-tabs-border-width;
    left: 0;
    position: absolute;
    transform: translateY($am-tabs-border-width);
    transition: 0.2s background, 0.25s transform;
    width: 100%;
  }

  &:focus,
  &:hover {
    background: $am-tabs-btn-background-focus;
    outline: none;
    text-decoration: none;

    &:after {
      transform: none;
    }
  }

  &:active {
    border: 0;
    box-shadow: none;
  }
}

@mixin am-tabs-btn-active {
  background: $am-tabs-btn-background-focus;
  color: $am-tabs-color-focus;

  &:after {
    @include am-fill(accent);
    box-shadow: 0 -1px 1px rgba(#000, 0.1), inset 0 1px 1px rgba(#fff, 0.50);
    transform: none;
  }

  &:focus,
  &:hover {
    background: $am-tabs-btn-background-focus;
  }
}

@mixin am-tabs-btn-error {
  padding-right: am-unit(5);

  &:before {
    @include am-color(error-400);
    animation: 2s am-tabs-error-throb infinite alternate;
    content: '\026a0';
    font-size: 20px;
    line-height: am-unit(2);
    margin-top: -6px;
    position: absolute;
    right: am-unit(1);
    top: 50%;
  }
}
