A unified IF-detection theory for practical coherent optical system design