<?php header('Content-Type: text/html; charset=UTF-8'); ?>

<?php
// views/home.php - Vista della pagina principale
$stations = loadTvStations();
?>

<div class="radio-header" style="padding: 20px; margin: 0 0 20px 0; border-bottom: 1px solid #eee; display: flex; align-items: center; justify-content: space-between;position: sticky;top: 0px;background: white;">
    <div class="left-controls" style="display: flex; align-items: center;">
        <a href="<?php echo $base_path; ?>/home" data-page="home" class="linkBox" style="color: #333; display: flex; align-items: center; text-decoration: none;">
            <span class="material-icons" style="font-size: 28px;">arrow_back</span>
        </a>
        <span style="font-size: 18px; font-weight: 600; color: #333; margin-left: 15px;">TV</span>
    </div>
</div>

<div class="stationList px-4">
    <div class="row g-2">
        <?php foreach ($stations as $station): ?>
        <div class="col-6">
            <div class="stationCard <?php if((string)$station->thematic === 'true'){echo "isthematic";} ?>" data-id="<?php echo $station->id; ?>">
                <a href="<?php echo $base_path; ?>/playtv/<?php echo $station->id; ?>" data-page="playtv/<?php echo $station->id; ?>" class="nav-link stationLink">
                    <img src="<?php echo $station->logo; ?>" alt="<?php echo $station->name; ?>" class="stationLogo">
                </a>
            </div>
        </div>
        <?php endforeach; ?>
    </div>
</div>