@extends('site.layout')

@section('title', 'Support - Dewemoji')
@section('meta_description', 'Get help with Dewemoji account setup, API usage, billing, and common troubleshooting.')

@push('jsonld')
<script type="application/ld+json">
{
  "@@context": "https://schema.org",
  "@@type": "FAQPage",
  "mainEntity": [
    {"@@type":"Question","name":"How do I upgrade to Personal?","acceptedAnswer":{"@@type":"Answer","text":"Open Pricing, choose Personal Monthly or Annual, then complete checkout with PayPal or QRIS."}},
    {"@@type":"Question","name":"Can free accounts use API keys?","acceptedAnswer":{"@@type":"Answer","text":"No. API key management is available on Personal only."}},
    {"@@type":"Question","name":"How do I use API in Personal plan?","acceptedAnswer":{"@@type":"Answer","text":"Create an API key in Dashboard and send Authorization: Bearer YOUR_API_KEY in requests."}}
  ]
}
</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 text-gray-400 hover:text-white hover:bg-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 bg-white/10 text-brand-sun border border-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 / Support</div>
                <h1 class="font-display text-2xl md:text-3xl font-bold">Support Center</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 md:grid-cols-2">
                <section class="glass-card rounded-2xl p-5">
                    <h2 class="font-semibold mb-2">Install & get started</h2>
                    <ol class="list-decimal pl-5 text-sm text-gray-300 space-y-1">
                        <li>Install Dewemoji extension.</li>
                        <li>Sign in with your Dewemoji account.</li>
                        <li>Upgrade in Pricing if you need Personal features.</li>
                    </ol>
                </section>

                <section class="glass-card rounded-2xl p-5">
                    <h2 class="font-semibold mb-2">API quick start</h2>
                    <pre class="text-xs overflow-x-auto bg-black/30 rounded-lg p-3"><code>curl -H "Authorization: Bearer YOUR_API_KEY" \
"{{ url('/v1/emojis') }}?q=love&limit=20"</code></pre>
                </section>

                <section class="glass-card rounded-2xl p-5 md:col-span-2">
                    <h2 class="font-semibold mb-2">Common issues</h2>
                    <ul class="list-disc pl-5 text-sm text-gray-300 space-y-1">
                        <li><strong>API 401 invalid key:</strong> ensure key is active and belongs to a Personal account.</li>
                        <li><strong>Insert not working:</strong> focus target input and retry.</li>
                    </ul>
                    <p class="mt-4 text-sm text-gray-400">Need direct help? Email <a class="text-brand-oceanSoft hover:text-white" href="mailto:hello@dewemoji.com">hello@dewemoji.com</a>.</p>
                </section>
            </div>
        </div>
    </main>
</div>
@endsection
