<?php
$app = app();
$isLoggedIn = isset($_SESSION['user_id']);
$isDebug = defined('APP_DEBUG') && APP_DEBUG === true;
?>
<header class="site-header">
  <div class="container nav-row">
    <div class="brand">
      <img data-logo-img src="/assets/bilder/logo_male.png" alt="Papa-Kind-Treff Logo" class="brand__logo">
      <div class="brand__text">
        <span class="brand__name">Papa-Kind-Treff</span>
        <span class="brand__tag">Väter vernetzen</span>
      </div>
    </div>
    <nav class="nav-links" aria-label="Hauptmenü">
      <a href="/">Home</a>
      <a href="/search">Suche</a>
      <a href="/#events" data-nav-events>Termine</a>
      <a href="/community">Community</a>
    </nav>
    <div class="nav-actions">
      <?php if ($isLoggedIn): ?>
        <a class="btn ghost" href="/dashboard">Dashboard</a>
        <a class="btn ghost" href="/logout">Logout</a>
        <?php if ($isDebug): ?>
          <a class="btn ghost" href="/debug">Debug</a>
        <?php endif; ?>
      <?php else: ?>
        <a class="btn ghost" href="/login">Anmelden</a>
        <a class="btn" href="/register">Kostenlos registrieren</a>
      <?php endif; ?>
      <button class="menu-toggle" aria-label="Menü öffnen">☰</button>
    </div>
  </div>
  <div class="mobile-menu" id="mobileMenu">
    <a href="/">Home</a>
    <a href="/search">Suche</a>
    <a href="/#events" data-nav-events>Termine</a>
    <a href="/community">Community</a>
    <?php if ($isLoggedIn): ?>
      <a class="btn ghost" href="/dashboard">Dashboard</a>
      <a class="btn block" href="/logout">Logout</a>
      <?php if ($isDebug): ?>
        <a class="btn ghost block" href="/debug">Debug</a>
      <?php endif; ?>
    <?php else: ?>
      <a class="btn ghost" href="/login">Anmelden</a>
      <a class="btn block" href="/register">Kostenlos registrieren</a>
    <?php endif; ?>
  </div>
</header>
<div id="headerSentinel" class="header-sentinel" aria-hidden="true"></div>
