<div class="grid grid-cols-1 gap-6 lg:grid-cols-12">
    <div class="lg:col-span-3">
        <div class="rounded-2xl border border-border bg-card shadow-sm">
            <div class="border-b border-border px-4 py-4">
                <h3 class="text-sm font-semibold uppercase tracking-wide text-muted-foreground"><?= lang('all_messages') ?></h3>
            </div>
            <div class="p-4">
                <a href="<?= base_url() ?>client/mailbox/index/compose"
                   class="mb-4 inline-flex w-full items-center justify-center gap-2 rounded-lg bg-indigo-600 px-4 py-2 text-xs font-semibold text-white shadow-sm hover:bg-indigo-500">
                    <i data-lucide="pen-square" class="h-4 w-4"></i>
                    <?= lang('compose') ?>
                </a>
                <nav class="space-y-1 text-sm">
                    <a href="<?= base_url() ?>client/mailbox/index/inbox"
                       class="flex items-center justify-between rounded-lg px-3 py-2 font-medium <?php echo ($menu_active == 'inbox') ? 'bg-indigo-50 text-indigo-700' : 'text-foreground hover:bg-muted'; ?>">
                        <span class="flex items-center gap-2"><i class="fa fa-inbox w-5 text-center text-lg leading-none"></i><?= lang('inbox') ?></span>
                        <span class="rounded-full bg-indigo-100 px-2 py-0.5 text-xs font-semibold text-indigo-600">
                            <?php echo !empty($inbox_count) ? $inbox_count : '0'; ?>
                        </span>
                    </a>
                    <a href="<?= base_url() ?>client/mailbox/index/sent"
                       class="flex items-center justify-between rounded-lg px-3 py-2 font-medium <?php echo ($menu_active == 'sent') ? 'bg-indigo-50 text-indigo-700' : 'text-foreground hover:bg-muted'; ?>">
                        <span class="flex items-center gap-2"><i data-lucide="mail" class="h-5 w-5 shrink-0"></i><?= lang('sent') ?></span>
                        <span class="rounded-full bg-muted px-2 py-0.5 text-xs font-semibold text-muted-foreground">
                            <?php echo !empty($sent_count) ? $sent_count : '0'; ?>
                        </span>
                    </a>
                    <a href="<?= base_url() ?>client/mailbox/index/draft"
                       class="flex items-center justify-between rounded-lg px-3 py-2 font-medium <?php echo ($menu_active == 'draft') ? 'bg-indigo-50 text-indigo-700' : 'text-foreground hover:bg-muted'; ?>">
                        <span class="flex items-center gap-2"><i data-lucide="file-text" class="h-5 w-5 shrink-0"></i><?= lang('draft') ?></span>
                        <span class="rounded-full bg-muted px-2 py-0.5 text-xs font-semibold text-muted-foreground">
                            <?php echo !empty($draft_count) ? $draft_count : '0'; ?>
                        </span>
                    </a>
                    <a href="<?= base_url() ?>client/mailbox/index/favourites"
                       class="flex items-center justify-between rounded-lg px-3 py-2 font-medium <?php echo ($menu_active == 'favourites') ? 'bg-indigo-50 text-indigo-700' : 'text-foreground hover:bg-muted'; ?>">
                        <span class="flex items-center gap-2"><i class="fa fa-star text-yellow w-5 text-center text-lg leading-none"></i><?= lang('favourites') ?></span>
                        <span class="rounded-full bg-muted px-2 py-0.5 text-xs font-semibold text-muted-foreground">
                            <?php echo !empty($favourites_count) ? $favourites_count : '0'; ?>
                        </span>
                    </a>
                    <a href="<?= base_url() ?>client/mailbox/index/trash"
                       class="flex items-center justify-between rounded-lg px-3 py-2 font-medium <?php echo ($menu_active == 'trash') ? 'bg-indigo-50 text-indigo-700' : 'text-foreground hover:bg-muted'; ?>">
                        <span class="flex items-center gap-2">
							<i data-lucide="trash-2" class="h-5 w-5 shrink-0"></i><?= lang('trash') ?>
						</span>
                        <span class="rounded-full bg-amber-100 px-2 py-0.5 text-xs font-semibold text-amber-700">
                            <?php
                            $inbox_query = $this->db->where(array('to' => $this->session->userdata('email'), 'deleted' => 'Yes'))->get('tbl_inbox');
                            $totat_inbox = $inbox_query->num_rows();
                            $sent_query = $this->db->where(array('user_id' => $this->session->userdata('user_id'), 'deleted' => 'Yes'))->get('tbl_sent');
                            $totat_sent = $sent_query->num_rows();
                            $draft_query = $this->db->where(array('user_id' => $this->session->userdata('user_id'), 'deleted' => 'Yes'))->get('tbl_draft');
                            $tatal_draft = $draft_query->num_rows();
                            echo $totat_inbox + $totat_sent + $tatal_draft;
                            ?>
                        </span>
                    </a>
                </nav>
            </div>
        </div>
    </div>
    <div class="lg:col-span-9 space-y-4">
        <?php echo message_box('success'); ?>
        <?php echo message_box('error'); ?>
        <?php $this->load->view('client/mailbox/' . $view) ?>
    </div>


