/**
 *
 * This file may have been modified by Bytedance Inc. (“Bytedance Inc.'s Modifications”). 
 * All Bytedance Inc.'s Modifications are Copyright (year) Bytedance Inc..  
 * 
 * This source code is licensed under the Apache license.
 * See LICENSE file in the project root for license information.
 *
 */
@import '../../../styles/variables.less';
@import '../../../styles/mixins.less';

@import './variables.less';
@import './mixins.less';

.@{ant-prefix}-btn:not(.sp-null) {
  // 取消点击阴影动画

  &::after {
    display: none;
  }
  > .@{ant-prefix}-btn-loading-icon {
    transition: none;
  }
  // 最小宽度和padding

  & {
    .sbtn-style-default();
    .sbtn-size(@btn-padding-y, @btn-padding-x, @btn-minWidth, @btn-text-lineHeight);
    .sbtn-icon(@btn-icon-width, @btn-icon-height);
    line-height: 16px;
    vertical-align: middle;
    overflow: hidden;
    transition: none;
    text-shadow: none;
    .@{ant-prefix}-sp-icon {
      vertical-align: bottom;
      margin-right: 2px;

      &.sp-icon-spin {
        vertical-align: -.15em;
      }
    }
  }
  // 小号尺寸
  &.@{ant-prefix}-btn-sm {
    .sbtn-size(@btn-padding-y-sm, @btn-padding-x-sm, @btn-minWidth-sm, @btn-text-lineHeight-sm);
    .sbtn-icon(@btn-icon-width-sm, @btn-icon-height-sm);
  }
  // 小号尺寸
  &.@{ant-prefix}-btn-mi {
    font-size: 12px;
    height: 24px;
    .sbtn-size(@btn-padding-y-mi, @btn-padding-x-mi, @btn-minWidth-mi, @btn-text-lineHeight-mi);
    .sbtn-icon(@btn-icon-width-sm, @btn-icon-height-sm);
  }
  // 大号尺寸 loading 位置
  &.@{ant-prefix}-btn-lg {
    line-height: 26px;
  }

  // primary
  &.@{ant-prefix}-btn-primary {
    .sbtn-style-primary();
  }
  // secondary
  &.@{ant-prefix}-btn-secondary {
    .sbtn-style-secondary();
  }
  // secondary
  &.@{ant-prefix}-btn-tertiary {
    .sbtn-style-tertiary();
  }
  // dangerous
  &.@{ant-prefix}-btn-dangerous {
    .sbtn-style-dangerous();
  }
  // primary-dangerous
  &.@{ant-prefix}-btn-primary.@{ant-prefix}-btn-dangerous {
    .sbtn-style-primary-dangerous();
  }
  // secondary-dangerous
  &.@{ant-prefix}-btn-secondary.@{ant-prefix}-btn-dangerous {
    .sbtn-style-secondary-dangerous();
  }
  // dashed
  &.@{ant-prefix}-btn-dashed {
    .sbtn-style-dashed();
  }
  // link
  &.@{ant-prefix}-btn-link {
    .sbtn-style-link();
    .@{ant-prefix}-sp-icon {

      &:first-child {
        margin-right: 2px;
      }
    }
    .@{ant-prefix}-sp-icon {

      &:last-child {
        margin-left: 8px;
      }
    }
  }
  // text
  &.@{ant-prefix}-btn-text {
    .sbtn-style-text();
    .@{ant-prefix}-sp-icon {

      &:first-child {
        margin-right: 2px;
      }
    }
    .@{ant-prefix}-sp-icon {

      &:last-child {
        margin-left: 8px;
      }
    }
  }
  &.@{ant-prefix}-btn-text {
    padding: @btn-style-text-padding;
    min-width: @btn-style-text-min-width;
    height: @btn-style-text-height;
    border: @btn-style-text-border;
  }
  // link 取消宽度
  &.@{ant-prefix}-btn-link {
    padding: 0;
    min-width: auto;
    height: auto;
    border: none;
  }

  // loading 状态取消文字显示，修改icon位置
  &.@{ant-prefix}-btn-loading {
    &:not(.@{ant-prefix}-btn-mi):not(.@{ant-prefix}-btn-sm):not(.@{ant-prefix}-btn-lg) {
      .@{ant-prefix}-btn-loading-icon {
        line-height: 20px;
      }
    }

    &::before {
      display: none !important;
    }
    &.@{ant-prefix}-btn-link,
    &.@{ant-prefix}-btn-text {
      &:not(.@{ant-prefix}-btn-sm):not(.@{ant-prefix}-btn-lg) {
        .@{ant-prefix}-btn-loading-icon {
          line-height: 18px;
        }
      }
      .@{ant-prefix}-btn-loading-icon {

        & + span {
          display: none;
        }
      }
    }
    .@{ant-prefix}-btn-loading-icon {

      & + span {
        display: block;
        opacity: 0;
      }
    }
  }
}
