@import '../variable';

.radio {
  & input {
    position: absolute;
    z-index: -1;
    opacity: 0;
    margin: 0;

    &:checked + .radio__text:after {
      opacity: 1;
    }

    &:disabled + .radio__text {
      cursor: not-allowed;

      &:after {
        background: $color-main-grey-text;
        box-shadow: none;
      }
    }
  }

  &__text {
    cursor: pointer;
    display: block;
    position: relative;
    padding: 0 0 0 26px;

    &:before {
      content: '';
      position: absolute;
      top: 0;
      left: 0;
      width: 16px;
      height: 16px;
      border: 1px solid $color-main-grey-text;
      border-radius: 50%;
      background: $color-main-white;
    }

    &:after {
      content: '';
      position: absolute;
      top: 3px;
      left: 3px;
      width: 10px;
      height: 10px;
      border-radius: 50%;
      background: linear-gradient(180deg, $color-additional-green, $color-main-green);
      box-shadow: inset 0 1px 1px $color-main-grey-text;
      opacity: 0;
      transition: 0.2s;
    }
  }
}

// slide
.radio-slide + label {
  position: relative;
  display: inline-block;
  width: 54px;
  height: 24px;
  background-color: $color-main-grey-background;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease-out;
  box-shadow: 2px 2px 1px rgba(0, 0, 0, 0.1) inset;
}

.radio-slide + label::before {
  content: '';
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 100%;
  background-color: white;
  position: absolute;
  top: 5px;
  left: 4px;
  transition: all 0.3s ease-out;
  box-shadow: 2px 2px 2px rgba(0, 0, 0, 0.1);
}

.radio-slide + label::after {
  content: attr(data-deny);
  color: white;
  position: absolute;
  top: 4px;
  right: 5px;
  font-size: 12px;
  transition: all 0.3s ease-out;
}

.radio-slide:checked + label {
  background-color: $color-additional-green;
}

.radio-slide:checked + label::before {
  left: 36px;
}

.radio-slide:checked + label::after {
  content: attr(data-permit);
  left: 10px;
}
