<nav class="navbar navbar-expand-lg navbar-dark bg-dark fixed-top">
    <div class="container-fluid">
        <a class="navbar-brand d-flex align-items-center" href="index.php">
            <img src="img/icon-192.png" alt="Logo" width="32" height="32" class="me-2">
            DoMiLi
        </a>

        <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
            <span class="navbar-toggler-icon"></span>
        </button>

        <div class="collapse navbar-collapse" id="navbarNav">
            <ul class="navbar-nav">
                <li class="nav-item">
                    <a class="nav-link d-flex align-items-center" href="planning.php">
                        <span class="material-icons md-18 me-2" style="width: 24px;">event</span> Terminplanung
                    </a>
                </li>
                <li class="nav-item dropdown">
                    <a class="nav-link d-flex align-items-center dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown">
                        <span class="material-icons md-18 me-2">bar_chart</span> Auswertung
                    </a>
                    <ul class="dropdown-menu">
                        <li><a class="dropdown-item d-flex align-items-center" href="history.php"><span class="material-icons text-secondary me-2">calendar_month</span>History</a></li>
                        <li><a class="dropdown-item d-flex align-items-center" href="kasse.php"><span class="material-icons text-secondary me-2">euro</span>Kasse</a></li>
                        <li><a class="dropdown-item d-flex align-items-center" href="stats.php"><span class="material-icons text-secondary me-2">bar_chart</span>Statistik</a></li>
                    </ul>
                </li>
                <li class="nav-item">
                    <a class="nav-link d-flex align-items-center" href="trip.php">
                        <span class="material-symbols-outlined md-18 me-2" style="width: 24px;">trip</span> Ausflüge
                    </a>
                </li>
                <li class="nav-item">
                    <a class="nav-link d-flex align-items-center" href="mail.php">
                        <span class="material-symbols-outlined md-18 me-2" style="width: 24px;">mail</span> Mail
                    </a>
                </li>
                <li class="nav-item">
                    <a class="nav-link d-flex align-items-center" href="vacation.php">
                        <span class="material-icons md-18 me-2" style="width: 24px;">beach_access</span> Abwesenheiten
                    </a>
                </li>
                <li class="nav-item">
                    <a class="nav-link d-flex align-items-center" href="info.php">
                        <span class="material-icons md-18 me-2" style="width: 24px;">rule</span> Info
                    </a>
                </li>
                <li class="nav-item">
                    <a class="nav-link d-flex align-items-center" href="version.php">
                        <span class="material-icons md-18 me-2" style="width: 24px;">info</span> Release Notes
                    </a>
                </li>
                <li class="nav-item dropdown">
                    <a class="nav-link d-flex align-items-center dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown">
                        <span class="material-icons md-18 me-2">settings</span> Settings
                    </a>
                    <ul class="dropdown-menu">
                        <li><a class="dropdown-item d-flex align-items-center" href="colors.php"><span class="material-icons text-secondary me-2">palette</span>Farben</a></li>
                        <li><a class="dropdown-item d-flex align-items-center" href="users.php"><span class="material-icons text-secondary me-2">group</span>Benutzer</a></li>
                        <li><a class="dropdown-item d-flex align-items-center" href="backup.php"><span class="material-icons text-secondary me-2">archive</span>PDF-Backup</a></li>
                    </ul>
                </li>
            </ul>

            <ul class="navbar-nav ms-auto">
                <li class="nav-item dropdown">
                    <a class="nav-link dropdown-toggle d-flex align-items-center" href="#" role="button" data-bs-toggle="dropdown">
                        <span class="material-symbols-outlined align-middle md-18 me-2">person</span>
                        <?= htmlspecialchars($_SESSION['username'] ?? 'Benutzer'); ?>
                    </a>
                    <ul class="dropdown-menu dropdown-menu-end">
                        <li>
                            <a class="dropdown-item d-flex align-items-center" href="profil.php">
                                <span class="material-icons text-secondary" style="width: 24px;">person</span>
                                Profil
                            </a>
                        </li>
                        <li>
                            <a class="dropdown-item d-flex align-items-center" href="change_password.php">
                                <span class="material-icons text-secondary" style="width: 24px;">lock</span>
                                Passwort ändern
                            </a>
                        </li>

                        <?php if (isset($_SESSION['role']) && $_SESSION['role'] === 'admin'): ?>
                            <li>
                                <a class="dropdown-item d-flex align-items-center" href="check_session.php">
                                    <span class="material-icons text-secondary" style="width: 24px;">check_small</span>
                                    Session prüfen
                                </a>
                            </li>
                        <?php endif; ?>
                        <li>
                            <hr class="dropdown-divider">
                        </li>
                        <li>
                            <a class="dropdown-item d-flex align-items-center" href="logout.php">
                                <span class="material-icons text-secondary" style="width: 24px;">logout</span>
                                Log Out
                            </a>
                        </li>
                    </ul>
                </li>
            </ul>
        </div>
    </div>
</nav>