<?php
declare(strict_types=1);
require_once __DIR__ . '/../api/connect.php';
start_auth_session();
?>
<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width,initial-scale=1">
  <meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self'; style-src 'self'; img-src 'self' data:; connect-src 'self'; base-uri 'none'; form-action 'self'">
  <title>Student registration | Rockview University</title>
  <link rel="stylesheet" href="../../shared/vendor/bootstrap/bootstrap.min.css">
<link rel="stylesheet" href="../css/login.css?v=20261010-6">
  <link rel="stylesheet" href="../css/register.css?v=20261010-6">
  <script src="../js/auth.js?v=20261010-6" defer></script>
  <script src="../js/register.js?v=20261010-6" defer></script>

<link rel="stylesheet" href="../../shared/css/bootstrap-theme.css?v=2">
<script src="../../shared/vendor/bootstrap/bootstrap.bundle.min.js" defer></script>
<script src="../../shared/js/bootstrap-ui.js?v=9" defer></script>
<link rel="stylesheet" href="../css/auth-professional.css?v=2">
<link rel="stylesheet" href="../../shared/css/system-design.css?v=4">
<script src="../../shared/js/form-modals.js?v=5" defer></script>
<link rel="stylesheet" href="../../shared/css/university-design.css?v=5">
</head>
<body class="auth-page registration-page">
  <div id="preloader" aria-hidden="true">
  <div class="big-spinner-container">
    <svg viewBox="0 0 24 24" fill="none" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
      <path stroke="var(--dark-gold)" d="M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8" />
      <path stroke="var(--dark-gold)" d="M3 3v5h5" />
      <path stroke="var(--dark-green)" d="M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16" />
      <path stroke="var(--dark-green)" d="M16 16h5v5" />
    </svg>
  </div>
  <div class="preloader-text"><span class="text-green">Rockview</span> <span class="text-gold">Connecting&gt;&gt;&gt;</span></div>
</div>
  <main class="login-card registration-card is-preparing">
    <header class="header-section registration-header">
      <div class="auth-wordmark"><span class="auth-eyebrow">ROCKVIEW UNIVERSITY</span><span class="auth-brand-rule" aria-hidden="true"></span><span class="auth-service">Student Learning Practical System</span></div>
    </header>
    <form id="registrationForm" class="login-form" enctype="multipart/form-data" novalidate>
      <input type="hidden" name="csrf_token" value="<?= htmlspecialchars($_SESSION['csrf_token'], ENT_QUOTES, 'UTF-8') ?>">
      <div class="form-heading"><h2 class="page-title">Create your student account</h2><p class="description">Complete each section, then review your details before creating your account.</p></div>
      <ol class="registration-progress" aria-label="Registration progress">
        <li class="active" data-progress="0"><span>1</span><small>Personal details</small></li>
        <li data-progress="1"><span>2</span><small>Student details</small></li>
        <li data-progress="2"><span>3</span><small>Profile &amp; review</small></li>
      </ol>
      <div id="message" class="form-message" role="status" aria-live="polite" hidden></div>

      <section class="registration-step" data-step-panel="0" aria-labelledby="stepTitle0">
        <h3 id="stepTitle0" class="step-title">Personal details <span>Step 1 of 3</span></h3>
        <div class="field-grid">
          <div class="registration-field"><label for="full_name">Full names</label><input id="full_name" name="full_name" required maxlength="150" autocomplete="name"></div>
          <div class="registration-field"><label for="email">Email address</label><input id="email" name="email" type="email" required maxlength="150" autocomplete="email"></div>
          <div class="registration-field"><label for="identity_type">Identity document</label><select id="identity_type" name="identity_type" required><option value="nrc">Zambian NRC</option><option value="passport">Foreign student passport</option></select></div>
          <div class="registration-field"><label for="identity_number">NRC or passport number</label><input id="identity_number" name="identity_number" required maxlength="40" placeholder="157486/79/1" autocomplete="off"></div>
        </div>
      </section>

      <section class="registration-step" data-step-panel="1" aria-labelledby="stepTitle1" hidden>
        <h3 id="stepTitle1" class="step-title">Student details <span>Step 2 of 3</span></h3>
        <div class="field-grid">
          <div class="registration-field"><label for="student_number">Student number</label><input id="student_number" name="student_number" required maxlength="20" placeholder="RVU/2024/00123" autocomplete="off"></div>
          <div class="registration-field"><label for="department_id">Department</label><select id="department_id" name="department_id" required><option value="">Loading departments…</option></select></div>
          <div class="registration-field"><label for="campus_id">Campus</label><select id="campus_id" name="campus_id" required><option value="">Loading campuses…</option></select></div>
          <div class="registration-field"><label for="year_of_study">Year / level</label><select id="year_of_study" name="year_of_study" required><option value="">Select year</option><option value="1">Year 1</option><option value="2">Year 2</option><option value="3">Year 3</option><option value="4">Year 4</option></select></div>
        </div>
      </section>

      <section class="registration-step" data-step-panel="2" aria-labelledby="stepTitle2" hidden>
        <h3 id="stepTitle2" class="step-title">Profile &amp; review <span>Step 3 of 3</span></h3>
        <div class="final-step-grid">
          <div class="registration-field photo-field"><label for="profile_picture">Profile picture</label><p class="field-note">Required · JPG, PNG or WebP · up to 5 MB</p><input id="profile_picture" name="profile_picture" type="file" accept="image/jpeg,image/png,image/webp" required></div>
          <div id="registrationReview" class="registration-review" aria-live="polite"></div>
        </div>
      </section>

      <div class="step-actions">
        <button type="button" id="backButton" class="btn-secondary" hidden>Back</button>
        <button type="button" id="nextButton" class="btn-submit">Next</button>
        <button type="submit" id="submitButton" class="btn-submit" hidden>Create account</button>
      </div>
      <div class="form-links"><a href="login.php">Return to sign in</a></div>
    </form>
    <footer class="surveillance-note">Rockview University · SLPS</footer>
  </main>
</body>
</html>
