<?php require_once __DIR__ . '/includes/bootstrap.php';
$pageTitle = 'Contact | Underground FX Radio';
$currentPage = basename(__FILE__);
include __DIR__ . '/includes/header.php';
?>
<section class="ugfx-page-hero">
  <div class="container-xxl">
    <div class="ugfx-kicker"><i class="bi bi-lightning-charge-fill"></i> Underground FX Radio</div>
    <h1 class="page-title">Contact the station</h1>
    <p class="page-copy">Premium contact form and outreach page. This stores messages locally for now so the flow works first go.</p>
  </div>
</section>

<?php
$success = false;
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    $items = ugfx_read_json($ugfx['storage']['contact'], []);
    $items[] = [
        'name' => trim($_POST['name'] ?? ''),
        'email' => trim($_POST['email'] ?? ''),
        'subject' => trim($_POST['subject'] ?? ''),
        'message' => trim($_POST['message'] ?? ''),
        'created_at' => date('Y-m-d H:i:s')
    ];
    ugfx_write_json($ugfx['storage']['contact'], $items);
    $success = true;
}
?>
<section class="section-pad pt-3">
  <div class="container-xxl">
    <div class="row g-4">
      <div class="col-lg-7">
        <div class="ugfx-card p-4">
          <?php if ($success): ?><div class="alert alert-success">Message saved into the new contact queue.</div><?php endif; ?>
          <form method="post" class="row g-3">
            <div class="col-md-6"><label class="form-label">Name</label><input class="form-control" name="name" required></div>
            <div class="col-md-6"><label class="form-label">Email</label><input class="form-control" type="email" name="email" required></div>
            <div class="col-12"><label class="form-label">Subject</label><input class="form-control" name="subject" required></div>
            <div class="col-12"><label class="form-label">Message</label><textarea class="form-control" rows="6" name="message" required></textarea></div>
            <div class="col-12"><button class="btn ugfx-btn-primary">Send message</button></div>
          </form>
        </div>
      </div>
      <div class="col-lg-5"><div class="ugfx-card p-4"><h3>Launch contact shell</h3><p class="text-secondary mb-0">This can later split into contact, join the team, sponsor interest, or applications without redesigning the base front-end.</p></div></div>
    </div>
  </div>
</section>

<?php include __DIR__ . '/includes/footer.php'; ?>
