<?php
require_once __DIR__ . '/config/config.php';
require_once __DIR__ . '/includes/db.php';
require_once __DIR__ . '/includes/functions.php';
require_once __DIR__ . '/includes/layout.php';

$definitions = getAutoPlaylistDefinitions();

renderHeader('자동 플레이리스트', 'auto_playlists');
?>
<div class="auto-playlists-page">
    <div class="page-title-section">
        <h1 class="page-main-title">자동 플레이리스트</h1>
        <p class="page-subtitle">보관함 데이터를 기준으로 자동 구성되는 재생 목록입니다.</p>
    </div>

    <div class="auto-playlist-grid">
        <?php foreach ($definitions as $type => $definition): ?>
            <?php $count = count(getAutoPlaylistSongs($type, 12)); ?>
            <a class="auto-playlist-card" href="auto_playlist.php?type=<?php echo h($type); ?>">
                <i class="fas fa-wand-magic-sparkles"></i>
                <strong><?php echo h($definition['title']); ?></strong>
                <span><?php echo h($definition['description']); ?></span>
                <small><?php echo number_format($count); ?>곡 미리보기</small>
            </a>
        <?php endforeach; ?>
    </div>
</div>
<?php renderFooter(); ?>
