<?php
if (session_status() === PHP_SESSION_NONE) { session_start(); }
// Finale Version für Sensor-Seiten-Fix
define('APP_VERSION', '18.3.0'); 
?>
<!DOCTYPE html>
<html lang="de">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Cazubu - Cannabis Zucht Buddy</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" href="css/style.css?v=<?php echo APP_VERSION; ?>">
</head>
<body>
    <div class="zoom-effect-container">
        <div class="zoom-effect-image"></div>
    </div>
    <div class="site-container">
        <nav class="side-menu d-flex flex-column p-3">
            <div>
                <div class="text-center">
                    <a href="index.php"><img src="logo.png" alt="Cazubu Logo" class="site-logo"></a>
                    <h2 class="project-name">Cazubu</h2>
                </div>
                <hr>
                <ul class="nav nav-pills flex-column">
                    <?php if(isset($_SESSION["loggedin"]) && $_SESSION["loggedin"] === true): ?>
                        <li><a href="index.php" class="nav-link text-white">Startseite</a></li>
                        <li><a href="plants.php" class="nav-link text-white">Pflanzen</a></li>
                        <li class="mt-2"><span class="nav-link-header">AKTIONEN</span></li>
                        <li><a href="sensors.php" class="nav-link text-white">Sensoren</a></li>
                        <li><a href="#" class="nav-link text-white" data-bs-toggle="modal" data-bs-target="#globalActivityModal">Aktivität durchführen</a></li>
                        <li class="mt-2"><span class="nav-link-header">VERWALTUNG</span></li>
                        <li><a href="inventory.php" class="nav-link text-white">Inventar</a></li>
                        <li><a href="seeds.php" class="nav-link text-white">Samen</a></li>
                        <li class="mt-2"><span class="nav-link-header">SYSTEM</span></li>
                        <li><a href="profile.php" class="nav-link text-white">Profil</a></li>
                    <?php else: ?>
                        <li><a href="login.php" class="nav-link text-white">Login</a></li>
                        <li><a href="register.php" class="nav-link text-white">Registrieren</a></li>
                    <?php endif; ?>
                </ul>
            </div>
            <?php if(isset($_SESSION["loggedin"]) && $_SESSION["loggedin"] === true): ?>
            <div class="mt-auto">
                <hr>
                <div class="text-center text-white-50 small"><p class="mb-1">Angemeldet als:</p><strong class="text-white d-block"><?php echo htmlspecialchars($_SESSION['username']); ?></strong></div>
                <a href="logout.php" class="btn btn-outline-light w-100 mt-2">Abmelden</a>
            </div>
            <?php endif; ?>
        </nav>
        <main class="main-content">
