//
// Copyright IBM Corp. 2016, 2018
//
// This source code is licensed under the Apache-2.0 license found in the
// LICENSE file in the root directory of this source tree.
//

@import '../../globals/scss/typography';

/// Button base styles
/// @access private
/// @group button
@mixin button-base {
  @include reset;
  @include type-style('body-short-01');

  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  min-height: rem($button-height);
  padding: $button-padding;
  border-radius: $button-border-radius;
  text-align: left;
  text-decoration: none;
  transition: all $duration--fast-01 motion(entrance, productive);
  outline: $button-outline-width solid transparent;
  outline-offset: -4px;
  position: relative;
  max-width: rem(320px);

  &:disabled,
  &.#{$prefix}--btn--disabled {
    cursor: not-allowed;
    color: $disabled-03;
    background: $disabled-02;
    border-color: $disabled-02;
  }

  .#{$prefix}--btn__icon {
    position: absolute;
    right: rem(16px);
    flex-shrink: 0;
    width: rem(16px);
    height: rem(16px);
  }
}

/// Button variant styles
/// @access private
/// @group button
@mixin button-theme(
  $bg-color,
  $border-color,
  $font-color,
  $hover-bg-color,
  $icon-color,
  $active-color,
  $border-width: $button-border-width
) {
  background-color: $bg-color;
  border-width: $border-width;
  border-style: solid;
  border-color: $border-color;
  color: $font-color;

  &:hover {
    background-color: $hover-bg-color;
  }

  &:focus {
    border-color: $focus;
    outline-color: $ui-02;
  }

  &:disabled:hover,
  &:disabled:focus,
  &:hover.#{$prefix}--btn--disabled,
  &:focus.#{$prefix}--btn--disabled {
    color: $ui-04;
    background-color: $disabled-02;
    border-color: $disabled-02;
    text-decoration: none;
  }

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

  .#{$prefix}--btn__icon,
  .#{$prefix}--btn__icon path {
    fill: $icon-color;
  }
}
