<?php
session_start();
if (empty($_SESSION['user_id']) || ($_SESSION['role'] ?? '') !== 'admin') {
    header('Location: ../account.php');
    exit;
}
include __DIR__ . '/header.php';
?>
    <div class="container">
        <div class="admin-box">
            <h2>Admin panel</h2>

            <section class="admin-section">
                <h3>Products</h3>
                <p><a href="products.php">Product management</a></p>
            </section>

            <section class="admin-section">
                <h3>Orders</h3>
                <p><a href="orders.php">View and manage orders</a></p>
            </section>

            <section class="admin-section">
                <h3>Users</h3>
                <p><a href="users.php">User roles</a></p>
                <p><a href="user_messages.php">User messages</a></p>
            </section>

            <p style="margin-top: 24px;">
                <a href="logout.php" class="btn">Log out</a>
                <a href="../index.php" class="btn" style="margin-left: 10px; background: #555;">To shop</a>
            </p>
        </div>
    </div>
<?php include __DIR__ . '/footer.php'; ?>
