@import url('../CloudTheme.css');

@mixin Severity($color, $hoverColor) {
  color: white;
  background-color: $color;

  &:not(.disabled):hover {
    background-color: $hoverColor;
  }
}

button.zButton {
  border-radius: 6px;
  line-height: 135%;
  font-weight: 500;
  box-sizing: border-box;
  box-shadow: none;
  text-transform: inherit;
  min-width: 80px;

  &:not(.disabled):hover {
    box-shadow: none;
  }

  &.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: auto;
  }

  &:global(.zSplitIconButton) {
    min-width: 24px;
  }

  &.xlarge,
  &.large,
  &.medium {
    &:global(.zSplitIconButton) {
      padding: 10px;
    }

    svg {
      width: 16px;
      height: 16px;
    }
  }

  &.xlarge {
    padding: 15.5px 20px;
    height: 50px;
    font-size: 14px;
    border-radius: 8px;
  }

  &.large {
    padding: 10.5px 20px;
    height: 40px;
    font-size: 14px;
    border-radius: 8px;
  }

  &.medium {
    padding: 8.5px 20px;
    height: 36px;
    font-size: 14px;
    border-radius: 8px;
  }
  &.small {
    padding: 5px 16px;
    height: 28px;
    font-size: 13px;
    min-width: 80px;

    &:global(.zSplitIconButton) {
      padding: 7px;
      min-width: 24px;
    }

    svg {
      width: 14px;
      height: 14px;
    }
  }
  &.tiny {
    padding: 3.5px 12px;
    height: 24px;
    font-size: 12px;
    font-weight: 400;
    min-width: 80px;

    &:global(.zSplitIconButton) {
      padding: 6px;
      min-width: 24px;
    }

    svg {
      width: 12px;
      height: 12px;
    }
  }

  &.contained {
    color: white;
    background-color: $blue-blue1;

    &:not(.disabled):hover {
      background-color: $blue-dark1;
    }

    &:not(.disabled):active {
      background-color: $blue-dark2;
    }
  }

  &.outlined {
    color: $black-black1;
    background-color: white;
    border-color: $stroke-stroke1;
    box-shadow: 0px 1px 2px 0px rgba(33, 37, 44, 0.08);

    &.noShadow {
      box-shadow: none;
    }

    &:not(.disabled):hover {
      background-color: $black-black5;
    }

    &.disabled {
      opacity: 0.5;
      background-color: $black-black5;
      cursor: not-allowed;
      pointer-events: auto;
    }
  }

  &.danger {
    @include Severity($red-red2, $red-red1);
  }

  &.warning {
    @include Severity($yellow-yellow2, $yellow-yellow1);
  }

  &.success {
    @include Severity($green-green2, $green-green1);
  }

  &.textBlue {
    color: $blue-blue1;
    min-width: 0;

    &.small {
      font-weight: 400;
    }

    &.noMargin {
      margin: 0;
      padding: 0;
      height: auto;
    }

    &:not(.disabled):hover {
      color: $blue-dark1;
      background-color: $blue-blue4;

      &.noMargin {
        background-color: transparent;
      }
    }
  }

  &.textBlack {
    color: $black-black1;
    min-width: 0;

    &.small {
      font-weight: 400;
    }

    &.noMargin {
      margin: 0;
      padding: 0;
      height: auto;
    }

    &:not(.disabled):hover {
      background-color: $black-black4;

      &.noMargin {
        color: $black-black2;
        background-color: transparent;
      }
    }
  }

  &.textGhost {
    padding: 0;
    font-weight: 400;
    color: $blue-blue1;
    background-color: transparent;
    min-width: 0;

    &:not(.disabled):hover {
      color: $blue-dark1;
    }
  }

  &.text {
    color: $black-black2;
    background-color: transparent;
    border: 1px solid transparent;

    &:not(.disabled):hover {
      color: $black-black1;
      border-color: $stroke-stroke1;
    }
  }

  &.link {
    color: $blue-blue1;
    background-color: transparent;
    border: none;

    &:not(.disabled):hover {
      color: $blue-blue1;
      text-decoration: underline;
      background-color: transparent;
    }
  }

  &:global(.MuiButtonGroup-firstButton) {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;

    &.contained {
      border-right: 1px solid white;
    }
  }

  &:global(.MuiButtonGroup-middleButton) {
    border-radius: 0;

    &.contained {
      border-right: 1px solid white;
      margin-left: 0;
    }
  }

  &:global(.MuiButtonGroup-lastButton) {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;

    &.contained {
      margin-left: 0;
    }
  }
}
