<?php 
// To get the filename for active state management
if (!isset($current_page)) {
    $current_page = basename($_SERVER['PHP_SELF'], '.php');
}
?>
<div class="sidebar" id="sidebarMenu">
    
    <div class="sidebar-header border-bottom border-white border-opacity-10 py-4 mb-3 text-center">
        <h4 class="fw-bold mb-0 text-white" style="letter-spacing: 1px;">
            <i class="fas fa-user-shield me-2" style="color: var(--accent);"></i> Admin Panel
        </h4>
        <small class="text-white-50 fw-semibold text-uppercase tracking-widest mt-1 d-block" style="font-size: 10px; color: var(--accent) !important;">
            Ahmad Academy
        </small>
    </div>
    
    <nav class="mt-2 pb-5 custom-scrollbar" style="overflow-y: auto; height: calc(100vh - 100px); overflow-x: hidden;">
        
        <small class="px-4 mb-2 d-block fw-bold text-uppercase" style="font-size: 10px; color: var(--accent); letter-spacing: 1px;">Core Analytics</small>
        
        <a href="dashboard" class="<?= ($current_page == 'dashboard' || $current_page == 'index') ? 'active' : '' ?>">
            <i class="fas fa-th-large"></i> Dashboard Overview
        </a>

        <hr class="mx-4 my-3 bg-white opacity-25">
        
        <small class="px-4 mb-2 d-block fw-bold text-uppercase" style="font-size: 10px; color: var(--accent); letter-spacing: 1px;">User Management</small>

        <a href="students" class="<?= (in_array($current_page, ['students', 'view_student', 'edit_student'])) ? 'active' : '' ?>">
            <i class="fas fa-users"></i> Student Management
        </a>

        <a href="manage_teachers" class="<?= (in_array($current_page, ['manage_teachers', 'add_teacher', 'edit_teacher'])) ? 'active' : '' ?>">
            <i class="fas fa-chalkboard-teacher"></i> Teacher Management
        </a>

        <a href="view_admissions.php" class="<?= ($current_page == 'view_admissions') ? 'active' : '' ?>">
            <i class="fas fa-user-clock"></i> Admission Requests
        </a>

        <a href="manage_enrollments" class="<?= ($current_page == 'manage_enrollments') ? 'active' : '' ?>">
            <i class="fas fa-user-check"></i> Course Enrollments
        </a>

        <hr class="mx-4 my-3 bg-white opacity-25">

        <small class="px-4 mb-2 d-block fw-bold text-uppercase" style="font-size: 10px; color: var(--accent); letter-spacing: 1px;">Academics & Content</small>

        <a href="manage_courses" class="<?= (in_array($current_page, ['manage_courses', 'add_course', 'edit_course'])) ? 'active' : '' ?>">
            <i class="fas fa-book-medical"></i> Course Management
        </a>

        <a href="manage_content" class="<?= ($current_page == 'manage_content') ? 'active' : '' ?>">
            <i class="fas fa-layer-group text-info"></i> Course Curriculum
        </a>

        <a href="manage_classes" class="<?= (in_array($current_page, ['manage_classes', 'add_class', 'edit_class'])) ? 'active' : '' ?>">
            <i class="fas fa-video"></i> Live Classes & Links
        </a>

        <a href="manage_hifz" class="<?= ($current_page == 'manage_hifz') ? 'active' : '' ?>">
            <i class="fas fa-quran text-white"></i> Hifz Management
        </a>

        <a href="manage_assignments" class="<?= (in_array($current_page, ['manage_assignments', 'view_submissions'])) ? 'active' : '' ?>">
            <i class="fas fa-tasks text-warning"></i> Assignments Desk
        </a>

        <a href="mark_attendance" class="<?= ($current_page == 'mark_attendance' || $current_page == 'view_attendance') ? 'active' : '' ?>">
            <i class="fas fa-clipboard-check text-success"></i> Mark Attendance
        </a>

        <a href="manage_notices" class="<?= (in_array($current_page, ['manage_notices', 'add_notice', 'edit_notice'])) ? 'active' : '' ?>">
            <i class="fas fa-bullhorn text-white"></i> Manage Notices
        </a>

        <hr class="mx-4 my-3 bg-white opacity-25">

        <small class="px-4 mb-2 d-block fw-bold text-uppercase" style="font-size: 10px; color: var(--accent); letter-spacing: 1px;">Performance & Support</small>

        <a href="manage_exams" class="<?= (in_array($current_page, ['manage_exams', 'add_exam', 'add_questions', 'edit_exam'])) ? 'active' : '' ?>">
            <i class="fas fa-file-signature"></i> Online Exams
        </a>

        <a href="add_feedback" class="<?= ($current_page == 'add_feedback') ? 'active' : '' ?>">
            <i class="fas fa-comment-medical text-warning"></i> Mentorship & Feedback
        </a>

        <a href="messages" class="<?= ($current_page == 'messages') ? 'active' : '' ?>">
            <i class="fas fa-comments text-info"></i> Help Desk & Messages
        </a>

        <a href="manage_results" class="<?= (in_array($current_page, ['manage_results', 'add_result', 'edit_result'])) ? 'active' : '' ?>">
            <i class="fas fa-certificate"></i> Manage Certificates
        </a>

        <hr class="mx-4 my-3 bg-white opacity-25">

        <small class="px-4 mb-2 d-block fw-bold text-uppercase" style="font-size: 10px; color: var(--accent); letter-spacing: 1px;">System Configuration</small>
        
        <a href="manage_team" class="<?= (in_array($current_page, ['manage_team', 'add_team_member', 'edit_team_member'])) ? 'active' : '' ?>">
    <i class="fas fa-users-cog text-info"></i> Manage Team (Website)
</a>

        <a href="settings" class="<?= ($current_page == 'settings') ? 'active' : '' ?>">
            <i class="fas fa-cogs"></i> Website CMS & Settings
        </a>

        <div class="mt-4 mb-4">
            <hr class="mx-4 bg-white opacity-25">
            <a href="logout" class="text-danger fw-bold logout-btn">
                <i class="fas fa-sign-out-alt"></i> Logout
            </a>
        </div>
    </nav>
</div>

<style>
    /* Sidebar Styles (আগের মতোই থাকবে) */
    .custom-scrollbar::-webkit-scrollbar { width: 4px; }
    .custom-scrollbar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 10px; }
    .sidebar nav a {
        display: flex; align-items: center; padding: 13px 20px;
        color: rgba(255, 255, 255, 0.7); text-decoration: none;
        transition: 0.3s; border-left: 3px solid transparent; font-size: 14px;
    }
    .sidebar nav a:hover { background: rgba(255, 255, 255, 0.03); color: #fff; padding-left: 25px; }
    .sidebar nav a.active {
        background: linear-gradient(90deg, rgba(212, 175, 55, 0.1) 0%, transparent 100%);
        color: var(--accent); border-left-color: var(--accent); font-weight: 700;
    }
    .sidebar nav a i { width: 25px; text-align: center; margin-right: 12px; opacity: 0.8; }
</style>