<?= $this->extend('layout/admin') ?>
<?= $this->section('title') ?>My Domains<?= $this->endSection() ?>

<?= $this->section('content') ?>
<div class="page-header">
    <h1 style="font-size: 1.5rem; font-weight: 700;">My Domains</h1>
    <a href="<?= base_url() ?>" class="btn btn-primary">+ Claim New Domain</a>
</div>

<div class="table-wrapper">
    <?php if(empty($domains)): ?>
        <div style="padding: 3rem; text-align: center; color: var(--text-muted);">
            <svg width="48" height="48" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1" style="margin-bottom: 1rem;"><circle cx="12" cy="12" r="10"></circle><line x1="12" y1="8" x2="12" y2="12"></line><line x1="12" y1="16" x2="12.01" y2="16"></line></svg>
            <h3>No domains yet</h3>
            <p style="margin-top: 0.5rem; margin-bottom: 1.5rem;">You haven't claimed any domains yet. Get started today!</p>
            <a href="<?= base_url() ?>" class="btn btn-primary">Find a Domain</a>
        </div>
    <?php else: ?>
        <table>
            <thead>
                <tr>
                    <th>Domain Name</th>
                    <th>Status</th>
                    <th>Registered On</th>
                    <th>Actions</th>
                </tr>
            </thead>
            <tbody>
                <?php foreach($domains as $domain): ?>
                <tr>
                    <td style="font-weight: 600; color: var(--text-main);"><?= esc($domain->full_domain) ?></td>
                    <td>
                        <span class="status-badge status-<?= esc($domain->status) ?>"><?= ucfirst(esc($domain->status)) ?></span>
                    </td>
                    <td style="color: var(--text-muted);"><?= date('M j, Y', strtotime($domain->created_at)) ?></td>
                    <td>
                        <a href="<?= base_url('dashboard/manage/' . $domain->id) ?>" class="btn btn-outline" style="font-size: 0.75rem; padding: 0.4rem 0.75rem;">Manage DNS</a>
                    </td>
                </tr>
                <?php endforeach; ?>
            </tbody>
        </table>
    <?php endif; ?>
</div>
<?= $this->endSection() ?>
