Gamma-ray signatures of cosmic ray acceleration, propagation, and confinement in the era of CTA