Quantization of evanescent electromagnetic waves based on detector modes