@import '~ant-design-vue/lib/style/themes/default';
@import '~ant-design-vue/es/button/style/mixin';

.button-variant(@color; @background) {
  .button-color(@color; @background; @background);

  text-shadow: @btn-text-shadow;
  box-shadow: @btn-primary-shadow;

  &:hover,
  &:focus {
    .button-color(@color; ~`colorPalette('@{background}', 5) `; ~`colorPalette('@{background}', 5) `);
  }

  &:active,
  &.active {
    .button-color(@color; ~`colorPalette('@{background}', 7) `; ~`colorPalette('@{background}', 7) `);
  }

  .button-disabled();
}

.set-button-color(@btn-type, @btn-color, @btn-bg, @btn-border-color) {
  .ant-btn-@{btn-type} {
    .button-variant(@btn-color; @btn-bg);

    .ant-btn-group {
      &:not(:first-child):not(:last-child) {
        border-right-color: @btn-border-color;
        border-left-color: @btn-border-color;

        &:disabled {
          border-color: @btn-default-border;
        }
      }

      &:first-child {
        &:not(:last-child) {
          border-right-color: @btn-border-color;

          &[disabled] {
            border-right-color: @btn-default-border;
          }
        }
      }
    }

    .ant-btn-group &:last-child:not(:first-child),
    .ant-btn-group & + & {
      border-left-color: @btn-border-color;

      &[disabled] {
        border-left-color: @btn-default-border;
      }
    }
  }
}
