<?php require_once __DIR__ . '/../config.php'; require_admin(); $settings = get_settings(); ?>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>Admin Control Room</title>
<link rel="stylesheet" href="../assets/css/style.css">
</head>
<body>
<div class="admin-shell">
  <aside class="admin-sidebar">
    <div class="brand">
      <img src="../assets/site-logo.png" alt="Logo">
      <div>
        <h2>Control Room</h2>
        <div class="meta">Broadcasturself Admin</div>
      </div>
    </div>
    <nav>
      <a href="index.php">Dashboard</a>
      <a href="site-control.php">Site Control</a>
      <a href="stations.php">Stations</a>
      <a href="schedule.php">Schedule</a>
      <a href="clues.php">Clues</a>
      <a href="answers.php">Answers</a>
      <a href="submissions.php">Submissions</a>
      <a href="dj-control.php">DJ Control</a>
      <a href="network.php">Network Sync</a>
      <a href="listeners.php">Listener Panel</a>
      <a href="poll.php">Poll Control</a>
      <a href="logout.php">Logout</a>
    </nav>
  </aside>
  <main class="admin-main">
    <?php
    $submissions = get_submissions();
    $stations = get_stations();
    $schedule = get_schedule();
    ?>
    <div class="card">
      <h1>Live Control Dashboard <span class="live-pill" style="display:inline-flex;margin-left:10px"><span class="live-dot"></span><span>LIVE</span></span></h1>
      <p>Use the control room to manage countdowns, alerts, stations, schedules, clues, answers, submissions, polls, and live network messaging.</p>
    </div>

    <div class="grid cards">
      <div class="card kpi"><span class="meta">Submissions</span><strong><?= count($submissions) ?></strong></div>
      <div class="card kpi"><span class="meta">Stations</span><strong><?= count($stations) ?></strong></div>
      <div class="card kpi"><span class="meta">Schedule Rows</span><strong><?= count($schedule) ?></strong></div>
      <div class="card kpi"><span class="meta">Winner</span><strong><?= esc($settings['winner_name'] ?? '—') ?></strong></div>
    </div>

    <div class="card">
      <h3>Data Tools</h3>
      <div class="toolbar">
        <a class="button" href="export-submissions.php">⬇ Export Submissions CSV</a>
        <a class="button secondary" href="import-submissions.php">⬆ Import Submissions CSV</a>
      </div>
    </div>

  </main>
</div>
</body>
</html>
