Cohen-Macaulay injective, projective, and flat dimension