Direct and ecological costs of resistance to herbivory