.switch { position: relative; display: inline-block; width: 36px; height: 20px; } .switch-input { opacity: 0; width: 0; height: 0; } .switch-slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: rgba(37, 72, 120, 0.14); transition: 0.2s; border-radius: 20px; } .switch-slider:before { position: absolute; content: ""; height: 16px; width: 16px; left: 2px; bottom: 2px; background-color: white; transition: 0.2s; border-radius: 50%; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); } .switch-input:checked + .switch-slider { background-color: var(--primary); } .switch-input:focus-visible + .switch-slider { box-shadow: 0 0 0 2px rgba(20, 112, 255, 0.38); } .switch-input:checked + .switch-slider:before { transform: translateX(16px); } .switch-input:disabled + .switch-slider { opacity: 0.5; cursor: not-allowed; }