@extends('layouts.app')

{{-- Title is controlled dynamically from Admin SEO Settings for home page only --}}
@section('description', $siteDescription)

@section('content')

{{-- ============ HERO ============ --}}
<section class="relative bg-[#f5f1ea] dark:bg-gray-900 overflow-hidden">
    <div class="max-w-7xl mx-auto px-6 lg:px-10 pt-10 pb-20 lg:pt-16 lg:pb-28">
        <div class="grid lg:grid-cols-12 gap-10 items-center">
            {{-- Left: copy --}}
            <div class="lg:col-span-6 relative z-10">
                <span class="inline-flex items-center gap-2 text-xs tracking-[0.3em] uppercase text-[#0c2340] dark:text-gray-300 font-semibold">
                    <span class="w-8 h-px bg-[#0c2340] dark:bg-gray-400"></span> Your Journey, Our Passion
                </span>

                <h1 class="mt-6 font-serif text-5xl md:text-6xl lg:text-7xl leading-[1.02] text-[#0c2340] dark:text-white">
                    Explore the World.
                    <span class="block italic font-light">Create Memories.</span>
                </h1>

                <p class="mt-6 text-base md:text-lg text-[#0c2340]/70 dark:text-gray-400 max-w-lg leading-relaxed">
                    Discover amazing travel packages curated just for you. From breathtaking landscapes to cultural adventures, find your next unforgettable journey.
                </p>

                <div class="mt-8 flex flex-wrap gap-3">
                    <a href="#packages" class="group inline-flex items-center gap-3 bg-[#0c2340] dark:bg-gray-700 text-white px-7 py-4 rounded-full hover:bg-[#1a4a6e] dark:hover:bg-gray-600 transition">
                        Explore Journeys
                        <i data-feather="arrow-right" class="w-4 h-4 group-hover:translate-x-1 transition"></i>
                    </a>
                    <a href="#contact" class="inline-flex items-center gap-3 border border-[#0c2340]/30 dark:border-gray-600 text-[#0c2340] dark:text-gray-200 px-7 py-4 rounded-full hover:bg-[#0c2340] hover:text-white dark:hover:bg-gray-700 transition">
                        Get in Touch
                    </a>
                </div>

                {{-- Stats inline --}}
                <div class="mt-12 grid grid-cols-3 gap-6 max-w-md border-t border-[#0c2340]/15 dark:border-gray-700 pt-8">
                    <div>
                        <div class="font-serif text-3xl text-[#0c2340] dark:text-white">{{ $statsDestinations }}</div>
                        <div class="text-xs uppercase tracking-wider text-[#0c2340]/60 dark:text-gray-400 mt-1">Destinations</div>
                    </div>
                    <div>
                        <div class="font-serif text-3xl text-[#0c2340] dark:text-white">{{ $statsTravelers }}</div>
                        <div class="text-xs uppercase tracking-wider text-[#0c2340]/60 dark:text-gray-400 mt-1">Travelers</div>
                    </div>
                    <div>
                        <div class="font-serif text-3xl text-[#0c2340] dark:text-white">{{ $statsRating }}</div>
                        <div class="text-xs uppercase tracking-wider text-[#0c2340]/60 dark:text-gray-400 mt-1">Rating</div>
                    </div>
                </div>
            </div>

            {{-- Right: collage --}}
            <div class="lg:col-span-6 relative">
                <div class="relative h-[480px] lg:h-[600px]">
                    <div class="absolute top-0 right-0 w-[70%] h-[75%] rounded-[2rem] overflow-hidden shadow-2xl">
                        <img src="https://images.unsplash.com/photo-1507525428034-b723cf961d3e?w=900&h=1200&fit=crop" alt="Hero" class="w-full h-full object-cover">
                    </div>
                    <div class="absolute bottom-0 left-0 w-[55%] h-[45%] rounded-[2rem] overflow-hidden shadow-2xl border-8 border-[#f5f1ea]">
                        <img src="https://images.unsplash.com/photo-1506905925346-21bda4d32df4?w=600&h=600&fit=crop" alt="Inset" class="w-full h-full object-cover">
                    </div>
                    {{-- Floating card --}}
                    <div class="absolute bottom-6 right-6 bg-white/95 backdrop-blur rounded-2xl p-4 shadow-xl w-56">
                        <div class="text-[10px] uppercase tracking-widest text-[#0c2340]/60">Featured</div>
                        <div class="font-serif text-lg text-[#0c2340] mt-1">Perfect Getaway</div>
                        <div class="text-sm text-[#0c2340]/70 mt-1">Maldives · <span class="font-semibold">$2,599</span></div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</section>


