<?php $page='Admissions'; define('BASE','../'); require __DIR__.'/../includes/header.php'; require __DIR__.'/../includes/hero.php';
hero('Admissions', 'Admissions', $FACULTY['tagline'], '../assets/images/hero.jpg', $FACULTY['primary']);
?>
<section class="max-w-6xl mx-auto px-4 py-16">
<?php
$errors=[]; $ok=false;
if($_SERVER['REQUEST_METHOD']==='POST'){
  $name = trim($_POST['name'] ?? '');
  $email = trim($_POST['email'] ?? '');
  $program = trim($_POST['program'] ?? '');
  $message = trim($_POST['message'] ?? '');
  if(!$name) $errors[]='Name required';
  if(!filter_var($email,FILTER_VALIDATE_EMAIL)) $errors[]='Valid email required';
  if(!$program) $errors[]='Program required';
  if(!$errors){
    @file_put_contents(__DIR__.'/../inquiries.log', json_encode(compact('name','email','program','message'))."\n", FILE_APPEND);
    $ok=true;
  }
}
?>
<div class="grid md:grid-cols-2 gap-10">
  <div>
    <h2 class="font-serif text-3xl font-bold">Admissions</h2>
    <p class="mt-3 text-slate-600">Interested in joining the <?= htmlspecialchars($FACULTY['short']) ?> faculty? Submit an inquiry and our admissions team will follow up.</p>
    <h3 class="mt-8 font-serif text-xl font-semibold">Requirements</h3>
    <ul class="mt-3 space-y-2 text-slate-600 text-sm">
      <li>• Completed secondary education transcript</li>
      <li>• English proficiency (IELTS 6.0+ or equivalent)</li>
      <li>• Personal statement</li>
      <li>• Two letters of recommendation</li>
    </ul>
    <h3 class="mt-8 font-serif text-xl font-semibold">Key dates</h3>
    <ul class="mt-3 space-y-1 text-slate-600 text-sm">
      <li>Early application deadline: <strong>15 January 2027</strong></li>
      <li>Regular deadline: <strong>15 March 2027</strong></li>
      <li>Term begins: <strong>24 August 2027</strong></li>
    </ul>
  </div>
  <div>
    <?php if($ok): ?>
      <div class="rounded-xl p-6 bg-green-50 border border-green-200">
        <p class="font-semibold text-green-800">Thank you — your inquiry has been received.</p>
        <p class="text-sm text-green-700 mt-2">The admissions team will respond within 3 business days.</p>
      </div>
    <?php else: ?>
    <form method="post" class="rounded-xl border bg-white p-6 space-y-4">
      <h3 class="font-serif text-xl font-semibold">Request information</h3>
      <?php if($errors): ?><div class="text-sm text-red-600"><?= implode('; ', $errors) ?></div><?php endif; ?>
      <div>
        <label class="text-sm font-medium">Full name</label>
        <input name="name" required class="mt-1 w-full border rounded-md px-3 py-2">
      </div>
      <div>
        <label class="text-sm font-medium">Email</label>
        <input type="email" name="email" required class="mt-1 w-full border rounded-md px-3 py-2">
      </div>
      <div>
        <label class="text-sm font-medium">Program of interest</label>
        <select name="program" required class="mt-1 w-full border rounded-md px-3 py-2">
          <option value="">Select…</option>
          <?php foreach($PROGRAMS as $p): ?>
          <option><?= htmlspecialchars($p['title']) ?></option>
          <?php endforeach; ?>
        </select>
      </div>
      <div>
        <label class="text-sm font-medium">Message</label>
        <textarea name="message" rows="4" class="mt-1 w-full border rounded-md px-3 py-2"></textarea>
      </div>
      <button class="w-full px-5 py-3 rounded-md text-white font-medium" style="background: <?= $FACULTY['primary'] ?>">Submit inquiry</button>
    </form>
    <?php endif; ?>
  </div>
</div>
</section>
<?php require __DIR__.'/../includes/footer.php'; ?>
