To expand a little bit: with an IMAP account, all the mail resides on the server, as twerppoet noted. Each device, whether an iPhone, iPad, Mac, or PC, can be considered a window into your account on the server. Messages reside temporarily on a device, for quick reference, but permanently on the server, unless you delete them manually. When you delete a message, it moves from an inbox to the trash, and your "view" from any device reflects that. You needn't worry about which device you use to read or delete a message, because everything is synched by the server.
Once you get used to the ease and convenience of IMAP, you'll wonder why you didn't switch sooner!