<?php
session_start();
require __DIR__ . '/auth.php';
require_once __DIR__ . '/../includes/content_store.php';
require_once __DIR__ . '/../includes/comments_lib.php';
$pageTitle = 'Underground FX Admin Studio';
include __DIR__ . '/includes/admin_header.php';
$baseDir = realpath(__DIR__ . '/..') ?: (__DIR__ . '/..');
$settings = smurf_read_json(__DIR__ . '/../data/settings.json', []);
$pages = smurf_read_json(__DIR__ . '/../data/pages.json', []);
$news = ht_load_news_items($baseDir);
$events = ht_load_event_items($baseDir);
$djs = smurf_read_json(__DIR__ . '/../data/djs.json', []);
$friends = smurf_read_json(__DIR__ . '/../data/friends.json', []);
$fans = smurf_read_json(__DIR__ . '/../data/fans.json', []);
?>
<section class="admin-hero-grid">
  <div class="admin-panel-card hero"><div class="fx-section-kicker">Control room overview</div><h2>One station shell. One studio dashboard. No toy admin.</h2><p>This admin studio is rebuilt to feel like part of the same product as the public site: darker panels, stronger grouping, faster routing and a cleaner working surface.</p><div class="admin-quick-grid"><a href="/admin/news.php">News</a><a href="/admin/events.php">Events</a><a href="/admin/djs.php">DJs</a><a href="/admin/schedule.php">Schedule</a><a href="/admin/radiostats.php">Radio stats</a><a href="/admin/player.php">Player</a></div></div>
  <div class="admin-panel-card"><div class="fx-section-kicker">Live config</div><ul class="admin-bullet-list"><li><strong>Stream:</strong> <?= htmlspecialchars((string)($settings['stream_url'] ?? 'Not set'), ENT_QUOTES, 'UTF-8') ?></li><li><strong>Timezone:</strong> <?= htmlspecialchars((string)($settings['station_timezone'] ?? 'America/New_York'), ENT_QUOTES, 'UTF-8') ?></li><li><strong>Discord:</strong> <?= htmlspecialchars((string)($settings['discord_url'] ?? 'Not set'), ENT_QUOTES, 'UTF-8') ?></li><li><strong>Player in nav:</strong> <?= !empty($settings['player_show_in_nav']) ? 'Enabled' : 'Disabled' ?></li></ul></div>
</section>
<section class="admin-stat-grid wide mt-4">
  <div class="admin-metric"><span>News items</span><strong><?= is_array($news)?count($news):0 ?></strong></div>
  <div class="admin-metric"><span>Events</span><strong><?= is_array($events)?count($events):0 ?></strong></div>
  <div class="admin-metric"><span>DJ profiles</span><strong><?= is_array($djs)?count($djs):0 ?></strong></div>
  <div class="admin-metric"><span>Friends + fans</span><strong><?= (is_array($friends)?count($friends):0) + (is_array($fans)?count($fans):0) ?></strong></div>
  <div class="admin-metric"><span>Pages</span><strong><?= is_array($pages)?count($pages):0 ?></strong></div>
</section>
<section class="admin-tool-grid mt-4">
  <a class="admin-tool-card" href="/admin/news.php"><i class="bi bi-newspaper"></i><h3>News Studio</h3><p>Create and feature station updates with images that carry across the whole site.</p></a>
  <a class="admin-tool-card" href="/admin/events.php"><i class="bi bi-stars"></i><h3>Event Control</h3><p>Promos, contests and event media in the same premium system.</p></a>
  <a class="admin-tool-card" href="/admin/djs.php"><i class="bi bi-mic"></i><h3>DJ Manager</h3><p>Keep the real roster, bios and images together in one wall.</p></a>
  <a class="admin-tool-card" href="/admin/schedule.php"><i class="bi bi-calendar2-week"></i><h3>Schedule Board</h3><p>Manage the programming grid that drives the public schedule and live handoff.</p></a>
  <a class="admin-tool-card" href="/admin/requests.php"><i class="bi bi-music-note-list"></i><h3>Requests Desk</h3><p>Review listener requests, status them and keep the station flow moving.</p></a>
  <a class="admin-tool-card" href="/admin/radiostats.php"><i class="bi bi-activity"></i><h3>Live Stats</h3><p>Now playing, listeners and stream telemetry from the new fallbacks.</p></a>
</section>
<?php include __DIR__ . '/includes/admin_footer.php'; ?>