What exactly is a chemical pregnancy?

Is it pregnancy detection and loss before implantation? In that case why does everyone say pregnancy CAN'T be detected before implantation? I felt pregnant last month. I took a test early in the wee hours of the morning with a vvvfl. That evening, bam. My period came. I am so confused about HSG levels and pregnancy detection. Anything helps!