// radio
.yc-radio {
  position: relative;
  cursor: pointer;
  padding-left: 5px;
  font-size: 14px;
  line-height: unset;
  display: inline-flex;
  align-items: center;
  gap: 8px;

  .yc-radio-icon,
  .yc-radio-label {
    flex-shrink: 0;
  }
  .yc-radio-icon {
    position: relative;
    width: 14px;
    height: 14px;
    border: 2px solid var(--color-neutral-3);
    border-radius: var(--border-radius-circle);
    color: var(--color-white);
    display: flex;
    justify-content: center;
    align-items: center;
    &::after {
      content: '';
      position: absolute;
      transform: scale(1);
      width: 10px;
      height: 10px;
      border-radius: var(--border-radius-circle);
      transition: transform 0.3s cubic-bezier(0.3, 1.3, 0.3, 1);
      background-color: var(--color-bg-2);
    }
  }
  .yc-radio-label {
    user-select: none;
    flex: 1;
    color: var(--color-text-1);
  }
}
// button
.yc-radio-button {
  position: relative;
  display: inline-block;
  margin: 1.5px;
  color: var(--color-text-2);
  background-color: transparent;
  border-radius: var(--border-radius-small);
  cursor: pointer;
  transition: all 0.1s cubic-bezier(0, 0, 1, 1);
  &:not(:first-child):before {
    content: '';
    display: block;
    position: absolute;
    top: 50%;
    left: -2px;
    transform: translateY(-50%);
    background-color: var(--color-neutral-3);
    width: 1px;
    height: 14px;
    transition: all 0.1s cubic-bezier(0, 0, 1, 1);
  }
  &:not(.yc-radio-disabled):not(.yc-radio-checked) {
    &:hover {
      background-color: var(--color-bg-5);
      color: var(--color-text-1);
    }
    &:hover::before {
      opacity: 0;
    }
    &:hover + .yc-radio-button {
      &::before {
        opacity: 0;
      }
    }
  }
  .yc-radio-button-content {
    display: block;
    padding: 0 12px;
  }
}
.yc-radio,
.yc-radio-button {
  .yc-radio-target {
    position: absolute;
    left: 0;
    top: 0;
    width: 0;
    height: 0;
    visibility: hidden;
  }
}
// checked
.yc-radio-checked {
  &.yc-radio {
    .yc-radio-icon {
      border-color: rgb(var(--primary-6));
      background-color: rgb(var(--primary-6));
      &::after {
        background-color: var(--color-white);
        transform: scale(0.4);
      }
    }
  }
  &.yc-radio-button {
    color: rgb(var(--primary-6));
    background-color: var(--color-bg-5);
    &::before {
      opacity: 0;
    }
    & + .yc-radio-button {
      &::before {
        opacity: 0;
      }
    }
  }
}
// unchecked
.yc-radio-unchecked {
  &:not(.yc-radio-disabled):hover .yc-icon-button {
    &::before {
      background-color: var(--color-fill-2);
    }
    .yc-radio-icon {
      transition: border-color 0.1s cubic-bezier(0, 0, 1, 1);
      border-color: var(--color-neutral-3);
    }
  }
}
// disabled
.yc-radio-disabled {
  * {
    cursor: not-allowed;
  }
  &.yc-radio {
    &.yc-radio-unchecked {
      .yc-radio-icon {
        border-color: var(--color-neutral-3);
        &::after {
          background-color: var(--color-fill-2);
        }
      }
    }
    &.yc-radio-checked {
      .yc-radio-icon {
        border-color: transparent;
        background-color: var(--color-primary-light-3);
      }
    }
    .yc-radio-label {
      color: var(--color-text-4);
    }
  }
  &.yc-radio-button {
    &.yc-radio-unchecked {
      color: var(--color-text-4);
    }
    &.yc-radio-checked {
      color: var(--color-primary-light-3);
      background-color: var(--color-bg-5);
    }
  }
}
//size
@size: {
  mini: 18px;
  small: 22px;
  medium: 26px;
  large: 30px;
};
each(@size, {
  @font-size:if(@key=mini,12px,14px);
  .yc-radio-button.yc-radio-button-size-@{key} {
    font-size: @font-size;
    line-height: @value;
  }
});
