Need to understand working of FIFO in zerodha

I had purchased 1300 quantities of upl900 ce on 7th june at buy value 14.2 and then on 8th again to average I purchased 1300 at 9.3 rs. So my avg became 11.75 for 2600 quantities. Now yesterday on 14th june it dropped below and to cope up loss I purchased mis share at 4 rs buy value and quantity 1300 and sold same mis at 5.2 thinking it will at least minimize my loss by 1500. But no today when I logged in I realised my avg value for normal 2600 quantities is 6.65 and I have already lost 11.7 k .when I checked in console it says it has sold shares which was bought at 7th June at buy value of 14.25 with sell value 5.2 And it made avg of shares bought on 8th and 14th June - (9.3+4) equals.6.65…but as per as I understand those shares which were bought on 7-8th are Normal shares and on 14th it was mis shares (intraday) and position for them was never converted. So how come Mis share and normal shares are mixed and how’s calculation done.

For F&O, average price is calculated on pure FIFO (First In First Out) basis. This support article explains it in detail: