@import "mixins";

button,
a.button {
  outline: none;
  padding: 0 1.528em;
  min-height: 44px;
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  border: none;
  margin: 8px 12px;
  transition: box-shadow 0.1s ease;
  cursor: pointer;
  font-size: 1em;
  font-weight: 700;
  font-family: var(--font-family-sans-serif);
  @include rounded(2px);


  &:active {
    position: relative;
    top: 1px;
  }

  &.outlined {
    box-shadow: none;
  }

  &.text {
    background: transparent;
    border: none;
    box-shadow: none;
    margin: 8px 0;
  }

  &.icon-only {
    width: 36px;
    height: 36px;
    min-height: 36px;
    padding: 0;
    margin: 8px 12px;
    background: transparent !important;
    box-shadow: none !important;
    border-radius: 100%;

    &:disabled {
      background: transparent;
    }

    i {
      font-size: 24px;
      width: 24px;
      height: 24px;
    }
  }

  &.small {
    min-height: 36px;

    &.icon-only {
      width: 32px;
      min-height: 32px;
      height: 32px;

      i {
        font-size: 20px;
        width: 20px;
        height: 20px;
      }
    }
  }

  &.x-small {
    min-height: 28px;

    &.icon-only {
      width: 24px;
      min-height: 24px;
      height: 24px;

      i {
        font-size: 16px;
        width: 16px;
        height: 16px;
      }
    }
  }

  &.large {
    min-height: 52px;

    &.icon-only {
      width: 44px;
      min-height: 44px;
      height: 44px;

      i {
        font-size: 36px;
        width: 36px;
        height: 36px;
      }
    }
  }

  &.disabled,
  &:disabled {
    cursor: not-allowed;
    -webkit-box-shadow: none;
    -moz-box-shadow: none;
    box-shadow: none;
    border: none;
    color: var(--disabled-text-color) !important;

    &:active {
      position: relative;
      top: 0;
    }
  }

  &.small {
    font-size: 0.75em;
  }

  &.x-small {
    font-size: 0.7em;
  }
}

@mixin button( $color_name, $text_color, ) {
  color: $text_color;
  background: var(--#{$color_name}-color);
  box-shadow: 0 4px 12px var(--#{$color_name}-box-shadow);

  &:hover {
    box-shadow: 0 3px 6px var(--#{$color_name}-box-shadow-hover)
  }

  &.outlined {
    background: transparent;
    color: var(--#{$color_name}-color);
    border: 1px solid var(--#{$color_name}-color);
    box-shadow: none;
  }

  &.text {
    color: var(--#{$color_name}-color);
    background: transparent;
    box-shadow: none;
  }

  &.flat {
    box-shadow: none;
  }

  &.tile {
    border-radius: 0;
  }

  &.icon-only {
    i {
      color: var(--#{$color_name}-color);
    }

    &:hover {
      box-shadow: none;
      background: transparent;
    }
  }

  &.disabled,
  &:disabled {
    background: var(--#{$color_name}-disabled);
    box-shadow: none;

    i {
      color: var(--disabled-text-color) !important;
    }
  }

}


button {
  @include button(brand, #ffffff);

  &.danger {
    @include button(error, #ffffff);
  }

  &.secondary {
    @include button(secondary, #fff);
  }
}

a {
  color: var(--link-color);
  text-decoration: none;
  transition: color 0.3s ease-in-out;

  &:hover {
    text-decoration: underline;
    color: var(--link-color-hover);
  }
}

// Buttons
//
// Buttons can be default, outline, text
//
// Markup:
//  <button>Button</button>
//  <button class="outlined">Outlined Button</button>
//  <button class="text">Text Button</button>
//  <button class="danger">Danger Button</button>
//  <button class="danger text">Text Danger Button</button>
//  <button class="danger outlined">Outlined Danger Button</button>
//
// Styleguide Components.Buttons
//
