/* toggle.css — Componentes de toggle: slider pill e icon toggle */

/* -------------------------------------------------------
   Slider Pill
   Uso: <label class="toggle-switch [--md|--sm]">
          <input type="checkbox">
          <span class="toggle-slider"></span>
        </label>
   ------------------------------------------------------- */

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 24px;
  flex-shrink: 0;
}

.toggle-switch--md {
  width: 34px;
  height: 20px;
}

.toggle-switch--sm {
  width: 28px;
  height: 16px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: rgb(var(--slate-6, var(--lv-slate-6)));
  border-radius: 999px;
  transition: background-color 0.2s;
}

/* Knob — tamanho padrão (lg) */
.toggle-slider:before {
  position: absolute;
  content: "";
  width: 18px;
  height: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  border-radius: 50%;
  transition: transform 0.2s;
}

/* Knob — md */
.toggle-switch--md .toggle-slider:before {
  width: 14px;
  height: 14px;
}

/* Knob — sm */
.toggle-switch--sm .toggle-slider:before {
  width: 10px;
  height: 10px;
}

/* Estados */
.toggle-switch input:checked + .toggle-slider {
  background-color: rgb(var(--teal-9, var(--lv-teal-9)));
}

.toggle-switch input:disabled + .toggle-slider {
  opacity: 0.5;
  cursor: not-allowed;
}

/* translateX por tamanho: track - knob - (left + right padding) */
.toggle-switch input:checked + .toggle-slider:before        { transform: translateX(16px); } /* 40-18-6 */
.toggle-switch--md input:checked + .toggle-slider:before    { transform: translateX(14px); } /* 34-14-6 */
.toggle-switch--sm input:checked + .toggle-slider:before    { transform: translateX(12px); } /* 28-10-6 */

/* Linha que envolve toggle + label */
.toggle-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* -------------------------------------------------------
   Icon Toggle
   Uso: <button class="table-action-btn">
          <svg class="toggle-icon toggle-icon--on">...</svg>
        </button>
   ------------------------------------------------------- */

.toggle-icon--on  { color: rgb(var(--teal-9,  var(--lv-teal-9)));  }
.toggle-icon--off { color: rgb(var(--slate-8, var(--lv-slate-8))); }
