<?php
require __DIR__ . '/_boot.php';
require __DIR__ . '/partials/nav.php';
if (!$user) { header('Location: login-dev.php'); exit; }
$pollId = (int)($_GET['id'] ?? 0);
?>
<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Member Polls | Pyrk</title>
  <link rel="stylesheet" href="assets/css/app.css">
  <link rel="stylesheet" href="assets/css/client_polls.css?v=1">
</head>
<body>
<?php pyrk_render_nav('client'); ?>
<main class="container client-polls-page">
  <section class="page-hero">
    <div>
      <p class="eyebrow">Your opinion matters</p>
      <h1>Member polls</h1>
      <p class="muted">Vote on walk timing, dates, locations, routes, and community ideas.</p>
    </div>
  </section>

  <section class="panel">
    <div class="section-head">
      <div><p class="eyebrow">Open polls</p><h2>Give your opinion</h2></div>
      <button class="btn btn-light btn-small" type="button" onclick="loadPolls()">Refresh</button>
    </div>
    <div id="clientPolls" class="client-poll-list"></div>
    <p class="notice" id="clientPollMsg"></p>
  </section>
</main>
<script>
window.PYRK_API_BASE='../api';
window.PYRK_CSRF='<?= htmlspecialchars($csrf) ?>';
window.PYRK_SELECTED_POLL_ID=<?= (int)$pollId ?>;
</script>
<script src="assets/js/api.js"></script>
<script src="assets/js/client_polls.js?v=1"></script>
</body>
</html>
