Stability criteria for complex ecosystems