@radio-prefix-cls: ~"@{css-prefix}radio";
@radio-group-prefix-cls: ~"@{radio-prefix-cls}-group";
@radio-inner-prefix-cls: ~"@{radio-prefix-cls}-inner";
@radio-group-button-prefix-cls: ~"@{radio-group-prefix-cls}-button";

.@{radio-prefix-cls}-focus {
  // box-shadow: 0 0 0 2px fade(@color-brand-primary, 20%);
  z-index: 1;
}

.@{radio-group-prefix-cls} {
  display: inline-block;
  font-size: @font-size-middle;
  vertical-align: middle;

  .@{radio-prefix-cls}-wrapper {
    margin-right: 24px;
  }

  //outline: none;
  &-vertical {
    .@{radio-prefix-cls}-wrapper {
      display: block;
      height: 30px;
      line-height: 30px;
    }
  }
}

// 普通状态 - Normal state
.@{radio-prefix-cls}-wrapper {
  font-size: @font-size-middle;
  vertical-align: middle;
  display: inline-block;
  position: relative;
  white-space: nowrap;
  // margin-right: 24px;
  cursor: pointer;

  &-disabled {
    cursor: @cursor-disabled;
    color: @radio-disabled-text-color;
  }

  &:not(&-disabled):hover {
    .@{radio-inner-prefix-cls} {
      border-color: @color-brand-primary;
    }
  }
}

.@{radio-prefix-cls} {
  display: inline-block;
  margin-right: 8px;
  white-space: nowrap;
  position: relative;
  vertical-align: middle;
  cursor: pointer;

  
  &:not(&-disabled):hover {
    .@{radio-inner-prefix-cls} {
      border-color: @color-brand-primary;
    }
  }

  &-inner {
    display: inline-block;
    width: 16px;
    height: 16px;
    position: relative;
    top: 0;
    left: 0;
    background-color: @color-bg-card;
    border: 1px solid @color-border-normal1;
    border-radius: 50%;
    transition: all @transition-time @ease-in-out;

    &:after {
      position: absolute;
      width: 6px;
      height: 6px;
      left: 3px;
      top: 3px;
      border-radius: @border-radius-base;
      display: table;
      border-top: 0;
      border-left: 0;
      content: ' ';
      background-color: @color-functional-white;
      opacity: 0;
      transition: all @transition-time @ease-in-out;
      transform: scale(0);
    }
  }

  &-large {
    font-size: @font-size-middle;

    & .@{radio-inner-prefix-cls} {
      width: 16px;
      height: 16px;

      &:after {
        width: 6px;
        height: 6px;
        left: 3px;
        top: 3px;
      }
    }

    &.@{radio-prefix-cls}-wrapper,
    & .@{radio-prefix-cls}-wrapper {
      font-size: @font-size-middle;
    }
  }

  &-small {
    & .@{radio-inner-prefix-cls} {
      width: 16px;
      height: 16px;

      &:after {
        width: 6px;
        height: 6px;
        left: 3px;
        top: 3px;
      }
    }
  }

  &-input {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1;
    opacity: 0;
    cursor: pointer;
  }

  &-border {
    border: 1px solid @color-border-normal1;
    border-radius: @border-radius-base;
    height: @btn-height-base;
    line-height: @btn-height-base - 2px;
    padding: 0 15px;
    transition: border @transition-time @ease-in-out;
  }

  &-small&-border,
  .@{radio-group-prefix-cls}-small &-border {
    height: @btn-height-small;
    line-height: @btn-height-small - 2px;
    padding: @btn-padding-small;
  }

  &-large&-border,
  .@{radio-group-prefix-cls}-large &-border {
    height: @btn-height-base;
    line-height: @btn-height-base - 4px;
    padding: @btn-padding-base;
  }

  &-default&-border,
  .@{radio-group-prefix-cls}-default &-border {
    height: @btn-circle-size-middle;
    line-height: @btn-circle-size-middle - 4px;
    padding: @btn-padding-base;
  }
}

.@{radio-prefix-cls}-wrapper-checked.@{radio-prefix-cls}-border {
  border-color: @color-brand-primary;
}

.@{radio-prefix-cls}-wrapper-disabled.@{radio-prefix-cls}-border {
  border-color: @color-border-disable;
}

// 选中状态 - Selected state
.@{radio-prefix-cls}-checked {
  .@{radio-inner-prefix-cls} {
    border-color: @color-brand-primary;
    border-width: 5px;
    // &:after {
    //   opacity: 1;
    //   transform: scale(1.2);
    //   transition: all @transition-time @ease-in-out;
    //   // background-color: @color-bg-radio-selected;
    //   // background-color: @color-brand-primary;
    //   border-radius: 50%;
    // }
  }

  &:hover {
    .@{radio-inner-prefix-cls} {
      border-color: @color-brand-primary;
    }
  }
}

//选中后禁用的样式
.@{radio-prefix-cls}-checked.@{radio-prefix-cls}-disabled {
  .@{radio-inner-prefix-cls} {
    border-color: @color-complementary-6;
    background-color: @color-functional-white !important;
  }
}

