<?php
// Closes the user app shell opened by user_header.php.
?>
    </main>
  </div>
</div>
<script src="assets/crypto.js"></script>
<script>
function replaySidebarAnim() {
    document.querySelectorAll('#sidebar .side-anim-1, #sidebar .side-anim-2, #sidebar .side-anim-3, #sidebar .side-anim-4, #sidebar .side-anim-5, #sidebar .side-anim-6, #sidebar .side-anim-7, #sidebar .side-anim-8').forEach(function(el) {
        el.style.animation = 'none';
        void el.offsetWidth;
        el.style.animation = '';
    });
}
function toggleSidebar() {
    var sb = document.getElementById('sidebar');
    var ov = document.getElementById('sideOverlay');
    var opening = !sb.classList.contains('open');
    sb.classList.toggle('open');
    ov.classList.toggle('open');
    if (opening) replaySidebarAnim();
}
document.addEventListener('DOMContentLoaded', function() {
    if (document.getElementById('sidebar').classList.contains('open')) {
        replaySidebarAnim();
    }
});
(function() {
    var root = document.documentElement;
    var btn = document.getElementById('themeToggle');
    var saved = null;
    try { saved = localStorage.getItem('fampapi_theme'); } catch (e) {}
    if (saved === 'dark') root.setAttribute('data-theme', 'dark');
    if (saved === 'light') root.removeAttribute('data-theme');
    if (btn) {
        btn.addEventListener('click', function() {
            var dark = root.getAttribute('data-theme') === 'dark';
            if (dark) { root.removeAttribute('data-theme'); try { localStorage.setItem('fampapi_theme', 'light'); } catch (e) {} }
            else { root.setAttribute('data-theme', 'dark'); try { localStorage.setItem('fampapi_theme', 'dark'); } catch (e) {} }
        });
    }
})();
function toggleUserMenu() {
    var dd = document.getElementById('userMenuDropdown');
    var open = dd.classList.contains('open');
    document.querySelectorAll('.user-menu-dropdown.open').forEach(function(el) { el.classList.remove('open'); });
    if (!open) dd.classList.add('open');
}
document.addEventListener('click', function(e) {
    var menu = document.getElementById('userMenu');
    if (menu && !menu.contains(e.target)) {
        var dd = document.getElementById('userMenuDropdown');
        if (dd) dd.classList.remove('open');
    }
});
document.addEventListener('keydown', function(e) {
    if (e.key === 'Escape') {
        var dd = document.getElementById('userMenuDropdown');
        if (dd) dd.classList.remove('open');
    }
});
</script>
</body>
</html>
