Using millis() in motion/light sensitive LED application, not working properly

I'm trying to debug some code that does not throw an error and compiles just fine. However, the problem is that the light does not stay illuminated even when the motion sensor is still receiving movement input. Otherwise it works as it should.. When the light value drops below the given threshold and motion is detected it lights up. What I'm loking for is for the light to continually sense movement and continue to illuminate as long as movement is detected. When it no longer senses movement, continue to illuminate for a pre-determined period and then shut off. What am I doing wrong?

#include <FastLED.h>

//the time we give the sensor to calibrate (10-60 secs according to the datasheet)
int calibrationTime = 25;

//the time when the sensor outputs a low impulse
long unsigned int lowIn;

//the amount of milliseconds the sensor has to be low
//before we assume all motion has stopped
long unsigned int pause = 70000;

boolean lockLow = true;
boolean takeLowTime;

const int numLeds = 20;
const int pirPin = 0;
const int ldrPin = 1;       //ldr #1. Physical GPIO pin #2
const int ledPin = 3;
const int threshold = 5;    //Should be 10

#define NUM_LEDS 20
CRGB leds[NUM_LEDS];

void setup() {
  FastLED.addLeds<WS2811, ledPin, GRB>(leds, NUM_LEDS).setCorrection( TypicalLEDStrip );
  pinMode(pirPin, INPUT);
  pinMode(ldrPin, INPUT);
  pinMode(ledPin, OUTPUT);
  (pirPin, LOW);
  analogRead(ldrPin);
  leds[0] = CRGB::Black;
  FastLED.show();
}

void loop() {
  if (analogRead(ldrPin) < threshold) {
    if (digitalRead(pirPin) == HIGH) {
      if (lockLow) {
        //makes sure we wait for a transition to LOW before any further output is made:
        lockLow = false;
        FadeIn(0xff, 0x00, 0x00, 10);
        delay(50);
      }
      takeLowTime = true;
    }
  }

  if (digitalRead(pirPin) == LOW) {
    if (takeLowTime) {
      lowIn = millis();      //save the time of the transition from high to LOW make sure this is only done at the start of a LOW phase
      takeLowTime = false;
    }
    //if the sensor is low for more than the given pause, we assume that no more motion is going to happen
    if (!lockLow && millis() - lowIn > pause) {
      //makes sure this block of code is only executed again after a new motion sequence has been detected
      lockLow = true;
      FadeOut(0xff, 0x00, 0x00, 10);
      delay(50);
    }
  }
}

void FadeIn(byte red, byte green, byte blue, uint8_t wait) {
  float r, g, b;

  for (int k = 0; k < 256; k = k + 1) {
    r = (k / 256.0) * red;
    g = (k / 256.0) * green;
    b = (k / 256.0) * blue;
    setAll(r, g, b);
    FastLED.show();
    delay(wait);
  }
}

void FadeOut(byte red, byte green, byte blue, uint8_t wait) {
  float r, g, b;

  for (int k = 255; k >= 0; k = k - 2) {
    r = (k / 256.0) * red;
    g = (k / 256.0) * green;
    b = (k / 256.0) * blue;
    setAll(r, g, b);
    FastLED.show();
    delay(wait);
  }
}
void showStrip() {
  FastLED.show();
}

void setPixel(int Pixel, byte red, byte green, byte blue) {
  // FastLED
  leds[Pixel].r = red;
  leds[Pixel].g = green;
  leds[Pixel].b = blue;
}

void setAll(byte red, byte green, byte blue) {
  for (int i = 0; i < NUM_LEDS; i++ ) {
    setPixel(i, red, green, blue);
  }

}

I can't test this but I'm pretty sure it will work. The idea is that if the light is below a certain threshold and the pir sensor detects motion it will reset the timer and fade in the LEDS. I believe if they are already faded in it will not make a difference. If the pir sensor does not detect motion for the pause time then a timeout will happen and the LEDs will be faded out. Note that if the LEDs are already faded in and the pir detects motion before the timeout period again then the timer is reset and the LEDs stay lit. You could keep a flag to determine if the LEDs are already on and skip the fade-in for a motion which occurs when the LEDs are already on.

#include <FastLED.h>

//the time we give the sensor to calibrate (10-60 secs according to the datasheet)
int calibrationTime = 25;

//the time when the sensor outputs a low impulse
unsigned long lowIn;

//the amount of milliseconds the sensor has to be low
//before we assume all motion has stopped
unsigned long pause = 70000;

const int numLeds = 20;
const int pirPin = 0;
const int ldrPin = 1;       //ldr #1. Physical GPIO pin #2
const int ledPin = 3;
const int threshold = 5;    //Should be 10
int prevPirVal;

#define NUM_LEDS 20
CRGB leds[NUM_LEDS];

void setup() {
  FastLED.addLeds<WS2811, ledPin, GRB>(leds, NUM_LEDS).setCorrection( TypicalLEDStrip );
  pinMode(pirPin, INPUT);
  pinMode(ldrPin, INPUT);
  pinMode(ledPin, OUTPUT);
  (pirPin, LOW);
  analogRead(ldrPin);
  leds[0] = CRGB::Black;
  FastLED.show();
  prevPirVal = digitalRead(pirPin);
}

void loop() 
{
  int pirVal = digitalRead(pirPin);
  
  if (analogRead(ldrPin) < threshold) 
  {
    if (pirVal != prevPirVal)
    {
      if (pirVal == HIGH)
      {
        // motion has been detected
        FadeIn(0xff, 0x00, 0x00, 10);
        lowIn = millis();
      }
      delay(50);
    }
  }

  //if the sensor is low for more than the given pause, we assume that no more motion is going to happen
  if (millis() - lowIn > pause) 
  {
    FadeOut(0xff, 0x00, 0x00, 10);
    delay(50);
  }

  prevPirVal = pirVal;
}

void FadeIn(byte red, byte green, byte blue, uint8_t wait) {
  float r, g, b;

  for (int k = 0; k < 256; k = k + 1) {
    r = (k / 256.0) * red;
    g = (k / 256.0) * green;
    b = (k / 256.0) * blue;
    setAll(r, g, b);
    FastLED.show();
    delay(wait);
  }
}

void FadeOut(byte red, byte green, byte blue, uint8_t wait) {
  float r, g, b;

  for (int k = 255; k >= 0; k = k - 2) {
    r = (k / 256.0) * red;
    g = (k / 256.0) * green;
    b = (k / 256.0) * blue;
    setAll(r, g, b);
    FastLED.show();
    delay(wait);
  }
}
void showStrip() {
  FastLED.show();
}

void setPixel(int Pixel, byte red, byte green, byte blue) {
  // FastLED
  leds[Pixel].r = red;
  leds[Pixel].g = green;
  leds[Pixel].b = blue;
}

void setAll(byte red, byte green, byte blue) {
  for (int i = 0; i < NUM_LEDS; i++ ) {
    setPixel(i, red, green, blue);
  }

}

Thanks for the tip, and what you suggest makes alot of sense. I have no idea how I would implement the flag to tell the program what state it is in. Any takers?