"use client";

import React, { useState, useEffect } from 'react';
import {
    BookOpen,
    Feather,
    Globe,
    Gem,
    ArrowRight,
    Menu,
    X,
    Palette,
    History,
    Languages,
    Crown,
    Scroll
} from 'lucide-react';

// --- Components ---

const Button = ({
    children,
    variant = 'primary',
    href,
    className = '',
    ...props
}: {
    children: React.ReactNode;
    variant?: 'primary' | 'secondary' | 'outline';
    href?: string;
    className?: string;
    [key: string]: any;
}) => {
    const baseStyles = "inline-flex items-center justify-center px-8 py-4 rounded-sm font-serif tracking-widest uppercase text-sm transition-all duration-500 focus:outline-none focus:ring-2 focus:ring-offset-2";

    const variants = {
        primary: "bg-gradient-to-r from-amber-600 to-yellow-600 hover:from-amber-700 hover:to-yellow-700 text-white focus:ring-amber-500 shadow-xl shadow-amber-900/20 border border-amber-400/20",
        secondary: "bg-slate-900 hover:bg-slate-800 text-amber-50 focus:ring-slate-500 border border-slate-700",
        outline: "border border-amber-600/50 hover:border-amber-500 hover:bg-amber-600/10 text-amber-600 bg-transparent"
    };

    const combinedClasses = `${baseStyles} ${variants[variant]} ${className}`;

    if (href) {
        return (
            <a
                href={href}
                target="_blank"
                rel="noopener noreferrer"
                className={combinedClasses}
                {...props}
            >
                {children}
            </a>
        );
    }

    return (
        <button className={combinedClasses} {...props}>
            {children}
        </button>
    );
};

const FeatureCard = ({ icon: Icon, title, description }: { icon: any, title: string, description: string }) => (
    <div className="bg-slate-50 p-10 border border-amber-100 hover:border-amber-400 transition-all duration-500 hover:shadow-2xl group relative overflow-hidden">
        <div className="absolute top-0 right-0 p-4 opacity-10 group-hover:opacity-20 transition-opacity">
            <Icon size={80} className="text-amber-900" />
        </div>
        <div className="w-12 h-12 border border-amber-600 rounded-full flex items-center justify-center mb-6 group-hover:bg-amber-600 transition-colors">
            <Icon className="w-5 h-5 text-amber-700 group-hover:text-white transition-colors" />
        </div>
        <h3 className="text-xl font-serif font-bold text-slate-900 mb-4 tracking-wide">{title}</h3>
        <p className="text-slate-600 leading-relaxed font-light">{description}</p>
    </div>
);

const StatItem = ({ value, label }: { value: string, label: string }) => (
    <div className="text-center p-6 border-r border-slate-200 last:border-0">
        <div className="text-3xl md:text-4xl font-serif text-amber-700 mb-2">{value}</div>
        <div className="text-xs font-bold text-slate-400 uppercase tracking-[0.2em]">{label}</div>
    </div>
);

// --- Main App Component ---

