Ideal and Max voltages for analog pins as INPUTS

You could use transistors to solve this.

12V to the Base to switch 5V to input pin. Something like a 2N3906.

Common practice, as well as using optoisolators.