<div class="mb-6">
    <a href="/admin/social?platform=<%= platform %>" class="text-blue-600 dark:text-blue-400 hover:underline">← Back to Dashboard</a>
</div>

<div class="max-w-xl mx-auto">
    <div class="bg-white dark:bg-darkcard rounded-lg border border-gray-200 dark:border-gray-700">
        <div class="p-6 border-b border-gray-200 dark:border-gray-700">
            <h1 class="text-2xl font-bold dark:text-white">📸 Account Snapshot</h1>
            <p class="text-gray-500 dark:text-gray-400 text-sm">Record account-level metrics from TikTok Studio Overview</p>
        </div>
        
        <form action="/admin/social/snapshot" method="POST" class="p-6 space-y-6">
            <input type="hidden" name="_csrf" value="<%= csrfToken %>">
            <input type="hidden" name="platform" value="<%= platform %>">
            
            <div>
                <label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">
                    Snapshot Date <span class="text-red-500">*</span>
                </label>
                <input type="date" name="snapshot_date" required
                       value="<%= new Date().toISOString().split('T')[0] %>"
                       class="w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg dark:bg-gray-800 dark:text-white">
            </div>
            
            <div class="grid grid-cols-2 gap-4">
                <div>
                    <label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">
                        Total Followers
                    </label>
                    <input type="number" name="total_followers" min="0" value="0"
                           class="w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg dark:bg-gray-800 dark:text-white"
                           placeholder="From Followers tab">
                </div>
                <div>
                    <label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">
                        Profile Views (7 days)
                    </label>
                    <input type="number" name="profile_views" min="0" value="0"
                           class="w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg dark:bg-gray-800 dark:text-white"
                           placeholder="From Overview">
                </div>
            </div>
            
            <div>
                <label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">
                    Top Search Queries (JSON array)
                </label>
                <input type="text" name="search_queries"
                       class="w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg dark:bg-gray-800 dark:text-white"
                       placeholder='["frost fire server minecraft", "fire trail minecraft"]'>
                <p class="text-xs text-gray-500 dark:text-gray-400 mt-1">Copy from Overview → Search queries section</p>
            </div>
            
            <div>
                <label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">
                    Demographics (JSON)
                </label>
                <textarea name="demographics" rows="3"
                          class="w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg dark:bg-gray-800 dark:text-white"
                          placeholder='{"gender": {"female": 87, "male": 13}, "age": {"18-24": 57, "25-34": 13}}'></textarea>
                <p class="text-xs text-gray-500 dark:text-gray-400 mt-1">From Viewers tab (optional but useful)</p>
            </div>
            
            <div class="flex justify-end gap-3 pt-4 border-t dark:border-gray-700">
                <a href="/admin/social?platform=<%= platform %>" 
                   class="px-4 py-2 border border-gray-300 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-700 dark:text-white">
                    Cancel
                </a>
                <button type="submit" 
                        class="px-6 py-2 bg-purple-600 text-white rounded-lg hover:bg-purple-700 transition">
                    Save Snapshot
                </button>
            </div>
        </form>
    </div>
</div>
