function PrivacyModal({ open, onClose }) {
  React.useEffect(() => {
    const onKey = (e) => { if (e.key === 'Escape' && open) onClose(); };
    window.addEventListener('keydown', onKey);
    return () => window.removeEventListener('keydown', onKey);
  }, [open, onClose]);

  if (!open) return null;

  return (
    <div className="modal-backdrop" onClick={onClose}>
      <div className="modal privacy-modal" onClick={e => e.stopPropagation()}>
        <div className="modal-header">
          <div />
          <div style={{fontWeight:700, fontSize:14, color:'var(--ink-2)'}}>Privacy Policy</div>
          <button className="modal-close" onClick={onClose}><Ic.close /></button>
        </div>
        <div className="modal-body privacy-modal-body">
          <p style={{fontSize:13, color:'var(--ink-3)', marginBottom:18}}>
            Last updated: May 21, 2026
          </p>

          <p>BuzyBee Roofing ("BuzyBee Roofing," "we," "us," or "our") respects your privacy. This Privacy Policy explains what information we collect when you visit our website, fill out a form, or interact with our ads, and how we use, share, and protect that information.</p>
          <p>By using our website or submitting any form, you agree to the terms of this Privacy Policy.</p>

          <h4>1. Information We Collect</h4>
          <p><strong>Information you give us.</strong> When you fill out a form on our website (such as the free estimate or offer request form), we collect:</p>
          <ul>
            <li>Your first and last name</li>
            <li>Email address</li>
            <li>Phone number</li>
            <li>Property ZIP code</li>
            <li>Information about your home and roofing project (project type, condition, timeline, homeowner status)</li>
          </ul>
          <p><strong>Information we collect automatically.</strong> When you visit our website, we automatically collect:</p>
          <ul>
            <li>IP address</li>
            <li>Browser type and version</li>
            <li>Device type and operating system</li>
            <li>Pages visited and how long you spent on them</li>
            <li>Referring website and URL parameters (including UTM tracking parameters from ads)</li>
            <li>Cookies and similar tracking technologies</li>
          </ul>

          <h4>2. How We Use Your Information</h4>
          <ul>
            <li>Respond to your estimate or service request</li>
            <li>Schedule and conduct on-site visits and provide quotes</li>
            <li>Contact you by phone, email, or text message about your inquiry</li>
            <li>Send you follow-up information about our roofing services and promotions</li>
            <li>Improve our website, marketing, and customer service</li>
            <li>Comply with legal obligations</li>
            <li>Measure and optimize our advertising campaigns</li>
          </ul>

          <h4>3. How We Share Your Information</h4>
          <p>We do not sell your personal information. We share it only with:</p>
          <ul>
            <li><strong>Service providers</strong> who help us run our business (such as Google for spreadsheet storage and email, and customer relationship management tools)</li>
            <li><strong>Advertising platforms</strong> including Meta (Facebook/Instagram) and Google, who help us measure ad performance and reach similar audiences. These platforms may receive hashed or anonymized data through tracking pixels.</li>
            <li><strong>Legal authorities</strong> when required by law, subpoena, or to protect our rights</li>
          </ul>

          <h4>4. Cookies and Tracking Technologies</h4>
          <p>We use cookies and tracking pixels (including the Meta Pixel) to measure the performance of our ads, show you relevant ads on Facebook, Instagram, and across the web, and understand how visitors use our website.</p>
          <p>You can disable cookies through your browser settings. You can also opt out of personalized ads through Meta, Google Ad Settings, or the Digital Advertising Alliance.</p>

          <h4>5. SMS and Phone Communication</h4>
          <p>By submitting your phone number through our forms, you agree to receive phone calls and SMS text messages from BuzyBee Roofing related to your inquiry, estimate, scheduled appointment, and follow-up communications. Message and data rates may apply. You can opt out at any time by replying STOP to any message or telling us by phone or email.</p>
          <p>We will not share your phone number or SMS opt-in with any third party for their marketing purposes.</p>

          <h4>6. Your Rights</h4>
          <p>Depending on where you live, you may have the right to:</p>
          <ul>
            <li>Access the personal information we have about you</li>
            <li>Correct inaccurate information</li>
            <li>Delete your personal information</li>
            <li>Opt out of marketing communications at any time</li>
            <li>Opt out of the sale or sharing of your personal information (we do not sell personal information)</li>
          </ul>
          <p>To exercise any of these rights, email us at <a href="mailto:pete@buzybeeroofing.com" style={{color:'var(--brand-primary)', fontWeight:600}}>pete@buzybeeroofing.com</a>. We will respond within 30 days.</p>
          <p>California residents have additional rights under the California Consumer Privacy Act (CCPA). Washington residents have rights under applicable state laws.</p>

          <h4>7. Data Security</h4>
          <p>We use reasonable administrative, technical, and physical safeguards to protect your information. However, no method of transmission over the internet is 100% secure, and we cannot guarantee absolute security.</p>

          <h4>8. Data Retention</h4>
          <p>We retain your information for as long as needed to provide our services, comply with legal obligations, and resolve disputes. If you ask us to delete your information, we will do so unless we are required to retain it by law.</p>

          <h4>9. Children's Privacy</h4>
          <p>Our website and services are not directed to children under 13. We do not knowingly collect personal information from children under 13. If you believe a child has provided us with personal information, please contact us so we can delete it.</p>

          <h4>10. Third-Party Links</h4>
          <p>Our website may contain links to third-party websites. We are not responsible for the privacy practices of those websites. We encourage you to read their privacy policies.</p>

          <h4>11. Changes to This Policy</h4>
          <p>We may update this Privacy Policy from time to time. Any changes will be posted on this page with an updated "Last updated" date. Significant changes will be communicated by email or a prominent notice on our website.</p>

          <h4>12. Contact Us</h4>
          <p>If you have any questions about this Privacy Policy or how we handle your information, contact us at <a href="mailto:pete@buzybeeroofing.com" style={{color:'var(--brand-primary)', fontWeight:600}}>pete@buzybeeroofing.com</a>.</p>
          <p style={{fontWeight:600}}>BuzyBee Roofing &middot; Bellevue, WA &amp; Greater Seattle</p>

          <p style={{marginTop:18, fontSize:13, fontStyle:'italic', color:'var(--ink-3)'}}>
            By using our services, submitting your information, or interacting with our ads, you agree to the terms outlined in this Privacy Policy.
          </p>
        </div>
        <div className="modal-footer modal-footer--divider">
          <button className="btn btn-dark btn-lg" onClick={onClose}>Close</button>
        </div>
      </div>
    </div>
  );
}
window.PrivacyModal = PrivacyModal;
