Nanostructured thin films as functional coatings