<?php
$settingsFile = __DIR__ . '/../data/settings.json';
$settings = [];
if (file_exists($settingsFile)) {
  $settings = json_decode(file_get_contents($settingsFile), true);
  if (!is_array($settings)) $settings = [];
}
$chatEnabled = !empty($settings['chat_enabled']);
$chatLiveNow = !empty($settings['chat_live_now']);
$chatShowNav = array_key_exists('chat_show_in_nav', $settings) ? !empty($settings['chat_show_in_nav']) : true;
$showChatLink = ($chatEnabled && $chatShowNav && $chatLiveNow);
?>
<!-- Mobile overlay -->
<div id="navOverlay" class="nav-overlay" aria-hidden="true"></div>

<nav id="sideNav" class="side-nav" aria-label="Site navigation">
  <div class="nav-top">
    <div class="nav-title">Menu</div>
    <button class="nav-close" type="button" aria-label="Close menu">✕</button>
  </div>

  <ul class="nav-list">
    <li><a href="/index.php"><img src="/img/nav-icons/home.png" alt=""><span>Home</span></a></li>
    <li><a href="/about.php"><img src="/img/nav-icons/about.png" alt=""><span>About</span></a></li>
    <li><a href="/news.php"><img src="/img/nav-icons/news.png" alt=""><span>News</span></a></li>
    <li><a href="/schedule.php"><img src="/img/nav-icons/schedule.png" alt=""><span>Schedule</span></a></li>
    <li><a href="/requests.php"><img src="/img/nav-icons/requests.png" alt=""><span>Requests</span></a></li>
    <li><a href="/top50.php"><img src="/img/nav-icons/top50.png" alt=""><span>Top 50</span></a></li>
    <li><a href="/djs.php"><img src="/img/nav-icons/ourdjs.png" alt=""><span>Our DJs</span></a></li>
    <?php if ($showChatLink): ?>
    <li><a href="/chat.php"><img src="/img/nav-icons/chat.png" alt=""><span>Live Chat</span></a></li>
    <?php endif; ?>
    <li><a href="/friends.php"><img src="/img/nav-icons/friends.png" alt=""><span>Friends</span></a></li>
    <li><a href="/contact.php"><img src="/img/nav-icons/contact.png" alt=""><span>Contact</span></a></li>
    <li><a href="/team.php"><img src="/img/nav-icons/join.png" alt=""><span>Join the Team</span></a></li>

    <li class="nav-admin">
      <a href="/admin/index.php"><img src="/img/nav-icons/admin.png" alt=""><span>Admin</span></a>
    </li>
  </ul>
</nav>