import { PublicNavbar } from "@/components/public/navbar";
import { PublicFooter } from "@/components/public/footer";
import { Scale, ShieldAlert, FileCheck, CheckCircle2, AlertTriangle, HelpCircle } from "lucide-react";
import Link from "next/link";

export const metadata = {
  title: "Terms of Service | Nigeria Listing",
  description: "Official legal terms, user obligations, property listing guidelines, and subscription billing terms governing the Nigeria Listing real estate marketplace.",
};

export default function TermsOfServicePage() {
  const lastUpdated = "August 28, 2026";

  return (
    <div className="min-h-screen flex flex-col bg-[#fdfdf7] dark:bg-[#0f1115] text-foreground transition-colors selection:bg-primary/20">
      <PublicNavbar />

      <main className="flex-1 max-w-5xl mx-auto w-full px-4 sm:px-6 lg:px-8 py-10 sm:py-16 space-y-12">
        {/* Header Banner */}
        <div className="space-y-4 text-center sm:text-left border-b border-border/80 pb-8">
          <div className="inline-flex items-center gap-2 px-3 py-1 rounded-full bg-primary/10 text-primary text-xs font-semibold">
            <Scale className="size-4" />
            <span>Commercial Marketplace Agreement</span>
          </div>
          <h1 className="text-3xl sm:text-4xl lg:text-5xl font-extrabold tracking-tight text-foreground">
            Terms of Service
          </h1>
          <p className="text-sm sm:text-base text-muted-foreground max-w-3xl leading-relaxed">
            These Terms of Service (&quot;Terms&quot;) constitute a legally binding agreement between you and Nigeria Listing (&quot;we&quot;, &quot;us&quot;), governing your access to and use of our website, listing tools, KYC accreditation systems, and client inquiry features.
          </p>
          <div className="flex flex-wrap items-center gap-4 text-xs text-muted-foreground pt-2">
            <span>Last Updated: <strong className="text-foreground">{lastUpdated}</strong></span>
            <span>·</span>
            <span>Applicable Law: <strong>Federal Republic of Nigeria</strong></span>
            <span>·</span>
            <span>Regulatory Oversight: <strong>LASRERA / CAC</strong></span>
          </div>
        </div>

        {/* Quick Rule Cards */}
        <div className="grid grid-cols-1 sm:grid-cols-3 gap-4">
          <div className="p-5 rounded-2xl border border-border bg-card shadow-xs space-y-2">
            <div className="size-9 rounded-xl bg-amber-500/10 text-amber-600 dark:text-amber-400 flex items-center justify-center">
              <ShieldAlert className="size-4" />
            </div>
            <h2 className="font-bold text-sm text-foreground">Mandated Listings Only</h2>
            <p className="text-xs text-muted-foreground leading-relaxed">
              You must possess a valid, written vendor mandate or legal ownership title before advertising any property on Nigeria Listing.
            </p>
          </div>

          <div className="p-5 rounded-2xl border border-border bg-card shadow-xs space-y-2">
            <div className="size-9 rounded-xl bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 flex items-center justify-center">
              <FileCheck className="size-4" />
            </div>
            <h2 className="font-bold text-sm text-foreground">Accredited Realtor KYC</h2>
            <p className="text-xs text-muted-foreground leading-relaxed">
              Realtors claiming verified status must undergo Government NIN verification and provide official accreditation (LASRERA, ERCAAN, or NIESV).
            </p>
          </div>

          <div className="p-5 rounded-2xl border border-border bg-card shadow-xs space-y-2">
            <div className="size-9 rounded-xl bg-rose-500/10 text-rose-600 dark:text-rose-400 flex items-center justify-center">
              <AlertTriangle className="size-4" />
            </div>
            <h2 className="font-bold text-sm text-foreground">Zero Tolerance for Fraud</h2>
            <p className="text-xs text-muted-foreground leading-relaxed">
              Forged land titles (C of O, Gazette), bait-and-switch pricing, or fake agency claims result in instant blacklisting and referral to law enforcement.
            </p>
          </div>
        </div>

        {/* Legal Terms Content */}
        <div className="prose prose-zinc dark:prose-invert max-w-none space-y-10 text-sm sm:text-base leading-relaxed text-foreground/90">
          
          {/* Section 1 */}
          <section className="space-y-3">
            <h2 className="text-xl sm:text-2xl font-bold tracking-tight text-foreground border-b border-border/60 pb-2">
              1. Acceptance &amp; Eligibility
            </h2>
            <p>
              By accessing, browsing, registering for an account, or listing properties on Nigeria Listing, you represent and warrant that you are at least 18 years of age, legally competent to enter into binding contracts, and fully authorized to act on behalf of any entity you represent.
            </p>
            <p>
              If you do not agree with any provision of these Terms, you must immediately cease all use of Nigeria Listing.
            </p>
          </section>

          {/* Section 2 */}
          <section className="space-y-3">
            <h2 className="text-xl sm:text-2xl font-bold tracking-tight text-foreground border-b border-border/60 pb-2">
              2. Marketplace Intermediary Role
            </h2>
            <p>
              <strong>Nigeria Listing functions strictly as an architectural marketing and listing platform.</strong> Unless explicitly designated under a managed service agreement:
            </p>
            <ul className="list-disc list-inside space-y-1.5 text-muted-foreground">
              <li>We do not own, sell, purchase, lease, or broker the properties listed on the marketplace by third-party agents, agencies, or owners.</li>
              <li>We do not inspect properties on behalf of buyers, nor do we act as property conveyancers or legal title insurers.</li>
              <li>All contracts for sale, lease, or tenancy are negotiated and executed directly between the respective property seeker and the advertiser.</li>
              <li>Buyers and tenants are strongly advised to conduct independent title investigations at the relevant State Land Registry (e.g., Lagos State Lands Bureau, Alausa) prior to committing financial deposits.</li>
            </ul>
          </section>

          {/* Section 3 */}
          <section className="space-y-3">
            <h2 className="text-xl sm:text-2xl font-bold tracking-tight text-foreground border-b border-border/60 pb-2">
              3. Listing Standards &amp; Prohibited Conduct
            </h2>
            <p>Users publishing property advertisements must adhere to the following mandatory standards:</p>
            
            <div className="space-y-3 pl-2">
              <div className="flex items-start gap-2 text-sm text-foreground">
                <CheckCircle2 className="size-4 text-emerald-600 mt-0.5 shrink-0" />
                <span><strong>Accurate Information:</strong> Asking price, location, square meters, bedrooms, and amenities must reflect the true state of the property.</span>
              </div>
              <div className="flex items-start gap-2 text-sm text-foreground">
                <CheckCircle2 className="size-4 text-emerald-600 mt-0.5 shrink-0" />
                <span><strong>Valid Mandate:</strong> You must have written consent or agency mandate from the legal titleholder to advertise the property.</span>
              </div>
              <div className="flex items-start gap-2 text-sm text-foreground">
                <CheckCircle2 className="size-4 text-emerald-600 mt-0.5 shrink-0" />
                <span><strong>Truthful Title Disclosures:</strong> Claiming a property holds a &quot;Governor&apos;s Consent&quot; or &quot;C of O&quot; when it only has an unregistered survey or excision in process is strictly prohibited.</span>
              </div>
              <div className="flex items-start gap-2 text-sm text-foreground">
                <CheckCircle2 className="size-4 text-emerald-600 mt-0.5 shrink-0" />
                <span><strong>No Duplicate Spamming:</strong> Repetitive reposting of the exact same property unit to manipulate search visibility will result in listing rejection.</span>
              </div>
            </div>
          </section>

          {/* Section 4 */}
          <section className="space-y-3">
            <h2 className="text-xl sm:text-2xl font-bold tracking-tight text-foreground border-b border-border/60 pb-2">
              4. Realtor KYC &amp; Regulatory Vetting
            </h2>
            <p>
              To maintain Nigeria&apos;s premier high-trust property environment, realtors and brokerage agencies apply for verified status through our KYC Moderation Desk:
            </p>
            <ul className="list-disc list-inside space-y-1.5 text-muted-foreground">
              <li>Agents must provide accurate National Identity Numbers (NIN) verified against the NIMC database.</li>
              <li>Realtors operating within Lagos State are expected to hold valid registration under the <strong>Lagos State Real Estate Regulatory Authority (LASRERA) Law 2022</strong>.</li>
              <li>Corporate agencies must provide verifiable Corporate Affairs Commission (CAC) RC numbers and Tax Identification Numbers (TIN).</li>
              <li>Submission of altered, expired, or counterfeit accreditation documents will result in permanent platform ban and formal notification to the Nigerian Police Force (Special Fraud Unit) and EFCC.</li>
            </ul>
          </section>

          {/* Section 5 */}
          <section className="space-y-3">
            <h2 className="text-xl sm:text-2xl font-bold tracking-tight text-foreground border-b border-border/60 pb-2">
              5. Subscriptions, Fees &amp; Billing
            </h2>
            <p>
              Nigeria Listing offers both free starter tiers and premium subscription tiers (Agent Pro at ₦15,000/month or ₦150,000/year; Agency Growth at ₦50,000/month or ₦500,000/year).
            </p>
            <ul className="list-disc list-inside space-y-1.5 text-muted-foreground">
              <li><strong>Billing Cycle:</strong> Subscriptions are billed in advance via secure payment channels and will recur automatically unless cancelled prior to the renewal date.</li>
              <li><strong>Currency:</strong> All fees are stated and charged in Nigerian Naira (NGN) inclusive of applicable statutory value-added taxes (VAT).</li>
              <li><strong>Refund Policy:</strong> Due to immediate activation of digital listing quotas, verified badges, and search priority, subscription fees are generally non-refundable once an active billing cycle commences.</li>
              <li><strong>Plan Adjustments:</strong> Nigeria Listing reserves the right to modify subscription pricing upon 30 days written notice to active subscribers.</li>
            </ul>
          </section>

          {/* Section 6 */}
          <section className="space-y-3">
            <h2 className="text-xl sm:text-2xl font-bold tracking-tight text-foreground border-b border-border/60 pb-2">
              6. Inspection Protocol &amp; User Safety
            </h2>
            <p>
              When arranging site viewings or physical inspections:
            </p>
            <ul className="list-disc list-inside space-y-1.5 text-muted-foreground">
              <li>Users assume all responsibility for their personal safety during off-platform property visits.</li>
              <li>Inspections should occur during daylight hours in public or accompanied settings.</li>
              <li><strong>Nigeria Listing will NEVER ask buyers to pay caution fees or booking deposits into personal bank accounts prior to physical inspection.</strong> Any agent demanding such upfront fees should be reported immediately.</li>
            </ul>
          </section>

          {/* Section 7 */}
          <section className="space-y-3">
            <h2 className="text-xl sm:text-2xl font-bold tracking-tight text-foreground border-b border-border/60 pb-2">
              7. Intellectual Property &amp; Media Rights
            </h2>
            <p>
              By uploading architectural imagery, floor plans, and video tours to Nigeria Listing, you grant us a worldwide, non-exclusive, royalty-free license to display, resize, optimize, and distribute such media for platform promotion, search syndication, and social media showcase. You represent that you hold full copyright or licensing rights to all uploaded photographs.
            </p>
          </section>

          {/* Section 8 */}
          <section className="space-y-3">
            <h2 className="text-xl sm:text-2xl font-bold tracking-tight text-foreground border-b border-border/60 pb-2">
              8. Limitation of Liability &amp; Indemnity
            </h2>
            <p>
              To the maximum extent permitted by Nigerian law, Nigeria Listing, its directors, employees, and affiliates shall not be liable for any indirect, incidental, punitive, or consequential damages resulting from property transaction disputes, title defects, misrepresentations by third-party advertisers, or site downtime.
            </p>
            <p>
              You agree to indemnify and hold harmless Nigeria Listing against any claims, losses, or legal expenses arising from your violation of these Terms or third-party property rights.
            </p>
          </section>

          {/* Section 9 */}
          <section className="space-y-3">
            <h2 className="text-xl sm:text-2xl font-bold tracking-tight text-foreground border-b border-border/60 pb-2">
              9. Governing Law &amp; Dispute Resolution
            </h2>
            <p>
              These Terms are governed by and construed in accordance with the <strong>Laws of the Federal Republic of Nigeria</strong>.
            </p>
            <p>
              In the event of any controversy, claim, or dispute arising out of or relating to these Terms, the parties shall first attempt to resolve the dispute amicably through good-faith mediation administered by the <strong>Lagos State Multi-Door Courthouse (LMDC)</strong>. If mediation is unsuccessful within 30 days, disputes shall be submitted to the exclusive jurisdiction of the state or federal courts located in Lagos State, Nigeria.
            </p>
          </section>

          {/* Section 10 */}
          <section className="space-y-3">
            <h2 className="text-xl sm:text-2xl font-bold tracking-tight text-foreground border-b border-border/60 pb-2">
              10. Legal Contact Information
            </h2>
            <p>For legal inquiries, formal notices, or copyright takedown requests, contact our Legal Affairs Division:</p>
            <div className="p-4 rounded-xl border border-border bg-card/60 text-sm space-y-1 text-muted-foreground">
              <p><strong className="text-foreground">Legal &amp; Compliance Directorate:</strong> <a href="mailto:legal@nigerialisting.com" className="text-primary hover:underline">legal@nigerialisting.com</a></p>
              <p><strong className="text-foreground">Corporate Counsel:</strong> Nigeria Listing Legal Counsel</p>
              <p><strong className="text-foreground">Head Office:</strong> Plot 14, Admiralty Way, Lekki Phase 1, Lagos, Nigeria</p>
            </div>
          </section>
        </div>

        {/* Bottom Navigation */}
        <div className="pt-8 border-t border-border flex flex-wrap items-center justify-between gap-4">
          <div className="flex items-center gap-4 text-xs font-medium">
            <Link href="/privacy" className="text-primary hover:underline">
              Privacy Policy →
            </Link>
            <Link href="/trust-and-safety" className="text-primary hover:underline">
              Trust &amp; Safety Guide →
            </Link>
            <Link href="/help" className="text-primary hover:underline">
              Help Center →
            </Link>
          </div>
          <Link href="/dashboard" className="text-xs text-muted-foreground hover:text-foreground">
            Return to Dashboard
          </Link>
        </div>
      </main>

      <PublicFooter />
    </div>
  );
}
