/**Variable**/
@import './helpers/mixin.scss';
@import './base/common.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 {
  display: inline-block;
  vertical-align: middle;
  white-space: nowrap;
  user-select: none;
  line-height: 1;
  cursor: pointer;
  > input {
    &[type="radio"] {
      position: absolute;
      width: 0;
      height: 0;
      border: 0;
      appearance: none;
    }
    &+.vxe-radio--icon {
      position: relative;
      display: inline-block;
      width: 1em;
      height: 1em;
      border: $vxe-radio-border-width solid $vxe-input-border-color;
      background-color: $vxe-radio-icon-background-color;
      vertical-align: middle;
      border-radius: 50%;
    }
    &:checked+.vxe-radio--icon {
      background-color: $vxe-primary-color;
      border-color: $vxe-primary-color;
      &:before {
        content: "";
        position: absolute;
        background-color: $vxe-radio-checked-icon-background-color;
        border-radius: 50%;
        height: 0.25em;
        width: 0.25em;
        top: 50%;
        left: 50%;
        transform: translate(-50%,-50%);
      }
      &+.vxe-radio--label {
        color: $vxe-primary-color;
      }
    }
  }
  &:not(.is--disabled) {
    & > input {
      &:focus {
        &+.vxe-radio--icon {
          border-color: $vxe-primary-color;
          box-shadow: 0 0 0.2em 0 $vxe-primary-color;
        }
      }
    }
    &:hover {
      > input {
        &+.vxe-radio--icon {
          border-color: $vxe-primary-color;
        }
      }
    }
  }
  &.is--disabled {
    cursor: not-allowed;
    > input {
      &+.vxe-radio--icon {
        border-color: $vxe-input-disabled-color;
        background-color: $vxe-input-disabled-background-color;
        &:before {
          border-color: $vxe-primary-disabled-color;
          background-color: $vxe-primary-disabled-color;
        }
        &+.vxe-radio--label {
          color: $vxe-disabled-color;
        }
      }
    }
  }
  .vxe-radio--label {
    padding-left: 0.5em;
    vertical-align: middle;
    display: inline-block;
    max-width: 50em;
    @extend %TextEllipsis;
  }
  &:not(.vxe-radio-button) {
    &+.vxe-radio {
      margin-left: 10px;
    }
  }
}

.vxe-radio-button {
  .vxe-radio--label {
    background-color: #fff;
  }
  &: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;
  .vxe-radio--icon {
    font-size: $vxe-radio-font-size-default;
  }
  &.size--medium {
    font-size: $vxe-font-size-medium;
    .vxe-radio--icon {
      font-size: $vxe-radio-font-size-medium;
    }
  }
  &.size--small {
    font-size: $vxe-font-size-small;
    .vxe-radio--icon {
      font-size: $vxe-radio-font-size-small;
    }
  }
  &.size--mini {
    font-size: $vxe-font-size-mini;
    .vxe-radio--icon {
      font-size: $vxe-radio-font-size-mini;
    }
  }
}