How to make player move align with camera position?

I just want the player’s movement to work align with the camera’s position.

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

public class PlayerMovement : MonoBehaviour
{
    private float speed = 10f;
    private float jumpForce = 8f;
    private float gravity = 30f;
    private Vector3 moveDir = Vector3.zero;
    public int distance = 2;

    void Start()
    {
        
    }

    // Update is called once per frame

    void Update()
    {
        var look = new Vector3(Camera.main.transform.forward.x, transform.position.y, Camera.main.transform.forward.z);
        if (Input.GetKey("w"))
        {
            transform.position = transform.position + look * distance * Time.deltaTime;
        }
        if (Input.GetKey("s"))
        {
            transform.position = transform.position - look * distance * Time.deltaTime;
        }
        CharacterController controller = gameObject.GetComponent<CharacterController>();

        if (controller.isGrounded)
        {
            moveDir = new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical"));

            moveDir = transform.TransformDirection(moveDir);

            moveDir *= speed;

            if (Input.GetButtonDown ("Jump"))
            {
                moveDir.y = jumpForce;
            }
        }
        moveDir.y -= gravity * Time.deltaTime;

        controller.Move(moveDir * Time.deltaTime);

    }
}

Vector3 input = new Vector3(A/D-input,up/down-input,W/S-input);

Vector3 moveDirection = Camera.main.transform.TransformDirection(input);

transform.position += moveDirection * speed;

something like this should work.