<?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 name="referrer" content="no-referrer">
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self'; style-src 'self'; img-src 'self'; connect-src 'self'; base-uri 'none'; form-action 'self'">
<title>Sign in | Rockview University</title>
<link rel="stylesheet" href="../../shared/vendor/bootstrap/bootstrap.min.css">
<link rel="stylesheet" href="../css/login.css?v=20261010-6">
<script src="../js/auth.js?v=20261010-6" defer></script><script src="../js/login.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">
<link rel="stylesheet" href="../../shared/css/assistant.css?v=4"><script src="../../shared/js/chat-format.js?v=1" defer></script><script src="../../shared/js/assistant.js?v=3" defer></script>
</head>
<body class="auth-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 login-page-card is-preparing" id="loginCard">
<header class="header-section"><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>
<div class="auth-intro"><h1>Welcome back</h1><p>Sign in to your university workspace.</p></div>
<form id="authForm" class="login-form" action="../api/login.php" method="post">
<input type="hidden" name="csrf_token" value="<?= htmlspecialchars($_SESSION['csrf_token'], ENT_QUOTES, 'UTF-8') ?>">
<p class="description">Students sign in with their student number and password. Staff and HODs use their username or email.</p>
<div id="message" class="form-message" role="status" aria-live="polite" tabindex="-1" hidden></div>
<noscript><p class="form-message">JavaScript is unavailable. You can still sign in using the secure form.</p></noscript>
<label for="username">Student number / username / email</label><div class="input-group"><span class="icon-box" aria-hidden="true"><svg viewBox="0 0 24 24"><path d="M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z"/></svg></span><input class="input-field" type="text" id="username" name="username" placeholder="RVU/2024/00123" autocomplete="username" required maxlength="150"></div><label for="password">Password</label><div class="input-group"><span class="icon-box" aria-hidden="true"><svg viewBox="0 0 24 24"><path d="M18 8h-1V6a5 5 0 0 0-10 0v2H6a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V10a2 2 0 0 0-2-2zm-6 9a2 2 0 1 1 0-4 2 2 0 0 1 0 4zm3-9H9V6a3 3 0 0 1 6 0z"/></svg></span><input class="input-field" type="password" id="password" name="password" placeholder="Password" autocomplete="current-password" required maxlength="1024"><button type="button" class="toggle-password" data-toggle="password" aria-controls="password" aria-pressed="false" aria-label="Show password">Show</button></div><button type="submit" id="submitButton" class="btn-submit"><svg class="btn-spinner stroke-icon" aria-hidden="true" viewBox="0 0 24 24"><path d="M4 4v5h5m11 11v-5h-5M4.6 9a8 8 0 0 1 15 2M4.4 13a8 8 0 0 0 15 2"/></svg><span id="buttonText">Secure login</span></button>
<div class="form-links"><a href="register.php">Create a student account</a></div>
</form>
<footer class="surveillance-note">Rockview University · Authorised access only</footer>
</main>
<?php require __DIR__.'/chat_widget.php'; ?>
</body></html>
