// Name:            Switch
// Description:     Input switch in website's forms
//
// Component:       `c-form-switch`
//
// ========================================================================
@use '../../../../assets/sass/settings/v7/colors.tokens' as *;
@use '../../../../assets/sass/settings/v7/spacing.tokens' as *;
@use '../../../../assets/sass/settings/v7/layout-standard' as *;
@use '../../../../assets/sass/settings/v7/global' as *;

@use '../../../../assets/sass/tools/v7/mq' as *;
@use '../../../../assets/sass/tools/v7/utils' as *;
@use '../../../../assets/sass/tools/v7/typography' as *;
@use '../../../../assets/sass/tools/v7/zindex' as *;

// @use '../../../../assets/sass/objects/v7/links' as *;
// @use '../../../../assets/sass/objects/v7/icons' as *;

// Variables
// ========================================================================

$switch-width: 40px;
$switch-height: 20px;
$switch-radius: 23px;
$switch-button: 16px;

// ========================================================================

.c-form {
  &-switch {
    display: inline-block;
    // width: auto;
    // white-space: nowrap;
    width: 100%;
  
    .c-form-label {
      display: inline-block;
      position: absolute;
      left: calc(#{$switch-width} + #{$margin-xsmall});
      padding-bottom: 0;
      cursor: pointer;
    }
    
    input {
      width: 0;
      height: 0; 
      opacity: 0;

      &:checked + .c-form-switcher {
        background-color: $interactive-01;

        &::before {
          -webkit-transform: translateX(20px);
          -ms-transform: translateX(20px);
          transform: translateX(20px);
        }
      }
    }
  }
  
  &-switcher {
    width: $switch-width;
    height: $switch-height;
    border-radius: $switch-radius;
    background-color: $ui-03;
    -webkit-transition: .4s;
    transition: .4s;

    &::before {
      position: absolute;
      bottom: 2px;
      left: 2px;
      content: "";
      width: $switch-button;
      height: $switch-button;
      border-radius: 50%;
      background-color: $ui-01;
      -webkit-transition: .4s;
      transition: .4s;
    }
  }
}
