let lastVideoUrl = null;

chrome.runtime.onMessage.addListener((message, sender, sendResponse) => {
  if (message.action === "openPopup") {
    lastVideoUrl = message.videoUrl;
    chrome.action.openPopup(); // opens popup.html
  }
});

chrome.runtime.onMessage.addListener((message, sender, sendResponse) => {
  if (message.action === "getVideoUrl") {
    sendResponse({ videoUrl: lastVideoUrl });
  }
});
