@extends('site.layout')

@section('title', 'Download - Dewemoji')
@section('meta_description', 'Download Dewemoji for Chrome and Android.')

@push('jsonld')
<script type="application/ld+json">
{
  "@@context": "https://schema.org",
  "@@type": "SoftwareApplication",
  "name": "Dewemoji",
  "applicationCategory": "BrowserApplication",
  "operatingSystem": "Chrome",
  "downloadUrl": "https://chromewebstore.google.com/detail/dewemoji-emojis-made-effo/elcikbedkbpkmdhkcmfnkdaacmnpdmha"
}
</script>
@endpush

@section('content')
<div class="flex h-screen w-full">
    <aside class="hidden lg:flex w-20 lg:w-64 h-full glass-panel flex-col justify-between p-4 z-50 shrink-0">
        <div>
            <div class="flex items-center gap-3 px-2 mb-8 mt-2">
                <div class="w-10 h-10 rounded-xl bg-gradient-to-br from-white to-gray-300 flex items-center justify-center shadow-lg shadow-white/20 shrink-0">
                    <img src="/assets/logo/logo-mark.svg" alt="Dewemoji logo" class="w-7 h-7 object-contain" />
                </div>
                <h1 class="font-display font-bold text-lg tracking-tight hidden lg:block">Dewemoji</h1>
            </div>
            <nav class="space-y-1">
                <a href="{{ route('home') }}" class="flex items-center gap-4 px-3 py-3 rounded-xl text-gray-400 hover:text-white hover:bg-white/5 transition-all"><i data-lucide="layout-grid" class="w-5 h-5"></i><span class="text-sm hidden lg:block">Discover</span></a>
                <a href="{{ route('api-docs') }}" class="flex items-center gap-4 px-3 py-3 rounded-xl text-gray-400 hover:text-white hover:bg-white/5 transition-all"><i data-lucide="book-open" class="w-5 h-5"></i><span class="text-sm hidden lg:block">API Docs</span></a>
                <a href="{{ route('pricing') }}" class="flex items-center gap-4 px-3 py-3 rounded-xl text-gray-400 hover:text-white hover:bg-white/5 transition-all"><i data-lucide="badge-dollar-sign" class="w-5 h-5"></i><span class="text-sm hidden lg:block">Pricing</span></a>
                <a href="{{ route('download') }}" class="flex items-center gap-4 px-3 py-3 rounded-xl bg-white/10 text-brand-sun border border-white/5 transition-all"><i data-lucide="download" class="w-5 h-5"></i><span class="text-sm hidden lg:block">Download</span></a>
                <a href="{{ route('support') }}" class="flex items-center gap-4 px-3 py-3 rounded-xl text-gray-400 hover:text-white hover:bg-white/5 transition-all"><i data-lucide="life-buoy" class="w-5 h-5"></i><span class="text-sm hidden lg:block">Support</span></a>
            </nav>
        </div>
        <div class="space-y-1">
            @auth
                <a href="{{ route('dashboard.overview') }}" class="flex items-center gap-4 px-3 py-3 rounded-xl text-gray-400 hover:text-white hover:bg-white/5 transition-all"><i data-lucide="layout-dashboard" class="w-5 h-5"></i><span class="text-sm hidden lg:block">Dashboard</span></a>
            @endauth
            @guest
                <a href="{{ route('login') }}" class="flex items-center gap-4 px-3 py-3 rounded-xl text-gray-400 hover:text-white hover:bg-white/5 transition-all"><i data-lucide="log-in" class="w-5 h-5"></i><span class="text-sm hidden lg:block">Login</span></a>
            @endguest
            <a href="{{ route('privacy') }}" class="flex items-center gap-4 px-3 py-3 rounded-xl text-gray-400 hover:text-white hover:bg-white/5 transition-all"><i data-lucide="shield-check" class="w-5 h-5"></i><span class="text-sm hidden lg:block">Privacy</span></a>
            <a href="{{ route('terms') }}" class="flex items-center gap-4 px-3 py-3 rounded-xl text-gray-400 hover:text-white hover:bg-white/5 transition-all"><i data-lucide="file-text" class="w-5 h-5"></i><span class="text-sm hidden lg:block">Terms</span></a>
        </div>
    </aside>

    <main class="flex-1 flex flex-col h-full min-w-0 relative z-10">
        <header class="glass-header px-6 py-5 shrink-0 flex items-center justify-between">
            <div>
                <div class="text-[11px] uppercase tracking-wider text-gray-500 mb-1">Public / Download</div>
                <h1 class="font-display text-2xl md:text-3xl font-bold">Get Dewemoji</h1>
            </div>
            <button id="theme-toggle" class="w-9 h-9 rounded-full theme-surface border border-white/10 shadow-lg flex items-center justify-center text-gray-300 hover:text-white transition-colors">
                <span class="sr-only">Toggle theme</span>
                <i data-lucide="moon" class="w-4 h-4" data-theme-icon="dark"></i>
                <i data-lucide="sun" class="w-4 h-4 hidden" data-theme-icon="light"></i>
            </button>
        </header>

        <div class="flex-1 overflow-y-auto p-6 md:p-10">
            <div class="max-w-5xl mx-auto grid gap-4 lg:grid-cols-2">
                <section class="glass-card rounded-2xl p-6">
                    <div class="text-xs uppercase tracking-[0.25em] text-gray-400">Available now</div>
                    <h2 class="mt-2 text-2xl font-semibold">Chrome Extension</h2>
                    <p class="mt-2 text-sm text-gray-300">Fast emoji search and copy workflow directly in your browser.</p>
                    <a
                        href="https://chromewebstore.google.com/detail/dewemoji-emojis-made-effo/elcikbedkbpkmdhkcmfnkdaacmnpdmha"
                        target="_blank"
                        rel="noopener"
                        class="mt-5 inline-flex items-center gap-2 rounded-full bg-brand-ocean text-white force-white px-5 py-2.5 text-sm font-semibold hover:bg-brand-oceanSoft transition-colors"
                    >
                        <i data-lucide="download" class="w-4 h-4"></i>
                        Install for Chrome
                    </a>
                    <p class="mt-3 text-xs text-gray-400">Existing extension URL stays the same on updates.</p>
                </section>

                <section class="glass-card rounded-2xl p-6">
                    <div class="text-xs uppercase tracking-[0.25em] text-gray-400">
                        {{ $androidEnabled ? 'Available now' : 'Coming soon' }}
                    </div>
                    <h2 class="mt-2 text-2xl font-semibold">Android App</h2>
                    @if($androidEnabled)
                        <p class="mt-2 text-sm text-gray-300">Direct APK distribution from Dewemoji download channel.</p>
                        <a
                            href="{{ $androidLatestApkUrl }}"
                            rel="noopener"
                            class="mt-5 inline-flex items-center gap-2 rounded-full bg-brand-sun text-black px-5 py-2.5 text-sm font-semibold hover:brightness-95 transition-colors"
                        >
                            <i data-lucide="smartphone" class="w-4 h-4"></i>
                            Download APK
                        </a>
                        <div class="mt-4 text-xs text-gray-400">
                            Update metadata: <a href="{{ $androidVersionJsonUrl }}" class="underline hover:text-gray-200">{{ $androidVersionJsonUrl }}</a>
                        </div>
                    @else
                        <p class="mt-2 text-sm text-gray-300">Native app release is in progress. We will launch internal testing first, then public release.</p>
                        <div class="mt-5 inline-flex items-center gap-2 rounded-full border border-white/10 px-4 py-2 text-xs text-gray-300 bg-white/5">
                            <i data-lucide="smartphone" class="w-4 h-4"></i>
                            Android release in preparation
                        </div>
                        <div class="mt-4 text-xs text-gray-400">
                            Recommended for now: use web dashboard + Chrome extension.
                        </div>
                    @endif
                </section>

                <section class="glass-card rounded-2xl p-6 lg:col-span-2">
                    <h3 class="text-lg font-semibold">Platform Status</h3>
                    <div class="mt-4 grid gap-3 sm:grid-cols-3">
                        <div class="rounded-xl border border-emerald-500/30 bg-emerald-500/10 p-4">
                            <div class="flex items-center gap-2 text-xs uppercase tracking-[0.2em] text-emerald-300">
                                <i data-lucide="chromium" class="w-4 h-4"></i>
                                <span>Chrome</span>
                            </div>
                            <div class="mt-1 text-sm text-emerald-100">Available</div>
                        </div>
                        <div class="rounded-xl {{ $androidEnabled ? 'border border-emerald-500/30 bg-emerald-500/10' : 'border border-amber-500/30 bg-amber-500/10' }} p-4">
                            <div class="flex items-center gap-2 text-xs uppercase tracking-[0.2em] {{ $androidEnabled ? 'text-emerald-300' : 'text-amber-300' }}">
                                <i data-lucide="bot" class="w-4 h-4"></i>
                                <span>Android</span>
                            </div>
                            <div class="mt-1 text-sm {{ $androidEnabled ? 'text-emerald-100' : 'text-amber-100' }}">
                                {{ $androidEnabled ? 'Available' : 'In progress' }}
                            </div>
                        </div>
                        <div class="rounded-xl border border-sky-500/30 bg-sky-500/10 p-4">
                            <div class="flex items-center gap-2 text-xs uppercase tracking-[0.2em] text-sky-300">
                                <i data-lucide="earth" class="w-4 h-4"></i>
                                <span>Web</span>
                            </div>
                            <div class="mt-1 text-sm text-sky-100">Available</div>
                        </div>
                    </div>
                </section>
            </div>
        </div>
    </main>
</div>
@endsection
