<?php

function renderAdminLayout($title, $content, $conn = null) {
?>
<!DOCTYPE html>
<html>
<head>
    <title><?= htmlspecialchars($title) ?> - Admin Panel</title>

    <style>
        body {
            margin:0;
            font-family: Arial, sans-serif;
            background:#f4f6f9;
        }

        .admin-container {
            display:flex;
            min-height:100vh;
        }

        /* Sidebar */
        .sidebar {
            width:220px;
            background:#1a73e8;
            color:white;
            padding:20px;
        }

        .sidebar h2 {
            margin-bottom:30px;
        }

        .sidebar a {
            display:block;
            color:white;
            text-decoration:none;
            padding:10px;
            margin-bottom:10px;
            border-radius:5px;
        }

        .sidebar a:hover {
            background:rgba(255,255,255,0.2);
        }

        /* Main content */
        .main {
            flex:1;
            padding:20px;
        }

        .header {
            background:#fff;
            padding:15px;
            border-radius:8px;
            margin-bottom:20px;
            box-shadow:0 2px 5px rgba(0,0,0,0.1);
        }

        .content-box {
            background:#fff;
            padding:20px;
            border-radius:10px;
            box-shadow:0 2px 8px rgba(0,0,0,0.08);
        }
    </style>
</head>

<body>

<div class="admin-container">

    <!-- Sidebar -->
    <div class="sidebar">
        <h2>Admin Panel</h2>

        <ul class="sidebar-menu">

        <li>
            <a href="/admin/index.php"
               class="<?= $currentPage == 'index.php' ? 'active' : '' ?>">
               🏠 Dashboard
            </a>
        </li>
         <li>
            <a href="/admin/change_password.php"
               class="<?= $currentPage == 'change_password.php' ? 'active' : '' ?>">
               🔑  Password
            </a>
        </li>
        <li>
            <a href="/admin/users.php"
               class="<?= $currentPage == 'users.php' ? 'active' : '' ?>">
               👤 Manage Users
            </a>
        </li>

        <li>
            <a href="/admin/create_user.php"
               class="<?= $currentPage == 'create_user.php' ? 'active' : '' ?>">
               ➕ Create User
            </a>
        </li>

        <li>
            <a href="/admin/transactions.php"
               class="<?= $currentPage == 'transactions.php' ? 'active' : '' ?>">
               💸 Transactions
            </a>
        </li>

        <li>
            <a href="/admin/assign_token_steps.php"
               class="<?= $currentPage == 'assign_token_steps.php' ? 'active' : '' ?>">
               🔐 Token Engine
            </a>
        </li>

        <li>
            <a href="/admin/system_settings.php"
               class="<?= $currentPage == 'system_settings.php' ? 'active' : '' ?>">
               ⚙️ System Settings
            </a>
        </li>

        <li>
            <a href="/admin/user_logs.php"
               class="<?= $currentPage == 'user_logs.php' ? 'active' : '' ?>">
               📄 User Logs
            </a>
        </li>

        <li>
            <a href="/admin/user_actions.php"
               class="<?= $currentPage == 'user_actions.php' ? 'active' : '' ?>">
               🧾 Admin Actions
            </a>
        </li>

        <li class="logout">
            <a href="/admin/logout.php">
                🚪 Logout
            </a>
        </li>

    </ul>
    </div>

    <!-- Main Content -->
    <div class="main">

        <div class="header">
            <h2><?= htmlspecialchars($title) ?></h2>
        </div>

        <div class="content-box">
            <?= $content ?>
        </div>

    </div>

</div>

</body>
</html>
<?php
}