Confinement and phase transitions