The electroweak phase transition in two-Higgs-doublet models and implications for LHC searches