<?php

declare(strict_types=1); ?>
<!doctype html>
<html lang="en">

<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>1CFD | Registration</title>
  <link rel="preconnect" href="https://fonts.googleapis.com">
  <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
  <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap" rel="stylesheet">
  <link rel="stylesheet" href="assets/styles.css">
  <link rel="icon" href="assets/favicon.png" type="image/jpeg">
</head>

<body>
  <main class="container">
    <header class="header">
      <img src="assets/logo.png" alt="Logo" class="logo" />
      <h1 class="title">Registration</h1>
      <p class="subtitle">Please fill all required fields to complete your registration.</p>
    </header>

    <section class="card" aria-labelledby="form-title">
      <h2 id="form-title" class="sr-only">Registration form</h2>
      <form id="registration-form" action="api/submit.php" method="post" novalidate>
        <div class="grid">
          <div class="field">
            <label for="full_name">Name</label>
            <input id="full_name" name="full_name" type="text" required placeholder="John Doe" autocomplete="name" />
          </div>
          <div class="field">
            <label for="email">Email</label>
            <input id="email" name="email" type="email" required placeholder="john@example.com" autocomplete="email" />
          </div>
          <div class="field">
            <label for="phone">Phone Number</label>
            <input id="phone" name="phone" type="tel" required placeholder="+9665XXXXXXXX" pattern="^\+?[0-9]{7,15}$" autocomplete="tel" />
          </div>
        </div>

        <div class="actions">
          <button id="submit-btn" class="btn" type="submit">
            <span class="btn-label">Submit Registration</span>
            <span class="spinner" aria-hidden="true"></span>
          </button>
        </div>
        <p id="form-message" class="form-message" role="alert" aria-live="polite"></p>
      </form>
    </section>

    <section id="success-panel" class="success hidden" aria-live="polite">
      <h3>Thank you!</h3>
      <p>Your registration has been received. A confirmation email has been sent to your inbox.</p>
      <div class="success-actions">
        <a id="qr-download" class="btn btn-outline" href="#" download>Download your QR</a>
      </div>
    </section>
  </main>

  <script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
  <script src="assets/app.js"></script>
</body>

</html>