.nut-button {
  position: relative;
  display: inline-block;
  flex-shrink: 0;
  height: $button-default-height;
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  line-height: $button-default-line-height;
  font-size: $button-default-font-size;
  text-align: center;
  cursor: pointer;
  transition: opacity 0.2s;
  -webkit-appearance: none;
  user-select: none;
  touch-action: manipulation;

  color: $button-default-color;
  background: $button-default-bg-color;
  border: $button-border-width solid $button-default-border-color;

  .nut-button-text {
    margin-left: $button-text-icon-margin-left;
  }

  &::before {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    background-color: $black;
    border: inherit;
    border-color: $black;
    border-radius: inherit;
    transform: translate(-50%, -50%);
    opacity: 0;
    content: ' ';
  }

  &::after {
    border: none;
  }

  &:active::before {
    opacity: 0.1;
  }

  &__warp {
    height: 100%;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: initial;
  }

  &--loading,
  &--disabled {
    &::before {
      display: none;
    }
  }

  &--solid {
    color: $button-primary-color;
    background: $button-primary-background-color;
    border: $button-border-width solid transparent;
  }

  &.nut-button--outline {
    color: $button-primary-border-color;
    border-color: $button-primary-border-color;
    background: transparent;
  }

  &.nut-button--none {
    color: $button-primary-border-color;
    background: transparent;
    border-color: transparent;
  }

  &--primary {
    color: $button-primary-color;
    background: $button-primary-background-color;
    border: $button-border-width solid transparent;

    &.nut-button--outline {
      color: $button-primary-border-color;
      border-color: $button-primary-border-color;
      background: transparent;
    }

    &.nut-button--none {
      color: $button-primary-border-color;
      background: transparent;
      border-color: transparent;
    }
  }

  &--info {
    color: $button-info-color;
    background: $button-info-background-color;
    border: $button-border-width solid transparent;

    &.nut-button--outline {
      color: $button-info-border-color;
      border-color: $button-info-border-color;
      background: transparent;
    }

    &.nut-button--none {
      color: $button-info-border-color;
      background: transparent;
      border-color: transparent;
    }
  }

  &--success {
    color: $button-success-color;
    background: $button-success-background-color;
    border: $button-border-width solid transparent;

    &.nut-button--outline {
      color: $button-success-border-color;
      border-color: $button-success-border-color;
      background: transparent;
    }

    &.nut-button--none {
      color: $button-success-border-color;
      background: transparent;
      border-color: transparent;
    }
  }

  &--danger {
    color: $button-danger-color;
    background: $button-danger-background-color;
    border: $button-border-width solid transparent;

    &.nut-button--outline {
      color: $button-danger-border-color;
      border-color: $button-danger-border-color;
      background: transparent;
    }

    &.nut-button--none {
      color: $button-danger-border-color;
      background: transparent;
      border-color: transparent;
    }
  }

  &--warning {
    color: $button-warning-color;
    background: $button-warning-background-color;
    border: $button-border-width solid transparent;

    &.nut-button--outline {
      color: $button-warning-border-color;
      border-color: $button-warning-border-color;
      background: transparent;
    }

    &.nut-button--none {
      color: $button-warning-border-color;
      background: transparent;
      border-color: transparent;
    }
  }

  &--large {
    width: 100%;
    height: $button-large-height;
    line-height: $button-large-line-height;

    .text {
      margin-left: $button-text-icon-large-margin-left;
    }
  }

  &--normal {
    padding: $button-default-padding;
    font-size: $button-default-font-size;
  }

  &--small {
    height: $button-small-height;
    line-height: $button-small-line-height;
    padding: $button-small-padding;
    font-size: $button-small-font-size;

    .text {
      margin-left: $button-text-icon-small-margin-left;
    }
  }

  &--mini {
    height: $button-mini-height;
    line-height: $button-mini-line-height;
    padding: $button-mini-padding;
    font-size: $button-mini-font-size;

    .text {
      margin-left: $button-text-icon-mini-margin-left;
    }
  }

  &--block {
    display: block;
    width: 100%;
  }

  &--disabled {
    cursor: not-allowed;
    opacity: $button-disabled-opacity;
  }

  &--loading {
    cursor: default;
    opacity: 0.9;
  }

  &--round {
    border-radius: $button-border-radius;
  }

  &--square {
    border-radius: 0;
  }
}
