Flames and explosions erupted at a battery recycling plant in North Ayrshire.