We use the past perfect
simple to talk about what happened before a point in the past. It looks
back from a point in the past to further in the past.
I hadn't known the bad news when I spoke to him.
I checked with the supplier and they still hadn't received the contract.
She had already told him before I got a chance to give him my version.
The company has started the year well but was badly hit by the postal strike.
The past perfect simple is often used when we report what people had said/thought/believed.
He told me they had already paid the bill.
He said he believed that John had moved to Italy.
I thought we had already decided on a name for this product.
We use the past perfect continuous to look back at a situation in progress.
It looked like a good time to invest. Inflation had been falling for several months.
Before I changed jobs, I had been working on a plan to reduce production costs.
We had been thinking about doing that but then decided against it.