how to make player movement be based on direction its facing

I want my player to move directions relative to the direction the player is facing when I press the arrow keys. So if I press the “up” arrow to move the player forward, I want forward to be the direction it is facing, yet forward seems to always be tied to the worlds forward, because pressing the “up” arrow moves me in the same direction regardless of what way I’m facing. My code does correctly turn the player so that it is facing whichever direction it is going, making the local “forward” correct, but then pressing the “up” arrow turns my player to the Global forward instead of moving in the players forward. I’m pretty new to both coding and Unity, and I don’t know how to go about changing that. Any advice or info is appreciated (even if it doesn’t solve this particular problem, I’m eager to learn) but I will say I’d prefer not to use a Rigidbody, I’m trying to learn using character controller. Here is my code for the player:

public class PlayerController : MonoBehaviour
{
private CharacterController playerCC;
private Vector3 playerVelocity;
private bool groundedPlayer;
private float playerSpeed = 10.0f;
private float jumpHeight = 3.0f;
private float gravityValue = -9.81f;
[SerializeField] Camera mainCamera;

private void Start()
{
    playerCC = gameObject.GetComponent<CharacterController>();
}
void Update()
{
    groundedPlayer = playerCC.isGrounded;
    if (groundedPlayer && playerVelocity.y < 0)
    {
        playerVelocity.y = 0f;
    }
    float horizontalInput = Input.GetAxis("Horizontal");
    float verticalInput = Input.GetAxis("Vertical");

    Vector3 move = new Vector3(horizontalInput, 0, verticalInput);
    playerCC.Move(move * Time.deltaTime * playerSpeed);

    if (move != Vector3.zero)
    {
        gameObject.transform.forward = move;
    }
    if (Input.GetButtonDown("Jump") && groundedPlayer)
    {
        playerVelocity.y += Mathf.Sqrt(jumpHeight * -3.0f * gravityValue);
    }
    playerVelocity.y += gravityValue * Time.deltaTime;
    playerCC.Move(playerVelocity * Time.deltaTime);
}

}

Im just gonna guess you wand the sideways arrow key to rotate the player? then up and down to move forward and back relative to facing direction?


public float movementSpeed = 25f;

    void Update()
    {
        float hInput = Input.GetAxis("Horizontal");
        float vInput = Input.GetAxis("Vertical");

        if (vInput > 0)
        {
            transform.position += transform.up * Time.deltaTime *movementSpeed;
        }
        if (vInput < 0)
        {
            transform.position -= transform.up * Time.deltaTime *movementSpeed;
        }
        if (hInput > 0)
        {
            transform.Rotate(0, 0, -1f, Space.Self);
        }
        if (hInput < 0)
        {
            transform.Rotate(0, 0, 1f, Space.Self);
        }