/* Interrupteur pill oui / non (formulaires) */

.toggle-switch-field {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-weight: normal;
  margin: 0;
  max-width: 100%;
}

.toggle-switch-field-block {
  align-items: flex-start;
}

.toggle-switch-field-block .toggle-switch-label {
  flex: 1;
  line-height: 1.4;
  padding-top: 4px;
}

.toggle-switch-field.is-disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.toggle-switch-label {
  user-select: none;
  line-height: 1.4;
}

.toggle-button-container.toggle-switch-compact {
  position: relative;
  width: 64px;
  height: 26px;
  flex-shrink: 0;
  box-sizing: border-box;
}

.toggle-switch-compact .toggle-button {
  position: relative;
  height: 100%;
  margin: 0;
  background: transparent;
  box-shadow: none;
  border-radius: 0;
}

.toggle-switch-compact .toggle-button:before {
  display: none;
}

.toggle-switch-compact .toggle-button.gd {
  display: block;
  height: 100%;
}

.toggle-switch-compact .btn.toggle-switch-btn {
  position: relative;
  display: block;
  width: 64px;
  height: 26px;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  box-shadow: none;
  overflow: hidden;
  border-radius: 100px;
  font-weight: inherit;
  line-height: 1;
  vertical-align: baseline;
}

.toggle-switch-compact .btn-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  border-radius: 100px;
  background-color: #cb6253;
  transition: background-color 0.25s ease;
}

.toggle-switch-compact .toggle-switch-input:checked ~ .btn-bg {
  background-color: #58a681;
}

.toggle-switch-compact .knob {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  border-radius: 100px;
}

.toggle-switch-compact .knob::before,
.toggle-switch-compact .knob::after {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: lowercase;
  color: #fff;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.toggle-switch-compact .knob::before {
  content: "oui";
  left: 0;
  opacity: 0;
}

.toggle-switch-compact .knob::after {
  content: "non";
  right: 0;
  opacity: 1;
}

.toggle-switch-compact .toggle-switch-input:checked + .knob::before {
  opacity: 1;
}

.toggle-switch-compact .toggle-switch-input:checked + .knob::after {
  opacity: 0;
}

.toggle-switch-compact .knob span {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  transition: transform 0.25s ease;
  z-index: 2;
}

.toggle-switch-compact .toggle-switch-input:checked + .knob span {
  transform: translateX(38px);
}

.toggle-switch-compact .toggle-switch-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 5;
  -webkit-appearance: none;
  appearance: none;
}

.toggle-switch-compact .toggle-switch-input:disabled {
  cursor: not-allowed;
}

.form-horizontal .toggle-switch-field,
.form-group .toggle-switch-field {
  display: inline-flex;
  align-items: center;
}

.form-group .toggle-switch-field {
  margin-bottom: 4px;
}

.checkbox .toggle-switch-field,
.checkbox-inline .toggle-switch-field {
  display: inline-flex;
}
