<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title><?= $this->renderSection('title') ?> - Dashboard</title>
    <link rel="stylesheet" href="<?= base_url('assets/css/style.css') ?>">
</head>
<body>
    <header>
        <div class="container navbar" style="max-width: 100%;">
            <a href="<?= base_url() ?>" class="brand">
                <svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
                    <circle cx="12" cy="12" r="10"></circle>
                    <line x1="2" y1="12" x2="22" y2="12"></line>
                    <path d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"></path>
                </svg>
                ready.bd
            </a>
            
            <div class="auth-buttons">
                <span class="text-muted">Welcome, <?= session()->get('username') ?></span>
                <a href="<?= base_url('logout') ?>" class="btn btn-outline" style="padding: 0.25rem 0.75rem;">Logout</a>
            </div>
        </div>
    </header>

    <div class="dashboard-layout">
        <aside class="sidebar">
            <ul class="sidebar-nav">
                <?php if(session()->get('role') === 'admin'): ?>
                    <li><a href="<?= base_url('admin/dashboard') ?>">Dashboard</a></li>
                    <li><a href="<?= base_url('admin/users') ?>">Manage Users</a></li>
                    <li><a href="<?= base_url('admin/domains') ?>">Manage Domains</a></li>
                    <li><a href="<?= base_url('admin/suffixes') ?>">Suffixes</a></li>
                    <li><a href="<?= base_url('admin/settings') ?>">Settings</a></li>
                <?php else: ?>
                    <li><a href="<?= base_url('dashboard') ?>">My Domains</a></li>
                    <li><a href="<?= base_url('dashboard/account') ?>">Account Settings</a></li>
                <?php endif; ?>
            </ul>
        </aside>

        <main class="main-content">
            <?php if(session()->getFlashdata('success')): ?>
                <div class="alert alert-success"><?= session()->getFlashdata('success') ?></div>
            <?php endif; ?>
            <?php if(session()->getFlashdata('error')): ?>
                <div class="alert alert-error"><?= session()->getFlashdata('error') ?></div>
            <?php endif; ?>

            <?= $this->renderSection('content') ?>
        </main>
    </div>
    
    <?= $this->renderSection('scripts') ?>
</body>
</html>
