<?php
// 取得目前執行的檔案名稱，用來判斷哪個選單要亮起
$current_page = basename($_SERVER['PHP_SELF']);
?>
<style>
    /* 導覽列共用樣式 */
    .navbar { background-color: #2c3e50; color: white; padding: 15px 20px; display: flex; justify-content: space-between; align-items: center; box-shadow: 0 2px 5px rgba(0,0,0,0.1); }
    .navbar h2 { margin: 0; font-size: 1.2rem; }
    .nav-links a { color: #bdc3c7; text-decoration: none; margin-left: 15px; font-weight: bold; transition: color 0.3s; }
    .nav-links a:hover { color: #fff; }
    .nav-links a.active { color: #f1c40f; }

    /* 手機版適應設計 */
    @media (max-width: 768px) {
        .navbar { flex-direction: column; gap: 15px; text-align: center; }
        .nav-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
        .nav-links a { margin-left: 0; font-size: 0.95rem; }
    }
</style>

<div class="navbar">
    <h2>👑 <?php echo htmlspecialchars($_SESSION['display_name']); ?> 的管理後台</h2>
    <div class="nav-links">
        <a href="family.php" class="<?php echo ($current_page == 'family.php') ? 'active' : ''; ?>">👨‍👩‍👧‍👦 家庭成員管理</a>
        <a href="tasks.php" class="<?php echo ($current_page == 'tasks.php') ? 'active' : ''; ?>">📋 任務設定庫</a>
        <a href="assignments.php" class="<?php echo ($current_page == 'assignments.php') ? 'active' : ''; ?>">📅 任務指派與排程</a>
        <a href="verify.php" class="<?php echo ($current_page == 'verify.php') ? 'active' : ''; ?>">⚖️ 任務驗收</a>
        <a href="reports.php" class="<?php echo ($current_page == 'reports.php') ? 'active' : ''; ?>">📊 統計報表</a>
        <a href="shop.php" class="<?php echo ($current_page == 'shop.php') ? 'active' : ''; ?>">🏪 家庭柑仔店</a>
        <a href="redemptions.php" class="<?php echo ($current_page == 'redemptions.php') ? 'active' : ''; ?>">🎁 兌換核銷</a>
        <a href="../logout.php">登出</a>
    </div>
</div>