<?php
$CI =& get_instance();
$CI->load->model('Peminjaman_model');
$notif = $CI->Peminjaman_model->notifikasi_h3();
$notif_count = count($notif);
?>

<style>
.sidebar{
    width:240px;
    height:100vh;
    background:linear-gradient(180deg,#1e293b,#0f172a);
    position:fixed;
    left:0;
    top:0;
    color:#fff;
    overflow-y:auto;
}

.sidebar img{
    margin-bottom:10px;
}

.sidebar h3{
    font-size:16px;
    margin:5px 0 0;
}

.sidebar center{
    font-size:13px;
    opacity:.7;
}

.sidebar hr{
    border-color:rgba(255,255,255,.1);
    margin:15px 0;
}

.sidebar a{
    display:flex;
    align-items:center;
    justify-content:space-between;
    padding:12px 18px;
    color:#cbd5e1;
    text-decoration:none;
    font-size:14px;
    transition:.2s;
}

.sidebar a span{
    flex-grow:1;
    margin-left:8px;
}

.sidebar a:hover{
    background:rgba(255,255,255,.08);
    color:#fff;
    padding-left:22px;
}

.sidebar a.active{
    background:linear-gradient(90deg,#0d6efd,#4e73df);
    color:#fff;
}

.sidebar .badge{
    font-size:11px;
}

.sidebar .logout{
    color:#f87171;
}

.topbar{
    background:#fff;
    padding:12px 20px;
    box-shadow:0 4px 12px rgba(0,0,0,.05);
    font-weight:600;
}
</style>

<div class="sidebar">

<center style="padding-top:20px">
<img src="<?= base_url('assets/img/logo-man.png') ?>" width="70">
<h3><?= $this->session->userdata('nama') ?></h3>
<small>Petugas</small>
</center>

<hr>

<a href="<?= base_url('index.php/dashboard')?>"
class="<?= uri_string()=='dashboard'?'active':'' ?>">
🏠 <span>Dashboard</span>
</a>

<a href="<?= base_url('index.php/anggota')?>"
class="<?= uri_string()=='anggota'?'active':'' ?>">
👨‍🎓 <span>Anggota</span>
</a>

<a href="<?= base_url('index.php/kategori')?>"
class="<?= uri_string()=='kategori'?'active':'' ?>">
🗂️ <span>Kategori</span>
</a>

<a href="<?= base_url('index.php/buku')?>"
class="<?= uri_string()=='buku'?'active':'' ?>">
📚 <span>Buku</span>
</a>

<hr>

<a href="<?= base_url('index.php/peminjaman')?>"
class="<?= uri_string()=='peminjaman'?'active':'' ?>">
🔄 <span>Transaksi Peminjaman</span>
</a>

<a href="<?= base_url('index.php/notifikasi')?>"
class="<?= uri_string()=='notifikasi'?'active':'' ?>">
🔔 <span>Notifikasi</span>

<?php if($notif_count>0){ ?>
<span class="badge bg-danger"><?= $notif_count ?></span>
<?php } ?>
</a>

<a href="<?= base_url('index.php/laporan/peminjaman')?>">
📄 <span>Laporan Peminjaman</span>
</a>

<a href="<?= base_url('index.php/pengunjung')?>">
👥 <span>Laporan Pengunjung</span>
</a>

<hr>

<a class="logout" href="<?= base_url('index.php/login/logout')?>">
🚪 <span>Logout</span>
</a>

</div>

<div class="content">

<div class="topbar">
<span id="toggleSidebar" style="cursor:pointer;margin-right:10px">☰</span>
Perpustakaan Digital MAN 2 Sleman
</div>