{{-- ============ FEATURED PACKAGES ============ --}}
<section id="packages" class="bg-white dark:bg-gray-950 py-20 lg:py-28">
    <div class="max-w-7xl mx-auto px-6 lg:px-10">
        <div class="flex flex-col md:flex-row md:items-end md:justify-between gap-6 mb-14">
            <div>
                <span class="text-xs tracking-[0.3em] uppercase text-[#c9a84c] font-semibold">🎯 Featured Packages</span>
                <h2 class="font-serif text-4xl md:text-5xl text-[#0c2340] dark:text-white mt-3 max-w-xl leading-tight">Best Holiday Packages For You</h2>
            </div>
            <p class="text-[#0c2340]/60 dark:text-gray-400 max-w-sm">Handpicked destinations with exclusive deals and unforgettable experiences.</p>
        </div>

        <div class="grid sm:grid-cols-2 lg:grid-cols-3 gap-6 lg:gap-8">
            @forelse($featuredPackages as $package)
                <article class="group bg-[#f5f1ea] dark:bg-gray-800 rounded-3xl overflow-hidden hover:-translate-y-1 transition-all duration-500 hover:shadow-2xl dark:hover:shadow-xl">
                    <div class="relative h-64 overflow-hidden">
                        @if($package->main_image)
                            <img src="{{ asset('storage/' . $package->main_image) }}" alt="{{ $package->title }}" class="w-full h-full object-cover group-hover:scale-110 transition-transform duration-700">
                        @else
                            <img src="https://images.unsplash.com/photo-1506905925346-21bda4d32df4?w=500&h=300&fit=crop" alt="{{ $package->title }}" class="w-full h-full object-cover group-hover:scale-110 transition-transform duration-700">
                        @endif

                        @if($package->has_discount)
                            <div class="absolute top-4 left-4 bg-[#c9a84c] text-[#0c2340] dark:text-[#0c2340] text-xs font-bold px-3 py-1.5 rounded-full">
                                -{{ $package->discount_percentage }}%
                            </div>
                        @endif

                        <div class="absolute top-4 right-4 bg-white/90 dark:bg-gray-800/90 backdrop-blur text-[#0c2340] dark:text-gray-200 text-[10px] uppercase tracking-widest font-semibold px-3 py-1.5 rounded-full">
                            {{ $package->category ?? 'Adventure' }}
                        </div>
                    </div>

                    <div class="p-6">
                        <h3 class="font-serif text-2xl text-[#0c2340] dark:text-white leading-snug">{{ $package->title }}</h3>
                        <p class="text-sm text-[#0c2340]/65 dark:text-gray-400 mt-2 leading-relaxed">{{ Str::limit($package->description, 100) }}</p>

                        <div class="flex items-center gap-2 mt-4 text-sm">
                            <div class="flex text-[#c9a84c]">
                                @for($i = 0; $i < 5; $i++)
                                    <i data-feather="star" class="w-3.5 h-3.5 fill-current"></i>
                                @endfor
                            </div>
                            <span class="text-[#0c2340]/50 dark:text-gray-400 text-xs">(128 reviews)</span>
                        </div>

                        <div class="flex items-center gap-4 mt-4 text-xs text-[#0c2340]/70 dark:text-gray-400">
                            <span class="flex items-center gap-1.5"><i data-feather="clock" class="w-3.5 h-3.5"></i>{{ $package->duration_days }} Days</span>
                            <span class="flex items-center gap-1.5"><i data-feather="map-pin" class="w-3.5 h-3.5"></i>{{ $package->destination }}</span>
                        </div>

                        <div class="flex items-end justify-between mt-6 pt-5 border-t border-[#0c2340]/10 dark:border-gray-700">
                            <div>
                                @if($package->has_discount)
                                    <div class="text-xs text-[#0c2340]/40 dark:text-gray-500 line-through">{{ $package->formatted_price }}</div>
                                    <div class="font-serif text-2xl text-[#0c2340] dark:text-white">{{ $package->formatted_discount_price }}</div>
                                @else
                                    <div class="text-xs uppercase tracking-wider text-[#0c2340]/50 dark:text-gray-500">From</div>
                                    <div class="font-serif text-2xl text-[#0c2340] dark:text-white">{{ $package->formatted_price }}</div>
                                @endif
                            </div>
                            <a href="{{ route('packages.show', $package->slug) }}" class="bg-[#0c2340] dark:bg-gray-700 text-white p-3 rounded-full hover:bg-[#c9a84c] hover:text-[#0c2340] dark:hover:bg-gray-600 transition">
                                <i data-feather="arrow-right" class="w-4 h-4"></i>
                            </a>
                        </div>
                    </div>
                </article>
            @empty
                <div class="col-span-full text-center py-16 text-[#0c2340]/50 dark:text-gray-400">
                    <p>No featured packages available at the moment.</p>
                </div>
            @endforelse
        </div>

        <div class="text-center mt-14">
            <a href="{{ route('packages.index') }}" class="inline-flex items-center gap-2 border-b-2 border-[#0c2340] dark:border-gray-400 text-[#0c2340] dark:text-gray-200 pb-1 font-medium hover:gap-3 transition-all">
                View All Packages <i data-feather="arrow-right" class="w-4 h-4"></i>
            </a>
        </div>
    </div>
