.toggle-container {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-md);
    cursor: pointer;
    user-select: none;
}

.toggle-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text-primary);
    transition: color var(--transition-base);
}

.toggle-switch {
    position: relative;
    width: 52px;
    height: 28px;
    background: var(--color-gray-300);
    border-radius: var(--radius-full);
    transition: background var(--transition-base);
    cursor: pointer;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.toggle-thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 24px;
    height: 24px;
    background: var(--color-bg-primary);
    border-radius: var(--radius-full);
    transition: all var(--transition-base);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

.toggle-switch.active {
    background: var(--gradient-success-solid);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-switch.active .toggle-thumb {
    transform: translateX(24px);
}

.toggle-icon {
    font-size: 12px;
    line-height: 1;
}

.toggle-icon-off {
    display: block;
}

.toggle-icon-on {
    display: none;
}

.toggle-switch.active .toggle-icon-off {
    display: none;
}

.toggle-switch.active .toggle-icon-on {
    display: block;
}

.toggle-container:hover .toggle-switch {
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15), 0 0 0 3px rgba(var(--color-primary-rgb), var(--opacity-10));
}

.toggle-container:hover .toggle-label {
    color: var(--color-primary);
}

.toggle-container:focus-within .toggle-switch {
    outline: 2px solid var(--color-info);
    outline-offset: 2px;
}

.toggle-container.disabled {
    opacity: var(--opacity-50);
    cursor: not-allowed;
    pointer-events: none;
}

.toggle-input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
    .toggle-switch,
    .toggle-thumb,
    .toggle-label {
        transition: none;
    }
}

@media (max-width: 768px) {
    .toggle-switch {
        width: 48px;
        height: 26px;
    }

    .toggle-thumb {
        width: 22px;
        height: 22px;
    }

    .toggle-switch.active .toggle-thumb {
        transform: translateX(22px);
    }

    .toggle-label {
        font-size: 13px;
    }
}

@media (prefers-contrast: high) {
    .toggle-switch {
        border: 2px solid var(--color-text-primary);
    }

    .toggle-thumb {
        border: 2px solid var(--color-text-primary);
    }
}