A Theoretical Framework for Preventing Class Collapse in Supervised Contrastive Learning