<?= $this->extend('layouts/main') ?>

<?= $this->section('content') ?>
<div class="container py-5">
    <div class="row mb-5 fade-in">
        <div class="col-12">
            <h1 class="display-5 text-primary">Welcome, <?= esc($name) ?>!</h1>
            <p class="lead text-muted">Manage your <?= esc($role) ?> portal</p>
        </div>
    </div>

    <div class="row g-4 fade-in" style="animation-delay: 0.2s;">
        <!-- Common Stats/Actions based on role -->
        <?php if($role === 'admin'): ?>
            <div class="col-md-4">
                <div class="card h-100 border-primary border-top border-4">
                    <div class="card-body">
                        <i class="fa-solid fa-users fs-1 text-primary mb-3"></i>
                        <h4 class="card-title">User Management</h4>
                        <p class="text-muted">Manage system users, agents, and departments.</p>
                        <a href="#" class="btn btn-outline-primary">Manage Users</a>
                    </div>
                </div>
            </div>
            <div class="col-md-4">
                <div class="card h-100 border-success border-top border-4">
                    <div class="card-body">
                        <i class="fa-solid fa-percent fs-1 text-success mb-3"></i>
                        <h4 class="card-title">Commissions</h4>
                        <p class="text-muted">Configure markup and agent commissions.</p>
                        <a href="#" class="btn btn-outline-success">Set Rules</a>
                    </div>
                </div>
            </div>
            <div class="col-md-4">
                <div class="card h-100 border-info border-top border-4">
                    <div class="card-body">
                        <i class="fa-solid fa-chart-line fs-1 text-info mb-3"></i>
                        <h4 class="card-title">Reports</h4>
                        <p class="text-muted">View global sales, flight and hotel bookings.</p>
                        <a href="#" class="btn btn-outline-info">View Reports</a>
                    </div>
                </div>
            </div>
        <?php elseif($role === 'agent'): ?>
            <div class="col-md-6">
                <div class="card h-100">
                    <div class="card-body">
                        <i class="fa-solid fa-plane-up fs-1 text-primary mb-3"></i>
                        <h4 class="card-title">Book Flights</h4>
                        <p class="text-muted">Search and book flights for your clients.</p>
                        <a href="<?= base_url('flights') ?>" class="btn btn-primary">Search Flights</a>
                    </div>
                </div>
            </div>
            <div class="col-md-6">
                <div class="card h-100">
                    <div class="card-body">
                        <i class="fa-solid fa-hotel fs-1 text-success mb-3"></i>
                        <h4 class="card-title">Book Hotels</h4>
                        <p class="text-muted">Exclusive B2B rates for premium stays.</p>
                        <a href="<?= base_url('hotels') ?>" class="btn btn-success">Search Hotels</a>
                    </div>
                </div>
            </div>
        <?php else: ?>
            <div class="col-md-6">
                <div class="card h-100">
                    <div class="card-body">
                        <h4 class="card-title"><i class="fa-solid fa-suitcase me-2 text-primary"></i>My Bookings</h4>
                        <p class="text-muted">View and manage your upcoming trips.</p>
                        <a href="#" class="btn btn-outline-primary">View History</a>
                    </div>
                </div>
            </div>
            <div class="col-md-6">
                <div class="card h-100">
                    <div class="card-body">
                        <h4 class="card-title"><i class="fa-solid fa-compass me-2 text-success"></i>Explore</h4>
                        <p class="text-muted">Find the best deals on flights and hotels.</p>
                        <div class="d-flex gap-2">
                            <a href="<?= base_url('flights') ?>" class="btn btn-primary">Flights</a>
                            <a href="<?= base_url('hotels') ?>" class="btn btn-success">Hotels</a>
                        </div>
                    </div>
                </div>
            </div>
        <?php endif; ?>
    </div>
</div>
<?= $this->endSection() ?>
