Clinton made the mistake of counting her chickens before they hatched, based upon her obviously superior background and experience, aided and abetted by the media which ridiculed Trump at every opportunity.  She absolutely reeked of self-entitlement, and it drove just enough people away to make the difference.  

Gender wasn't even an issue until she made it one, looking forward to making history as the first female American president ("It's about time a woman had the job!"---another expression of entitlement).  Now she attributes her loss to the gender issue.