<div>
    {{-- Hero Section --}}
    <section class="relative h-[500px] flex items-center justify-center overflow-hidden">
        {{-- Background Image --}}
        <div class="absolute inset-0 z-0">
            <img src="https://images.pexels.com/photos/22589353/pexels-photo-22589353.jpeg" alt="Article Background"
                class="w-full h-full object-cover">
            <div class="absolute inset-0 bg-black/40"></div>
        </div>

        {{-- Content --}}
        <div class="relative z-10 container mx-auto px-6 text-center">
            <h1 class="text-4xl md:text-5xl lg:text-6xl font-bold text-white mb-6">{{ $pageTitle }}</h1>
            <p class="text-white/80 text-lg md:text-xl max-w-2xl mx-auto mb-10">
                {{ $pageDesc }}
            </p>
        </div>
    </section>

    <main class="px-6 lg:px-32 xl:px-48 py-24 bg-white text-black font-sans">


        {{-- Product Detail Section --}}
        <div class="grid grid-cols-1 lg:grid-cols-2 gap-12 mb-24">

            {{-- Product Image --}}
            <div class="space-y-4">
                <div
                    class="aspect-square w-full rounded-2xl overflow-hidden shadow-2xl bg-home-primary/5 border border-home-foreground/10">
                    <img src="{{ $product->image }}" alt="{{ $product->name }}"
                        class="w-full h-full object-cover hover:scale-105 transition-transform duration-500">
                </div>
            </div>

            {{-- Product Info --}}
            <div class="space-y-6">

                {{-- Categories (for perfume) --}}
                @if ($productType === 'perfume' && $product->categories->isNotEmpty())
                    <div class="flex flex-wrap gap-2">
                        @foreach ($product->categories as $category)
                            <span
                                class="text-xs font-bold text-home-primary bg-home-primary/10 px-3 py-1 rounded-full border border-home-primary/10 uppercase tracking-wider">
                                {{ $category->name }}
                            </span>
                        @endforeach
                    </div>
                @endif

                {{-- Product Name --}}
                <h1 class="text-3xl md:text-4xl lg:text-5xl font-bold text-home-foreground leading-tight">
                    {{ $product->name }}
                </h1>

                {{-- Brand (for perfume) --}}
                @if ($productType === 'perfume' && $product->brand)
                    <div class="flex items-center gap-2">
                        <span class="text-home-foreground/60">Brand:</span>
                        <span class="font-bold text-home-primary">{{ $product->brand->name }}</span>
                    </div>
                @endif

                {{-- Concentration (for perfume) --}}
                @if ($productType === 'perfume' && isset($product->concentration))
                    <div class="flex items-center gap-2">
                        <span class="text-home-foreground/60">Konsentrasi:</span>
                        <span class="font-medium text-home-foreground">{{ $product->concentration->label() }}</span>
                    </div>
                @endif

                {{-- Price --}}
                <div class="py-6 border-y border-home-foreground/10">
                    <div class="flex items-baseline gap-3">
                        <span class="text-4xl font-bold text-home-primary">Rp
                            {{ formatCurrencyNumber($product->sale_price) }}</span>
                    </div>
                </div>

                {{-- Notes (for perfume) --}}
                @if ($productType === 'perfume')
                    <div class="space-y-4">
                        @if ($product->top_notes)
                            <div class="flex gap-4">
                                <span class="text-home-foreground/60 font-medium min-w-[120px]">Top Notes:</span>
                                <span class="text-home-foreground">{{ $product->top_notes }}</span>
                            </div>
                        @endif
                        @if ($product->middle_notes)
                            <div class="flex gap-4">
                                <span class="text-home-foreground/60 font-medium min-w-[120px]">Middle Notes:</span>
                                <span class="text-home-foreground">{{ $product->middle_notes }}</span>
                            </div>
                        @endif
                        @if ($product->base_notes)
                            <div class="flex gap-4">
                                <span class="text-home-foreground/60 font-medium min-w-[120px]">Base Notes:</span>
                                <span class="text-home-foreground">{{ $product->base_notes }}</span>
                            </div>
                        @endif
                    </div>
                @endif

                {{-- Description --}}
                @if ($product->description)
                    <div class="space-y-3">
                        <h3 class="text-lg font-bold text-home-foreground">Deskripsi</h3>
                        <p class="text-home-foreground/70 leading-relaxed text-justify">
                            {!! $product->description !!}
                        </p>
                    </div>
                @endif

                {{-- Stats --}}
                <div class="flex items-center gap-6 pt-4">
                    <div class="flex items-center gap-2 text-home-foreground/60">
                        <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
                                d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"></path>
                            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
                                d="M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z">
                            </path>
                        </svg>
                        <span class="text-sm">{{ $product->views }}x dilihat</span>
                    </div>
                    <div class="flex items-center gap-2 text-home-foreground/60">
                        <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
                                d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"></path>
                        </svg>
                        <span class="text-sm">{{ formatDateLocalized($product->created_at) }}</span>
                    </div>
                </div>

                {{-- Share Buttons --}}
                <div class="flex items-center gap-4 pt-6 border-t border-home-foreground/10">
                    <span class="text-sm font-bold text-home-foreground">Bagikan:</span>

                    {{-- WhatsApp --}}
                    <a href="https://wa.me/?text={{ urlencode($product->name . ' - ' . url()->current()) }}"
                        target="_blank" rel="noopener noreferrer"
                        class="w-10 h-10 rounded-full border border-home-foreground/10 flex items-center justify-center text-home-foreground hover:bg-home-primary hover:text-white hover:border-home-primary transition-all">
                        <svg class="w-4 h-4" fill="currentColor" viewBox="0 0 24 24">
                            <path
                                d="M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94 1.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51-.173-.008-.371-.01-.57-.01-.198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074.149.198 2.096 3.2 5.077 4.487.709.306 1.262.489 1.694.625.712.227 1.36.195 1.871.118.571-.085 1.758-.719 2.006-1.413.248-.694.248-1.289.173-1.413-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 01-5.031-1.378l-.361-.214-3.741.982.998-3.648-.235-.374a9.86 9.86 0 01-1.51-5.26c.001-5.45 4.436-9.884 9.888-9.884 2.64 0 5.122 1.03 6.988 2.898a9.825 9.825 0 012.893 6.994c-.003 5.45-4.437 9.884-9.885 9.884m8.413-18.297A11.815 11.815 0 0012.05 0C5.495 0 .16 5.335.157 11.892c0 2.096.547 4.142 1.588 5.945L0 24l6.335-1.662c1.72.94 3.659 1.437 5.634 1.437h.005c6.515 0 11.825-5.309 11.828-11.825a11.823 11.823 0 00-3.414-8.369" />
                        </svg>
                    </a>

                    {{-- Facebook --}}
                    <a href="https://www.facebook.com/sharer/sharer.php?u={{ urlencode(url()->current()) }}"
                        target="_blank" rel="noopener noreferrer"
                        class="w-10 h-10 rounded-full border border-home-foreground/10 flex items-center justify-center text-home-foreground hover:bg-home-primary hover:text-white hover:border-home-primary transition-all">
                        <svg class="w-4 h-4" fill="currentColor" viewBox="0 0 24 24">
                            <path
                                d="M24 12.073c0-6.627-5.373-12-12-12s-12 5.373-12 12c0 5.99 4.388 10.954 10.125 11.854v-8.385H7.078v-3.47h3.047V9.43c0-3.007 1.792-4.669 4.533-4.669 1.312 0 2.686.235 2.686.235v2.953H15.83c-1.491 0-1.956.925-1.956 1.874v2.25h3.328l-.532 3.47h-2.796v8.385C19.612 23.027 24 18.062 24 12.073z" />
                        </svg>
                    </a>

                    {{-- X (Twitter) --}}
                    <a href="https://twitter.com/intent/tweet?text={{ urlencode($product->name) }}&url={{ urlencode(url()->current()) }}"
                        target="_blank" rel="noopener noreferrer"
                        class="w-10 h-10 rounded-full border border-home-foreground/10 flex items-center justify-center text-home-foreground hover:bg-home-primary hover:text-white hover:border-home-primary transition-all">
                        <svg class="w-4 h-4" fill="currentColor" viewBox="0 0 24 24">
                            <path
                                d="M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z" />
                        </svg>
                    </a>
                </div>

            </div>

        </div>

        {{-- Related Products --}}
        @if (count($relatedProducts) > 0)
            <section class="mt-24 pt-16 border-t border-home-foreground/10">
                <div class="mb-12">
                    <h2 class="text-2xl md:text-3xl font-bold text-home-primary">Produk Terkait</h2>
                    <p class="text-home-foreground/60 mt-2">Produk lain yang mungkin Anda suka</p>
                </div>

                <div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-8">
                    @foreach ($relatedProducts as $related)
                        <article
                            class="group bg-white rounded-2xl border border-home-foreground/10 overflow-hidden hover:shadow-xl hover:border-home-primary/30 transition-all duration-300 flex flex-col h-full">
                            <div class="h-60 overflow-hidden relative bg-home-primary/5">
                                <img src="{{ $related['image'] }}" alt="{{ $related['name'] }}"
                                    class="w-full h-full object-cover group-hover:scale-105 transition-transform duration-500">

                                <div
                                    class="absolute inset-0 bg-black/20 opacity-0 group-hover:opacity-100 transition-opacity duration-300 flex items-center justify-center">
                                    <a href="{{ route('product.show', $related['slug']) }}" wire:navigate
                                        class="w-10 h-10 bg-white rounded-full flex items-center justify-center text-home-foreground hover:bg-home-primary hover:text-white transition-all shadow-lg transform hover:scale-110">
                                        <svg class="w-5 h-5" fill="none" stroke="currentColor"
                                            viewBox="0 0 24 24">
                                            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
                                                d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"></path>
                                            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
                                                d="M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z">
                                            </path>
                                        </svg>
                                    </a>
                                </div>
                            </div>
                            <div class="p-5 flex flex-col flex-grow">
                                @if ($related['category'])
                                    <div
                                        class="text-[10px] font-bold tracking-widest text-home-primary uppercase mb-2">
                                        {{ $related['category'] }}
                                    </div>
                                @endif
                                <h3 class="text-lg font-bold text-home-foreground mb-1 line-clamp-2">
                                    {{ $related['name'] }}
                                </h3>
                                <div class="mt-auto pt-4 flex items-center justify-between">
                                    <span class="font-bold text-home-primary">Rp
                                        {{ formatCurrencyNumber($related['price']) }}</span>
                                </div>
                            </div>
                        </article>
                    @endforeach
                </div>
            </section>
        @endif

    </main>
</div>
