If I was you, i would take the master cylinder out of the car and bench bleed it. Plenty of tutorials on the net to explain how to do it. Once you get air in the master cylinder, it is very hard to get it out whilst it's fitted to the car and it can cause the sort of problems you describe. You can bleed at the wheels as much as you like and the problem will persist.
If you do fit a new master cylinder, make sure you bench bleed it before you install it.
Also, on the side of the master cylinder there is a bolt. This is the piston stop bolt, and it keeps the internal pistons correctly located. If you mistakenly believe this to be a bleed valve (it isn't) and back it off to try and bleed the master cylinder, the pistons will sit incorrectly and your brakes won't work properly either.