Phase transitions in nanostructures