Crystal structure and phase transitions in perovskite-like C(NH2)3SnCl3