// Slide-toggle (mat-slide-toggle, class sln-mat-slide-toggle)

core-field-bool.sln-bool-xs {
  .mat-mdc-slide-toggle {
    min-height: calc(var(--INPUT-HEIGHT) / 2);

    .mdc-form-field button {
      height: 18px;
      width: 55px;
    }

    .mdc-switch__icons {
      height: 60%;
      width: 57%;
      top: 4.5px;
    }
  }

  .mat-mdc-slide-toggle
    .mdc-switch--selected
    .mdc-switch__handle:has(.mdc-switch__icons) {
    margin: 0;
    margin-left: 5px;
  }

  .sln-mat-slide-toggle-label {
    font-size: 12px;
    display: block;
  }

  .mdc-switch--unselected .mdc-switch__track,
  .mdc-switch:not(.mdc-switch--checked) .mdc-switch__track {
    background-size: 22px;
    background-repeat: no-repeat;
    background-position: bottom -1px right 3px;
  }

  .mdc-switch--selected .mdc-switch__track,
  .mdc-switch--checked .mdc-switch__track {
    background-size: 22px;
    background-repeat: no-repeat;
    background-position: bottom 0 right 25px;
  }

  .mdc-switch--selected .mdc-switch__handle-track,
  .mdc-switch--checked .mdc-switch__handle-track {
    transform: translateX(160%);
    width: 23px;
  }
}

core-field-bool.sln-bool-s {
  .mat-mdc-slide-toggle {
    min-height: calc(var(--INPUT-HEIGHT) - 15px);
  }

  .mdc-form-field button {
    width: 62px;
    height: 22px;
  }

  .mdc-switch__icons {
    height: 66%;
    width: 66%;
    top: 3.3px;
  }

  .mat-mdc-slide-toggle
    .mdc-switch--selected
    .mdc-switch__handle:has(.mdc-switch__icons) {
    margin: 0;
    margin-left: 5px;
  }

  .sln-mat-slide-toggle-label {
    font-size: 14px;
  }

  .mdc-switch--unselected .mdc-switch__track,
  .mdc-switch:not(.mdc-switch--checked) .mdc-switch__track {
    background-position: bottom 23px right 2px;
    background-size: 26px;
  }

  .mdc-switch--selected .mdc-switch__track,
  .mdc-switch--checked .mdc-switch__track {
    background-position: bottom 23px right 28px;
    background-size: 26px;
  }

  .mdc-switch--selected .mdc-switch__handle-track,
  .mdc-switch--checked .mdc-switch__handle-track {
    transform: translateX(180%);
    width: 23px;
  }
}

.sln-core-field-bool {
  margin: 5px 0;
}

.sln-mat-slide-toggle.sln-mat-slide-toggle--no-border {
  border-color: transparent;

  .mdc-form-field {
    padding: 0;
  }

  &:hover:not(:disabled):not(.sln-mat-slide-toggle-disabled) {
    border-color: transparent;
  }
}

.sln-mat-slide-toggle {
  display: flex !important;
  min-height: var(--INPUT-HEIGHT);
  border: 1px solid var(--CONTROL-BORDER);
  border-radius: var(--INPUT-RADIUS);
  align-items: center;
  background: var(--WHITE);
  width: 100%;
  overflow: hidden;
  transition: border-color 0.15s ease;

  &:hover:not(:disabled):not(.sln-mat-slide-toggle-disabled) {
    border-color: var(--CONTROL-BORDER-HOVER);
  }

  &:disabled,
  &.sln-mat-slide-toggle-disabled {
    border-color: var(--LIGHT-GRAY);
    opacity: 0.55;
    cursor: not-allowed;
  }

  .mdc-label {
    font-size: 14px;
    color: var(--DARK-GREY) !important;
    font-family: var(--font-medium);
  }

  .mdc-form-field {
    display: flex;
    flex-direction: row-reverse;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 0 12px;
    gap: 12px;

    button {
      width: 70px;
      height: 30px;
      border-radius: 30px;
      background: var(--SLIDE-TRACK-OFF);
    }
  }

  .mdc-switch__icon {
    display: none;
  }

  .mdc-switch__icons {
    background: var(--SLIDE-HANDLE);
    border-radius: 30px;
    box-shadow:
      0 0 1px rgba(25, 31, 41, 0.08),
      0 2px 6px rgba(68, 83, 113, 0.16);
  }

  .mdc-switch--selected .mdc-switch__icons,
  .mdc-switch--checked .mdc-switch__icons {
    right: 5px;
  }

  .mdc-switch--selected .mdc-switch__handle-track,
  .mdc-switch--checked .mdc-switch__handle-track {
    transform: translateX(198%);
    width: 10px;
  }

  .mdc-switch--unselected .mdc-switch__handle-track,
  .mdc-switch:not(.mdc-switch--checked) .mdc-switch__handle-track {
    transform: translateX(8%);
  }

  .mdc-switch--selected .mdc-switch__track,
  .mdc-switch--checked .mdc-switch__track {
    background-repeat: repeat-y;
    background-position: bottom 25px right 28px;
  }

  .mdc-switch--unselected .mdc-switch__track,
  .mdc-switch:not(.mdc-switch--checked) .mdc-switch__track {
    background-repeat: repeat-y;
    background-position: bottom 25px right 2px;
  }

  .mdc-switch.mdc-switch--selected:enabled .mdc-switch__icon,
  .mdc-switch.mdc-switch--checked:enabled .mdc-switch__icon,
  .mdc-switch.mdc-switch--unselected:enabled .mdc-switch__icon,
  .mdc-switch:not(.mdc-switch--checked):enabled .mdc-switch__icon {
    fill: var(--WHITE);
  }

  .mdc-switch--selected,
  .mdc-switch--checked {
    background: var(--SLIDE-TRACK-ON) !important;

    .mdc-switch__track::before,
    .mdc-switch__track::after {
      background: none;
    }
  }

  .mdc-switch.mdc-switch--unselected:disabled .mdc-switch__icon,
  .mdc-switch:not(.mdc-switch--checked):disabled .mdc-switch__icon {
    display: none;
  }

  .mdc-switch.mdc-switch--unselected:disabled .mdc-switch__icons,
  .mdc-switch:not(.mdc-switch--checked):disabled .mdc-switch__icons {
    opacity: 1;
  }

  .mdc-switch.mdc-switch--selected:disabled .mdc-switch__icons,
  .mdc-switch.mdc-switch--checked:disabled .mdc-switch__icons {
    opacity: 0.85;
  }

  .mdc-switch:disabled .mdc-switch__track {
    opacity: 0.55;
  }

  .mdc-switch__track::before,
  .mdc-switch__track::after {
    border: none;
  }
}

.sln-mat-slide-toggle-label {
  display: flex;
  align-items: center;
  padding-right: 5px;
  color: var(--MIDLE-GRAY);
  font-family: var(--font-medium);
  font-size: 14px;
  line-height: 1.4;
}

.sln-mat-slide-toggle.sln-mat-slide-toggle--no-border:disabled,
.sln-mat-slide-toggle.sln-mat-slide-toggle--no-border.sln-mat-slide-toggle-disabled {
  border-color: transparent;
}
