Enrich your mystery with an opponent who gives your detective problems. The opponent has a role quite different from the villain’s role. The villain in a mystery is the one who committed the murder. From Agatha Christie’s Chief Inspector Japp and Hercule Poirot to the neighbor Grannenin the Swedish television series Beck.
The opponent is a character who causes trouble for your hero, the detective. They may be a rival, or a love or ex-spouse, or a neighbor… But somehow, villainous or bumbling, they are connected to the detective and oppose your central character.