Ekrem Imamoglu's detention comes days before he was due to be selected as a presidential candidate.