chrome.runtime.onMessage.addListener((msg, sender) => {
  if (msg.type === "show_popup") {
    chrome.action.openPopup().catch(err => {
      console.error("Popup could not be opened:", err);
    });
  }
});
