$radio-prefix-cls: $lib-name + "-radio";
$radio-group-prefix-cls: $radio-prefix-cls + "-group";
$radio-inner-prefix-cls: $radio-prefix-cls + "-inner";

$cursor-disabled: not-allowed;
$ease-in-out: ease-in-out;

.#{$radio-group-prefix-cls} {
  display: inline-block;
  .#{$radio-prefix-cls}-wrapper + .#{$radio-prefix-cls}-wrapper {
    margin-left: 10px;
  }
  &-vertical {
    .#{$radio-prefix-cls}-wrapper {
      display: block;
      margin: 10px 0;
    }
    .#{$radio-prefix-cls}-wrapper + .#{$radio-prefix-cls}-wrapper {
      margin-left: 0;
    }
  }
}

.#{$radio-prefix-cls}-wrapper {
  position: relative;
  display: inline-block;
  // hack inline-block gap
  font-size: 0;
  line-height: 1px;
  color: $content-color-light;
  white-space: nowrap;
  cursor: pointer;
  &-disabled {
    cursor: $cursor-disabled;
    color: $disabled-text-color-light;
  }
  .radio-label {
    padding-left: 8px;
  }
}

// size: small
.#{$radio-prefix-cls}-wrapper__small {
  .#{$radio-prefix-cls} {
    top: 2px;
    line-height: 12px;
    height: 12px;
    .#{$radio-inner-prefix-cls} {
      width: 12px;
      height: 12px;
      &:after {
        width: 6px;
        height: 6px;
      }
    }
  }
  .radio-label {
    font-size: 12px;
    line-height: 16px;
  }
}

// size: default
.#{$radio-prefix-cls}-wrapper__default {
  .#{$radio-prefix-cls} {
    top: 2px;
    line-height: 14px;
    height: 14px;
    .#{$radio-inner-prefix-cls} {
      width: 14px;
      height: 14px;
      &:after {
        width: 8px;
        height: 8px;
      }
    }
  }
  .radio-label {
    font-size: 14px;
    line-height: 20px;
  }
}

// size: large
.#{$radio-prefix-cls}-wrapper__large {
  .#{$radio-prefix-cls} {
    top: 2px;
    line-height: 16px;
    height: 16px;
    .#{$radio-inner-prefix-cls} {
      width: 16px;
      height: 16px;
      &:after {
        width: 10px;
        height: 10px;
      }
    }
  }
  .radio-label {
    font-size: 16px;
    line-height: 24px;
  }
}

.#{$radio-prefix-cls} {
  display: inline-block;
  white-space: nowrap;
  outline: none;
  position: relative;
  cursor: pointer;
  &:hover {
    .#{$radio-inner-prefix-cls} {
      border-color: darken($border-color-base, 10);
    }
  }
  .#{$radio-inner-prefix-cls} {
    display: inline-block;
    width: 14px;
    height: 14px;
    position: relative;
    top: 0;
    left: 0;
    background-color: $background-color-base;
    border: 1px solid $border-color-base;
    box-sizing: border-box;
    border-radius: 50%;
    transition: all $transition-time $ease-in-out;

    &:after {
      position: absolute;
      width: 8px;
      height: 8px;
      left: 2px;
      top: 2px;
      border-radius: 50%;
      display: table;
      border-top: 0;
      border-left: 0;
      content: " ";
      background-color: $primary-color;
      opacity: 0;
      transition: all $transition-time $ease-in-out;
      transform: scale(0);
    }
  }

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

// 选中状态
.#{$radio-prefix-cls}-checked {
  .#{$radio-inner-prefix-cls} {
    border-color: darken($primary-color, 0);
    &:after {
      opacity: 1;
      transform: scale(1);
      transition: all $transition-time $ease-in-out;
    }
  }
  &:hover {
    .#{$radio-inner-prefix-cls} {
      border-color: darken($primary-color, 0);
    }
  }
}

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

  &:hover {
    .#{$radio-inner-prefix-cls} {
      border-color: $border-color-base;
    }
  }
  .#{$radio-inner-prefix-cls} {
    border-color: $border-color-base;
    background-color: $background-color-disabled;
    &:after {
      background-color: $border-color-base;
    }
  }
}
