<style>
    /* CSS khusus untuk Sidebar Admin */
    .sidebar { width: 250px; height: 100vh; background-color: #2c3e50; color: white; position: fixed; top: 0; left: 0; padding-top: 20px; z-index: 1000; }
    .brand { font-size: 1.2rem; font-weight: bold; padding: 15px 20px; display: block; background: #1a252f; text-align: center; }
    .sidebar a { display: block; padding: 15px 20px; color: #bdc3c7; text-decoration: none; transition: 0.3s; }
    .sidebar a:hover { background-color: #34495e; color: white; }
    .sidebar a i { margin-right: 10px; width: 20px; text-align: center; }
</style>

<div class="sidebar">
    <span class="brand"><i class="fas fa-user-shield"></i> PANEL ADMIN</span>

<div style="background: #273c75; padding: 10px; margin: 15px; border-radius: 5px; text-align: center; font-size: 0.9rem; color: #fff;">
    Periode Aktif: <br> 
    <strong>
    <?php
    // 1. Tahun Pelajaran
    $q_thn = mysqli_query($koneksi, "SELECT tahun_pelajaran FROM tahun_pelajaran WHERE status = 'Aktif' LIMIT 1");
    $thn = mysqli_fetch_array($q_thn);
    echo ($thn['tahun_pelajaran'] ?? 'Belum Set');

    // 2. Ambil semua data semester
    echo " | ";
    $q_sem = mysqli_query($koneksi, "SELECT nama_semester, status FROM semester");
    
    $semester_ketemu = "Belum Set";
    while ($row = mysqli_fetch_array($q_sem)) {
        // Kita bandingkan secara kasar (tanpa mempedulikan spasi)
        if (trim($row['status']) == "Aktif") {
            $semester_ketemu = $row['nama_semester'];
        }
    }
    echo $semester_ketemu;
    ?>
    </strong>
</div>

    <a href="dashboard.php"><i class="fas fa-tachometer-alt"></i> Dashboard</a>
    <a href="data_guru.php"><i class="fas fa-chalkboard-teacher"></i> Data Guru</a>
    <a href="data_siswa.php"><i class="fas fa-user-graduate"></i> Data Siswa</a>
    <a href="set_tahun_ajaran.php"><i class="fas fa-calendar-alt"></i> Tahun Ajaran</a>
    <a href="../logout.php" style="color: #ff7675;"><i class="fas fa-sign-out-alt"></i> Logout</a>
</div>