It is used specially with "if clauses" and normal sentences of course : If ----could , I would ( in this case it means if i am able to do i will ,but i am not sure ,but still there is a possibility to do ,it is not excluded !) as CJ said it is a possible action to take in the future ,while you remain unsure if you can or not when you say that ~!
While to say : If ----- could have , would have -- ( In this case , the situation terminated and I didnt do cause i couldnt ,so i say if i was able i would have , but when I am saying that ,the possibiltiy of doing is excluded !
As for could used as a past of "can" , that is not the case .
I can go tonite ,,,,, you cant say "" " i could go tonite " and it will mean the past , it will mean it is possible for me to go but i am not sure ,if i will be able to do it !
The past of can in this case , will be possibly:"was able"
I " was able" to go tonite .