<?php
// template-review-pdf.php - Used by generate-pdf.php to render the PDF view
$form = $form ?? $_SESSION['form_data'] ?? [];
?>
<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <style>
    body { font-family: sans-serif; font-size: 12px; color: #222; }
    h1 { text-align: center; margin-bottom: 20px; }
    h2 { border-bottom: 1px solid #ccc; margin-top: 20px; }
    p { margin: 2px 0; }
  </style>
</head>
<body>
  <h1>Tartu College Summer Application</h1>
  <p><strong>Application Reference:</strong> <?= $form['reference'] ?? 'N/A' ?></p>

  <h2>Personal Information</h2>
  <p><strong>Name:</strong> <?= $form['first_name'] . ' ' . $form['last_name'] ?></p>
  <p><strong>Preferred Name:</strong> <?= $form['preferred_name'] ?></p>
  <p><strong>Birthdate:</strong> <?= $form['birthdate'] ?></p>
  <p><strong>Gender:</strong> <?= $form['gender'] ?></p>
  <p><strong>Citizenship:</strong> <?= $form['citizenship'] ?></p>
  <p><strong>Student Status:</strong> <?= $form['student_status'] ?></p>

  <h2>Contact Information</h2>
  <p><strong>Phone:</strong> <?= $form['phone'] ?></p>
  <p><strong>Email:</strong> <?= $form['email'] ?></p>

  <h2>Home Address</h2>
  <p><?= $form['address'] ?>, <?= $form['city'] ?>, <?= $form['region'] ?>, <?= $form['country'] ?> <?= $form['postal'] ?></p>

  <h2>Emergency Contact</h2>
  <p><strong>Name:</strong> <?= $form['emergency_name'] ?></p>
  <p><strong>Phone:</strong> <?= $form['emergency_phone'] ?></p>
  <p><strong>Email:</strong> <?= $form['emergency_email'] ?></p>

  <h2>Room Details</h2>
  <p><strong>Room Type:</strong> <?= $form['room_type'] ?></p>
  <p><strong>Room Option:</strong> <?= $form['room_option'] ?></p>
  <p><strong>Suite Sharing:</strong> <?= $form['suite_share'] ?></p>
  <p><strong>Gender Neutral Friendly:</strong> <?= isset($form['gender_neutral']) ? 'Yes' : 'No' ?></p>

  <h2>Occupancy Dates</h2>
  <p><strong>Move-in:</strong> <?= $form['move_in'] ?></p>
  <p><strong>Move-out:</strong> <?= $form['move_out'] ?></p>

  <h2>Additional Info</h2>
  <p><strong>Comments:</strong> <?= nl2br($form['comments']) ?></p>
  <p><strong>Referral Source:</strong> <?= $form['referral'] ?></p>
  <p><strong>Agreed to Rules:</strong> <?= isset($form['agree_rules']) ? 'Yes' : 'No' ?></p>

  <footer>
    <p style="margin-top:30px; text-align:center; font-size: 10px;">
      This application together with payment receipt will constitute the occupancy contract with Tartu College.
    </p>
  </footer>
</body>
</html>
