I would suggest you shut down you current non-working mailcow, completly remove the directory and start over from scratch. I suspect that your mailcow.conf currently contains invalid/invisible characters or something like that which leads to the error message “services.nginx-mailcow.ports contains an invalid type, it should be a number, or an object”
Start over, generate the config and change only the lines
HTTP_BIND=
HTTP_PORT=8080
HTTPS_BIND=
HTTPS_PORT=8443
and maybe the other services ports as you did before.