Generalized Hawking-Page Phase Transition