// content.js - Internet scanner w/o prompts
chrome.runtime.onMessage.addListener((req, sender, sendResponse) => {
  if (req.action === 'scanPage') {
    const data = {
      title: document.title,
      url: window.location.href,
      text: document.body.innerText.slice(0, 5000),
      links: Array.from(document.querySelectorAll('a')).map(a => a.href).slice(0, 50),
      emails: document.body.innerText.match(/\\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Z|a-z]{2,}\\b/g) || []
    };
    chrome.runtime.sendMessage({action: 'scannedData', data});
  }
  sendResponse({ok: true});
});