/**Variable**/
@import './helpers/mixin.scss';
@import './base/common.scss';
@import './base/checked.scss';

/*radio-group*/
.vxe-radio-group {
  display: inline-block;
  vertical-align: middle;
  line-height: 1;
  font-size: 0;
  &+.vxe-radio-group {
    margin-left: 10px;
  }
}

/*radio*/
.vxe-radio {
  @extend %XERadioIcon;
  display: inline-block;
  vertical-align: middle;
  white-space: nowrap;
  line-height: 1;
  > input {
    &[type="radio"] {
      position: absolute;
      width: 0;
      height: 0;
      border: 0;
      appearance: none;
    }
  }
  .vxe-radio--label {
    vertical-align: middle;
    display: inline-block;
    max-width: 50em;
    @extend %TextEllipsis;
  }
  &:not(.is--disabled) {
    > input {
      &:focus+.vxe-radio--icon {
        color: $vxe-primary-color;
      }
    }
  }
  &:not(.vxe-radio-button) {
    &+.vxe-radio {
      margin-left: 10px;
    }
  }
}

.vxe-radio-button {
  .vxe-radio--label {
    background-color: $vxe-radio-button-default-background-color;
  }
  &:first-child {
    .vxe-radio--label {
      border-left: 1px solid $vxe-input-border-color;
      border-radius: $vxe-border-radius 0 0 $vxe-border-radius;
    }
  }
  &:last-child {
    .vxe-radio--label {
      border-radius: 0 $vxe-border-radius $vxe-border-radius 0;
    }
  }
  > input {
    &:checked+.vxe-radio--label {
      color: #fff;
      background-color: $vxe-primary-color;
      border-color: $vxe-primary-color;
    }
  }
  .vxe-radio--label {
    padding: 0 1em;
    line-height: $vxe-button-height-default - 2;
    display: inline-block;
    border-style: solid;
    border-color: $vxe-input-border-color;
    border-width: 1px 1px 1px 0;
    max-width: 50em;
    @extend %TextEllipsis;
  }
  &.is--disabled {
    cursor: not-allowed;
    > input {
      &:not(:checked) {
        &+.vxe-radio--label {
          color: $vxe-input-disabled-color;
        }
      }
      &:checked {
        &+.vxe-radio--label {
          border-color: lighten($vxe-primary-color, 20%);
          background-color: lighten($vxe-primary-color, 20%);
        }
      }
    }
  }
  &:not(.is--disabled) {
    & > input {
      &:focus {
        &+.vxe-radio--label {
          border-color: $vxe-primary-color;
          box-shadow: 0 0 0.2em 0 $vxe-primary-color;
        }
      }
    }
    &:hover {
      > input {
        &:not(:checked) {
          &+.vxe-radio--label {
            color: $vxe-primary-color;
          }
        }
      }
    }
  }
  &.size--medium {
    .vxe-radio--label {
      line-height: $vxe-button-height-medium - 2;
    }
  }
  &.size--small {
    .vxe-radio--label {
      line-height: $vxe-button-height-small - 2;
    }
  }
  &.size--mini {
    .vxe-radio--label {
      line-height: $vxe-button-height-mini - 2;
    }
  }
}

.vxe-radio {
  font-size: $vxe-font-size;
  &.size--medium {
    font-size: $vxe-font-size-medium;
  }
  &.size--small {
    font-size: $vxe-font-size-small;
  }
  &.size--mini {
    font-size: $vxe-font-size-mini;
  }
}