Generalized Fermat equations over totally real fields