<?php require_once __DIR__ . '/includes/bootstrap.php';
$pageTitle = 'Requests | 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">Send a request</h1>
    <p class="page-copy">Fresh premium request form with cleaner UX, ready for your final destination logic. Right now it stores submissions in local JSON so the flow works on first boot.</p>
  </div>
</section>

<?php
$success = false;
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    $submissions = ugfx_read_json($ugfx['storage']['requests'], []);
    $submissions[] = [
        'name' => trim($_POST['name'] ?? ''),
        'email' => trim($_POST['email'] ?? ''),
        'artist' => trim($_POST['artist'] ?? ''),
        'song' => trim($_POST['song'] ?? ''),
        'message' => trim($_POST['message'] ?? ''),
        'created_at' => date('Y-m-d H:i:s')
    ];
    ugfx_write_json($ugfx['storage']['requests'], $submissions);
    $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">Your request has been sent to Underground FX.</div><?php endif; ?>
          <form method="post" class="row g-3">
            <div class="col-md-6"><label class="form-label">Your 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"></div>
            <div class="col-md-6"><label class="form-label">Artist</label><input class="form-control" name="artist" required></div>
            <div class="col-md-6"><label class="form-label">Song title</label><input class="form-control" name="song" required></div>
            <div class="col-12"><label class="form-label">Shoutout / note</label><textarea class="form-control" rows="5" name="message"></textarea></div>
            <div class="col-12"><button class="btn ugfx-btn-primary">Send request</button></div>
          </form>
        </div>
      </div>
      <div class="col-lg-5">
        <div class="ugfx-card p-4">
          <div class="ugfx-micro-label">REQUESTS UPGRADE PATH</div>
          <h3>Already rebuilt cleaner</h3>
          <p class="text-secondary">This is using fresh page structure and form handling. Later it can be pointed at your global request system or admin queue without rewriting the front-end.</p>
          <div class="d-flex gap-2 flex-wrap">
            <span class="ugfx-chip">Local JSON storage</span>
            <span class="ugfx-chip">Admin-ready</span>
            <span class="ugfx-chip">Premium form shell</span>
          </div>
        </div>
      </div>
    </div>
  </div>
</section>

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