/*!
 * Profit Calc - Custom Switch Overrides
 *
 * Restores the Bootstrap 4 custom-switch toggle styling (track + sliding knob)
 * for .custom-control.custom-switch controls only. Does NOT affect regular
 * .form-check-input checkboxes or radios.
 *
 * App-owned CSS replacements previously shipped the track (.custom-switch
 * .custom-control-label::before) but were missing the switch-specific knob
 * (::after) and its checked translateX movement, leaving toggles rendered as
 * solid-filled / empty pills.
 */

.custom-switch {
  display: inline-block;
  margin-left: 0.75rem;
  margin-right: 0.75rem;
  padding-left: calc(2.25rem + 0.75rem);
  padding-right: 0.75rem;
}

.custom-switch .custom-control-label {
  padding-left: 0.75rem;
}

.custom-switch .custom-control-label::before {
  left: -2.25rem;
  width: 2.25rem;
  height: 1rem;
  border-radius: 0.5rem;
  pointer-events: all;
  background-color: #fff;
  border: 1px solid #adb5bd;
}

.custom-switch .custom-control-label::after {
  content: "";
  display: block;
  position: absolute;
  top: calc(0.25rem + 2px);
  left: calc(-2.25rem + 2px);
  width: calc(1rem - 4px);
  height: calc(1rem - 4px);
  background-color: #adb5bd;
  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-switch .custom-control-input:checked ~ .custom-control-label::before {
  color: #fff;
  border-color: #62657c;
  background-color: #62657c;
}

.custom-switch .custom-control-input:checked ~ .custom-control-label::after {
  background-color: #fff;
  transform: translateX(1.25rem);
}

.custom-switch .custom-control-input:focus ~ .custom-control-label::before {
  box-shadow: 0 0 0 0.2rem rgba(98, 101, 124, 0.25);
  border-color: #62657c;
}

.custom-switch .custom-control-input:focus:not(:checked) ~ .custom-control-label::before {
  border-color: #adb5bd;
}

.custom-switch .custom-control-input:not(:disabled):active ~ .custom-control-label::before {
  background-color: #d4d6e0;
  border-color: #d4d6e0;
}

.custom-switch .custom-control-input:disabled ~ .custom-control-label::before {
  background-color: #e9ecef;
  border-color: #dee2e6;
}

.custom-switch .custom-control-input:disabled ~ .custom-control-label::after {
  background-color: #ced4da;
}

.custom-switch .custom-control-input:disabled:checked ~ .custom-control-label::before {
  background-color: rgba(98, 101, 124, 0.5);
}

.switch-float-right {
  float: right;
}

.switch-attention {
  border: 2px solid #c84243;
  border-radius: 5px;
  padding-top: 0.3125rem;
  padding-bottom: 0.3125rem;
}

.switch-control-row {
  margin: 12px 0 4px 20px;
}

.switch-control-row .custom-switch {
  display: inline-flex;
  align-items: center;
  min-height: 1.5rem;
}