</section>


{{-- ============ WHY CHOOSE US (intro) ============ --}}
<section class="bg-[#0c2340] text-white py-20 lg:py-28">
    <div class="max-w-7xl mx-auto px-6 lg:px-10">
        <div class="max-w-2xl mb-14">
            <span class="text-xs tracking-[0.3em] uppercase text-[#c9a84c] font-semibold">{{ __('🌟 Why Choose Us') }}</span>
            <h2 class="font-serif text-4xl md:text-5xl mt-3 leading-tight">{{ __('Exceptional Travel Experiences') }}</h2>
            <p class="text-white/70 mt-5">{{ __('We transform your travel dreams into unforgettable memories with personalized service and unbeatable value') }}</p>
        </div>

        <div class="grid md:grid-cols-2 gap-6">
            <div class="border border-white/15 rounded-3xl p-8 hover:bg-white/5 transition">
                <div class="w-12 h-12 rounded-2xl bg-[#c9a84c] text-[#0c2340] flex items-center justify-center mb-6">
                    <i data-feather="shield" class="w-5 h-5"></i>
                </div>
                <h3 class="font-serif text-2xl">{{ __('Safe & Secure') }}</h3>
                <p class="text-white/65 mt-3">{{ __('Your safety is our priority with comprehensive travel insurance and 24/7 support') }}</p>
                <div class="mt-5 inline-flex items-center gap-2 text-xs uppercase tracking-widest text-[#c9a84c]">
                    <i data-feather="check" class="w-4 h-4"></i> {{ __('Fully Insured') }}
                </div>
            </div>

            <div class="border border-white/15 rounded-3xl p-8 hover:bg-white/5 transition">
                <div class="w-12 h-12 rounded-2xl bg-[#c9a84c] text-[#0c2340] flex items-center justify-center mb-6">
                    <i data-feather="tag" class="w-5 h-5"></i>
                </div>
                <h3 class="font-serif text-2xl">{{ __('Best Prices') }}</h3>
                <p class="text-white/65 mt-3">{{ __('Competitive prices with no hidden fees and flexible payment options') }}</p>
                <div class="mt-5 inline-flex items-center gap-2 text-xs uppercase tracking-widest text-[#c9a84c]">
                    <i data-feather="check" class="w-4 h-4"></i> {{ __('No Hidden Fees') }}
                </div>
            </div>
        </div>
    </div>
