Microscopic characterization of the nanostructure of polyamide thin films in reverse osmosis and nanofiltration membranes