Transition to complex dynamics in the cubic lid-driven cavity