@import (reference) '../theme/variables/antdVariables.less';
@radio-prefix-cls: ~'@{ant-prefix}-radio';

@radioPrefixCls: ~'ued-radio';
// 单选框单选组，通用样式
label.@{radio-prefix-cls}-wrapper {
  line-height: @input-height-base;
}

// 按钮组
.@{radioPrefixCls}-button {
  .@{radio-prefix-cls}-button-wrapper {
    &:first-child {
      border-radius: 4px 0 0 4px;
    }
    &:last-child {
      border-radius: 0 4px 4px 0;
    }
  }
}
.@{radioPrefixCls}-wrap {
  &:not(.@{radioPrefixCls}-Radio) {
    display: inline-flex;
    flex-wrap: wrap;
    row-gap: 8px;
  }
}
// 分体按钮
.@{radioPrefixCls}-SplitButton {
  .@{radio-prefix-cls}-button-wrapper {
    border-radius: 4px;
    border-left-width: 1px;
    &:not(:first-child):before {
      display: none;
    }
  }
}
// 背景按钮
.@{radioPrefixCls}-BackgroundButton {
  .@{radio-prefix-cls}-button-wrapper {
    border-radius: 4px;
    border-left-width: 1px;
    border: none;
    background-color: rgba(247, 248, 250, 1);
    &:not(:first-child):before {
      display: none;
    }
    &-checked {
      font-weight: 500;
      background-color: fade(@primary-color, 15%);
      border: none;
    }
    &:not(.@{radio-prefix-cls}-button-wrapper-disabled):focus-within {
      box-shadow: none;
    }
  }
}
// 圆形按钮
.@{radioPrefixCls}-CircleButton {
  .@{radio-prefix-cls}-button-wrapper {
    border-radius: 999px;
    border-left-width: 1px;
    border-color: fade(@primary-color, 10%);
    background-color: rgba(247, 248, 250, 1);
    transition: none;
    &:not(:first-child):not(.@{radio-prefix-cls}-button-wrapper-checked):before {
      display: none;
    }
    &-checked {
      font-weight: 500;
      background: fade(@primary-color, 10%);
      border-color: @primary-color;
      position: relative;
      &::before {
        display: inline-block;
        content: '';
        position: absolute;
        top: 0;
        right: -3px;
        width: 12px;
        height: 12px;
        background: @primary-color;
        border-radius: 50%;
        border: 1px solid white;
        left: unset;
        padding: 0;
        box-sizing: border-box;
      }
      &::after {
        border: 1px solid #fff;
        border-bottom-left-radius: 1px;
        content: "";
        display: inline-block;
        position: absolute;
        right: -0.5px;
        text-align: center;
        top: 3px;
        width: 6.5px;
        height: 4.5px;
        border-top: none;
        border-right: none;
        transform: rotate(-45deg);
      }
    }
  }
}
// 彩色按钮
.@{radioPrefixCls}-ColorButton {
  .@{radio-prefix-cls}-button-wrapper {
    border-radius: 4px;
    border-left-width: 1px;
    border: none;
    background-color: fade(@primary-color, 10%);
    transition: none;
    &:not(:first-child):before {
      display: none;
    }
    &-checked {
      font-weight: 500;
      color: white;
      background: linear-gradient( 270deg, fade(@primary-color, 60%) 0%, @primary-color 100%);
      border: none;
      &:not(.@{radio-prefix-cls}-button-wrapper-disabled):hover {
        color: white;
      }
    }
    &:not(.@{radio-prefix-cls}-button-wrapper-disabled):focus-within {
      box-shadow: none;
    }
  }
}
// 角标按钮
.@{radioPrefixCls}-BadgeButton {
  .@{radio-prefix-cls}-button-wrapper {
    border-radius: 4px;
    border-left-width: 1px;
    border: none;
    background-color: rgba(247, 248, 250, 1);
    &:not(:first-child):not(.@{radio-prefix-cls}-button-wrapper-checked):before {
      display: none;
    }
    &-checked {
      font-weight: 500;
      background-color: fade(@primary-color, 15%);
      border: none;
      &:hover {
        &::before {
          background-color: transparent;
        }
      }
      &::before {
        display: inline-block;
        content: '';
        position: absolute;
        bottom: 0;
        right: 0;
        border: 8px solid transparent;
        border-right-color: @primary-color;
        border-bottom-color: @primary-color;
        border-bottom-right-radius: 4px;
        left: unset;
        padding: 0;
        box-sizing: border-box;
        background-color: transparent;
        width: 0;
        height: 0;
        top: unset;
      }
      &::after {
        border: 1px solid #fff;
        border-bottom-left-radius: 1px;
        content: "";
        display: inline-block;
        position: absolute;
        right: 2px;
        text-align: center;
        bottom: 4px;
        width: 6px;
        height: 3.5px;
        border-top: none;
        border-right: none;
        transform: rotate(-45deg);
      }
    }
    &:not(.@{radio-prefix-cls}-button-wrapper-disabled):focus-within {
      box-shadow: none;
    }
  }
}

