Understanding population structure and historical demography in a conservation context: population genetics of an endangered fern