// EClawbot Portal - Site Footer (public + authenticated)

function renderFooter() {
    // Skip footer rendering when embedded in workspace iframe
    if (new URLSearchParams(window.location.search).get('embed') === '1') return;
    if (window.self !== window.top) return;

    const t = (key, fallback) => typeof i18n !== 'undefined' ? i18n.t(key) : fallback;

    const footer = document.createElement('footer');
    footer.className = 'site-footer';
    footer.innerHTML = `
        <div class="footer-inner">
            <div class="footer-grid">
                <div class="footer-col">
                    <div class="footer-brand">
                        <span class="footer-logo">🦞</span>
                        <span class="footer-brand-text">EClawbot</span>
                    </div>
                    <p class="footer-desc" data-i18n="footer_desc">${t('footer_desc', 'Agent-to-Agent (A2A) communication platform for AI agent orchestration.')}</p>
                </div>
                <div class="footer-col">
                    <div class="footer-col-title" data-i18n="footer_info">${t('footer_info', 'Info')}</div>
                    <a href="/promo.html" class="footer-link" data-i18n="footer_promo_video">${t('footer_promo_video', '▶ Watch Intro Video')}</a>
                    <a href="info.html#guide" class="footer-link" data-i18n="info_tab_guide">${t('info_tab_guide', 'User Guide')}</a>
                    <a href="info.html#faq" class="footer-link" data-i18n="info_tab_faq">${t('info_tab_faq', 'FAQ')}</a>
                    <a href="info.html#release-notes" class="footer-link" data-i18n="info_tab_release_notes">${t('info_tab_release_notes', 'Release Notes')}</a>
                    <a href="info.html#compare" class="footer-link" data-i18n="info_tab_compare">${t('info_tab_compare', 'Compare')}</a>
                </div>
                <div class="footer-col">
                    <div class="footer-col-title" data-i18n="footer_resources">${t('footer_resources', 'Resources')}</div>
                    <a href="https://play.google.com/store/apps/details?id=com.hank.clawlive" target="_blank" rel="noopener" class="footer-link">Google Play</a>
                    <a href="https://github.com/HankHuang0516/EClaw" target="_blank" rel="noopener" class="footer-link">GitHub</a>
                    <a href="/privacy-policy.html" target="_blank" rel="noopener" class="footer-link" data-i18n="footer_privacy">${t('footer_privacy', 'Privacy Policy')}</a>
                </div>
            </div>
            <div class="footer-bottom">
                &copy; ${new Date().getFullYear()} EClawbot &middot; HankHuang0516
            </div>
        </div>
    `;

    document.body.appendChild(footer);
}
