<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <!-- Tambahkan link CSS Bootstrap di sini agar tampilan tidak berantakan -->
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
    <style>
        .sidebar { width: 250px; position: fixed; height: 100%; padding: 20px; background: #f8f9fa; }
        .sidebar a { display: block; padding: 10px; text-decoration: none; color: #333; }
        .main-content { margin-left: 270px; padding: 20px; }
    </style>
</head>
<body>
<div class="sidebar">
    <a href="dashboard.php">Dashboard</a>
    <a href="tujuan_pembelajaran.php">Input Data TP</a>
    <a href="input_nilai.php">Input Nilai</a>
    
    <?php
    // Logika Sidebar: Hanya muncul jika guru adalah pembina ekskul
    $id_guru_login = $_SESSION['id_guru'] ?? '';
    // Query untuk cek apakah guru memegang minimal 1 ekskul
    $q_cek = mysqli_query($koneksi, "SELECT id_ekskul FROM ekstrakurikuler WHERE id_guru = '$id_guru_login'");
    
    if ($q_cek && mysqli_num_rows($q_cek) > 0) {
        echo '<a href="input_nilai_ekskul.php">Input Nilai Ekskul</a>';
    }
    ?>

    <a href="absensi_siswa.php">Absensi</a>
    <a href="leger.php">Leger Rapor</a>
    <a href="../logout.php" style="color: #ff7675; margin-top: 20px;">Keluar</a>
</div>