.custom-control {
  position: relative;
  display: block;
  min-height: 1.3125rem;
  padding-inline-start: 1.5rem;
}

.custom-control-inline {
  display: inline-flex;
  margin-inline-end: 1rem;
}

.custom-control-input {
  position: absolute;
  z-index: -1;
  opacity: 0;

  &:checked ~ .custom-control-label::before {
    color: rgb($white) ;
    border-color: #{$primary};
    background-color: #{$primary};
  }

  &:focus {
    ~ .custom-control-label::before {
      box-shadow: 0 0 0 0.2rem   #{$border};
    }

    &:not(:checked) ~ .custom-control-label::before {
      border-color:   #{$border};
    }
  }

  &:not(:disabled):active ~ .custom-control-label::before {
    color: rgb($white) ;
    background-color:  #{$primary-05};
    border-color:  #{$primary-05};
  }

  &:disabled ~ .custom-control-label {
    color: $black-5;

    &::before {
    	opacity:0.5;
    }
  }
}

label.custom-control-lg {
  margin-block-end: 1rem !important;
}

.custom-control-label {
  position: relative;
  margin-block-end: 0;
  vertical-align: top;

  &::before {
    position: absolute;
    inset-block-start: 0;
    inset-inline-start: -1.5rem;
    display: block;
    width: 1rem;
    height: 1rem;
    pointer-events: none;
    content: "";
    background-color: transparent ;
    border: #{$form-border} solid 1px;
  }

  &::after {
    position: absolute;
    inset-block-start: 0;
    inset-inline-start: -1.5rem;
    display: block;
    width: 1rem;
    height: 1rem;
    content: "";
    background: no-repeat 50% / 50% 50%;
  }
}

.custom-checkbox {
  .custom-control-label::before {
    border-radius: 3px;
  }

  .custom-control-input {
    &:checked ~ .custom-control-label::after {
      background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%23fff' d='M6.564.75l-3.59 3.612-1.538-1.55L0 4.26 2.974 7.25 8 2.193z'/%3e%3c/svg%3e");
        filter: invert(1);
    }

    &:indeterminate ~ .custom-control-label {
      &::before {
        border-color: #{$primary};
        background-color: #{$primary};
      }

      &::after {
        background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 4 4'%3e%3cpath stroke='%23fff' d='M0 2h4'/%3e%3c/svg%3e");
      }
    }

    &:disabled {
      &:checked ~ .custom-control-label::before, &:indeterminate ~ .custom-control-label::before {
        background-color:  #{$primary-05};
      }
    }
  }
}

.custom-radio {
  .custom-control-label::before {
    border-radius: 50%;
    background-color:rgba(255,255,255,0.05);
  }

  .custom-control-input {
    &:checked ~ .custom-control-label::after {
      background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23fff'/%3e%3c/svg%3e");
      filter: invert(1);
    }

    &:disabled:checked ~ .custom-control-label::before {
      background-color:  #{$primary-05};
    }
  }
}

.custom-switch {
  padding-inline-start: 2.25rem;

  .custom-control-label {
    &::before {
      inset-inline-start: -2.25rem;
      width: 1.75rem;
      pointer-events: all;
      border-radius: 0.5rem;
    }

    &::after {
      inset-block-start: calc(0.15625rem + 2px);
      inset-inline-start: calc(-2.25rem + 2px);
      width: calc(1rem - 4px);
      height: calc(1rem - 4px);
      background-color: #{$gray-500};
      border-radius: 0.5rem;
      transition: transform 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
    }
  }

  .custom-control-input {
    &:checked ~ .custom-control-label::after {
      background-color: rgb($white) ;
      transform: translateX(0.75rem);
    }

    &:disabled:checked ~ .custom-control-label::before {
      background-color:  #{$primary-05};
    }
  }
}

@media (prefers-reduced-motion: reduce) {
  .custom-switch .custom-control-label::after {
    transition: none;
  }
}

.custom-select {
  display: inline-block;
  width: 100%;
  height: calc(1.5em + 0.75rem + 2px);
  padding-block: 0.375rem;
  padding-inline-start: 1.75rem;
  padding-inline-end: 0.75rem;
  font-size: 0.875rem;
  font-weight: 400;
  line-height: 1.5;
  color: #{$gray-700};
  vertical-align: middle;
  background: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 4 5'%3e%3cpath fill='%233b4863' d='M2 0L0 2h4zm0 5L0 3h4z'/%3e%3c/svg%3e") no-repeat right 0.75rem (center / 8px) 10px;
  background-color: rgb($white) ;
  border: 1px solid #{$border};
  border-radius: 3px;
  appearance: none;

  &:focus {
    border-color:   #{$border};
    outline: 0;
  }

  &[multiple], &[size]:not([size="1"]) {
    height: auto;
    padding-inline-end: 0.75rem;
    background-image: none;
  }

  &:disabled {
    color: #{$gray-600};
    background-color: #{$gray-200};
  }

}