</section>


{{-- ============ TRAVEL STORIES ============ --}}
<section class="bg-[#f5f1ea] py-20 lg:py-28">
    <div class="max-w-7xl mx-auto px-6 lg:px-10">
        <div class="flex flex-col md:flex-row md:items-end md:justify-between gap-6 mb-14">
            <div>
                <span class="text-xs tracking-[0.3em] uppercase text-[#c9a84c] font-semibold">📖 Travel Inspiration</span>
                <h2 class="font-serif text-4xl md:text-5xl text-[#0c2340] mt-3 leading-tight">Travel Stories &amp; Tips</h2>
            </div>
            <p class="text-[#0c2340]/60 max-w-sm">Get inspired by stories from our travelers and useful tips for your next adventure.</p>
        </div>

        <div class="grid md:grid-cols-3 gap-6 lg:gap-8">
            @forelse($dynamicStories as $s)
                <article class="bg-white rounded-3xl overflow-hidden group hover:-translate-y-1 transition-all duration-500 hover:shadow-xl">
                    <div class="h-56 overflow-hidden">
                        @if($s->image)
                            <img src="{{ asset('storage/' . $s->image) }}" alt="{{ $s->title }}" class="w-full h-full object-cover group-hover:scale-110 transition-transform duration-700">
                        @else
                            <img src="https://images.unsplash.com/photo-1537996194471-e657df975ab4?w=600&h=400&fit=crop" alt="{{ $s->title }}" class="w-full h-full object-cover group-hover:scale-110 transition-transform duration-700">
                        @endif
                    </div>
                    <div class="p-7">
                        <span class="text-[10px] uppercase tracking-[0.25em] text-[#c9a84c] font-bold">{{ $s->type }}</span>
                        <h3 class="font-serif text-2xl text-[#0c2340] mt-2">{{ $s->title }}</h3>
                        <p class="text-sm text-[#0c2340]/65 mt-3 leading-relaxed">{{ $s->excerpt }}</p>
                        <a href="#" class="inline-flex items-center gap-2 text-[#0c2340] text-sm font-medium mt-5 hover:gap-3 transition-all">
                            Read More <i data-feather="arrow-right" class="w-4 h-4"></i>
                        </a>
                    </div>
                </article>
            @empty
                <div class="col-span-full text-center py-8 text-[#0c2340]/50">No stories available.</div>
            @endforelse
        </div>

        <div class="text-center mt-14">
            <a href="#" class="inline-flex items-center gap-2 border-b-2 border-[#0c2340] text-[#0c2340] pb-1 font-medium hover:gap-3 transition-all">
                Browse All Stories <i data-feather="arrow-right" class="w-4 h-4"></i>
            </a>
        </div>
    </div>
</section>


{{-- ============ TESTIMONIALS ============ --}}
<section class="bg-white py-20 lg:py-28">
    <div class="max-w-7xl mx-auto px-6 lg:px-10">
        <div class="text-center max-w-2xl mx-auto mb-14">
            <span class="text-xs tracking-[0.3em] uppercase text-[#c9a84c] font-semibold">⭐ Testimonials</span>
            <h2 class="font-serif text-4xl md:text-5xl text-[#0c2340] mt-3 leading-tight">What Our Travelers Say About Us</h2>
            <p class="text-[#0c2340]/60 mt-5">Real experiences from real travelers who created unforgettable memories with us.</p>
        </div>

        <div class="grid md:grid-cols-3 gap-6 lg:gap-8">
            @forelse($dynamicTestimonials as $t)
                <div class="bg-[#f5f1ea] rounded-3xl p-8 flex flex-col">
                    <div class="flex items-center gap-2 text-[#c9a84c]">
                        @for($i = 0; $i < floor($t->rating); $i++)
                            <i data-feather="star" class="w-4 h-4 fill-current"></i>
                        @endfor
                        <span class="text-xs text-[#0c2340]/60 ml-1">{{ $t->rating }}</span>
                    </div>
                    <p class="font-serif text-lg text-[#0c2340] mt-5 leading-relaxed italic flex-1">"{{ $t->quote }}"</p>
                    <div class="flex items-center gap-3 mt-6 pt-6 border-t border-[#0c2340]/10">
                        @if($t->image)
                            <div class="w-11 h-11 rounded-full overflow-hidden">
                                <img src="{{ asset('storage/' . $t->image) }}" class="w-full h-full object-cover">
                            </div>
                        @else
                            <div class="w-11 h-11 rounded-full bg-[#0c2340] text-white flex items-center justify-center font-semibold text-sm">{{ $t->initials ?? substr($t->name, 0, 2) }}</div>
                        @endif
                        <div>
                            <div class="font-semibold text-[#0c2340] text-sm">{{ $t->name }}</div>
                            <div class="text-xs text-[#0c2340]/55">{{ $t->meta }}</div>
                        </div>
                    </div>
                </div>
            @empty
                <div class="col-span-full text-center py-8 text-[#0c2340]/50">No testimonials available.</div>
            @endforelse
        </div>
    </div>
