How to change the CSS of the active toggle button using pseudo CSS transitions

I have multiple toggle buttons on my web page. I am using

checkbox

input control with some CSS to get a material toggle button design. When I change the state of any of the toggle buttons, the CSS effects are reflected on the first toggle. How can i apply the effect on just the active toggle.

if you want to have multiple toggle buttons, you need to use IDs, but you have the same IDs in both toggles, which can't happen because IDs are unique, so change the ID and the label for to target those IDs.