This question is an exact duplicate of:
I came across this sentence on stack exchange and it confused me.
'If you had called me 10 minutes ago, I would have been sleeping.' on
What is the structure of the above sentence called?
Why 'If you had called me? Can it be replaced with 'If you called me?'
I thought 'had called' is past perfect which means it happened before another event in the past. But in this case, it sounds like 'sleeping' came before.