Were they voting for Ms Clinton because she was the best candidate available or did they vote for her because of her gender?

Lots of women voted for Mr Trump.  Apparently enough that he won the election.