.custom-select-sm {
  height: calc(1.5em + 0.5rem + 2px);
  padding-block-start: 0.25rem;
  padding-block-end: 0.25rem;
  padding-inline-start: 0.5rem;
  font-size: 0.76562rem;
}

.custom-select-lg {
  height: calc(1.5em + 1rem + 2px);
  padding-block-start: 0.5rem;
  padding-block-end: 0.5rem;
  padding-inline-start: 1rem;
  font-size: 1.09375rem;
}

.custom-file {
  position: relative;
  display: inline-block;
  width: 100%;
  height: calc(1.5em + 0.75rem + 2px);
  margin-block-end: 0;
}

.custom-file-input {
  position: relative;
  z-index: 2;
  width: 100%;
  height: calc(1.5em + 0.75rem + 2px);
  margin: 0;
  opacity: 0;

  &:focus ~ .custom-file-label {
    border-color:   #{$border};
    box-shadow: 0 0 0 0.2rem   #{$border};
  }

  &:disabled ~ .custom-file-label {
    background-color: #{$gray-200};
  }

  &:lang(en) ~ .custom-file-label::after {
    content: "Browse";
  }

  ~ .custom-file-label[data-browse]::after {
    content: attr(data-browse);
  }
}

.custom-file-label {
  position: absolute;
  inset-block-start: 0;
  inset-inline-end: 0;
  inset-inline-start: 0;
  z-index: 1;
  height: calc(1.5em + 0.75rem + 2px);
  padding: 0.375rem 0.75rem;
  font-weight: 400;
  line-height: 1.5;
  color: #{$gray-700};
  background-color: rgb($white) ;
  border: 1px solid #{$border};
  border-radius: 3px;

  &::after {
    position: absolute;
    inset-block-start: 0;
    inset-inline-end: 0;
    inset-block-end: 0;
    z-index: 3;
    display: block;
    height: calc(1.5em + 0.75rem);
    padding: 0.375rem 0.75rem;
    line-height: 1.5;
    color: #{$gray-700};
    content: "Browse";
    background-color: #{$gray-200};
    border-inline-start: inherit;
    border-start-start-radius: 0;
    border-start-end-radius: 3px;
    border-end-end-radius: 3px;
    border-end-start-radius: 0;
  }
}

.custom-range {
  width: 100%;
  height: calc(1rem + 0.4rem);
  padding: 0;
  background-color: transparent;
  appearance: none;

  &:focus {
    outline: none;

    &::-webkit-slider-thumb {
      box-shadow: 0 0 0 1px rgb($white),   0 0 0 0.2rem   #{$border};
    }
  }

  &::-webkit-slider-thumb {
    width: 1rem;
    height: 1rem;
    margin-block-start: -0.25rem;
    background-color: #{$primary};
    border: 0;
    border-radius: 1rem;
    transition: background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
    appearance: none;

    &:active {
      background-color:  #{$primary-05};
    }
  }

  &::-webkit-slider-runnable-track {
    width: 100%;
    height: 0.5rem;
    color: transparent;
    cursor: pointer;
    background-color: rgb($background-gradient-color);
    border-color: transparent;
    border-radius: 1rem;
  }

  &:disabled {
    &::-webkit-slider-thumb {
      background-color: #{$gray-500};
    }

    &::-webkit-slider-runnable-track {
      cursor: default;
    }
  }
}

@media (prefers-reduced-motion: reduce) {
  .custom-range::-webkit-slider-thumb {
    transition: none;
  }
}