</section>


{{-- ============ WHY UNIQUE (split) ============ --}}
<section class="bg-[#f5f1ea] py-20 lg:py-28">
    <div class="max-w-7xl mx-auto px-6 lg:px-10">
        <div class="grid lg:grid-cols-2 gap-12 lg:gap-20 items-center">
            <div class="relative">
                <div class="rounded-[2rem] overflow-hidden h-[500px]">
                    <img src="https://images.unsplash.com/photo-1488646953014-85cb44e25828?w=800&h=1000&fit=crop" alt="Travel" class="w-full h-full object-cover">
                </div>
                <div class="absolute -bottom-6 -right-6 bg-[#c9a84c] text-[#0c2340] rounded-2xl px-6 py-5 shadow-xl">
                    <div class="font-serif text-3xl">10K+</div>
                    <div class="text-xs uppercase tracking-widest">Happy Travelers</div>
                </div>
            </div>

            <div>
                <span class="text-xs tracking-[0.3em] uppercase text-[#c9a84c] font-semibold">💎 Why Choose Us</span>
                <h2 class="font-serif text-4xl md:text-5xl text-[#0c2340] mt-3 leading-tight">Make Your Travel Experience Unique</h2>
                <p class="text-[#0c2340]/65 mt-5">We don't just book trips, we create unforgettable memories. Here's why thousands choose us:</p>

                <div class="mt-8 space-y-5">
                    @forelse($dynamicFeatures as $f)
                        <div class="flex gap-4">
                            <div class="shrink-0 w-12 h-12 rounded-2xl bg-white border border-[#0c2340]/10 flex items-center justify-center text-[#0c2340]">
                                <i data-feather="{{ $f->icon ?? 'award' }}" class="w-5 h-5"></i>
                            </div>
                            <div>
                                <h4 class="font-serif text-xl text-[#0c2340]">{{ $f->title }}</h4>
                                <p class="text-sm text-[#0c2340]/65 mt-1">{{ $f->description }}</p>
                            </div>
                        </div>
                    @empty
                        <div class="text-sm text-[#0c2340]/65">No features available.</div>
                    @endforelse
                </div>

                <a href="#packages" class="inline-flex items-center gap-3 bg-[#0c2340] text-white px-7 py-4 rounded-full mt-8 hover:bg-[#1a4a6e] transition">
                    Start Planning Your Trip <i data-feather="arrow-right" class="w-4 h-4"></i>
                </a>
            </div>
        </div>
    </div>
</section>


