
const LEGAL_CONTENT = {
  privacy: {
    title: 'Privacy Policy',
    updated: 'Last updated August 15, 2025',
    intro: 'This Privacy Policy explains how Wrap Technologies collects, uses, and protects your personal information when you visit our website, use our products, or interact with our services. We are committed to transparency and protecting your privacy rights.',
    sections: [
      { h2: 'Introduction', body: 'Wrap Technologies, Inc. ("Wrap," "we," "us," or "our") is committed to protecting your privacy and ensuring the security of your personal information. This Privacy Policy explains how we collect, use, disclose, and safeguard your information when you visit our website at wrap.com, use our products and services, or interact with us in other ways.\n\nBy using our website or services, you acknowledge that you have read and understood this Privacy Policy and agree to the collection, use, and disclosure of your information as described herein.' },
      { h2: 'Information We Collect', h3: 'Personal Information You Provide', body: 'We collect information you voluntarily provide to us, including:', bullets: ['Contact Information: Name, email address, phone number, mailing address, job title, agency or company name', 'Account Information: Username, password, and other credentials when you create an account', 'Communication Data: Information you provide when contacting us, including support requests, feedback, and correspondence', 'Training Records: Certification data, training completion records, and performance metrics for WrapTactics users', 'Business Information: Agency details, procurement requirements, and operational needs shared during sales processes', 'Event Information: Registration details for webinars, training sessions, or conferences'] },
      { h3: 'Information Collected Automatically', body: 'When you use our website or services, we automatically collect:', bullets: ['Technical Information: IP address, browser type and version, operating system, device identifiers', 'Usage Data: Pages visited, time spent on pages, click-through rates, and navigation patterns', 'Performance Data: System performance metrics, error logs, and diagnostic information', 'Location Data: General geographic location based on IP address', 'Cookies and Tracking Technologies: Information collected through cookies, web beacons, and similar technologies'] },
      { h3: 'Information from Third Parties', body: 'We may receive information about you from:', bullets: ['Business Partners: Law enforcement agencies, distributors, and authorized resellers', 'Public Sources: Publicly available information about law enforcement agencies and personnel', 'Service Providers: Third-party platforms that integrate with our services', 'Professional Networks: Industry contacts and referrals'] },
      { h2: 'How We Use Your Information', h3: 'Core Business Operations', bullets: ['Providing and maintaining our products and services', 'Processing orders, payments, and fulfilling product deliveries', 'Managing customer accounts and providing technical support', 'Administering training programs and maintaining certification records', 'Facilitating communication between our team and customers'] },
      { h3: 'Marketing and Communications', bullets: ['Sending promotional materials about new products, services, and updates', 'Providing industry news, best practices, and educational content', 'Inviting you to events, webinars, and training opportunities', 'Conducting market research and gathering feedback on our services'] },
      { h3: 'Legal and Compliance', bullets: ['Complying with legal obligations and regulatory requirements', 'Protecting our rights, property, and safety, and that of our customers', 'Preventing fraud, unauthorized access, and other illegal activities', 'Enforcing our terms of service and other agreements'] },
      { h2: 'Legal Basis for Processing', body: 'The legal bases for our processing of Personal Information about you are as follows:', bullets: ['Contract: When you purchase a product from us, we collect Personal Information necessary for completing that transaction', 'Consent: We obtain your consent to collect personal information for distinct purposes. You have the right to withdraw your consent at any time', 'Legitimate Interest: We have a legitimate interest to collect personal information for analytics, security, and improving our services'] },
      { h2: 'Information Sharing and Disclosure', body: 'We may share your information in the following circumstances:', bullets: ['With Your Consent: When you have given us explicit consent', 'Service Providers: Trusted third parties who assist with payment processing, cloud hosting, CRM, analytics, and training delivery', 'Business Partners: Authorized distributors, technology integration partners, and training organizations', 'Legal Requirements: When required by law, subpoena, court order, or government investigation', 'Business Transfers: In connection with a merger, acquisition, or sale of assets'] },
      { h2: 'Data Security', body: 'We implement appropriate technical and organizational measures to protect your information against unauthorized access, alteration, disclosure, or destruction. Our security measures include:', bullets: ['Encryption: Data transmission and storage using industry-standard encryption protocols', 'Access Controls: Restricted access to personal information based on job responsibilities', 'Network Security: Firewalls, intrusion detection systems, and regular security monitoring', 'Employee Training: Regular security training for all personnel handling personal information', 'Regular Audits: Periodic security assessments and compliance reviews'] },
      { h2: 'Data Retention', body: 'We retain your information for as long as necessary to fulfill the purposes outlined in this Privacy Policy. Specific retention periods include:', bullets: ['Customer Records: Maintained for the duration of the business relationship plus 7 years', 'Training Records: Retained in accordance with law enforcement training requirements', 'Communication Records: Maintained for 3 years for customer service purposes', 'Technical Logs: Retained for 12 months for security and operational purposes', 'Marketing Data: Maintained until you opt out or request deletion'] },
      { h2: 'Your Rights and Choices', body: 'Depending on your location and applicable laws, you may have the following rights:', bullets: ['Access and Portability: Request access to the personal information we hold about you', 'Correction and Updates: Request correction of inaccurate or incomplete information', 'Deletion and Restriction: Request deletion of your personal information, subject to legal requirements', 'Opt-out of Sale: We do not sell your personal information', 'Objection and Withdrawal: Object to processing for marketing purposes or withdraw consent', 'Equal Service: Exercising your rights will not result in discrimination'] },
      { h2: 'Cookies and Tracking', body: 'Our website uses cookies and similar technologies. Types of cookies we use:', bullets: ['Essential Cookies: Required for basic website functionality, authentication, and security', 'Analytics Cookies: Help us understand how visitors use our website (Google Analytics, performance tools)', 'Marketing Cookies: Support conversion tracking, social media integration, and personalized content'] },
      { h2: 'International Data Transfers', body: 'Wrap Technologies is based in the United States, and we may transfer your information to countries outside your residence for processing and storage. When we transfer information internationally, we implement appropriate safeguards including standard contractual clauses and recognized privacy frameworks.' },
      { h2: "Children's Privacy", body: 'Our services are not directed to individuals under the age of 18, and we do not knowingly collect personal information from children. If we become aware that we have collected information from a child without parental consent, we will take steps to delete such information promptly.' },
      { h2: 'Changes to This Policy', body: 'We may update this Privacy Policy periodically. We will notify you of material changes by posting an updated policy on our website, sending email notifications to registered users, and providing notice through our services.' },
      { h2: 'Contact Information', body: 'If you have questions, concerns, or requests regarding this Privacy Policy:\n\nWrap Technologies, Inc.\nPrivacy Officer\n3350 Virginia Street\nMiami, FL 33133\n\nEmail: privacy@wrap.com\nPhone: 1.800.583.2652' },
    ],
  },
  terms: {
    title: 'Terms of Service',
    updated: 'Last updated August 15, 2025',
    intro: 'These Terms of Service govern your use of the WRAP Technologies website and all services provided through it. By accessing or using any part of our website or services, you agree to be bound by these terms in full.',
    notice: 'THIS DOCUMENT CONTAINS AN ARBITRATION PROVISION THAT MAY REQUIRE ARBITRATION ON AN INDIVIDUAL BASIS AND LIMITS THE TIME PERIOD AND MANNER IN WHICH YOU CAN SEEK RELIEF FROM US.',
    sections: [
      { h2: 'Acceptance of Terms', body: 'Welcome to wrap.com, the website of Wrap Technologies, Inc. ("Wrap," "we," "us," or "our"). These Terms of Service ("Terms") constitute a legally binding agreement between you and Wrap Technologies, Inc. and govern your access to and use of our website and services.\n\nBy using the Website or clicking to accept this Agreement, you accept and agree to be bound by these Terms. If you do not want to agree, you must not access or use the Website.' },
      { h2: 'Description of Services', body: 'Wrap Technologies provides innovative pre-escalation public safety solutions, including:', bullets: ['BolaWrap 150®: Non-harmful restraint device for law enforcement', 'WrapReality™: Virtual reality training system for tactical scenarios', 'WrapVision™: Body-worn camera and evidence management platform', 'WrapTactics™: Learning management system for law enforcement training', 'Product sales, training, certification programs, technical support, and consulting'] },
      { h2: 'Eligibility and Account Registration', body: 'To use our services, you must be at least 18 years of age, be employed by or affiliated with a law enforcement agency, military organization, or security company, and have the legal authority to enter into binding agreements.\n\nWhen creating an account, you agree to provide accurate and complete information, maintain and update your information as necessary, keep your login credentials secure and confidential, and notify us immediately of any unauthorized access.' },
      { h2: 'Acceptable Use Policy', h3: 'Prohibited Activities', body: 'You agree not to:', bullets: ['Post, transmit, or share illegal, harmful, or offensive content', 'Impersonate others or provide false information', 'Attempt to gain unauthorized access to our systems', 'Use automated tools to scrape, harvest, or collect information', 'Reverse engineer, decompile, or disassemble our software', 'Resell, redistribute, or commercialize our services without authorization', 'Use the Website for any purpose other than which it was intended'] },
      { h2: 'Intellectual Property Rights', body: 'All content, software, designs, text, graphics, logos, trademarks, and other materials on our website are owned by or licensed to Wrap Technologies and are protected by intellectual property laws. This includes WRAP®, BolaWrap®, WrapReality™, WrapVision™, and WrapTactics™ trademarks.\n\nWe grant you a limited, non-exclusive, non-transferable license to access and use our website for its intended purposes. This license does not permit you to modify, distribute, or create derivative works based on our intellectual property.' },
      { h2: 'User Submissions', body: 'Any User Submission is submitted voluntarily and is not confidential or proprietary. You hereby grant Wrap a worldwide, royalty-free, non-exclusive, transferable, perpetual license to use, distribute, reproduce, modify, and publish your User Submissions. You represent and warrant that you own all User Submissions or have all rights necessary to grant these rights.' },
      { h2: 'Product Sales and Orders', bullets: ['All orders are subject to acceptance by Wrap Technologies', 'Prices are subject to change without notice until order confirmation', 'We reserve the right to refuse or cancel orders at our discretion', 'Payment is due according to the terms specified in your order or agreement', 'Late payments may incur interest charges and collection costs', 'Shipping terms and costs are specified at the time of order'] },
      { h2: 'Disclaimers', body: 'YOUR USE OF THE WEBSITE IS AT YOUR OWN RISK. THE WEBSITE IS PROVIDED ON AN "AS IS" AND "AS AVAILABLE" BASIS, WITHOUT ANY WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED. TO THE FULLEST EXTENT PROVIDED BY LAW, WRAP HEREBY DISCLAIMS ALL WARRANTIES OF ANY KIND, WHETHER EXPRESS OR IMPLIED, STATUTORY, OR OTHERWISE, INCLUDING ANY WARRANTIES OF MERCHANTABILITY, NON-INFRINGEMENT, AND FITNESS FOR PARTICULAR PURPOSE.' },
      { h2: 'Limitation of Liability', body: 'TO THE FULLEST EXTENT PROVIDED BY LAW, IN NO EVENT WILL WRAP, ITS AFFILIATES, OR THEIR LICENSORS, SERVICE PROVIDERS, EMPLOYEES, AGENTS, OFFICERS, OR DIRECTORS BE LIABLE FOR ANY INDIRECT, SPECIAL, INCIDENTAL, CONSEQUENTIAL, OR PUNITIVE DAMAGES. THE AGGREGATE LIABILITY OF THE WRAP PARTIES TO YOU FOR ALL CLAIMS WILL NOT EXCEED $100 U.S. DOLLARS.' },
      { h2: 'Indemnification', body: 'You agree to defend, indemnify, and hold harmless Wrap Technologies, its officers, directors, employees, and agents from any claims, damages, losses, or expenses arising from your use of our website or services, your violation of these Terms, your infringement of third-party rights, or your negligent or wrongful conduct.' },
      { h2: 'Dispute Resolution', body: 'These Terms are governed by the laws of the State of Florida. Any disputes shall be submitted to final and binding arbitration under the Rules of Arbitration of the American Arbitration Association applying Florida law, seated in Miami, Florida. YOU AGREE TO ARBITRATE IN YOUR INDIVIDUAL CAPACITY ONLY — NOT AS A REPRESENTATIVE OR MEMBER OF A CLASS.\n\nAny cause of action arising out of or relating to this Agreement must be commenced within one year after the cause of action accrues.' },
      { h2: 'Contact Information', body: 'Wrap Technologies, Inc.\nLegal Department\n3350 Virginia Street\nMiami, FL 33133\n\nEmail: legal@wrap.com\nPhone: 1.800.583.2652\nBusiness Hours: Monday–Friday, 8:00 AM–5:00 PM EST' },
    ],
  },
  accessibility: {
    title: 'Accessibility Statement',
    updated: 'Last updated 2025',
    intro: 'Wrap Technologies is committed to ensuring digital accessibility for people with disabilities. We are continually improving the user experience for everyone and applying the relevant accessibility standards.',
    sections: [
      { h2: 'Our Commitment', body: 'Wrap Technologies is committed to making our website accessible to all users, including those with disabilities. We strive to meet the Web Content Accessibility Guidelines (WCAG) 2.1 Level AA standards to ensure our digital content is perceivable, operable, understandable, and robust.' },
      { h2: 'Measures Taken', body: 'We take the following measures to ensure accessibility of our website:', bullets: ['Include accessibility as part of our design and development process', 'Provide staff training on accessibility best practices', 'Conduct regular accessibility reviews and audits', 'Address accessibility issues in a timely manner', 'Use clear, simple language throughout our content'] },
      { h2: 'Technical Specifications', body: 'Our website is built using technologies designed to support accessibility, including:', bullets: ['HTML, CSS, and JavaScript conforming to established standards', 'ARIA (Accessible Rich Internet Applications) attributes where appropriate', 'Semantic HTML to convey structure and meaning', 'Sufficient color contrast for text and interactive elements', 'Keyboard navigation support throughout the site'] },
      { h2: 'Known Limitations', body: 'Despite our best efforts, some areas of our website may not yet fully meet accessibility standards. We are actively working to address these limitations and appreciate your patience as we continue to improve.' },
      { h2: 'Feedback and Contact', body: 'We welcome your feedback on the accessibility of our website. If you experience any accessibility barriers or have suggestions for improvement, please contact us:\n\nWrap Technologies, Inc.\n3350 Virginia Street\nMiami, FL 33133\n\nEmail: accessibility@wrap.com\nPhone: 1.800.583.2652\n\nWe aim to respond to accessibility feedback within 2 business days.' },
      { h2: 'Formal Complaints', body: 'If you are not satisfied with our response to your accessibility concern, you may contact the relevant supervisory authority in your jurisdiction. In the United States, you may file a complaint with the U.S. Department of Justice, Civil Rights Division.' },
    ],
  },
};

