<?php
$currentRoute = $_GET['route'] ?? '';
$navItems = [
  ['/', 'icon-home', 'الرئيسية'],
  ['/games', 'icon-games', 'العاب'],
  ['/leaderboard', 'icon-leaderboard', 'ترتيب'],
  ['/profile', 'icon-profile', 'حسابي'],
];
?>

<!-- Floating play button -->
<a href="/play" class="nav-m-play" aria-label="العب الان">
  <svg class="icon"><use href="/public/icons/sprite.svg#icon-play"></use></svg>
</a>

<nav class="nav-m" aria-label="التنقل">
  <?php foreach ($navItems as $item):
    $href = $item[0]; $icon = $item[1]; $label = $item[2];
    $route = trim($href, '/');
    $isActive = ($route === '' && $currentRoute === '') || ($route !== '' && $currentRoute === $route);
  ?>
  <a href="<?= $href ?>" class="nav-m-item <?= $isActive ? 'active' : '' ?>" aria-current="<?= $isActive ? 'page' : 'false' ?>">
    <svg class="icon"><use href="/public/icons/sprite.svg#<?= $icon ?>"></use></svg>
    <span><?= $label ?></span>
  </a>
  <?php endforeach; ?>
</nav>
