import React from 'react';
import { motion, AnimatePresence } from 'motion/react';
import { X, ShieldCheck, Layers, Gift, CheckCircle2, HeartHandshake } from 'lucide-react';
import { Badge } from '../ui/Badge';
import { Button } from '../ui/Button';

interface VisionManifestoModalProps {
  isOpen: boolean;
  onClose: () => void;
  onOpenWaitlist: () => void;
}

export const VisionManifestoModal: React.FC<VisionManifestoModalProps> = ({
  isOpen,
  onClose,
  onOpenWaitlist
}) => {
  if (!isOpen) return null;

  return (
    <AnimatePresence>
      <div className="fixed inset-0 z-50 flex items-center justify-center p-4 sm:p-6 overflow-y-auto">
        {/* Backdrop */}
        <motion.div
          initial={{ opacity: 0 }}
          animate={{ opacity: 1 }}
          exit={{ opacity: 0 }}
          onClick={onClose}
          className="fixed inset-0 bg-slate-950/85 backdrop-blur-xl"
        />

        {/* Modal Window */}
        <motion.div
          initial={{ opacity: 0, scale: 0.95, y: 20 }}
          animate={{ opacity: 1, scale: 1, y: 0 }}
          exit={{ opacity: 0, scale: 0.95, y: 20 }}
          className="relative w-full max-w-3xl bg-slate-900 border border-slate-800 rounded-3xl p-6 sm:p-10 shadow-2xl z-10 max-h-[90vh] overflow-y-auto"
        >
          <button
            onClick={onClose}
            className="absolute top-6 right-6 p-2 rounded-xl bg-slate-800 text-slate-400 hover:text-white transition-colors"
          >
            <X className="w-5 h-5" />
          </button>

          <div className="flex items-center gap-3 mb-4">
            <Badge variant="tangerine">Official Declaration</Badge>
            <span className="text-xs font-mono text-slate-400">Public Document #001</span>
          </div>

          <h2 className="text-2xl sm:text-3xl font-extrabold text-white">
            The BM Connect Founder Manifesto
          </h2>
          <p className="text-xs text-orange-400 font-mono mt-1">
            Why we are funding software through a community token instead of Venture Capital.
          </p>

          <div className="mt-6 space-y-4 text-sm text-slate-300 leading-relaxed border-t border-slate-800 pt-6 font-normal">
            <p>
              In 2024, we built <strong>BirthdayMessaging.io</strong>. It was a simple, elegant idea: automate meaningful personal messages so people never miss key milestones in the lives of their clients and loved ones. It grew organically to serve over 85,000 active users.
            </p>
            <p>
              From that single product grew an ecosystem of <strong>30+ digital micro-SaaS applications</strong> covering encrypted routing, workflow automation, and live telemetry.
            </p>
            <p>
              When it came time to scale this ecosystem into <strong>BM Connect</strong>, traditional venture capital firms offered millions in exchange for board seats, liquidation preferences, and exit timelines. We turned them down.
            </p>
            <p className="p-4 rounded-xl bg-slate-950 border border-orange-500/30 text-white font-medium italic">
              "When VCs fund software, the investor becomes the customer and the user becomes the product. By funding BM Connect through a fair community token, our incentives remain 100% aligned with our software users."
            </p>
            <h4 className="text-base font-bold text-white pt-2">Our Irrevocable Pledges:</h4>
            <ul className="space-y-2 text-xs text-slate-300 font-mono">
              <li className="flex items-center gap-2">
                <CheckCircle2 className="w-4 h-4 text-sky-400" /> 1. Real revenue-generating software always precedes token launches.
              </li>
              <li className="flex items-center gap-2">
                <CheckCircle2 className="w-4 h-4 text-sky-400" /> 2. Zero VC allocations, zero secret discount presales.
              </li>
              <li className="flex items-center gap-2">
                <CheckCircle2 className="w-4 h-4 text-sky-400" /> 3. Multi-sig treasury contracts audited and visible on-chain 24/7.
              </li>
              <li className="flex items-center gap-2">
                <CheckCircle2 className="w-4 h-4 text-sky-400" /> 4. Software subscription profits automatically buy back $SX tokens.
              </li>
            </ul>
          </div>

          <div className="mt-8 pt-6 border-t border-slate-800 flex flex-col sm:flex-row items-center justify-between gap-4">
            <div className="flex items-center gap-3">
              <div className="w-10 h-10 rounded-full bg-gradient-to-tr from-orange-500 via-amber-500 to-sky-500 flex items-center justify-center text-white font-bold text-xs">
                SX
              </div>
              <div className="text-left">
                <p className="text-xs font-bold text-white">BM Connect Core Engineering Team</p>
                <p className="text-[11px] text-slate-400 font-mono">Creators of BirthdayMessaging.io</p>
              </div>
            </div>

            <Button
              variant="glow"
              size="md"
              onClick={() => {
                onClose();
                onOpenWaitlist();
              }}
            >
              Join Early Access Waitlist
            </Button>
          </div>
        </motion.div>
      </div>
    </AnimatePresence>
  );
};
