Tension on shutted down gpio

This can damage the chip.

It can, but that doesn't mean that it will.

So I must to isolate all the digital input with optocoupler, but i don't know what is the best solution for the analog input,

You don't have to isolate. But if you do isolate, the best solution will depend on your application, your parts availability, your tolerance for complexity, your bank account, etc.

can you help me?

Sure but not enough to go on.