Generalized approach to design multi-layer stacks for enhanced optical detectability of ultrathin layers