/* global React, AylaRouter */

function LegalContact() {
  return (
    <div className="legal-contact">
      <p>Ayla Technologies Ltd., Level 3, Innovation One, DIFC, Dubai, United Arab Emirates</p>
      <p><a href="mailto:contact@ayla-wellness.com">contact@ayla-wellness.com</a></p>
    </div>
  );
}

function LegalDoc({ title, updated, children }) {
  return (
    <div className="page">
      <section className="shell">
        <article className="article legal-page">
          <h1>{title}</h1>
          <p className="legal-updated">Last Updated: {updated}</p>
          {children}
        </article>
      </section>
    </div>
  );
}

function Terms({ setRoute }) {
  return (
    <LegalDoc title="Terms of Service" updated="June 5, 2026">
      <p>Welcome to Ayla Wellness.</p>
      <p>
        These Terms of Service ("Terms") govern your use of the Ayla Wellness website, Cycle Guide, blog content, waitlist, newsletters, and related services operated by Ayla Technologies Ltd. ("Ayla Wellness", "Ayla", "we", "our", or "us").
      </p>

      <h2>About Ayla</h2>
      <p>
        Ayla is a wellness platform focused on providing educational content, resources, and tools related to women's health and wellbeing.
      </p>
      <p>
        Our website may include articles, guides, newsletters, waitlists, and information about current or future products and services.
      </p>

      <h2>Eligibility</h2>
      <p>
        You must be at least 16 years old to use our website or submit personal information through our services. By using Ayla, you confirm that you meet this requirement.
      </p>

      <h2>Educational Information Only</h2>
      <p>
        All content provided by Ayla, including our website, blog posts, newsletters, Cycle Guide, and other materials, is intended for educational and informational purposes only.
      </p>
      <p>
        Ayla does not provide medical advice, diagnosis, treatment, or healthcare services.
      </p>
      <p>
        Nothing on our website or in our communications should be considered a substitute for professional medical advice, diagnosis, or treatment. Always seek the advice of a qualified healthcare professional regarding any medical condition or health concern.
      </p>
      <p>
        Never disregard professional medical advice or delay seeking treatment because of information provided by Ayla.
      </p>

      <h2>Waitlist and Email Communications</h2>
      <p>
        By requesting the Cycle Guide or joining our waitlist, you agree to receive the materials you requested and occasional communications from Ayla regarding wellness resources, product updates, and launch announcements.
      </p>
      <p>
        Joining the waitlist does not guarantee access to any future product, feature, pricing, launch date, or availability.
      </p>
      <p>
        You may unsubscribe from marketing communications at any time using the unsubscribe link included in our emails.
      </p>

      <h2>Acceptable Use</h2>
      <p>You agree to use our website lawfully and respectfully.</p>
      <p>You may not:</p>
      <ul className="legal-list">
        <li>Use the website for any unlawful purpose</li>
        <li>Attempt to interfere with the operation or security of the website</li>
        <li>Attempt to gain unauthorized access to systems or data</li>
        <li>Scrape, harvest, or collect information from the website using automated methods without permission</li>
        <li>Copy, reproduce, distribute, sell, or commercially exploit our content without written permission</li>
        <li>Misrepresent your identity or provide false information when interacting with our services</li>
      </ul>

      <h2>Intellectual Property</h2>
      <p>
        All content available through Ayla, including our name, branding, logo, website design, text, graphics, blog content, guides, and other materials, is owned by Ayla Technologies Ltd. or its licensors and is protected by applicable intellectual property laws.
      </p>
      <p>
        You may access, view, download, and print materials solely for your personal, non-commercial use.
      </p>
      <p>
        No rights are granted to you except as expressly stated in these Terms.
      </p>

      <h2>Future Products and Features</h2>
      <p>
        Ayla is an evolving platform. We may add, modify, suspend, or discontinue any feature, content, product, or service at any time without prior notice.
      </p>
      <p>
        Any descriptions of future products or features are provided for informational purposes only and do not constitute a promise or guarantee that such products or features will be launched.
      </p>

      <h2>Third-Party Links</h2>
      <p>
        Our website may contain links to third-party websites, products, or services.
      </p>
      <p>
        We are not responsible for the content, accuracy, availability, or privacy practices of any third-party websites. Your use of third-party services is governed by their own terms and policies.
      </p>

      <h2>Disclaimer of Warranties</h2>
      <p>
        To the fullest extent permitted by law, the website, Cycle Guide, newsletters, blog content, and all other materials are provided on an "as is" and "as available" basis.
      </p>
      <p>
        We make no warranties or representations regarding the accuracy, completeness, reliability, availability, or suitability of any content for a particular purpose.
      </p>
      <p>
        Your use of the website and its content is at your own risk.
      </p>

      <h2>Limitation of Liability</h2>
      <p>
        To the fullest extent permitted by law, Ayla Technologies Ltd., its founders, employees, contractors, affiliates, and partners shall not be liable for any loss, injury, damage, claim, or expense arising from or related to:
      </p>
      <ul className="legal-list">
        <li>Your use of the website or its content;</li>
        <li>Your reliance on information provided by Ayla; or</li>
        <li>Any interruption, error, or unavailability of the website or services.</li>
      </ul>
      <p>
        Nothing in these Terms excludes or limits liability that cannot be excluded under applicable law.
      </p>

      <h2>Privacy</h2>
      <p>
        Your use of our services is also governed by our{' '}
        <a
          href={AylaRouter.pathFor('privacy')}
          onClick={(e) => { e.preventDefault(); setRoute && setRoute('privacy'); }}
        >Privacy Policy</a>, which explains how we collect, use, and protect your information.
      </p>

      <h2>Changes to These Terms</h2>
      <p>
        We may update these Terms from time to time.
      </p>
      <p>
        If we make material changes, we will update the "Last Updated" date at the top of this page. Continued use of the website after any changes become effective constitutes acceptance of the revised Terms.
      </p>

      <h2>Severability</h2>
      <p>
        If any provision of these Terms is found to be invalid or unenforceable, that provision will be limited or removed to the minimum extent necessary, and the remaining provisions will remain in full force and effect.
      </p>

      <h2>No Waiver</h2>
      <p>
        Our failure to enforce any right or provision of these Terms will not be considered a waiver of that right or provision. Any waiver must be in writing to be effective.
      </p>

      <h2>Entire Agreement</h2>
      <p>
        These Terms, together with our Privacy Policy, constitute the entire agreement between you and Ayla regarding your use of our website and services, and supersede any prior agreements or understandings.
      </p>

      <h2>Governing Law</h2>
      <p>
        These Terms shall be governed by and interpreted in accordance with the laws of the Dubai International Financial Centre (DIFC). The DIFC Courts shall have exclusive jurisdiction over any dispute arising out of or relating to these Terms, subject to any mandatory consumer protection rights that may apply under local law.
      </p>

      <h2>Contact Us</h2>
      <p>If you have any questions about these Terms, please contact:</p>
      <LegalContact />
    </LegalDoc>
  );
}

