@import '../../styles/common/colors';

.radio-component {
  cursor: pointer;
  overflow: hidden;
  position: relative;
  width: 100%;

  > input {
    cursor: pointer;
    height: 100%;
    left: 0;
    margin: 0;
    opacity: 0;
    padding: 0;
    position: absolute;
    width: 100%;
    top: 0;
    z-index: 2;
  }

  &:hover {
    border-color: $neutral-2;

    &:not(.radio-disabled) {
      > input + div .radio-input {
        &:before {
          content: "";
          background-color: $neutral-2;
          border-radius: 50%;
          display: block;
          height: 6px;
          left: 3px;
          position: relative;
          top: 3px;
          width: 6px;
        }
      }
    }
  }

  &:active {
    border-color: $neutral-1;

    &:not(.radio-disabled) {
      > input + div .radio-input {
        &:before {
          content: "";
          background-color: $neutral-1;
          border-radius: 50%;
          display: block;
          height: 6px;
          left: 3px;
          position: relative;
          top: 3px;
          width: 6px;
        }
      }
    }
  }

  &:not(.radio-disabled) {
    > input:checked + div .radio-input {
      border-color: $primary-1;

      &:before {
        content: "";
        background-color: $primary-1;
        border-radius: 50%;
        display: block;
        height: 6px;
        left: 3px;
        position: relative;
        top: 3px;
        width: 6px;
      }
    }
  }

  > div {
    align-items: center;
    display: flex;
    height: 100%;
    width: 100%;

    &.label-group {
      align-items: inherit;
    }

    .radio-input {
      background-color: $white;
      border-radius: 50%;
      border: solid 2px $neutral-3;
      height: 12px;
      flex-shrink: 0;
      width: 12px;
    }

    .label-wrapper {
      display: flex;

      .label-title {
        font-size: 15px;
        font-weight: 200;
        line-height: 18px;
      }

      .label-description {
        display: block;
        line-height: 22px;
        opacity: 0.85;
        margin-bottom: -4px;
        margin-top: 8px;
      }
    }

    label {
      color: $navy-text;
      font-size: 14px;
      margin-left: 10px;
    }
  }

  &.radio-error {
    > div .radio-input {
      border-color: $danger;
    }
  }

  &.radio-disabled {
    cursor: not-allowed;

    > input {
      cursor: not-allowed;
    }

    > div {
      label {
        color: $neutral-3;
      }

      .radio-input {
        background-color: $neutral-3;
        border-color: $neutral-3;

        &:before {
          display: none;
        }
      }
    }
  }
}

.radio-group {
  > label {
    display: block;
    margin-bottom: 16px;
    font-size: 16px;
    color: $navy-text;
    font-weight: 200;
  }
  
  .radio-component {
    margin-bottom: 16px;

    &:last-child {
      margin-bottom: 0;
    }
  }
}
