import { createFileRoute } from "@tanstack/react-router";
import { Header } from "@/components/site/Header";
import { Footer } from "@/components/site/Footer";
import { SignInModal, CartDrawer, CheckoutFlow } from "@/components/site/Modals";
import { useState } from "react";

export const Route = createFileRoute("/shipping")({
  head: () => ({
    meta: [{ title: "Shipping Info — SulejaMarket" }],
  }),
  component: ShippingPage,
});

function ShippingPage() {
  const [signInOpen, setSignInOpen] = useState(false);
  const [cartOpen, setCartOpen] = useState(false);
  const [checkoutOpen, setCheckoutOpen] = useState(false);

  return (
    <div className="min-h-screen bg-neutral-50 flex flex-col">
      <SignInModal open={signInOpen} onOpenChange={setSignInOpen} />
      <CartDrawer open={cartOpen} onOpenChange={setCartOpen} onCheckout={() => { setCartOpen(false); setCheckoutOpen(true); }} />
      <CheckoutFlow open={checkoutOpen} onOpenChange={setCheckoutOpen} />
      <Header onOpenCart={() => setCartOpen(true)} onOpenSignIn={() => setSignInOpen(true)} />
      
      <main className="flex-1 max-w-[800px] w-full mx-auto px-4 py-12">
        <h1 className="text-3xl font-bold mb-6 text-neutral-900">Shipping Information</h1>
        <div className="bg-white p-8 rounded-lg border prose max-w-none text-neutral-600">
          <p className="mb-4">Everything you need to know about getting your orders delivered.</p>
          <h2 className="text-xl font-semibold mt-6 mb-2 text-neutral-900">Delivery Timelines</h2>
          <ul className="list-disc pl-5 space-y-2 mb-4">
            <li><strong>Lagos & Abuja:</strong> 1-2 business days</li>
            <li><strong>Other Major Cities:</strong> 3-5 business days</li>
            <li><strong>Remote Areas:</strong> 5-7 business days</li>
          </ul>
          <h2 className="text-xl font-semibold mt-6 mb-2 text-neutral-900">Shipping Fees</h2>
          <p className="mb-4">Shipping fees vary depending on the size and weight of your order, as well as your delivery location. The exact shipping fee is calculated at checkout before payment.</p>
          <h2 className="text-xl font-semibold mt-6 mb-2 text-neutral-900">Order Tracking</h2>
          <p>You can easily track your order progress in real-time on our <a href="/track-order" className="text-orange-600 hover:underline">Track Order</a> page.</p>
        </div>
      </main>
      
      <Footer />
    </div>
  );
}
