@import './mixins/mixins.scss';
@import './mixins/_button.scss';
@import './mixins/utils.scss';

@include b(radio-group) {
  display: inline-block;
  line-height: 1;
  vertical-align: middle;
  font-size: 0;
}

@include b(radio) {
  color: $--radio-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;
  @include utils-user-select(none);

  @include e(input) {
    display: inline-block;
    margin-right: 4px;
    white-space: nowrap;
    position: relative;
    line-height: 1;
    vertical-align: middle;
    cursor: pointer;

    @include when(disabled) {
      .ac-radio__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;
        }

        & + .ac-radio__label {
          cursor: not-allowed;
        }
      }
      &.is-checked {
        .ac-radio__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.ac-radio__label {
        color: $--color-text-placeholder;
        cursor: not-allowed;
      }
    }

    @include when(checked) {
      .ac-radio__inner {
        border-color: $--radio-checked-input-border-color;

        &::after {
          opacity: 1;
          transform: scale(1);
          transition: all .2s ease-in-out;
        }
      }
      & + .ac-radio__label {
        color: $--radio-checked-text-color;
      }
    }
  }



  @include e(inner) {
    border-radius: $--radio-input-border-radius;
    width: $--radio-input-width;
    height: $--radio-input-height;
    background-color: $--radio-input-fill;
    position: relative;
    cursor: pointer;
    display: inline-block;

    box-sizing: border-box;
    border: 1px solid #dddee1;
    transition: all .2s ease-in-out;

    &::after {
      position: absolute;
      width: $--radio-input-checked-width;
      height: $--radio-input-checked-height;
      left: 2px;
      top: 2px;
      border-radius: $--radio-input-border-radius;
      display: table;
      border-top: 0;
      border-left: 0;
      content: " ";
      background-color: $--radio-checked-input-border-color;
      opacity: 0;
      transition: all .2s ease-in-out;
      transform: scale(0);
    }
  }

  @include e(original) {
    opacity: 0;
    outline: none;
    position: absolute;
    z-index: -1;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    margin: 0;
    cursor: pointer;
  }

  @include e(label) {
    font-size: $--radio-font-size;
  }

  & + .ac-radio {
    margin-left: 30px;
  }
}
