@import url(../var.less);
@import url(../mixins/utils.less);
@import url(../mixins/_radio.less);

@radio-prefix: ~"@{prefix}radio";

.@{radio-prefix}{
  color: @radio-font-color;
  font-weight: @radio-font-weight;
  line-height: 1;
  position: relative;
  cursor: pointer;
  display: inline-block;
  white-space: nowrap;
  outline: none;
  font-size: @font-size-base;
  margin-right: 32px;
  .utils-user-select(none);

  &.is-bordered {
    padding: @radio-bordered-padding;
    border-radius: @radio-radius;
    border: @radio-border;
    box-sizing: border-box;
    height: @radio-bordered-height;

    &.is-checked {
      border-color: @primary-color;
    }

    &.is-disabled {
      cursor: not-allowed;
      border-color: @radio-disabled-border-color;
    }

    & + .w-radio.is-bordered {
      margin-left: 10px;
    }
  }

  &--medium {
    .radio-size(@radio-bordered-medium-padding, @radio-radius,@radio-bordered-medium-height, @radio-medium-font-size,@radio-medium-input-height,@radio-medium-input-width)
  }

  &--small {
    .radio-size(@radio-bordered-small-padding, @radio-radius,@radio-bordered-small-height, @radio-small-font-size,@radio-small-input-height,@radio-small-input-width)
  }

  &:last-child {
    margin-right: 0;
  }

  &__input {
    white-space: nowrap;
    cursor: pointer;
    outline: none;
    display: inline-block;
    line-height: 1;
    position: relative;
    vertical-align: middle;

    &.is-disabled {
      .@{radio-prefix}__inner {
        background-color: @radio-disabled-input-fill;
        border-color: @radio-disabled-input-border-color;
        cursor: not-allowed;

        &::after {
          cursor: not-allowed;
          background-color: @radio-disabled-icon-color;
        }

        & + .@{radio-prefix}__label {
          cursor: not-allowed;
        }
      }
      &.is-checked {
        .@{radio-prefix}__inner {
          background-color: @radio-disabled-checked-input-fill;
          border-color: @radio-disabled-checked-input-border-color;

          &::after {
            background-color: @radio-disabled-checked-icon-color;
          }
        }
      }
      & + span.@{radio-prefix}__label {
        color: @placeholder-text-color;
        cursor: not-allowed;
      }
    }

    &.is-checked {
      .@{radio-prefix}__inner {
        border-color: @radio-checked-input-border-color;

        &::after {
          background-color: @primary-color;
          transform: translate(-50%, -50%) scale(1);
        }
      }

      & + .@{radio-prefix}__label {
        color: @radio-checked-font-color;
      }
    } 

    &.is-focus {
      .@{radio-prefix}__inner {
        border-color: @radio-input-border-color-hover;
      }
    }
  }

  &__inner {
    border: @radio-border;
    border-radius: @radio-input-border-radius;
    width: @radio-input-width;
    height: @radio-input-height;
    background-color: @radio-input-background-color;
    position: relative;
    cursor: pointer;
    display: inline-block;
    box-sizing: border-box;

    &:hover {
      border-color: @radio-input-border-color-hover;
    }

    &::after {
      width: 8px;
      height: 8px;
      border-radius: @radio-input-border-radius;
    //   background-color: @primary-color;
      background-color: transparent;
      content: "";
      position: absolute;
      left: 50%;
      top: 50%;
      transform: translate(-50%, -50%) scale(0);
      transition: transform .15s ease-in;
    }
  }

  &__original {
    opacity: 0;
    outline: none;
    position: absolute;
    z-index: -1;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    margin: 0;
  }

  &:focus:not(.is-focus):not(:active):not(.is-disabled) { /*获得焦点时 样式提醒*/
    .@{radio-prefix}__inner {
      box-shadow: 0 0 2px 2px @radio-input-border-color-hover;
    }
  }
  &__label {
    font-size: @radio-font-size;
    padding-left: 12px;
  }

  &__position {
    &--right {
      padding-left: 0px;
      padding-right: 12px;
    }
  }

}