@use "../abstracts" as *;

// check radio 공통
.check-form-box input[type="checkbox"],
.radio-form-box input[type="radio"]{
  position: absolute;
  top: 0;
  left: 0;
  margin-left:0;
  opacity: 0;
  z-index: 1;
  flex: 0 0 auto;
  cursor: pointer;
}
.check-form-box label,
.radio-form-box label{
  position: relative;
  display: inline-block;
  margin-bottom:0;
  line-height:1.5;
  font-size: $font-s-13;
  color: $font-c;
  vertical-align: top;
  word-break:break-all;
  cursor: pointer;
  -webkit-user-select:none;
  -moz-user-select:none;
  -ms-user-select:none;
  user-select:none;
}

// check box
.check-form-box{
  position: relative;
  label{
    padding-left: 28px;
    &::before{
      content: "";
      display: inline-block;
      position: absolute;
      width: 20px;
      height: 20px;
      top: 0px;
      left: 0;
      margin-left: 0px;
      border: 1px solid #A8B6C7;
      border-radius: 4px;
      background-color: #fff;
      transition: border 0.15s ease-in-out, color 0.15s ease-in-out, background-color 0.15s ease-in-out;
      cursor: pointer;
    }
    &::after{
      content: "";
      display: inline-block;
      position: absolute;
      top: -1px;
      left: -1px;
      width: 7px;
      height: 9px;
      border: 2px solid transparent;
      border-left: none;
      border-top: none;
      transform: translate(7.75px,4.5px) rotate(45deg);
      -ms-transform: translate(7.75px,4.5px) rotate(45deg);
      cursor: pointer;
      transition: border 0.15s ease-in-out, color 0.15s ease-in-out;
    }
  }
  input[type="checkbox"]:checked + label::before{
    background-color: #A8B6C7;
    border-color: #A8B6C7;
  }
  input[type="checkbox"]:checked + label::after{
    content: "";
    border-color: #fff;
  }
  input[type="checkbox"]:disabled + label{
    opacity: 0.7;
    cursor: default;
  }
  input[type="checkbox"]:disabled + label::before{
    background-color: #f5f6fa;
    cursor: default;
  }
  input[type="checkbox"]:disabled + label::after{
    cursor: default;
  }
  input[type="checkbox"]:disabled:checked + label::before{
    background-color: #A8B6C7;
  }
  &.ch-bld{
    input[type="checkbox"]:checked + label{
      font-weight: 500;
    }
  } 
  &.light{
    label{
      color: #8595A7;
    }
  }
  &.space{
    label{
      &::after{
        top: 8px;
        left: 0px;
        width: 10px;
        height: 2px;
        border: none;
        background-color: transparent;
        transform: translate(50%, 50%);
        -ms-transform: none;
      }
    }
    input[type="checkbox"]:checked + label::after{
      background-color: #fff;
    }
  }
}

// radio box
.radio-form-box{
  position: relative;
  label{
    padding-left: 28px;
    &::before{
      content: "";
      display: inline-block;
      position: absolute;
      width: 20px;
      height: 20px;
      top: 0px;
      left: 0;
      margin-left: 0;
      border: 1px solid #A8B6C7;
      border-radius: 100%;
      background-color: #fff;
      text-align:center;
      font-size:17px;
      line-height:12px;
      transition: border 0.15s ease-in-out, color 0.15s ease-in-out;
      cursor: pointer;
    }
    &::after{
      content: "";
      display: inline-block;
      position: absolute;
      top: 5px;
      left: 5px;
      width: 10px;
      height: 10px;
      background-color: transparent;
      border-radius: 50%;
      transition: background-color 0.1s ease-in-out;
    }
  }

  input[type="radio"]:checked + label::after{
    background-color: #A8B6C7;
  }

  input[type="radio"]:disabled + label{
    opacity: 0.7;
    cursor: default;
  }
  input[type="radio"]:disabled + label::before{
    background-color: #f5f6fa;
    cursor: default;
  }
  input[type="radio"]:disabled + label::after{
    cursor: default;
  }
}


//toggle
.toggle-btn {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 22px;
  input {
    display: none;
  }
  .slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #E9F0F8;
    border-radius: 25px;
    text-align: center;
    line-height: 20px;
    color: $white-fff;
    font-size: 14px;
    font-weight: 400;
    transition: .4s;
    &:after {
        content: '';
        position: absolute;
        top: 1px;
        right: 8px;
        color: white;
        font-size: 14px;
        font-weight: 400;
    }
    &:before {
        position: absolute;
        content: "";
        height: 18px;
        width: 18px;
        left: 2px;
        bottom: 2px;
        background-color: $white-fff;
        transition: .4s;
        border-radius: 50%;
    }
  }
  input:checked + .slider {
    background-color: #0081b5;
    &:after {
        content: '';
        left: 10px;
        right: auto;
    }
    &:before {
        transform: translateX(16px);
    }
  }
}

.toggle-form{
  @include flex(8px);
  align-items: center;
  .toggle-name{
    @include defaultFont($font-s-13, $font-w-400, $font-c)
  }
}