Ex-Costa Rican president warns of ‘great reversal’ in democracy