<div class="klasmen">
    <section class="section">
        <h2 class="section-title">Klasemen Sementara</h2>
        <div class="wrapper">
            <table class="table">
                <thead>
                    <tr>
                        <th>#</th>
                        <th>Tim</th>
                        <th class="text-center">M</th>
                        <th class="text-center">W</th>
                        <th class="text-center">L</th>
                        <th class="pts">Pts</th>
                    </tr>
                </thead>
                <tbody>
                    <?php if (!empty($teams)): ?>
                        <?php foreach($teams as $index => $team): ?>
                        <tr>
                            <td class="rank"><?php echo $index + 1; ?></td>
                           <td class="team-name">
    <a href="?page=team&id=<?php echo $team['id']; ?>">
        <strong><?php echo htmlspecialchars($team['name']); ?></strong>
    </a>
</td>
                            
                            <td class="text-center">
                                <?php echo ($team['played'] > 0) ? $team['played'] : '-'; ?>
                            </td>
                            <td class="text-center text-win">
                                <?php echo ($team['played'] > 0) ? $team['win'] : '-'; ?>
                            </td>
                            <td class="text-center text-lose">
                                <?php echo ($team['played'] > 0) ? $team['lose'] : '-'; ?>
                            </td>
                            <td class="pts">
                                <?php echo ($team['played'] > 0) ? $team['points'] : '-'; ?>
                            </td>
                        </tr>
                        <?php endforeach; ?>
                    <?php else: ?>
                        <tr>
                            <td colspan="6" style="text-align:center; padding: 20px;">Belum ada data tim.</td>
                        </tr>
                    <?php endif; ?>
                </tbody>
            </table>
        </div>
    </section>
</div>