<?php
?>
    </main>
  </div>
</div>
<script src="assets/crypto.js"></script>
<script>
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');
}
function toggleUserMenu() {
  var dd = document.getElementById('userDropdownMenu');
  var open = dd.classList.contains('open');
  document.querySelectorAll('.user-dropdown-menu.open').forEach(function(el) { el.classList.remove('open'); });
  if (!open) dd.classList.add('open');
}
(function(){
  var root = document.documentElement;
  var btn = document.getElementById('themeToggle');
  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) {} }
    });
  }
})();
document.addEventListener('click', function(e) {
  var menu = document.getElementById('userDropdown');
  if (menu && !menu.contains(e.target)) {
    var dd = document.getElementById('userDropdownMenu');
    if (dd) dd.classList.remove('open');
  }
});
document.addEventListener('keydown', function(e) {
  if (e.key === 'Escape') {
    var dd = document.getElementById('userDropdownMenu');
    if (dd) dd.classList.remove('open');
    var sb = document.getElementById('sidebar');
    if (sb && sb.classList.contains('open')) {
      toggleSidebar();
    }
  }
});
</script>
</body>
</html>