/* Sirona Switch — CSS-only toggle switch */

.sirona-switch {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    user-select: none;
    line-height: 1;
}

.sirona-switch:has(.sirona-switch__input:disabled) {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

/* Hidden but accessible to JS / form submission */
.sirona-switch__input {
    position: absolute;
    width: 0;
    height: 0;
    opacity: 0;
    margin: 0;
    pointer-events: none;
}

/* ─── Track ───────────────────────────────────────────────────────────────── */

.sirona-switch__track {
    position: relative;
    width: 2.5rem;
    height: 1.375rem;
    background-color: var(--border-color, #d1d5db);
    border-radius: 999px;
    flex-shrink: 0;
    transition: background-color 0.2s ease;
}

/* ─── Thumb ───────────────────────────────────────────────────────────────── */

.sirona-switch__thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 1rem;
    height: 1rem;
    background: #ffffff;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
    transition: transform 0.2s ease;
}

/* ─── Checked state ───────────────────────────────────────────────────────── */

.sirona-switch__input:checked ~ .sirona-switch__track {
    background-color: var(--blueteq-blue, #186fb5);
}

.sirona-switch__input:checked ~ .sirona-switch__track .sirona-switch__thumb {
    transform: translateX(1.125rem);
}

/* ─── Focus ───────────────────────────────────────────────────────────────── */

.sirona-switch__input:focus-visible ~ .sirona-switch__track {
    outline: 2px solid var(--blueteq-blue, #186fb5);
    outline-offset: 2px;
}

/* ─── Label text ──────────────────────────────────────────────────────────── */

.sirona-switch__label {
    font-size: 0.875rem;
    color: var(--text-primary, #1f2937);
    transition: color 0.2s ease;
}

/* ─── Dark mode ───────────────────────────────────────────────────────────── */

[data-theme="dark"] .sirona-switch__track {
    background-color: var(--input-border, #475569);
}

[data-theme="dark"] .sirona-switch__input:checked ~ .sirona-switch__track {
    background-color: var(--blueteq-blue, #186fb5);
}

[data-theme="dark"] .sirona-switch__thumb {
    background: #e2e8f0;
}

[data-theme="dark"] .sirona-switch__label {
    color: var(--text-primary, #f1f5f9);
}

/* ─── High contrast ───────────────────────────────────────────────────────── */

[data-theme="high-contrast"] .sirona-switch__track {
    background-color: #444444;
    border: 2px solid #ffffff;
}

[data-theme="high-contrast"] .sirona-switch__thumb {
    background: #ffffff;
    top: 1px;
    left: 1px;
}

[data-theme="high-contrast"] .sirona-switch__input:checked ~ .sirona-switch__track {
    background-color: #0066ff;
}

[data-theme="high-contrast"] .sirona-switch__input:checked ~ .sirona-switch__track .sirona-switch__thumb {
    transform: translateX(1.125rem);
}

[data-theme="high-contrast"] .sirona-switch__input:focus-visible ~ .sirona-switch__track {
    outline: 3px solid #ffffff;
    outline-offset: 2px;
}

[data-theme="high-contrast"] .sirona-switch__label {
    color: #ffffff;
    font-weight: 700;
}
