import { createFileRoute } from "@tanstack/react-router";
import { AlertTriangle, Shield } from "lucide-react";

export const Route = createFileRoute("/terms")({
  head: () => ({
    meta: [
      { title: "Terms & Safety Disclaimer — SafeSight" },
      { name: "description", content: "SafeSight Terms of Service and Safety Disclaimer. SafeSight is a driver assistance tool only." },
      { property: "og:title", content: "Terms & Safety Disclaimer — SafeSight" },
      { property: "og:description", content: "SafeSight Terms of Service and Safety Disclaimer." },
      { property: "og:type", content: "website" },
      { property: "og:url", content: "/terms" },
    ],
    links: [{ rel: "canonical", href: "/terms" }],
  }),
  component: TermsPage,
});

function TermsPage() {
  return (
    <div className="flex min-h-screen flex-col">
      <section className="bg-navy py-16 sm:py-20">
        <div className="mx-auto max-w-7xl px-4 sm:px-6 lg:px-8">
          <div className="mx-auto max-w-3xl text-center">
            <h1 className="text-4xl font-extrabold tracking-tight text-navy-foreground sm:text-5xl">
              Terms & Safety Disclaimer
            </h1>
            <p className="mt-4 text-lg text-navy-foreground/80">
              Please read these terms carefully. SafeSight is a tool to help you drive more safely, but it is not a replacement for your own attention and judgment.
            </p>
          </div>
        </div>
      </section>

      {/* CRITICAL DISCLAIMER BANNER */}
      <section className="bg-accent/10 border-b border-accent/20 py-8">
        <div className="mx-auto max-w-3xl px-4 sm:px-6 lg:px-8">
          <div className="flex items-start gap-4 rounded-xl border border-accent/30 bg-accent/5 p-6">
            <AlertTriangle className="mt-1 h-8 w-8 shrink-0 text-accent" />
            <div>
              <h2 className="text-xl font-bold text-foreground">
                IMPORTANT SAFETY NOTICE
              </h2>
              <p className="mt-2 text-foreground">
                <strong>SafeSight is a driver assistance tool only.</strong> It does not prevent accidents and is not a substitute for attentive driving. Drivers remain fully responsible for vehicle operation and any accidents that may occur while using this app or at any other time.
              </p>
              <p className="mt-2 text-foreground">
                SafeSight is <strong>not liable</strong> for any damages, injuries, fatalities, or losses resulting from distracted driving, whether or not the app was active at the time of the incident.
              </p>
            </div>
          </div>
        </div>
      </section>

      <section className="bg-background py-16">
        <div className="mx-auto max-w-3xl px-4 sm:px-6 lg:px-8 space-y-10">
          <div>
            <h2 className="text-2xl font-bold text-foreground">1. Acceptance of Terms</h2>
            <p className="mt-3 text-muted-foreground">
              By downloading, installing, or using SafeSight, you agree to be bound by these Terms of Service and our Privacy Policy. If you do not agree to these terms, do not use the app.
            </p>
          </div>

          <div>
            <h2 className="text-2xl font-bold text-foreground">2. Driver Responsibility</h2>
            <p className="mt-3 text-muted-foreground">
              The user acknowledges and agrees that:
            </p>
            <ul className="mt-3 list-disc pl-5 space-y-2 text-muted-foreground">
              <li>They are solely responsible for the safe operation of their vehicle at all times.</li>
              <li>SafeSight is an assistive tool designed to provide notifications and awareness, not to control or guarantee safe driving.</li>
              <li>The presence of SafeSight does not excuse any negligent, reckless, or illegal driving behavior.</li>
              <li>They must comply with all local traffic laws, regulations, and ordinances while using the app.</li>
              <li>They must be able to handle distractions and maintain full control of their vehicle regardless of whether SafeSight is active.</li>
            </ul>
          </div>

          <div>
            <h2 className="text-2xl font-bold text-foreground">3. Limitation of Liability</h2>
            <p className="mt-3 text-muted-foreground">
              To the maximum extent permitted by applicable law, SafeSight and its developers, affiliates, officers, employees, and agents shall not be liable for any direct, indirect, incidental, special, consequential, or punitive damages, including but not limited to personal injury, property damage, loss of life, or emotional distress, arising out of or in connection with your use of or inability to use the app, even if advised of the possibility of such damages.
            </p>
          </div>

          <div>
            <h2 className="text-2xl font-bold text-foreground">4. No Warranty</h2>
            <p className="mt-3 text-muted-foreground">
              SafeSight is provided "as is" and "as available" without warranties of any kind, either express or implied, including but not limited to implied warranties of merchantability, fitness for a particular purpose, or non-infringement. We do not warrant that the app will be uninterrupted, error-free, or completely accurate in detecting distraction.
            </p>
          </div>

          <div>
            <h2 className="text-2xl font-bold text-foreground">5. Use of Camera</h2>
            <p className="mt-3 text-muted-foreground">
              SafeSight requires access to your device's camera to monitor driver focus. All processing is done on-device. By using the app, you consent to this camera access for the sole purpose of driver safety monitoring.
            </p>
          </div>

          <div>
            <h2 className="text-2xl font-bold text-foreground">6. Subscription & Payments</h2>
            <p className="mt-3 text-muted-foreground">
              Premium features require a subscription. Subscriptions are billed through Stripe and are subject to Stripe's terms. You may cancel anytime. No refunds are provided for partial billing periods unless required by law.
            </p>
          </div>

          <div>
            <h2 className="text-2xl font-bold text-foreground">7. Termination</h2>
            <p className="mt-3 text-muted-foreground">
              We reserve the right to terminate or suspend your access to SafeSight at any time, without notice, for conduct that we believe violates these terms or is harmful to other users or us.
            </p>
          </div>

          <div>
            <h2 className="text-2xl font-bold text-foreground">8. Governing Law</h2>
            <p className="mt-3 text-muted-foreground">
              These terms shall be governed by and construed in accordance with the laws of the State of Delaware, United States, without regard to its conflict of law provisions.
            </p>
          </div>

          <div>
            <h2 className="text-2xl font-bold text-foreground">9. Changes to Terms</h2>
            <p className="mt-3 text-muted-foreground">
              We may update these terms from time to time. Continued use of SafeSight after changes constitutes acceptance of the updated terms.
            </p>
          </div>

          <div>
            <h2 className="text-2xl font-bold text-foreground">10. Contact</h2>
            <p className="mt-3 text-muted-foreground">
              For questions about these terms, contact us at hello@safesight.app.
            </p>
          </div>

          <p className="text-sm text-muted-foreground pt-6 border-t border-border">
            Last updated: {new Date().toLocaleDateString("en-US", { year: "numeric", month: "long", day: "numeric" })}
          </p>
        </div>
      </section>
    </div>
  );
}