.@{radio-prefix-cls}-disabled {
  cursor: @cursor-disabled;

  .@{radio-prefix-cls}-input {
    cursor: @cursor-disabled;
  }

  .@{radio-inner-prefix-cls} {
    border-color: @radio-default-disabled-border-color;
    background-color: @radio-default-disabled-bg-color;
    &:after {
      background-color: @color-complementary-7;
    }
  }

  .@{radio-prefix-cls}-disabled+span {
    color: @color-text-disabled;
  }

  &.@{radio-prefix-cls}-checked .@{radio-inner-prefix-cls} {
    background-color: @color-bg-disable;
  }
}

span.@{radio-prefix-cls}+* {
  margin-left: 2px;
  margin-right: 2px;
}

// 按钮样式 - Button style
.@{radio-group-button-prefix-cls} {
  font-size: 0;
  -webkit-text-size-adjust: none;

  .@{radio-prefix-cls} {
    width: 0;
    margin-right: 0;
  }

  .@{radio-prefix-cls}-wrapper {
    display: inline-block;
    height: @btn-circle-size;
    line-height: @btn-circle-size - 2px;
    margin: 0;
    margin-right: 12px;
    padding: 0 20px;
    font-size: @font-size-middle;
    transition: all @transition-time ease-in-out;
    cursor: pointer;
    border: 1px solid @color-border-normal1;
    border-radius: @border-radius-base;
    background: @color-bg-select-tag;
    position: relative;

    >span {
      margin-left: 0;
    }

    &:before,
    &:after {
      content: '';
      display: none;
      position: absolute;
      width: 1px;
      height: 100%;
      left: -1px;
      top: 0;
      background: @color-border-normal1;
      //visibility: hidden;
      transition: all @transition-time ease-in-out;
    }

    &:after {
      height: @btn-circle-size + 4px;
      left: -1px;
      top: -3px;
      background: fade(@color-brand-primary, 20%);
      opacity: 0;
    }

    &:not(&-disabled):hover {
      position: relative;
      color: @color-brand-hover;
      border-color: @color-brand-primary;

      & .@{radio-prefix-cls} {
        background-color: black;
      }
    }

    .@{radio-prefix-cls}-inner,
    input {
      opacity: 0;
      width: 0;
      height: 0;
    }

    &-checked {
      background-color: @color-bg-normal;
      border-color: @color-brand-primary;
      color: @color-brand-primary;
      box-shadow: @radio-button-checked-shadow;
      z-index: 1;
      font-weight: 600;

      &:before {
        background: @color-brand-primary;
        opacity: 0.1;
      }

      &.@{radio-prefix-cls}-focus {

        // box-shadow: -1px 0 0 0 @color-brand-primary, 0 0 0 2px fade(@color-brand-primary, 20%);
        // transition: all @transition-time ease-in-out;
        &:after {
          // left: -3px;
          // top: -3px;
          // opacity: 1;
          // background: fade(@color-brand-primary, 20%);
        }

        &:first-child {
          // box-shadow: 0 0 0 2px fade(@color-brand-primary, 20%);
        }
      }

      &:first-child {
        box-shadow: none;
      }

      &:hover {
        border-color: tint(@color-brand-primary, 20%);
        //box-shadow: -1px 0 0 0 tint(@color-brand-primary, 20%);
        // color: tint(@color-brand-primary, 20%);
      }

      &:active {
        border-color: shade(@color-brand-primary, 5%);
        //box-shadow: -1px 0 0 0 shade(@color-brand-primary, 5%);
        color: shade(@color-brand-primary, 5%);
      }
    }

    &-disabled {
      border-color: @radio-default-disabled-border-color;
      background-color: @radio-default-disabled-bg-color;
      cursor: @cursor-disabled;
      color: @color-text-disabled;
    }

    &-disabled.@{radio-prefix-cls}-wrapper-checked {
      color: @color-functional-white;
      background-color: @color-brand-disabled2;
      border-color: @color-border-normal1;
      box-shadow: none !important;
    }
  }

  &-solid .@{radio-prefix-cls}-wrapper {
    &-checked:not(.@{radio-prefix-cls}-wrapper-disabled) {
      background: @color-brand-primary;
      color: @color-functional-white;

      &:hover {
        background: tint(@color-brand-primary, 20%);
        color: @color-functional-white;
      }
    }
  }
}

.@{radio-group-button-prefix-cls}.@{radio-group-prefix-cls}-large .@{radio-prefix-cls}-wrapper {
  height: @height-base;
  line-height: @height-base - 2px;
  font-size: @font-size-middle;

  &:after {
    height: @height-base + 4px;
  }
}

.@{radio-group-button-prefix-cls}.@{radio-group-prefix-cls}-default .@{radio-prefix-cls}-wrapper {
  height: @btn-circle-size-middle;
  line-height: @btn-circle-size-middle - 2px;
  font-size: @font-size-middle;

  &:after {
    height: @btn-circle-size-middle + 4px;
  }
}

.@{radio-group-button-prefix-cls}.@{radio-group-prefix-cls}-small .@{radio-prefix-cls}-wrapper {
  height: @btn-circle-size-small;
  line-height: @btn-circle-size-small - 2px;
  padding: 0 12px;
  font-size: @font-size-middle;

  &:after {
    height: @btn-circle-size-small + 4px;
  }
}