BIG HUGS
I am so sorry. What a horrible shock for you!
You have done absolutely the right and by far the kindest thing. The tumour must have pushed on the area that was regulating mobility.
Brain tumours are thankfully rare but they do happen and they are very much in the category of news none of us ever wants to get. Most are sadly only ever found right at the end, not that there is any cure/removal op for them at any stage. Since initial symptoms are generally extremely vague and can vary quite a lot at the end, they are also very difficult to diagnose. Early brain tumours are generally more like to be found accidentally. Guinea pigs are no helping with their strong prey animal instinct to suppress any symptoms of illness as much as possible, often until it is too late.
But there is nothing you have done wrong and it is not your fault in any way. It is just one of the genetic short straws in the lottery of cosmic bad luck; especially when it happens with a younger piggy.
I had to euthanize my Carwyn for a brain tumour in 2018 (he was 6 years by then); the only warning I had was a one-off bloody sneeze two months before he suddenly started haemorrhaging blood through the nose and down his throat late one evening. He had been looking a little ill but without any distinct symptoms to help with a diagnosis in the days leading up it. The vet could sadly only confirm my suspicion, having come across the hemorrhaging on the forum perhaps once or twice in a year, just to give you a bit of an idea how rare brain tumours are. Fitting is generally the other way a tumour is found - although most fitting is caused by other issues.
You can find very practical and helpful advice and information via this link below in terms of what you can do for yourself as you grieve, for what you can do for any companions and a guide with more information about euthanasia and when to call it time in case you have any concerns in that respect since most of us suffer from strong feelings of guilt, failure and soul-searching at the onset of the grieving process - we wouldn't have them if we didn't deeply care about our piggies in the first place. They are NOT a sign that you have done anything wrong or have been an unobservant owner just an expression of how much we love and feel responsible. A traumatic, sudden death can make these feelings worse.
Death, Dying, Terminal Illness; Human Grieving and Bereaved Companions: Information and Support for Owners and Their Children
I hope that this will help you. Please be as kind and gentle with yourself and give yourself time to grieve for CoCoa.