@import 'foundation/colors';
@import 'foundation/borders';
@import 'foundation/border-radius';
@import 'foundation/shadows';
@import 'shared/accessibility';
@import 'shared/controls';
@import 'shared/icons';

.basic{
.checkbox {
  position: relative;
}

.error {
  // The basic checked styles have more specificity than this, so need to
  // basically duplicate that selector here, too.
  // stylelint-disable-next-line selector-max-specificity
  .input:checked + .backdrop,
  .input.indeterminate + .backdrop,
  .backdrop {
    @include control-backdrop(error);
  }

  // We need to know if the input is focusing to change the border color.
  // stylelint-disable-next-line selector-max-specificity
  .input:focus + .backdrop,
  .input:active + .backdrop {
    @include control-backdrop(focused-error);
  }

  .icon {
    @include recolor-icon(color(red, dark));
  }
}
.errorsStyle {
  .backdrop {
    border: 1px solid #E53935;
    background: none;
    box-shadow: none;

  }

  .input {
    &:focus,
    &:active {
      +.backdrop {
        background: none;
        box-shadow: 0 0 0 1px #E53935;
        // box-shadow: none
      }
    }
  }
}

.input {
  @include visually-hidden;

  &:focus,
  &:active,
  &:checked,
  &.indeterminate  {
    + .backdrop {
      background: color(indigo);
    }
  }

  &:checked,
  &.indeterminate {
    ~ .icon {
      transform: translate(-50%, -50%) scale(1);
    }
  }

  &:focus,
  &:active {
    + .backdrop {
      @include control-backdrop(focused);
    }
  }

  &:disabled {
    + .backdrop {
      @include control-backdrop(disabled);
    }

    ~ .icon {
      @include recolor-icon(color(ink, lightest));
    }
  }
}

.backdrop {
  @include control-backdrop;
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  pointer-events: none;
 
}

.icon {
  @include recolor-icon(color(indigo));
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  transform-origin: 50% 50%;
  transition: control-icon-transition();
  pointer-events: none;
}
}

//new code
.circleCheckbox{
  .checkbox {
    position: relative;
  }

  .error {
    // The basic checked styles have more specificity than this, so need to
    // basically duplicate that selector here, too.
    // stylelint-disable-next-line selector-max-specificity
    .input:checked + .backdrop,
    .input.indeterminate + .backdrop,
    .backdrop {
      @include control-backdrop(error);
    }
    
  
    // We need to know if the input is focusing to change the border color.
    // stylelint-disable-next-line selector-max-specificity
    .input:focus + .backdrop,
    .input:active + .backdrop {
      @include control-backdrop(focused-error);
    }
  }
 
  .input {
    @include visually-hidden;

  
    &:checked {
      ~ .icon {
        transform: translate(-50%, -50%) scale(1);
      
      }
      ~ .backdrop {
        @include control-backdrop(focused);
        background: #1E88E5;   
        box-shadow: none;
        border: none;
  }
    }
    &.indeterminate {
      ~ .icon {
        transform: translate(-50%, -50%) scale(1);
        fill: #1E88E5;   
      }
      ~ .backdrop {
        @include control-backdrop(focused);
        background: transparent;   
        border: 1px solid #BDBDBD;
        box-shadow: none;

    }
    }
    &:disabled {
  
      ~ .icon {
        @include recolor-icon(color(ink, lightest));
      }
      ~ .backdrop {
        background: transparent;   
      border: none;
  }
    }
  }
  
  .backdrop {
    position: absolute;
    background: transparent;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    pointer-events: none;
    border: 1px solid #BDBDBD;
    border-radius: 50%;
  }
  
  .icon {
    @include recolor-icon(color(#fff));
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    transform-origin: 50% 50%;
    transition: control-icon-transition();
    pointer-events: none;
  }
    .errorsStyle {
      .backdrop {
        border: 1px solid #E53935;
        background: none;
        box-shadow: none;
      }

      .input {
        &:focus,
        &:active {
          +.backdrop {
            background: none;
            box-shadow: 0 0 0 1px #E53935;
            // box-shadow: none
          }
        }
      }
    }
  }

