Confinement, phase transitions and non-locality in the entanglement entropy