@import '../../styles/common/mixins';
@import '../../styles/common/colors';
@import '../../styles/common/screen';

.btn {
  @include vertical-align('inline');
  @include button-context($primary-1, $white);
  border: 1px solid transparent;
  border-radius: 3px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 200;
  line-height: 1em;
  margin-right: 12px;
  padding: 8px;
  text-decoration: none;
  transform: translateY(0);
  user-select: none;
  vertical-align: middle;
  white-space: nowrap;

  svg {
    fill: $white;
  }

  em {
    font-style: normal;
  }

  &.loading > em,
  &.loading + svg {
    opacity: 0;
  }

  // Button size(s)
  &.lg  {
    padding: 11px 8px;
    position: relative;
  }

  // Button types
  &.success {
    @include button-context($green, $white);
  }

  &.danger {
    @include button-context($danger, $white);
  }

  &.danger-alt {
    @include button-context(transparent, $danger);
  }

  &.flat {
    @include button-context($neutral-2, $neutral-4);
  }

  &.info {
    @include button-context($neutral-4, $white);
  }

  &.secondary {
    @include button-context($white, $primary-4);
    border: 1px solid $neutral-3;
  }

  &.plain {
    @include button-context(transparent, $primary-4);
    font-weight: normal;
  }

  &.plain-light {
    @include button-context(transparent, lighten($primary-4, 40%));
  }

  &.inverted {
    @include button-context($white, $primary-1);
  }

  em > span {
    float: left;
  }

  // To handle inline icons
  svg + span,
  span + svg {
    margin-left: 6px;
  }

  span + svg {
    float: right;
  }

  // for Firefox
  svg,
  svg ~ span {
    float: left;
  }

  svg + svg {
    float: none;
  }

  @media #{$media-small-minus} {
    &.collapse {
      span, em > span {
        display: none;
      }
      svg {
        margin: 0;
      }
    }
  }
}