export default function App() {
    const [isScrolled, setIsScrolled] = useState(false);
    const [isMobileMenuOpen, setIsMobileMenuOpen] = useState(false);

    // External booking link
    const BOOKING_URL = "https://calendly.com/";

    useEffect(() => {
        const handleScroll = () => {
            setIsScrolled(window.scrollY > 20);
        };
        window.addEventListener('scroll', handleScroll);
        return () => window.removeEventListener('scroll', handleScroll);
    }, []);

    const navLinks = [
        { name: 'The Craft', href: '#craft' },
        { name: 'Heritage', href: '#heritage' },
        { name: 'Content', href: '#content' },
        { name: 'Acquire', href: '#acquire' },
    ];

    return (
        <div className="min-h-screen bg-[#FDFBF7] font-sans text-slate-900 selection:bg-amber-200 selection:text-amber-900">

            {/* Hero Section */}
            <section className="relative min-h-screen flex items-center bg-slate-900 overflow-hidden">
                {/* Abstract Background - Gold Dust Effect */}
                <div className="absolute inset-0 bg-[url('https://www.transparenttextures.com/patterns/stardust.png')] opacity-20"></div>
                <div className="absolute inset-0 bg-gradient-to-b from-slate-900 via-slate-900/90 to-amber-900/20"></div>

                {/* Animated Orbs */}
                <div className="absolute top-1/4 right-0 w-[600px] h-[600px] bg-amber-600/20 rounded-full blur-[100px] animate-pulse"></div>
                <div className="absolute bottom-0 left-0 w-[400px] h-[400px] bg-yellow-600/10 rounded-full blur-[80px]"></div>

                <div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 relative z-10 pt-20">
                    <div className="grid lg:grid-cols-12 gap-12 items-center">
                        <div className="lg:col-span-7">
                            <div className="inline-flex items-center space-x-3 px-4 py-2 border border-amber-500/30 bg-amber-900/20 backdrop-blur-sm text-amber-400 text-xs font-bold uppercase tracking-[0.2em] mb-8">
                                <Crown size={14} />
                                <span>The World's Most Expensive Magazine</span>
                            </div>

                            <h1 className="text-5xl lg:text-7xl font-serif text-white leading-tight mb-6">
                                History Etched in <br />
                                <span className="text-transparent bg-clip-text bg-gradient-to-r from-amber-200 via-yellow-400 to-amber-600">
                                    Golden Palm Leaves
                                </span>
                            </h1>

                            <p className="text-lg text-slate-300 mb-8 max-w-xl leading-relaxed font-light border-l-2 border-amber-600 pl-6">
                                A ₹11,00,000 masterpiece blending <strong>Odisha's Pattachitra</strong> heritage with modern Business, Entertainment, and Social narratives. Available in limited editions across multiple languages.
                            </p>

                            <div className="flex flex-col sm:flex-row gap-6">
                                <Button href={BOOKING_URL} className="group min-w-[200px]">
                                    Inquire Now
                                    <ArrowRight className="ml-2 w-4 h-4 group-hover:translate-x-1 transition-transform" />
                                </Button>
                                <div className="flex items-center space-x-4 text-slate-400 text-sm">
                                    <div className="h-px w-12 bg-slate-700"></div>
                                    <span>Only 100 Copies Annually</span>
                                </div>
                            </div>
                        </div>

                        {/* Hero Image / Visual Representation */}
                        <div className="lg:col-span-5 relative hidden lg:block">
                            <div className="relative z-10 bg-gradient-to-br from-amber-100 to-amber-50 rounded-sm p-4 shadow-2xl rotate-3 hover:rotate-0 transition-all duration-700 border-4 border-slate-900/5">
                                <div className="aspect-[3/4] border border-amber-900/10 p-8 flex flex-col justify-between bg-[url('https://www.transparenttextures.com/patterns/wood-pattern.png')]">
                                    <div className="text-center">
                                        <div className="text-amber-900 font-serif text-4xl font-bold tracking-widest mb-2 border-b-2 border-amber-900/20 pb-4 mx-auto w-1/2">PANTHER</div>
                                        <div className="text-amber-800 text-xs uppercase tracking-[0.5em]">Speaks</div>
                                    </div>
                                    <div className="flex-1 flex items-center justify-center my-8">
                                        <div className="text-center opacity-40">
                                            <Feather size={64} className="mx-auto text-amber-900 mb-4" />
                                            <p className="font-serif italic text-amber-900">Handcrafted in Odisha</p>
                                        </div>
                                    </div>
                                    <div className="flex justify-between items-end border-t border-amber-900/10 pt-4">
                                        <span className="text-xs text-amber-900/60 font-mono">NO. 001</span>
                                        <span className="text-xs text-amber-900/60 font-mono">VOL. I</span>
                                    </div>
                                </div>
                            </div>
                            {/* Background accent */}
                            <div className="absolute -inset-4 border border-amber-500/20 rounded-sm -z-10 rotate-6"></div>
                        </div>
                    </div>
                </div>
            </section>

            {/* Pricing Strip */}
            <div className="bg-amber-900 text-white py-4 relative overflow-hidden">
                <div className="absolute inset-0 bg-[url('https://www.transparenttextures.com/patterns/diamond-upholstery.png')] opacity-10"></div>
                <div className="max-w-7xl mx-auto px-4 flex flex-col md:flex-row justify-between items-center relative z-10 text-center md:text-left gap-4">
                    <p className="text-amber-200/80 uppercase tracking-widest text-xs font-bold">The Pinnacle of Publishing</p>
                    <p className="font-serif text-2xl md:text-3xl tracking-wider">
                        Price: <span className="font-bold text-amber-400">₹11,00,000</span> <span className="text-sm text-amber-300/60">(INR)</span>
                    </p>
                    <Button href={BOOKING_URL} variant="outline" className="text-xs py-2 px-4 border-amber-400/30 text-amber-100 hover:bg-amber-800">
                        Check Availability
                    </Button>
                </div>
            </div>

            {/* The Craft Section */}
            <section id="craft" className="py-24 relative">
                <div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
                    <div className="text-center max-w-3xl mx-auto mb-20">
                        <h2 className="text-amber-600 font-bold uppercase tracking-widest text-sm mb-3">Ancient Tradition</h2>
                        <h3 className="text-4xl md:text-5xl font-serif text-slate-900 mb-6">The Art of Palm Leaf Etching</h3>
                        <p className="text-lg text-slate-600 font-light leading-relaxed">
                            Every page is a leaf, every word an etching. We employ the ancient 'Tala Pattachitra' technique from Odisha, where dried palm leaves are inscribed with an iron stylus and filled with natural black ink.
                        </p>
                    </div>

                    <div className="grid md:grid-cols-3 gap-0 border border-slate-200 bg-white shadow-xl">
                        <StatItem value="1,200" label="Man-Hours Per Edition" />
                        <StatItem value="100%" label="Organic Palm Leaves" />
                        <StatItem value="50+" label="Master Artisans" />
                    </div>

                    <div className="mt-16 grid md:grid-cols-2 gap-12 items-center">
                        <div className="space-y-8">
                            <div className="flex gap-6">
                                <div className="flex-shrink-0 w-16 h-16 bg-slate-100 flex items-center justify-center rounded-sm">
                                    <Palette className="text-slate-800" />
                                </div>
                                <div>
                                    <h4 className="text-xl font-serif font-bold text-slate-900 mb-2">Heritage Art</h4>
                                    <p className="text-slate-600 font-light">
                                        Illustrations aren't printed; they are carved. Detailed mythological and modern motifs frame every article.
                                    </p>
                                </div>
                            </div>
                            <div className="flex gap-6">
                                <div className="flex-shrink-0 w-16 h-16 bg-slate-100 flex items-center justify-center rounded-sm">
                                    <History className="text-slate-800" />
                                </div>
                                <div>
                                    <h4 className="text-xl font-serif font-bold text-slate-900 mb-2">Archival Quality</h4>
                                    <p className="text-slate-600 font-light">
                                        Treated with turmeric and neem, these leaves are preserved to last for centuries, making this an heirloom asset.
                                    </p>
                                </div>
                            </div>
                        </div>
                        <div className="bg-slate-100 h-96 w-full relative p-8">
                            <div className="absolute inset-0 border-8 border-white shadow-inner bg-[url('https://www.transparenttextures.com/patterns/wood-pattern.png')] opacity-50"></div>
                            <div className="relative h-full flex items-center justify-center border border-slate-300">
                                <p className="font-serif text-slate-400 italic text-center px-8">
                                    "A physical manifestation of time, art, and luxury."
                                </p>
                            </div>
                        </div>
                    </div>
                </div>
            </section>

            {/* Content Verticals */}
            <section id="content" className="py-24 bg-slate-900 text-white relative">
                <div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
                    <div className="grid lg:grid-cols-3 gap-8">
                        <div className="lg:col-span-1">
                            <h2 className="text-4xl font-serif mb-6">A Modern Narrative in Ancient Form</h2>
                            <p className="text-slate-400 mb-8 font-light">
                                While the medium is ancient, the voice is contemporary. Panther Speaks covers the zenith of modern lifestyle.
                            </p>
                            <ul className="space-y-4 mb-8">
                                <li className="flex items-center space-x-3 text-amber-400">
                                    <Globe size={18} />
                                    <span className="text-white tracking-wide">Global Business Insights</span>
                                </li>
                                <li className="flex items-center space-x-3 text-amber-400">
                                    <Gem size={18} />
                                    <span className="text-white tracking-wide">High Entertainment</span>
                                </li>
                                <li className="flex items-center space-x-3 text-amber-400">
                                    <Languages size={18} />
                                    <span className="text-white tracking-wide">Available in 5 Languages</span>
                                </li>
                            </ul>
                            <Button href={BOOKING_URL}>Subscribe Now</Button>
                        </div>
                        <div className="lg:col-span-2 grid sm:grid-cols-2 gap-6">
                            <FeatureCard
                                icon={Gem}
                                title="Business & Elite"
                                description="Exclusive interviews with industry titans, market analysis, and the future of wealth, etched onto nature's canvas."
                            />
                            <FeatureCard
                                icon={Palette}
                                title="Culture & Arts"
                                description="Deep dives into global art movements, opera, and traditional Indian heritage, blending East and West."
                            />
                            <FeatureCard
                                icon={Crown}
                                title="Social Society"
                                description="A look into the philanthropic and social calendars of the world's most influential families."
                            />
                            <FeatureCard
                                icon={BookOpen}
                                title="Entertainment"
                                description="Reviews of high cinema, luxury travel destinations, and the finest culinary experiences."
                            />
                        </div>
                    </div>
                </div>
            </section>

            {/* CTA Section */}
            <section id="acquire" className="py-24 bg-[#FDFBF7] relative overflow-hidden">
                <div className="max-w-4xl mx-auto px-4 text-center relative z-10">
                    <div className="mb-8 flex justify-center">
                        <Scroll className="text-amber-600 w-12 h-12" />
                    </div>
                    <h2 className="text-4xl md:text-6xl font-serif text-slate-900 mb-6">
                        Own a Piece of History
                    </h2>
                    <p className="text-xl text-slate-600 mb-4 max-w-2xl mx-auto font-light">
                        Panther Speaks is not just a magazine; it is an investment in art.
                    </p>
                    <div className="text-3xl font-bold text-amber-700 mb-10 font-serif">
                        ₹11,00,000 / Edition
                    </div>

                    <div className="bg-white p-8 shadow-2xl border border-slate-100 max-w-lg mx-auto transform -rotate-1">
                        <p className="text-slate-500 mb-6 italic">
                            "Due to the intricate handcrafted nature of the publication, we release a strictly limited number of copies each year. Please book your allocation."
                        </p>
                        <Button href={BOOKING_URL} className="w-full">
                            Book Your Edition
                        </Button>
                    </div>
                </div>
            </section>

        </div>
    );
}