<!-- Sidebar -->
<style>
/* ===== SIDEBAR PREMIUM COMPACT ===== */
.sidebar {
    width: 220px;
    min-height: 100vh;
    background: linear-gradient(135deg, #0d9488 0%, #115e59 100%);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 1000;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.15) transparent;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 4px; }

/* Brand */
.sidebar-brand {
    padding: 20px 16px 16px;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,.1);
    flex-shrink: 0;
}
.sidebar-brand .brand-icon {
    width: 42px; height: 42px;
    background: rgba(255,255,255,.18);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 8px;
}
.sidebar-brand .brand-icon i { font-size: 1.2rem; color: #fff; }
.sidebar-brand h4 {
    font-size: .9rem; font-weight: 800; color: #fff;
    margin: 0; letter-spacing: .06em; text-transform: uppercase;
}
.sidebar-brand small {
    font-size: .68rem; color: rgba(255,255,255,.55); font-weight: 500;
}

/* Menu wrapper */
.sidebar-menu {
    padding: 8px 0 16px;
    flex: 1;
}

/* Section label */
.sidebar-section-label {
    font-size: .62rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: .08em; color: rgba(255,255,255,.35);
    padding: 10px 18px 4px;
}

/* Nav items */
.sidebar .nav-item { margin: 1px 8px; }

.sidebar .nav-link {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 12px;
    border-radius: 8px;
    color: rgba(255,255,255,.75);
    font-size: .82rem;
    font-weight: 500;
    text-decoration: none;
    transition: all .15s ease;
    position: relative;
    white-space: nowrap;
}
.sidebar .nav-link i {
    font-size: .95rem;
    width: 18px;
    text-align: center;
    flex-shrink: 0;
    opacity: .85;
}
.sidebar .nav-link span { flex: 1; overflow: hidden; text-overflow: ellipsis; }

.sidebar .nav-link:hover {
    background: rgba(255,255,255,.1);
    color: #fff;
}
.sidebar .nav-link:hover i { opacity: 1; }

.sidebar .nav-link.active {
    background: rgba(255,255,255,.18);
    color: #fff;
    font-weight: 700;
}
.sidebar .nav-link.active i { opacity: 1; }
.sidebar .nav-link.active::before {
    content: '';
    position: absolute;
    left: 0; top: 50%; transform: translateY(-50%);
    width: 3px; height: 60%;
    background: #a7f3d0;
    border-radius: 0 2px 2px 0;
}

/* Logout link */
.sidebar .nav-link.logout-link {
    color: rgba(255,120,120,.8);
    margin-top: 4px;
}
.sidebar .nav-link.logout-link:hover {
    background: rgba(239,68,68,.15);
    color: #fca5a5;
}

/* Badges in sidebar */
.sidebar .nav-link .sb-badge {
    font-size: .62rem; font-weight: 700; padding: 2px 6px;
    border-radius: 999px; line-height: 1.2;
    flex-shrink: 0;
}
.sb-badge-danger  { background: #ef4444; color: #fff; }
.sb-badge-info    { background: rgba(255,255,255,.2); color: rgba(255,255,255,.7); }

/* Submenu collapse */
.sidebar .collapse .nav { padding: 2px 0 4px; }
.sidebar .collapse .nav-item { margin: 1px 0 1px 10px; }
.sidebar .collapse .nav-link {
    font-size: .79rem; padding: 6px 10px; border-radius: 7px;
}
.sidebar .collapse .nav-link::before { display: none; }

/* Divider */
.sidebar-divider {
    height: 1px; background: rgba(255,255,255,.08);
    margin: 6px 16px;
}

/* Chevron for collapse */
.sidebar .nav-link .chevron {
    font-size: .65rem; color: rgba(255,255,255,.45);
    margin-left: auto; flex-shrink: 0;
    transition: transform .2s;
}
.sidebar .nav-link[aria-expanded="true"] .chevron { transform: rotate(180deg); }

/* ===== MOBILE: overlay sidebar ===== */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform .25s ease;
        box-shadow: none;
    }
    .sidebar.show {
        transform: translateX(0);
        box-shadow: 4px 0 24px rgba(0,0,0,.18);
    }
}
</style>

<?php
/* Helper: cek apakah segment aktif untuk grup collapse */
if (!function_exists('seg_in')) {
    function seg_in($segs) {
        global $CI;
        return in_array($CI->uri->segment(1), $segs);
    }
}
$CI =& get_instance();
$seg1 = $CI->uri->segment(1);
$seg2 = $CI->uri->segment(2);
?>

<nav class="sidebar" id="mainSidebar">

    <!-- Brand -->
    <div class="sidebar-brand">
        <div class="brand-icon">
            <i class="bi bi-house-door-fill"></i>
        </div>
        <h4>SISTEM RT</h4>
        <small>Management System</small>
    </div>

    <div class="sidebar-menu">
        <ul class="nav flex-column">

            <!-- ══════════════════════════════════
                 DASHBOARD
            ══════════════════════════════════ -->
            <li class="nav-item">
                <a class="nav-link <?php echo ($seg1 == 'dashboard' || $seg1 == '') ? 'active' : ''; ?>"
                   href="<?php echo base_url('dashboard'); ?>">
                    <i class="bi bi-speedometer2"></i>
                    <span>Dashboard</span>
                </a>
            </li>

            <div class="sidebar-divider"></div>

            <!-- ══════════════════════════════════
                 1. KEPENDUDUKAN (admin only)
            ══════════════════════════════════ -->
            <?php if (is_admin()): ?>
            <?php $kependudukan_segs = ['warga', 'kartu-keluarga']; ?>
            <li class="nav-item">
                <a class="nav-link <?php echo seg_in($kependudukan_segs) ? 'active' : ''; ?>"
                   href="#menuKependudukan"
                   data-bs-toggle="collapse"
                   aria-expanded="<?php echo seg_in($kependudukan_segs) ? 'true' : 'false'; ?>">
                    <i class="bi bi-people-fill"></i>
                    <span>Kependudukan</span>
                    <i class="bi bi-chevron-down chevron"></i>
                </a>
                <div class="collapse <?php echo seg_in($kependudukan_segs) ? 'show' : ''; ?>" id="menuKependudukan">
                    <ul class="nav flex-column">
                        <li class="nav-item">
                            <a class="nav-link <?php echo ($seg1 == 'warga' && $seg2 != 'pemilih') ? 'active' : ''; ?>"
                               href="<?php echo base_url('warga'); ?>">
                                <i class="bi bi-people"></i>
                                <span>Data Warga</span>
                            </a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link <?php echo $seg1 == 'kartu-keluarga' ? 'active' : ''; ?>"
                               href="<?php echo base_url('kartu-keluarga'); ?>">
                                <i class="bi bi-house-door"></i>
                                <span>Kartu Keluarga</span>
                            </a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link <?php echo ($seg1 == 'warga' && $seg2 == 'pemilih') ? 'active' : ''; ?>"
                               href="<?php echo base_url('warga/pemilih'); ?>">
                                <i class="bi bi-person-vcard"></i>
                                <span>Pemilih Pemilu</span>
                            </a>
                        </li>
                    </ul>
                </div>
            </li>
            <?php endif; ?>

            <!-- ══════════════════════════════════
                 2. KEUANGAN
            ══════════════════════════════════ -->
            <?php
            $keuangan_segs = ['iuran', 'kas', 'tabungan', 'pinjaman', 'arisan'];
            $keuangan_aktif = seg_in($keuangan_segs);
            $show_keuangan  = (can('iuran','view') || can('kas','view') || can('tabungan','view') || can('pinjaman','view'));
            ?>
            <?php if ($show_keuangan): ?>
            <li class="nav-item">
                <a class="nav-link <?php echo $keuangan_aktif ? 'active' : ''; ?>"
                   href="#menuKeuangan"
                   data-bs-toggle="collapse"
                   aria-expanded="<?php echo $keuangan_aktif ? 'true' : 'false'; ?>">
                    <i class="bi bi-cash-stack"></i>
                    <span>Keuangan</span>
                    <i class="bi bi-chevron-down chevron"></i>
                </a>
                <div class="collapse <?php echo $keuangan_aktif ? 'show' : ''; ?>" id="menuKeuangan">
                    <ul class="nav flex-column">

                        <?php if (can('iuran','view')): ?>
                        <li class="nav-item">
                            <a class="nav-link <?php echo $seg1 == 'iuran' ? 'active' : ''; ?>"
                               href="<?php echo base_url('iuran'); ?>">
                                <i class="bi bi-receipt"></i>
                                <span><?php echo is_warga() ? 'Iuran Saya' : 'Iuran Warga'; ?></span>
                            </a>
                        </li>
                        <?php endif; ?>

                        <?php if (can('kas','view')): ?>
                        <li class="nav-item">
                            <a class="nav-link <?php echo $seg1 == 'kas' ? 'active' : ''; ?>"
                               href="<?php echo base_url('kas'); ?>">
                                <i class="bi bi-bank"></i>
                                <span>Kas RT</span>
                                <?php if (is_warga()): ?>
                                <span class="sb-badge sb-badge-info">View</span>
                                <?php endif; ?>
                            </a>
                        </li>
                        <?php endif; ?>

                        <?php if (can('tabungan','view')): ?>
                        <li class="nav-item">
                            <a class="nav-link <?php echo $seg1 == 'tabungan' ? 'active' : ''; ?>"
                               href="<?php echo base_url('tabungan'); ?>">
                                <i class="bi bi-wallet2"></i>
                                <span><?php echo is_warga() ? 'Tabungan Saya' : 'Tabungan'; ?></span>
                            </a>
                        </li>
                        <?php endif; ?>

                        <?php if (can('pinjaman','view')): ?>
                        <li class="nav-item">
                            <a class="nav-link <?php echo $seg1 == 'pinjaman' ? 'active' : ''; ?>"
                               href="<?php echo base_url('pinjaman'); ?>">
                                <i class="bi bi-cash-coin"></i>
                                <span><?php echo is_warga() ? 'Pinjaman Saya' : 'Pinjaman'; ?></span>
                            </a>
                        </li>
                        <?php endif; ?>

                        <li class="nav-item">
                            <a class="nav-link <?php echo $seg1 == 'arisan' ? 'active' : ''; ?>"
                               href="<?php echo base_url('arisan'); ?>">
                                <i class="bi bi-gift-fill"></i>
                                <span>Arisan RT</span>
                            </a>
                        </li>

                    </ul>
                </div>
            </li>
            <?php endif; ?>

            <!-- ══════════════════════════════════
                 3. INVENTARIS
            ══════════════════════════════════ -->
            <?php $inventaris_segs = ['inventaris', 'peminjaman-inventaris']; ?>
            <li class="nav-item">
                <a class="nav-link <?php echo seg_in($inventaris_segs) ? 'active' : ''; ?>"
                   href="#menuInventaris"
                   data-bs-toggle="collapse"
                   aria-expanded="<?php echo seg_in($inventaris_segs) ? 'true' : 'false'; ?>">
                    <i class="bi bi-box-seam"></i>
                    <span>Inventaris</span>
                    <i class="bi bi-chevron-down chevron"></i>
                </a>
                <div class="collapse <?php echo seg_in($inventaris_segs) ? 'show' : ''; ?>" id="menuInventaris">
                    <ul class="nav flex-column">
                        <li class="nav-item">
                            <a class="nav-link <?php echo $seg1 == 'inventaris' ? 'active' : ''; ?>"
                               href="<?php echo base_url('inventaris'); ?>">
                                <i class="bi bi-grid-3x3-gap"></i>
                                <span>Data Barang</span>
                            </a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link <?php echo $seg1 == 'peminjaman-inventaris' ? 'active' : ''; ?>"
                               href="<?php echo base_url('peminjaman-inventaris'); ?>">
                                <i class="bi bi-arrow-left-right"></i>
                                <span>Peminjaman</span>
                            </a>
                        </li>
                    </ul>
                </div>
            </li>

            <!-- ══════════════════════════════════
                 4. LAYANAN WARGA
            ══════════════════════════════════ -->
            <?php $layanan_segs = ['umkm', 'bansos', 'tamu', 'surat']; ?>
            <li class="nav-item">
                <a class="nav-link <?php echo seg_in($layanan_segs) ? 'active' : ''; ?>"
                   href="#menuLayanan"
                   data-bs-toggle="collapse"
                   aria-expanded="<?php echo seg_in($layanan_segs) ? 'true' : 'false'; ?>">
                    <i class="bi bi-shop-window"></i>
                    <span>Layanan Warga</span>
                    <i class="bi bi-chevron-down chevron"></i>
                </a>
                <div class="collapse <?php echo seg_in($layanan_segs) ? 'show' : ''; ?>" id="menuLayanan">
                    <ul class="nav flex-column">
                        <li class="nav-item">
                            <a class="nav-link <?php echo $seg1 == 'umkm' ? 'active' : ''; ?>"
                               href="<?php echo base_url('umkm'); ?>">
                                <i class="bi bi-shop"></i>
                                <span>UMKM</span>
                            </a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link <?php echo $seg1 == 'bansos' ? 'active' : ''; ?>"
                               href="<?php echo base_url('bansos'); ?>">
                                <i class="bi bi-heart-pulse-fill"></i>
                                <span>Bantuan Sosial</span>
                            </a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link <?php echo $seg1 == 'tamu' ? 'active' : ''; ?>"
                               href="<?php echo base_url('tamu'); ?>">
                                <i class="bi bi-person-badge-fill"></i>
                                <span>E-Visitor</span>
                                <?php if (is_warga()): ?>
                                <span class="sb-badge sb-badge-info">View</span>
                                <?php endif; ?>
                            </a>
                        </li>
                        <?php if (can('surat','view')): ?>
                        <li class="nav-item">
                            <a class="nav-link <?php echo $seg1 == 'surat' ? 'active' : ''; ?>"
                               href="<?php echo base_url('surat'); ?>">
                                <i class="bi bi-file-text-fill"></i>
                                <span><?php echo is_warga() ? 'Pengajuan Surat' : 'Surat Menyurat'; ?></span>
                            </a>
                        </li>
                        <?php endif; ?>
                    </ul>
                </div>
            </li>

            <!-- ══════════════════════════════════
                 5. KEGIATAN & INFO
            ══════════════════════════════════ -->
            <?php $kegiatan_segs = ['pengumuman','kalender','jadwal','notulen','kegiatan','struktur-rt','video','berita']; ?>
            <li class="nav-item">
                <a class="nav-link <?php echo seg_in($kegiatan_segs) ? 'active' : ''; ?>"
                   href="#menuKegiatan"
                   data-bs-toggle="collapse"
                   aria-expanded="<?php echo seg_in($kegiatan_segs) ? 'true' : 'false'; ?>">
                    <i class="bi bi-calendar3"></i>
                    <span>Kegiatan &amp; Info</span>
                    <i class="bi bi-chevron-down chevron"></i>
                </a>
                <div class="collapse <?php echo seg_in($kegiatan_segs) ? 'show' : ''; ?>" id="menuKegiatan">
                    <ul class="nav flex-column">

                        <?php if (can('pengumuman','view')): ?>
                        <li class="nav-item">
                            <a class="nav-link <?php echo $seg1 == 'pengumuman' ? 'active' : ''; ?>"
                               href="<?php echo base_url('pengumuman'); ?>">
                                <i class="bi bi-megaphone-fill"></i>
                                <span>Pengumuman</span>
                            </a>
                        </li>
                        <?php endif; ?>

                        <li class="nav-item">
                            <a class="nav-link <?php echo $seg1 == 'kalender' ? 'active' : ''; ?>"
                               href="<?php echo base_url('kalender'); ?>">
                                <i class="bi bi-calendar3"></i>
                                <span>Kalender</span>
                            </a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link <?php echo $seg1 == 'jadwal' ? 'active' : ''; ?>"
                               href="<?php echo base_url('jadwal'); ?>">
                                <i class="bi bi-calendar-check"></i>
                                <span>Jadwal Kegiatan</span>
                            </a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link <?php echo $seg1 == 'kegiatan' ? 'active' : ''; ?>"
                               href="<?php echo base_url('kegiatan'); ?>">
                                <i class="bi bi-calendar-event-fill"></i>
                                <span>Kegiatan RT</span>
                            </a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link <?php echo $seg1 == 'notulen' ? 'active' : ''; ?>"
                               href="<?php echo base_url('notulen'); ?>">
                                <i class="bi bi-journal-text"></i>
                                <span>Notulen Rapat</span>
                                <?php if (is_warga()): ?>
                                <span class="sb-badge sb-badge-info">View</span>
                                <?php endif; ?>
                            </a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link <?php echo $seg1 == 'struktur-rt' ? 'active' : ''; ?>"
                               href="<?php echo base_url('struktur-rt'); ?>">
                                <i class="bi bi-diagram-3-fill"></i>
                                <span>Struktur RT</span>
                            </a>
                        </li>

                        <!-- Sub-grup: Media -->
                        <li class="nav-item">
                            <a class="nav-link <?php echo in_array($seg1,['video','berita']) ? 'active' : ''; ?>"
                               href="#menuMedia"
                               data-bs-toggle="collapse"
                               aria-expanded="<?php echo in_array($seg1,['video','berita']) ? 'true' : 'false'; ?>">
                                <i class="bi bi-play-circle-fill"></i>
                                <span>Media</span>
                                <i class="bi bi-chevron-down chevron"></i>
                            </a>
                            <div class="collapse <?php echo in_array($seg1,['video','berita']) ? 'show' : ''; ?>" id="menuMedia">
                                <ul class="nav flex-column">
                                    <li class="nav-item">
                                        <a class="nav-link <?php echo $seg1 == 'video' ? 'active' : ''; ?>"
                                           href="<?php echo base_url('video'); ?>">
                                            <i class="bi bi-camera-video-fill"></i>
                                            <span>Video</span>
                                        </a>
                                    </li>
                                    <li class="nav-item">
                                        <a class="nav-link <?php echo $seg1 == 'berita' ? 'active' : ''; ?>"
                                           href="<?php echo base_url('berita'); ?>">
                                            <i class="bi bi-newspaper"></i>
                                            <span>Berita</span>
                                            <?php if (is_admin() && isset($count_berita_baru) && $count_berita_baru > 0): ?>
                                            <span class="sb-badge sb-badge-info"><?php echo $count_berita_baru; ?></span>
                                            <?php endif; ?>
                                        </a>
                                    </li>
                                </ul>
                            </div>
                        </li>

                    </ul>
                </div>
            </li>

            <!-- ══════════════════════════════════
                 6. ASPIRASI & PARTISIPASI
            ══════════════════════════════════ -->
            <?php
            $aspirasi_segs = ['saran','pengaduan','polling'];
            $aspirasi_aktif = seg_in($aspirasi_segs);
            $show_aspirasi  = (can('saran','view') || can('pengaduan','view') || true);
            ?>
            <?php if ($show_aspirasi): ?>
            <li class="nav-item">
                <a class="nav-link <?php echo $aspirasi_aktif ? 'active' : ''; ?>"
                   href="#menuAspirasi"
                   data-bs-toggle="collapse"
                   aria-expanded="<?php echo $aspirasi_aktif ? 'true' : 'false'; ?>">
                    <i class="bi bi-chat-dots-fill"></i>
                    <span>Aspirasi &amp; Partisipasi</span>
                    <?php
                    $total_notif = 0;
                    if (is_admin()) {
                        if (isset($unread_saran)    && $unread_saran    > 0) $total_notif += $unread_saran;
                        if (isset($unread_pengaduan) && $unread_pengaduan > 0) $total_notif += $unread_pengaduan;
                    }
                    if ($total_notif > 0): ?>
                    <span class="sb-badge sb-badge-danger"><?php echo $total_notif; ?></span>
                    <?php endif; ?>
                    <i class="bi bi-chevron-down chevron"></i>
                </a>
                <div class="collapse <?php echo $aspirasi_aktif ? 'show' : ''; ?>" id="menuAspirasi">
                    <ul class="nav flex-column">

                        <?php if (can('saran','view')): ?>
                        <li class="nav-item">
                            <a class="nav-link <?php echo $seg1 == 'saran' ? 'active' : ''; ?>"
                               href="<?php echo base_url('saran'); ?>">
                                <i class="bi bi-chat-dots-fill"></i>
                                <span>Saran &amp; Kritik</span>
                                <?php if (is_admin() && isset($unread_saran) && $unread_saran > 0): ?>
                                <span class="sb-badge sb-badge-danger"><?php echo $unread_saran; ?></span>
                                <?php endif; ?>
                            </a>
                        </li>
                        <?php endif; ?>

                        <li class="nav-item">
                            <a class="nav-link <?php echo $seg1 == 'pengaduan' ? 'active' : ''; ?>"
                               href="<?php echo base_url('pengaduan'); ?>">
                                <i class="bi bi-exclamation-circle-fill"></i>
                                <span>Pengaduan</span>
                                <?php if (is_admin() && isset($unread_pengaduan) && $unread_pengaduan > 0): ?>
                                <span class="sb-badge sb-badge-danger"><?php echo $unread_pengaduan; ?></span>
                                <?php endif; ?>
                            </a>
                        </li>

                        <li class="nav-item">
                            <a class="nav-link <?php echo $seg1 == 'polling' ? 'active' : ''; ?>"
                               href="<?php echo base_url('polling'); ?>">
                                <i class="bi bi-bar-chart-fill"></i>
                                <span>Polling Warga</span>
                                <?php if (is_admin() && isset($count_polling_aktif) && $count_polling_aktif > 0): ?>
                                <span class="sb-badge sb-badge-info"><?php echo $count_polling_aktif; ?></span>
                                <?php endif; ?>
                            </a>
                        </li>

                    </ul>
                </div>
            </li>
            <?php endif; ?>

            <!-- ══════════════════════════════════
                 PENGATURAN
            ══════════════════════════════════ -->
            <div class="sidebar-divider" style="margin-top:8px;"></div>

            <?php if (is_admin()): ?>
            <?php $pengaturan_segs = ['pengaturan','users','roles','profil','reset']; ?>
            <li class="nav-item">
                <a class="nav-link <?php echo seg_in($pengaturan_segs) ? 'active' : ''; ?>"
                   href="#menuPengaturan"
                   data-bs-toggle="collapse"
                   aria-expanded="<?php echo seg_in($pengaturan_segs) ? 'true' : 'false'; ?>">
                    <i class="bi bi-gear-fill"></i>
                    <span>Pengaturan</span>
                    <i class="bi bi-chevron-down chevron"></i>
                </a>
                <div class="collapse <?php echo seg_in($pengaturan_segs) ? 'show' : ''; ?>" id="menuPengaturan">
                    <ul class="nav flex-column">
                        <li class="nav-item">
                            <a class="nav-link <?php echo $seg1 == 'profil' ? 'active' : ''; ?>"
                               href="<?php echo base_url('profil'); ?>">
                                <i class="bi bi-person-circle"></i>
                                <span>Profil Saya</span>
                            </a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link <?php echo $seg1 == 'pengaturan' ? 'active' : ''; ?>"
                               href="<?php echo base_url('pengaturan'); ?>">
                                <i class="bi bi-sliders"></i>
                                <span>Umum</span>
                            </a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link <?php echo $seg1 == 'reset' ? 'active' : ''; ?>"
                               href="<?php echo base_url('reset'); ?>">
                                <i class="bi bi-exclamation-triangle-fill" style="color:#fca5a5;"></i>
                                <span>Reset</span>
                            </a>
                        </li>
                    </ul>
                </div>
            </li>

            <?php else: ?>
            <li class="nav-item">
                <a class="nav-link <?php echo $seg1 == 'profil' ? 'active' : ''; ?>"
                   href="<?php echo base_url('profil'); ?>">
                    <i class="bi bi-person-circle"></i>
                    <span>Profil Saya</span>
                </a>
            </li>
            <?php endif; ?>

            <!-- Logout -->
            <li class="nav-item" style="margin-top:6px;">
                <a class="nav-link logout-link" href="<?php echo base_url('auth/logout'); ?>">
                    <i class="bi bi-box-arrow-right"></i>
                    <span>Keluar</span>
                </a>
            </li>

        </ul>
    </div>
</nav>