.q-radio {
  --radio-color-base: rgb(var(--color-base-regular-rgb) / 96%);
  --radio-color-disabled: rgb(var(--color-rgb-gray) / 64%);
  --radio-background-color-base: var(--color-tertiary-gray-ultra-light);
  --radio-background-color-hover: var(--color-tertiary-gray);
  --radio-background-color-disabled: var(--color-tertiary-gray);
  --radio-dot-color-base: var(--color-accent-secondary-main);
  --radio-dot-color-disabled: rgb(var(--color-rgb-gray) / 64%);
  --radio-box-shadow-base: 1px 1px 3px rgb(var(--color-rgb-blue) / 40%);
  --radio-box-shadow-focus: 1px 1px 3px rgb(var(--color-rgb-blue) / 40%),
    inset 0 0 0 1px var(--color-accent-secondary-main);

  position: relative;
  display: inline-flex;
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-base);
  line-height: 1;
  color: var(--radio-color-base);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  outline: none;

  &_disabled {
    cursor: not-allowed;
  }

  &__label {
    padding-left: 16px;
    font-size: var(--font-size-base);
    color: var(--radio-color-base);
    word-break: break-word;
    white-space: normal;

    .q-radio_disabled & {
      color: var(--radio-color-disabled);
    }

    &_size {
      &_regular {
        margin-top: 2px;
        font-size: 14px;
        line-height: 20px;
      }

      &_small {
        --radio-color-base: rgb(var(--color-base-regular-rgb) / 64%);

        margin-top: 5px;
        font-size: 10px;
        line-height: 14px;
      }
    }
  }

  &__input {
    position: relative;
    line-height: 0;
    white-space: nowrap;
    border: none;
    outline: none;
  }

  &__inner {
    position: relative;
    box-sizing: border-box;
    display: inline-block;
    width: 24px;
    height: 24px;
    background-color: var(--radio-background-color-base);
    border-radius: 100%;
    outline: none;
    box-shadow: var(--radio-box-shadow-base);

    &::after {
      position: absolute;
      top: 50%;
      left: 50%;
      width: 12px;
      height: 12px;
      content: '';
      background-color: var(--radio-dot-color-base);
      border-radius: 100%;
      transition: transform 0.15s ease-in;
      transform: translate(-50%, -50%) scale(0);
    }

    &:hover {
      background-color: var(--radio-background-color-hover);
    }

    .q-form-item_is-error & {
      &,
      .q-checkbox__input_focus {
        border: var(--border-error);
      }
    }

    .q-radio_checked & {
      &::after {
        transform: translate(-50%, -50%) scale(1);
      }
    }

    .q-radio_disabled & {
      background-color: var(--radio-background-color-disabled);

      &::after {
        background-color: var(--radio-dot-color-disabled);
      }
    }

    .q-radio_checked &:hover {
      background-color: var(--radio-background-color-hover);
    }

    .q-radio_disabled &:hover {
      background-color: var(--radio-background-color-disabled);
    }

    .q-radio:not(.q-radio_disabled):focus & {
      box-shadow: var(--radio-box-shadow-focus);

      &:hover {
        background-color: var(--radio-background-color-hover);
      }
    }
  }

  &__original {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: -1;
    margin: 0;
    outline: none;
    opacity: 0;
  }
}
