how do I set the Animations For running and walking properly to match the stamina bar?

What Is Happening now is I start the game and I walk The player walks with the walking anim and stamina is not effected if I hold left shift the player runs with the run anim and stamina will decrease until there is no stamina left then the player will start walking again with the walking anim and stamina will increase this is intended if the player is running and stamina reaches 0 I want him to start walking and not b bale to run again until he has stamina the problem is I have to b holding shift to b walking after the stamina reaches 0 if I let go of shift I run and stamina will still increase if I hold shift again the player will walk and stamina will decrease what I want to happen is if I Hold shift I run if there is stamina and stamina will decrease if I let go of shift I walk and stamina will increase, This is very confusing an I hope that I worded it right so I can get the right answer. Here is the code I have Written, If you can help Id Appreciate it.

 private void CalculateValues()
{

    Hunger -= HungerOverTime * Time.deltaTime;
    Thirst -= ThirstOverTime * Time.deltaTime;

    if (Hunger <= MinAmmount || Thirst <= MinAmmount)
    {
        Health -= HealthOverTime * Time.deltaTime;
        MaxStamina -= StaminaDecreaseRate * Time.deltaTime;
    }

    if (MyBody.velocity.magnitude > 0 && Input.GetKey(KeyCode.LeftShift)) 

    {
        StaminaBar.value -= Time.deltaTime / StaminaDecreaseRate * StaminaDecreaseMult;

        

    }

    else
    {
        StaminaBar.value += Time.deltaTime / StaminaIncreaseRate * StaminaIncreaseMult;
    }

    if (StaminaBar.value >= MaxStamina)
    {
        StaminaBar.value = MaxStamina;
    }

    else if (StaminaBar.value <= 0)
    {
        StaminaBar.value = 0;
        PlayerController.MaxSpeed = PlayerController.WalkSpeed;
        PlayerController.IsWalking = true;
        PlayerController._animator.SetBool("IsRunning", false);
        

    }
    else if (StaminaBar.value >= 0)
    {
        PlayerController.Runspeed = PlayerController.RunspeedNorm;

        
    }

use this


   else if(!Inpud.GetKey(KeyCode.LeftShitf)){
       StaminaBar.value += Time.deltaTime / StaminaIncreaseRate * StaminaIncreaseMult;
    }