<?php
session_start();
require_once 'includes/header.php';

/* 🔒 SAFETY CHECKS */
if (!isset($_SESSION['user_id'])) {
    header("Location: login.php");
    exit();
}

if (!isset($_SESSION['practice_attempted']) || !isset($_SESSION['reinforcement_done'])) {
    header("Location: dashboard.php");
    exit();
}

if (isset($_SESSION['final_attempted'])) {
    header("Location: final_assessment_result.php");
    exit();
}

$language = ucfirst($_SESSION['language']);
?>

<div class="assessment-intro">

    <h2>Final Assessment – <?php echo $language; ?></h2>

    <p>
        This is the final assessment for your learning journey.
        Take your time and answer carefully.
    </p>

    <ul class="rules">
        <li>This assessment is based on the concepts you practiced.</li>
        <li>Only one attempt is allowed.</li>
        <li>No hints or retries during this test.</li>
        <li>Minimum 60% score required to earn certificate.</li>
    </ul>

    <a href="/rs_lab/final_assessment_test.php?name=<?= urlencode($name) ?>&roll=<?= urlencode($roll) ?>&class=<?= urlencode($class) ?>" class="btn">
  ▶ Begin Test
</a>

</div>

<?php require_once 'includes/footer.php'; ?>
