Rotate camera to follow player in a 2D platformer

So im making a little 2D platformer to get the hang of unity. I have a character and a camera that follows the player in a 2d plane. What I think would be cool is if the camera also rotated to smooth out the motion, leaving a way for me to have some small 3D elements in the scene. I couldnt find any answers online so I thought I would try here. Heres the code I have so far for the camera movement:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Camera_controller : MonoBehaviour
{
    public GameObject player;
    private float smoothTime = 0.25f;
    private Vector3 velocity = Vector3.zero;
    private Vector3 offset = new Vector3(0f, 0f, -10f);

    [SerializeField] private Transform target;

    // Start is called before the first frame update
    void Start()
    {
        
    }

    // Update is called once per frame
    void Update()
    {
        

        Vector3 targetPosition = target.position + offset;
        transform.position = Vector3.SmoothDamp(transform.position, targetPosition, ref velocity, smoothTime);
        
    }
}

again, the movement is nice and smooth now, but I would also like the camera to rotate to follow the player along with the x&y axis movement. Thanks!

Quaternion.Slerp is used to smoothly interpolate between the current rotation and the target rotation based on the rotationSpeed.

check this

using UnityEngine;

public class CameraController : MonoBehaviour
{
    public Transform target;
    public float smoothTime = 0.25f;
    public Vector3 offset = new Vector3(0f, 0f, -10f);
    public float rotationSpeed = 5f;

    private Vector3 velocity = Vector3.zero;

    private void Update()
    {
        Vector3 targetPosition = target.position + offset;
        transform.position = Vector3.SmoothDamp(transform.position, targetPosition, ref velocity, smoothTime);

        // Calculate the player's direction relative to the camera
        Vector3 directionToPlayer = target.position - transform.position;
        float angle = Mathf.Atan2(directionToPlayer.y, directionToPlayer.x) * Mathf.Rad2Deg;

        // Apply rotation smoothly
        Quaternion targetRotation = Quaternion.AngleAxis(angle, Vector3.forward);
        transform.rotation = Quaternion.Slerp(transform.rotation, targetRotation, rotationSpeed * Time.deltaTime);
    }
}

So I tried it out, and after a bit of modification, its super close to what Im looking for. Is there a way to get it to rotate on the x and y axis? I can only seem to get it to rotate on z, when I dont want it to rotate on z at all. Thanks for the help so far!