If there were no transactions, would mining be possible? What would happen if suddenly everyone stops transferring bitcoins so that there is no work for miners (no transactions to be grouped into blocks)? Would mining be possible in that conditions? How exactly?

Of course, I realize this is impossible, I am interested in the theory behind it.
Yes.

Miners would just produce empty blocks. They would only be paid a subsidy (12.5 BTC per block, currently) and not any fees from transactions.

In its early history, Bitcoin had many empty blocks.