axa-radio {
  @include text(t4);
  display: block;
  flex: none;
  box-sizing: border-box;
  border: 1px solid transparent;

  &[focus] {
    border-color: $color-axa-blue;
  }

  *,
  *::after,
  *::before {
    box-sizing: border-box;
  }

  &:hover:not([disabled]) {
    color: $color-axa-blue;

    & .a-radio__icon {
      border-color: $color-axa-blue;

      &::after {
        border-color: $color-axa-blue;
      }
    }
  }

  .a-radio__wrapper {
    position: relative;
    display: inline-flex;
    min-height: 20px;
    align-items: center;
    line-height: 1.5;
    justify-content: center;
  }

  .a-radio__input {
    position: absolute;
    width: 1px;
    height: 1px;
    clip: rect(0, 0, 0, 0);
    margin: -1px;
    overflow: hidden;

    &:focus + .a-radio__icon {
      border-width: 2px;
      border-color: $color-axa-blue;
    }

    &:checked + .a-radio__icon::after {
      border-color: $color-light-grey;
      background-color: $color-axa-blue;
    }

    &:disabled + .a-radio__icon {
      cursor: default;
      border-color: $color-silver;
    }

    &:disabled:checked + .a-radio__icon {
      &::after {
        border-color: $color-silver;
        background-color: $color-silver;
      }
    }
  }

  .a-radio__icon {
    transition: all 0.2s ease;
    width: 18px;
    height: 18px;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    background: #fff;
    border: 1px solid $color-light-grey;
    cursor: pointer;
    flex-shrink: 0;
    border-radius: 50%;
    box-sizing: border-box;

    &::after {
      width: 8px;
      height: 8px;
      display: block;
      border: 1px solid transparent;
      content: '';
      border-radius: 50%;
      box-sizing: border-box;
    }
  }
  // when label is empty, the icon doesn't need any margin
  label > .a-radio__icon {
    margin-right: 20px;
  }

  .a-radio__content {
    display: block;
    margin: 0;
    line-height: 1.37;
    color: $color-dark-grey;
  }

  &[button] {
    position: relative;
    max-width: 100%;

    .a-radio__wrapper {
      background-color: $color-wild-sand;
      border: 1px solid $color-light-grey;
      padding: 10px 20px;
      cursor: pointer;
      width: inherit;

      &:hover {
        border-color: $color-axa-blue;
        color: $color-axa-blue;
      }
    }

    .a-radio__content {
      display: table;
      background-color: $color-wild-sand;
      padding: 0;
      text-align: center;
      text-transform: uppercase;
      line-height: 18px;
      letter-spacing: 0.56px;
      color: inherit;
    }

    .a-radio__input {
      &:checked ~ .a-radio__content {
        color: $color-axa-blue;
        background-color: transparent;
        font-weight: bold;
      }
    }

    &[checked] {
      .a-radio__wrapper {
        background-color: transparent;
        border-color: $color-axa-blue;
        color: $color-axa-blue;
      }
    }

    &[disabled] {
      .a-radio__wrapper {
        background-color: $color-alabaster;
        border-color: $color-mercury;
        color: $color-silver;
        cursor: default;

        &:hover {
          border-color: $color-mercury;
        }
      }

      .a-radio__content {
        color: inherit;
        background-color: inherit;
      }
    }

    &[icon] {
      height: auto;

      .a-radio__wrapper {
        padding: 10px 41px 0 41px;
        flex-direction: column;
        justify-content: center;

        svg {
          width: 48px;
          height: 48px;
        }

        .a-radio__content {
          padding-bottom: 10px;
          padding-top: 10px;
        }
      }
    }
  }
}
