Conditional Shortest Path Through Weighted Cyclic Directed Graph
The problem is NP-hard, even when you ignore the constraints about categories.  See https://cstheory.stackexchange.com/q/17462/5038 for a simple proof based on a reduction from the longest path problem (or from the Hamiltonian path problem).  Therefore, you should not expect any efficient algorithm.

There are algorithms whose running time is polynomial in the size of the graph but exponential in $m$ (the length of the path). See https://en.wikipedia.org/wiki/Longest_path_problem#Parameterized_complexity.

The categories don't increase the complexity of the problem by more than a constant factor, since there are only 4 categories.  For instance, if the path is required to use at most 3 different categories, you can enumerate all ${4 \choose 3}$ subsets of 3 categories, and for each, construct a smaller graph that contains only the vertices in that subset and then solve the problem on that graph without the restriction on the number of categories.  So for an algorithm design perspective, I suggest you first solve the problem while ignoring the categories.  It will then be straightforward to extend your solution to deal with the categories.