<div class="tab-pane fade show active" role="tabpanel">
    <div class="table-responsive">
        <table class="table table-striped">
            <thead>
                <tr>
                    <th>#</th>
                    <th>Título</th>
                    <th>URL M3U</th>
                    <th>Dispositivo</th>
                    <th>DNS Primário</th>
                    <th>DNS Secundário</th>
                    <th>Status</th>
                    <th>Criada em</th>
                    <th>Ações</th>
                </tr>
            </thead>
            <tbody>
                <?php if (!empty($m3u_lists)): ?>
                    <?php foreach ($m3u_lists as $list): ?>
                        <tr>
                            <td><?= intval($list['id'] ?? 0) ?></td>
                            <td><strong><?= htmlspecialchars($list['title'] ?? '') ?></strong></td>
                            <td>
                                <small><code><?= htmlspecialchars(substr($list['url'] ?? '', 0, 40)) ?>...</code></small>
                            </td>
                            <td><?= htmlspecialchars($list['device_name'] ?? '-') ?></td>
                            <td><code><?= htmlspecialchars($list['dns_primary'] ?? '8.8.8.8') ?></code></td>
                            <td><code><?= htmlspecialchars($list['dns_secondary'] ?? '8.8.4.4') ?></code></td>
                            <td>
                                <span class="badge bg-<?= ($list['status'] ?? 'active') === 'active' ? 'success' : 'danger' ?>">
                                    <?= ($list['status'] ?? 'active') === 'active' ? '✓ Ativa' : '✗ Inativa' ?>
                                </span>
                            </td>
                            <td><small><?= htmlspecialchars($list['import_date'] ?? '') ?></small></td>
                            <td>
                                <a href="<?= PAGE_NAME ?>?edit=<?= intval($list['id'] ?? 0) ?>" class="btn btn-sm btn-info">
                                    <i class="fa fa-edit"></i>
                                </a>
                                <a href="<?= PAGE_NAME ?>?delete=<?= intval($list['id'] ?? 0) ?>" class="btn btn-sm btn-danger" 
                                   onclick="return confirm('Tem certeza?')">
                                    <i class="fa fa-trash"></i>
                                </a>
                            </td>
                        </tr>
                    <?php endforeach; ?>
                <?php else: ?>
                    <tr>
                        <td colspan="9" class="text-center">Nenhuma lista M3U adicionada</td>
                    </tr>
                <?php endif; ?>
            </tbody>
        </table>
    </div>
</div>
