/* ──────────────────────────────────────────────────────────────
   Control: Switches (Toggle Sliders)
   ──────────────────────────────────────────────────────────────
   Wiederverwendbare Toggle-Switches für die gesamte Anwendung.
   Aktivfarbe: --z-control-active (#18B2CB) — konsistent mit
   Checkboxen (checkbox.css) und Radio-Buttons (optgroup.css).

   Größen:
     .z-switch        → Standard (34×18px, Knob 14px)
     .z-switch-sm     → Klein (28×16px, Knob 12px)

   Nutzung:
     <label class="z-switch" title="Tooltip">
         <input type="checkbox" checked>
         <span class="z-switch-slider"></span>
     </label>

   Mit Label-Text:
     <label class="z-switch-label">
         <span class="z-switch">
             <input type="checkbox" checked>
             <span class="z-switch-slider"></span>
         </span>
         <span>Label</span>
     </label>

   Abhängigkeiten:  Design-Tokens aus _layout.html
   ────────────────────────────────────────────────────────────── */

/* ── Switch Container ─────────────────────────────────── */
.z-switch {
    position: relative;
    display: inline-block;
    width: 34px;
    height: 18px;
    flex-shrink: 0;
}

.z-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

/* ── Slider Track ─────────────────────────────────────── */
.z-switch-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: var(--z-border, #ccc);
    border-radius: 18px;
    transition: background 0.2s;
}

.z-switch-slider::before {
    content: '';
    position: absolute;
    width: 14px;
    height: 14px;
    left: 2px;
    bottom: 2px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

/* ── Checked State ────────────────────────────────────── */
.z-switch input:checked + .z-switch-slider {
    background: var(--z-control-active, #18B2CB);
}

.z-switch input:checked + .z-switch-slider::before {
    transform: translateX(16px);
}

/* ── Small Variant ────────────────────────────────────── */
.z-switch-sm {
    width: 28px;
    height: 16px;
}

.z-switch-sm .z-switch-slider::before {
    width: 12px;
    height: 12px;
}

.z-switch-sm input:checked + .z-switch-slider::before {
    transform: translateX(12px);
}

/* ── Switch + Label Combo ─────────────────────────────── */
.z-switch-label {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
    font-size: 0.8rem;
    color: var(--z-text-mid);
}

.z-switch-label:hover {
    color: var(--z-text);
}

/* ── Disabled ─────────────────────────────────────────── */
.z-switch:has(input:disabled) {
    opacity: 0.45;
}

.z-switch:has(input:disabled) .z-switch-slider {
    cursor: not-allowed;
}
