<?php use App\Core\Auth; use function App\Core\{e, url}; ?>

<section class="home-hero container">
    <div class="home-social-panel">
        <?php
        $storyTitle = 'Arkadas Hikayeleri';
        $storyEmpty = Auth::check() ? 'Takip ettigin kisilerin aktif storysi yok.' : 'Giris yapinca takip ettigin kisilerin storyleri burada gorunur.';
        $storyAllowCreate = Auth::check();
        $storyInlineComposer = Auth::check();
        require BASE_PATH . '/app/Views/partials/story-strip.php';
        ?>
        <div class="home-community-feed">
            <div class="home-community-head">
                <strong>Topluluk Akisi</strong>
                <div class="home-community-actions">
                    <button class="icon-btn" type="button" data-community-feed-prev aria-label="Geri">&lsaquo;</button>
                    <button class="icon-btn" type="button" data-community-feed-next aria-label="Ileri">&rsaquo;</button>
                </div>
            </div>
            <?php if (($communityPosts ?? []) === []): ?>
                <div class="empty-state small"><strong>Henuz topluluk gonderisi yok.</strong><p>Creator paylasimlari yayinlandikca burada gorunecek.</p></div>
            <?php else: ?>
                <div class="home-community-scroller" data-community-feed-slider>
                    <?php $communityCardCompact = true; ?>
                    <?php foreach (array_slice($communityPosts, 0, 8) as $post): ?>
                        <?php require BASE_PATH . '/app/Views/partials/community-post-card.php'; ?>
                    <?php endforeach; ?>
                    <?php unset($communityCardCompact); ?>
                </div>
            <?php endif; ?>
        </div>
    </div>
</section>

<?php require BASE_PATH . '/app/Views/partials/story-viewer.php'; ?>

<section class="container game-slider-wrap section">
    <div class="section-head">
        <div>
            <h2>Oyunlar</h2>
        </div>
    </div>
    <div class="slider-controls game-slider-edge-controls">
        <button class="icon-btn" type="button" data-slider-prev aria-label="Geri">&lsaquo;</button>
        <button class="icon-btn" type="button" data-slider-next aria-label="Ileri">&rsaquo;</button>
    </div>
    <div class="game-slider" data-slider>
        <?php foreach ($topGames as $category): ?>
            <?php require BASE_PATH . '/app/Views/partials/category-card.php'; ?>
        <?php endforeach; ?>
    </div>
</section>

<?php foreach ($sections as $section): ?>
    <section class="container section">
        <div class="section-head">
            <h2><?= e($section['title']) ?></h2>
            <a class="section-link" href="<?= url($section['url']) ?>">Tumunu goster</a>
        </div>
        <?php if (!empty($section['mods'])): ?>
            <div class="grid mods">
                <?php foreach ($section['mods'] as $mod): ?>
                    <?php require BASE_PATH . '/app/Views/partials/mod-card.php'; ?>
                <?php endforeach; ?>
            </div>
        <?php else: ?>
            <div class="empty-state">
                <strong>Bu alanda henuz mod yok.</strong>
                <p>Seed veya Studio akisi ile yayinlanan modlar burada gorunecek.</p>
            </div>
        <?php endif; ?>
    </section>
<?php endforeach; ?>

<section class="container section music-strip">
    <div class="section-head">
        <div>
            <p class="eyebrow">Zalorox Music</p>
            <h2>Muzikler</h2>
        </div>
        <a class="section-link" href="<?= url('/music') ?>">Music alanina git</a>
    </div>
    <?php if (!empty($music)): ?>
        <div class="grid music-grid">
            <?php foreach ($music as $track): ?>
                <?php require BASE_PATH . '/app/Views/partials/music-card.php'; ?>
            <?php endforeach; ?>
        </div>
    <?php else: ?>
        <div class="empty-state">
            <strong>Muzik alani hazirlaniyor.</strong>
            <p>Music tablo kayitlari veya sonraki bolumdeki muzik sistemi baglandiginda bu alan dolacak.</p>
        </div>
    <?php endif; ?>
</section>