function Privacy({ setRoute }) {
  return (
    <LegalDoc title="Privacy Policy" updated="June 5, 2026">
      <p>
        At Ayla, we believe privacy should be simple, transparent, and respectful. This Privacy Policy explains how Ayla Technologies Ltd. ("Ayla Wellness", "Ayla", "we", "our", or "us") collects, uses, and protects information when you visit our website, request the Cycle Guide, join our waitlist, or interact with our services.
      </p>

      <h2>Who We Are</h2>
      <p>
        Ayla Technologies Ltd. operates the Ayla Wellness website and related wellness resources. We are the data controller responsible for the personal information described in this policy.
      </p>
      <LegalContact />
      <p>
        If you have any questions about this Privacy Policy or our privacy practices, please contact us at the details above.
      </p>

      <h2>Information We Collect</h2>
      <h3>Information You Provide</h3>
      <p>When you request the Cycle Guide or join the Ayla waitlist, we may collect:</p>
      <ul className="legal-list">
        <li>Your email address</li>
        <li>Optional wellness interests or preferences you choose to share, including topics such as cycle awareness, sleep, energy, mood, nutrition, hormonal symptoms, and fertility</li>
      </ul>
      <p>Providing these preferences is entirely optional.</p>

      <h3>Website Usage Information</h3>
      <p>Like most websites, we may automatically collect limited technical information, including:</p>
      <ul className="legal-list">
        <li>Browser type</li>
        <li>Device type</li>
        <li>Pages viewed</li>
        <li>Referring website</li>
        <li>General location information (such as country or region)</li>
        <li>Website performance and analytics data</li>
      </ul>
      <p>
        This information helps us understand how visitors use our website and improve the experience.
      </p>

      <h2>Cookies and Tracking Technologies</h2>
      <p>
        We use cookies and similar tracking technologies to operate our website, understand how it is used, and measure the performance of our marketing.
      </p>
      <p>The categories we use include:</p>
      <ul className="legal-list">
        <li>Essential cookies that are necessary for the website to function.</li>
        <li>Analytics cookies that help us understand how visitors interact with our website. [e.g., Google Analytics]</li>
        <li>Advertising and marketing technologies, such as tracking pixels, that help us measure and improve our campaigns and may share limited information with the relevant advertising platforms. [e.g., Meta Pixel, TikTok Pixel]</li>
      </ul>
      <p>
        Where required by law, we will ask for your consent before placing non-essential cookies or tracking technologies. You can withdraw your consent or adjust your cookie preferences at any time through our cookie banner or settings, and you can also control cookies through your browser settings.
      </p>

      <h2>How We Use Your Information</h2>
      <p>We use your information to:</p>
      <ul className="legal-list">
        <li>Deliver the Cycle Guide you requested</li>
        <li>Add you to the Ayla waitlist</li>
        <li>Send occasional emails about Ayla, new resources, product updates, and launch announcements</li>
        <li>Understand which wellness topics are most relevant to our community</li>
        <li>Improve our website, content, and future products</li>
        <li>Respond to inquiries and support requests</li>
        <li>Maintain website security and comply with legal obligations</li>
      </ul>
      <p>
        You may unsubscribe from marketing communications at any time by clicking the unsubscribe link included in our emails.
      </p>

      <h2>Legal Basis for Processing</h2>
      <p>
        Where data protection laws such as the DIFC Data Protection Law or the EU/UK General Data Protection Regulation apply to you, we rely on the following legal bases to process your information:
      </p>
      <ul className="legal-list">
        <li>Consent — to send you marketing emails, deliver the Cycle Guide, and place non-essential cookies. You may withdraw consent at any time.</li>
        <li>Legitimate interests — to understand how our website is used, improve our services, and keep our website secure, in a way that is balanced against your rights.</li>
        <li>Legal obligation — to comply with applicable laws, regulations, and lawful requests.</li>
      </ul>

      <h2>How We Share Information</h2>
      <p>
        We do not sell or rent your personal information, and we do not share it with data brokers or other third parties for their own independent marketing purposes.
      </p>
      <p>We may share information in the following limited circumstances:</p>
      <p>
        <b>Service providers.</b> We work with trusted providers who help us operate our website, email communications, analytics, advertising measurement, and hosting. These providers are only permitted to process information on our behalf and are required to protect it appropriately.
      </p>
      <p>
        <b>Advertising and analytics platforms.</b> As described in Cookies and Tracking Technologies, our use of analytics and advertising pixels may involve limited information being shared with those platforms, subject to your consent where required.
      </p>
      <p>
        <b>Legal and protective reasons.</b> We may disclose information if required by law or when necessary to protect our rights, our users, or our services.
      </p>

      <h2>International Data Transfers</h2>
      <p>
        Ayla Technologies Ltd. is based in the Dubai International Financial Centre (DIFC) and serves users in multiple countries. Some of our service providers, such as email, analytics, and hosting providers, are located outside the DIFC and outside your country, including in the United States.
      </p>
      <p>
        When we transfer personal information across borders, we protect it in line with applicable data protection laws. Where data is transferred to a jurisdiction that is not recognized as providing an adequate level of protection, we rely on appropriate safeguards, such as standard contractual clauses, to keep your information protected.
      </p>

      <h2>Health and Wellness Information</h2>
      <p>
        The Cycle Guide and all content provided by Ayla are intended for educational and informational purposes only and do not constitute medical advice.
      </p>
      <p>
        At this stage, Ayla does not collect medical records, diagnostic information, or clinical health data through the Cycle Guide signup form. Please do not submit sensitive medical information through general website forms or email.
      </p>
      <p>
        If we introduce health-tracking, symptom-tracking, or personalized wellness features in the future — including in our mobile app — we will provide additional privacy disclosures before collecting any such information.
      </p>

      <h2>Data Retention</h2>
      <p>We retain personal information only for as long as reasonably necessary to:</p>
      <ul className="legal-list">
        <li>Provide the services you request</li>
        <li>Communicate with you about Ayla and maintain our waitlist</li>
        <li>Meet legal, regulatory, or security requirements</li>
      </ul>
      <p>
        In practice, we keep waitlist and newsletter information until you unsubscribe or ask us to delete it, or until it is no longer needed for the purposes above. You may request deletion of your information at any time by contacting us.
      </p>

      <h2>Data Security</h2>
      <p>
        We use reasonable administrative, technical, and organizational measures designed to protect your information from unauthorized access, disclosure, alteration, or loss.
      </p>
      <p>
        However, no method of transmitting or storing information online can be guaranteed to be completely secure, and we cannot guarantee absolute security.
      </p>

      <h2>Your Rights</h2>
      <p>Depending on your location, you may have rights to:</p>
      <ul className="legal-list">
        <li>Access the personal information we hold about you</li>
        <li>Correct inaccurate information</li>
        <li>Request deletion of your information</li>
        <li>Object to or restrict certain uses of your information</li>
        <li>Withdraw consent for marketing communications or cookies at any time</li>
        <li>Request a copy of your information in a portable format</li>
      </ul>
      <p>
        To exercise any of these rights, contact us at{' '}
        <a href="mailto:contact@ayla-wellness.com">contact@ayla-wellness.com</a>.
      </p>

      <h2>Marketing Communications</h2>
      <p>
        We send marketing and update emails only to people who have asked to receive them, such as by joining our waitlist or requesting the Cycle Guide. Every marketing email identifies Ayla as the sender and includes a clear unsubscribe link. You can opt out at any time, and we will stop sending you marketing communications.
      </p>

      <h2>Business Transfers</h2>
      <p>
        If Ayla is involved in a merger, acquisition, financing, reorganization, or sale of assets, your information may be transferred as part of that transaction. We will take reasonable steps to ensure your information remains protected and will notify you of any material change to how your information is handled.
      </p>

      <h2>Children's Privacy</h2>
      <p>
        Ayla is intended for individuals aged 16 and older. We do not knowingly collect personal information from children under the age of 16. If we become aware that we have collected such information, we will take steps to delete it.
      </p>

      <h2>Changes to This Policy</h2>
      <p>
        We may update this Privacy Policy from time to time. Any updates will be posted on this page, and the "Last Updated" date will be revised accordingly.
      </p>

      <h2>Contact Us</h2>
      <p>If you have any questions about this Privacy Policy or how we handle your information, please contact:</p>
      <LegalContact />
    </LegalDoc>
  );
}

Object.assign(window, { Privacy, Terms });
