The
Raspberry Pi camera is often more powerful than a webcam because of the great
PiCamera API.
However, the camera is a bit farsighted, and needs ~60cm minimum
distance to the subject to be able to focus. If that much space is not
available, an inexpensive cell phone macro lens can be used, often sold
as part of a set (fish-eye, macro, telephoto). These lenses have a
magnetic ring that attaches to a ring of metal, which in turn attaches
to the camera with adhesive tape. The lenses work OK, but the English
instructions may be awkward.