@import '../mixins/_color-scheme';

.q-radio-wrapper {
  display: inline-flex;

  .q-input[type=radio] {
    opacity: 0;
    position: absolute;
  }

  .q-input[type=radio]:focus {
    outline: none !important;
  }

  .q-input[type=radio]:checked + .q-label > span::before {
    border-color: $primary;
  }

  .q-input[type=radio]:checked + .q-label > span::after {
    transform: scale(1);
  }

  span::before, span::after {
    position: absolute;
    content: '';
    border-radius: 50%;
    display: block;
    box-sizing: border-box;
  }

  span::after {
    top: 6px;
    left: 6px;
    width: 8px;
    height: 8px;
  }

  span {
    width: 25px;
    height: 25px;
    vertical-align: middle;
    display: inline-block;
    position: relative;
    cursor: pointer;
    outline: none;
    user-select: none;

    &::before {
      left: 0;
      top: 0;
      width: 20px;
      height: 20px;
      border: 2px solid rgba(0,0,0,.54);
    }

    &::after {
      transform: scale(0);
      background: $primary;
    }
  }

  .q-input[type=radio]:checked:disabled {
    & + .q-label > span {
      color: $light-gray;
    }

    & + .q-label span::before {
      border-color: $light-gray;
    }

    & + .q-label span::after {
      background: $light-gray;
      opacity: .4;
    }
  }

  .q-input[type=radio]:disabled {
    & + .q-label > span::before {
      opacity: .4;
    }

    & + .q-label > span {
      color: $light-gray;
    }

    & + .q-label .q-typography {
      color: $light-gray;
      opacity: .4;
    }
  }

  &.q-error {
    color: $red;

    .q-input[type=radio] + .q-label > span::before {
      border: 2px solid $red;
    }

    .q-input[type=radio] + .q-label > span::after {
      background: $red;
    }
  }
}
