Detecting phase transitions in collective behavior using manifold's curvature