{{-- ============ EXPERIENCES ============ --}}
<section class="bg-white py-20 lg:py-28">
    <div class="max-w-7xl mx-auto px-6 lg:px-10">
        <div class="text-center max-w-2xl mx-auto mb-14">
            <span class="text-xs tracking-[0.3em] uppercase text-[#c9a84c] font-semibold">🌟 Experiences</span>
            <h2 class="font-serif text-4xl md:text-5xl text-[#0c2340] mt-3 leading-tight">Unforgettable Experiences Just for You</h2>
            <p class="text-[#0c2340]/60 mt-5">Explore unique activities and adventures that match your travel style.</p>
        </div>

        <div class="grid sm:grid-cols-2 lg:grid-cols-4 gap-5">
            @forelse($dynamicDestinations as $e)
                <a href="#" class="group relative rounded-3xl overflow-hidden h-[400px] block">
                    @if($e->image)
                        <img src="{{ asset('storage/' . $e->image) }}" alt="{{ $e->name }}" class="absolute inset-0 w-full h-full object-cover group-hover:scale-110 transition-transform duration-700">
                    @else
                        <img src="https://images.unsplash.com/photo-1464822759023-fed622ff2c3b?w=600&h=700&fit=crop" alt="{{ $e->name }}" class="absolute inset-0 w-full h-full object-cover group-hover:scale-110 transition-transform duration-700">
                    @endif
                    <div class="absolute inset-0 bg-gradient-to-t from-[#0c2340] via-[#0c2340]/30 to-transparent"></div>
                    <div class="absolute inset-x-0 bottom-0 p-6 text-white">
                        <span class="text-[10px] uppercase tracking-[0.25em] text-[#c9a84c] font-bold">{{ $e->tag ?? 'Experience' }}</span>
                        <h3 class="font-serif text-2xl mt-2">{{ $e->name }}</h3>
                        <p class="text-sm text-white/75 mt-1">{{ $e->description }}</p>
                        <div class="inline-flex items-center gap-2 text-sm mt-4 opacity-0 group-hover:opacity-100 transition">
                            Explore <i data-feather="arrow-right" class="w-4 h-4"></i>
                        </div>
                    </div>
                </a>
            @empty
                <div class="col-span-full text-center py-8 text-[#0c2340]/50">No experiences available.</div>
            @endforelse
        </div>
    </div>
</section>


{{-- ============ CTA ============ --}}
<section id="contact" class="relative py-20 lg:py-28 overflow-hidden">
    <div class="absolute inset-0">
        <img src="https://images.unsplash.com/photo-1469854523086-cc02fe5d8800?w=1600&h=900&fit=crop" alt="" class="w-full h-full object-cover">
        <div class="absolute inset-0 bg-[#0c2340]/85"></div>
    </div>

    <div class="relative max-w-4xl mx-auto px-6 lg:px-10 text-center text-white">
        <h2 class="font-serif text-4xl md:text-6xl leading-tight">Ready to Start Your <span class="italic font-light">Next Adventure?</span></h2>
        <p class="mt-6 text-white/75 max-w-2xl mx-auto">Don't let your dream destination wait. Book your perfect trip today and create memories that will last a lifetime.</p>

        <div class="mt-8 flex flex-wrap justify-center gap-3">
            <a href="{{ route('packages.index') }}" class="inline-flex items-center gap-3 bg-[#c9a84c] text-[#0c2340] px-7 py-4 rounded-full hover:bg-white transition font-medium">
                Explore Packages <i data-feather="arrow-right" class="w-4 h-4"></i>
            </a>
            <a href="#" class="inline-flex items-center gap-3 border border-white/40 text-white px-7 py-4 rounded-full hover:bg-white hover:text-[#0c2340] transition">
                Contact Us
            </a>
        </div>

        <div class="mt-14 grid grid-cols-3 gap-6 max-w-2xl mx-auto border-t border-white/20 pt-10">
            <div>
                <div class="font-serif text-3xl md:text-4xl text-[#c9a84c]">{{ $statsDestinations }}</div>
                <div class="text-xs uppercase tracking-widest text-white/70 mt-1">Destinations</div>
            </div>
            <div>
                <div class="font-serif text-3xl md:text-4xl text-[#c9a84c]">{{ $statsTravelers }}</div>
                <div class="text-xs uppercase tracking-widest text-white/70 mt-1">Happy Travelers</div>
            </div>
            <div>
                <div class="font-serif text-3xl md:text-4xl text-[#c9a84c]">{{ $statsRating }}</div>
                <div class="text-xs uppercase tracking-widest text-white/70 mt-1">Average Rating</div>
            </div>
        </div>
    </div>
</section>

@endsection
