<?php
session_start();

// Protect page — redirect to login if not logged in
if (!isset($_SESSION['authenticated_user']) || $_SESSION['authenticated_user'] !== true) {
    header("Location: /LoanApprovalPredction/login.php");
    exit;
}

// Optional: fallback name if not set
$name = $_SESSION['name'] ?? 'Member';

?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8" />
    <title>Members Area</title>
    <script src="https://cdn.tailwindcss.com"></script>
</head>
<body class="bg-gray-100 min-h-screen text-gray-800">

    <?php include '../includes/navbar.php'; ?>

    <main class="max-w-4xl mx-auto mt-16 p-8 bg-white shadow-lg rounded-lg">
        <h1 class="text-3xl font-bold mb-4">Welcome, <span class="text-blue-600"><?php echo htmlspecialchars($name); ?></span> 👋</h1>
        <p class="text-lg text-gray-600 mb-6">You are successfully logged in to the <strong>Members Area</strong>. Here you can access all member-specific content and tools.</p>

        <a href="/LoanApprovalPredction/logout.php" 
           class="inline-block px-6 py-2 bg-red-500 text-white font-semibold rounded hover:bg-red-600 transition duration-300">
            Logout
        </a>
    </main>

</body>
</html>