.custom-control-label::before, .custom-file-label, .custom-select {
  transition: background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

@media (prefers-reduced-motion: reduce) {
  .custom-control-label::before, .custom-file-label, .custom-select {
    transition: none;
  }
}

.custom-file, .custom-file-input {
  height: 38px;
}

.custom-file-label {
  height: 38px;
  line-height: 1.8;
  border-radius: 0;

  &::after {
    line-height: 1.8;
    border-radius: 0;
    height: auto;
  }
}

.custom-select {
  background: none;
}
.custom-control-label-lg::before {
  position: absolute;
  inset-block-start: 0.15625rem;
  inset-inline-start: -1.5rem;
  display: block;
  width: 1.75rem;
  height: 1.75rem;
  pointer-events: none;
  content: "";
  background-color: rgb($white);
  border:  #{$border} solid 1px;
  border-radius: 35px;
}
.custom-control-label-lg::after {
  position: absolute;
  inset-block-start: 0.15625rem;
  inset-inline-start: -1.5rem;
  display: block;
  width: 1.75rem;
  height: 1.75rem;
  content: "";
  background: no-repeat 50% / 50% 50%;
  border-radius: 35px;
}
.custom-control-label-md::before, .custom-control-label-md::after {
    width: 1.5rem !important;
    height: 1.5rem !important;
}

.custom-control-label-lg::before, .custom-control-label-lg::after {
    width: 1.75rem !important;
    height: 1.75rem !important;
}

.custom-checkbox .custom-control-input:disabled:checked~.custom-control-label::before {
    background-color: #{$primary};
    opacity: 0.2;
}
.custom-radio .custom-control-input:disabled:checked~.custom-control-label::before {
    background-color:#{$primary};
    opacity: 0.2;
}
.custom-switch-input {
    position: absolute;
    z-index: -1;
    opacity: 0;
}
.custom-switch-indicator {
    display: inline-block;
    height: 1.25rem;
    width: 2.25rem;
    background:  #{$bg-hover};
    border-radius: 50px;
    position: relative;
    vertical-align: bottom;
    cursor: pointer;
    border: 1px solid $primary-01;
    transition: .3s border-color, .3s background-color;
}
.custom-switch-indicator:before {
    content: '';
    position: absolute;
    height: calc(1.25rem - 4px);
    width: calc(1.25rem - 4px);
    inset-block-start: 1px;
    inset-inline-start: 1px;
    background: rgb($white);
    border: 1px solid $primary-01;
    border-radius: 50%;
    transition: .3s left;
    box-shadow: 0 1px 2px 0 #{$shadow-color};
}
.custom-switch-input:checked~.custom-switch-indicator {
    background: #{$primary};
}
.custom-switch-input:checked~.custom-switch-indicator:before {
    inset-inline-start: calc(1rem + 1px);
}
.custom-square {
    border-radius: 0px !important;
}
.custom-square:before {
    border-radius: 0px !important;
}
.custom-switch-indicator-lg {
    display: inline-block;
    height: 1.5rem;
    width: 3rem;
    background:  #{$bg-hover};
    border-radius: 50px;
    position: relative;
    vertical-align: bottom;
    border: 1px solid  #{$border};
    transition: .3s border-color, .3s background-color;
}
.custom-switch-indicator-lg:before {
    content: '';
    position: absolute;
    height: calc(1.5rem - 4px);
    width: calc(1.5rem - 4px);
    inset-block-start: 1px;
    inset-inline-start: 1px;
    background: rgb($white);
    border: 1px solid $primary-01;
    border-radius: 50%;
    transition: .3s left;
    box-shadow: 0 1px 2px 0 #{$shadow-color};
}
.custom-switch-input:checked~.custom-switch-indicator-lg:before {
    inset-inline-start: calc(1.46rem + 1px);
}
.custom-switch-indicator-xl {
    display: inline-block;
    height: 2rem;
    width: 4rem;
    background:  #{$bg-hover};
    border-radius: 50px;
    position: relative;
    vertical-align: bottom;
    border: 1px solid  #{$border};
    transition: .3s border-color, .3s background-color;
}
.custom-switch-indicator-xl:before {
    content: '';
    position: absolute;
    height: calc(2rem - 4px);
    width: calc(2rem - 4px);
    inset-block-start: 1px;
    inset-inline-start: 1px;
    border: 1px solid $primary-01;
    background: rgb($white);
    border-radius: 50%;
    transition: .3s left;
    box-shadow: 0 1px 2px 0 #{$shadow-color};
}
.custom-switch-input:checked~.custom-switch-indicator-xl:before {
    inset-inline-start: calc(1.96rem + 1px) !important;
}
.form-select:focus {
    box-shadow: none;
}
.item-card .cardprice-2 span.type--strikethrough {
    opacity: 0.5;
    text-decoration: line-through;
    font-size: 14px;
    font-weight: 400;
}
.item-card .cardprice-2 span {
    display: block;
    font-size: 18px;
    font-weight: 500;
}
.item-card .cardprice-2 {
    position: absolute;
    inset-inline-end: 15px;
}
