I asked for a lawyer before criminal detention, but the police refused. Is this legal?

Illegal.

You have the right to hire a lawyer from the first interrogation by the investigation organ.

It is suggested that a lawyer should be hired as soon as possible to supervise and complain about the violations in the process of police law enforcement.

The importance is self-evident, because of the lack of police enforcement, a lot of evidence will be rejected because of the principle of excluding illegal evidence.