<?php
$pageTitle='Underground FX Schedule'; include 'includes/header.php';
$schedule = is_file(__DIR__.'/data/schedule.json') ? json_decode((string)file_get_contents(__DIR__.'/data/schedule.json'), true) : [];
if (!is_array($schedule)) $schedule = [];
$days = array_keys($schedule);
?>
<section class="container-fluid container-xxl fx-page-hero"><div class="fx-section-card"><div class="fx-section-kicker">Programming grid</div><h1>Underground FX live schedule</h1><p>A cleaner control-board schedule with real structure instead of an ugly dump of time slots. Each day gets its own lane so the station feels curated and professional.</p></div></section>
<section class="container-fluid container-xxl fx-section-block">
  <div class="fx-day-tabs" id="scheduleTabs">
    <?php foreach ($days as $i => $day): ?><button class="<?= $i===0?'is-active':'' ?>" data-day="<?= htmlspecialchars($day, ENT_QUOTES, 'UTF-8') ?>"><?= htmlspecialchars($day, ENT_QUOTES, 'UTF-8') ?></button><?php endforeach; ?>
  </div>
  <?php foreach ($schedule as $day => $slots): ?>
    <div class="fx-schedule-board <?= array_key_first($schedule)===$day?'is-active':'' ?>" data-day-panel="<?= htmlspecialchars($day, ENT_QUOTES, 'UTF-8') ?>">
      <div class="row g-3">
        <?php foreach ((array)$slots as $hour => $dj): $hourLabel = str_pad((string)$hour,2,'0',STR_PAD_LEFT) . ':00'; ?>
        <div class="col-md-6 col-xl-4"><div class="fx-slot-card"><span><?= htmlspecialchars($hourLabel, ENT_QUOTES, 'UTF-8') ?></span><strong><?= htmlspecialchars((string)$dj, ENT_QUOTES, 'UTF-8') ?></strong><small>Underground FX live board</small></div></div>
        <?php endforeach; ?>
      </div>
    </div>
  <?php endforeach; ?>
</section>
<?php include 'includes/footer.php'; ?>