function LegalPage({ doc, navigate }) {
  const content = LEGAL_CONTENT[doc] || LEGAL_CONTENT.privacy;

  return (
    <main style={{ paddingTop: 72, background: 'var(--bg)', minHeight: '100vh' }}>
      {/* Header */}
      <section style={{ background: 'var(--bg)', borderBottom: '1px solid var(--border)', padding: '72px 48px 56px' }}>
        <div style={{ maxWidth: 900, margin: '0 auto' }}>
          <button onClick={() => navigate('home')} style={{ background: 'none', border: 'none', cursor: 'pointer', color: 'var(--text-muted)', fontSize: 13, fontFamily: 'DM Sans', padding: 0, marginBottom: 32 }}>← Back to Home</button>
          <div style={{ fontFamily: 'DM Sans', fontSize: 12, fontWeight: 600, letterSpacing: '0.14em', color: 'var(--accent)', textTransform: 'uppercase', marginBottom: 16 }}>Legal</div>
          <h1 style={{ fontFamily: 'Barlow Condensed', fontWeight: 900, fontSize: 'clamp(48px, 7vw, 88px)', textTransform: 'uppercase', color: 'var(--text)', lineHeight: 0.92, marginBottom: 20 }}>{content.title}</h1>
          <div style={{ fontSize: 13, color: 'var(--text-muted)', marginBottom: content.notice ? 24 : 0 }}>{content.updated}</div>
          {content.notice && (
            <div style={{ background: 'rgba(255,181,5,0.08)', border: '1px solid rgba(255,181,5,0.2)', borderRadius: 6, padding: '14px 18px', fontSize: 13, color: 'var(--text-sub)', lineHeight: 1.6, marginTop: 20 }}>
              <strong style={{ color: 'var(--accent)' }}>Important Notice:</strong> {content.notice}
            </div>
          )}
        </div>
      </section>

      {/* Body */}
      <section style={{ padding: '72px 48px 120px' }}>
        <div style={{ maxWidth: 900, margin: '0 auto', display: 'grid', gridTemplateColumns: '220px 1fr', gap: 64, alignItems: 'start' }}>

          {/* TOC sidebar */}
          <div style={{ position: 'sticky', top: 96 }}>
            <div style={{ fontSize: 11, fontWeight: 700, letterSpacing: '0.1em', textTransform: 'uppercase', color: 'var(--text-muted)', marginBottom: 16 }}>Contents</div>
            {content.sections.filter(s => s.h2).map((s, i) => (
              <div key={i} style={{ marginBottom: 10 }}>
                <a href={`#section-${i}`} style={{ fontSize: 13, color: 'var(--text-sub)', textDecoration: 'none', lineHeight: 1.5, display: 'block', transition: 'color 0.2s' }}
                  onMouseEnter={e => e.currentTarget.style.color = 'var(--accent)'}
                  onMouseLeave={e => e.currentTarget.style.color = 'var(--text-sub)'}
                >{s.h2}</a>
              </div>
            ))}

            {/* Switch between docs */}
            <div style={{ marginTop: 40, borderTop: '1px solid var(--border)', paddingTop: 24 }}>
              <div style={{ fontSize: 11, fontWeight: 700, letterSpacing: '0.1em', textTransform: 'uppercase', color: 'var(--text-muted)', marginBottom: 14 }}>Legal Documents</div>
              {[['privacy', 'Privacy Policy'], ['terms', 'Terms of Service'], ['accessibility', 'Accessibility Statement']].map(([key, label]) => (
                <button key={key} onClick={() => navigate('legal', key)} style={{
                  display: 'block', background: 'none', border: 'none', cursor: 'pointer', padding: '6px 0',
                  fontSize: 13, color: doc === key ? 'var(--accent)' : 'var(--text-sub)',
                  fontFamily: 'DM Sans', textAlign: 'left', width: '100%',
                  borderLeft: doc === key ? '2px solid var(--accent)' : '2px solid transparent',
                  paddingLeft: 12, transition: 'all 0.2s',
                }}>{label}</button>
              ))}
            </div>
          </div>

          {/* Main content */}
          <div>
            {content.intro && (
              <p style={{ fontSize: 17, lineHeight: 1.75, color: 'var(--text-sub)', marginBottom: 48, fontStyle: 'italic', borderLeft: '3px solid var(--accent)', paddingLeft: 20 }}>{content.intro}</p>
            )}

            {(() => {
              let sectionIdx = -1;
              return content.sections.map((s, i) => {
                if (s.h2) sectionIdx++;
                const anchorId = s.h2 ? `section-${sectionIdx}` : null;
                return (
                  <div key={i} style={{ marginBottom: s.h2 ? 48 : 24 }}>
                    {s.h2 && <h2 id={anchorId} style={{ fontFamily: 'Barlow Condensed', fontWeight: 800, fontSize: 32, textTransform: 'uppercase', color: 'var(--text)', marginBottom: s.h3 ? 8 : 16, letterSpacing: '0.01em', scrollMarginTop: 100 }}>{s.h2}</h2>}
                    {s.h3 && <h3 style={{ fontFamily: 'DM Sans', fontWeight: 600, fontSize: 16, color: 'var(--accent)', marginBottom: 12, marginTop: s.h2 ? 8 : 0 }}>{s.h3}</h3>}
                    {s.body && s.body.split('\n\n').map((para, pi) => (
                      <p key={pi} style={{ fontSize: 15, lineHeight: 1.8, color: 'var(--text-sub)', marginBottom: 14, whiteSpace: 'pre-line' }}>{para}</p>
                    ))}
                    {s.bullets && (
                      <ul style={{ listStyle: 'none', padding: 0, margin: '12px 0' }}>
                        {s.bullets.map((b, bi) => (
                          <li key={bi} style={{ display: 'flex', gap: 12, alignItems: 'flex-start', padding: '8px 0', borderBottom: '1px solid var(--border)' }}>
                            <span style={{ color: 'var(--accent)', fontWeight: 700, flexShrink: 0, marginTop: 2 }}>—</span>
                            <span style={{ fontSize: 14, lineHeight: 1.7, color: 'var(--text-sub)' }}>{b}</span>
                          </li>
                        ))}
                      </ul>
                    )}
                  </div>
                );
              });
            })()}

            <div style={{ marginTop: 64, padding: '32px', background: 'var(--card-bg)', border: '1px solid var(--border)', borderRadius: 8 }}>
              <div style={{ fontFamily: 'Barlow Condensed', fontWeight: 700, fontSize: 22, textTransform: 'uppercase', color: 'var(--text)', marginBottom: 12 }}>Questions?</div>
              <p style={{ fontSize: 14, color: 'var(--text-sub)', marginBottom: 20, lineHeight: 1.6 }}>Contact our team with any questions about these terms, our privacy practices, or accessibility.</p>
              <button onClick={() => navigate('contact')} style={{ background: 'var(--accent)', color: '#000', border: 'none', cursor: 'pointer', padding: '12px 28px', borderRadius: 4, fontFamily: 'DM Sans', fontWeight: 700, fontSize: 14 }}>Contact Us</button>
            </div>
          </div>
        </div>
      </section>

      <Footer navigate={navigate} />
    </main>
  );
}

Object.assign(window, { LegalPage });
