How can I rotate/orbit the camera around an object?

Hello new unity developer here trying to figure out how I can orbit/rotate the camera around my player object when the right mouse button is being held down (so hold right click, move mouse around to move the camera). So far I did manage to get things to work, however it’s a bit scuffed when rotating it seems like the camera goes upsidedown or something so wanted to know how I can improve this.

    public Transform focus;
    public float sensitivity = 1;
    public float speed = 30;
    public float zoomLevel;
    public float zoomPosition;
    public bool rotateCamera = false;

    void Update()
    {
        if (Input.GetMouseButtonDown(1))
        {
            Debug.Log("Right Mouse Button Clicked");
            Cursor.visible = false;
            rotateCamera = true;
        }

        if (Input.GetMouseButtonUp(1))
        {
            Debug.Log("Right Mouse Button Released");
            Cursor.visible = true;
            rotateCamera = false;
        }

        if (rotateCamera)
        {
            //Let the player drag the camera around (360 degrees/orbit idk)
            //when they let go of right click camera will stay in the position they left it in.
            transform.eulerAngles += 10 * new Vector3(Input.GetAxis("Mouse Y"), Input.GetAxis("Mouse X"), 0);
        }

        //Camera Zoom
        zoomLevel += Input.mouseScrollDelta.y * sensitivity;
        zoomLevel = Mathf.Clamp(zoomLevel, -30, 0); 
        zoomPosition = Mathf.MoveTowards(zoomPosition, zoomLevel, speed * Time.deltaTime);
        transform.position = focus.position + (transform.forward * zoomPosition);

Instead of using a script, you can use the Cinemachine package. I think (i dont really know) that Cinemachine has what your asking for.