<?php
session_start();
require_once 'config/database.php';
require_once 'includes/sidebar_layout.php';
require_once 'includes/site_settings.php';
if(!isset($_SESSION['user_id'])){require_once __DIR__.'/public_home.php';exit();}
$system_name=get_system_name($pdo);$settings=get_all_settings($pdo);$site_name=$settings['site_name']??'বিদ্যা নিকেতন';
$user_role=$_SESSION['user_role'];$user_name=$_SESSION['user_name']??$_SESSION['username']??'User';
try{$s=$pdo->query("SHOW TABLES LIKE 'visits'");if($s->rowCount()==0)$pdo->exec("CREATE TABLE IF NOT EXISTS visits(id INT AUTO_INCREMENT PRIMARY KEY,user_id INT NULL,ip VARCHAR(45) NULL,user_agent VARCHAR(255) NULL,visited_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP)ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;");
$ip=$_SERVER['REMOTE_ADDR']??null;$ua=substr($_SERVER['HTTP_USER_AGENT']??'',0,255);$ins=$pdo->prepare("INSERT INTO visits(user_id,ip,user_agent)VALUES(?,?,?)");$ins->execute([$_SESSION['user_id'],$ip,$ua]);
$visitor_total=(int)$pdo->query("SELECT COUNT(*)FROM visits")->fetchColumn();$visitor_today=(int)$pdo->query("SELECT COUNT(*)FROM visits WHERE DATE(visited_at)=CURDATE()")->fetchColumn();$visitor_unique_today=(int)$pdo->query("SELECT COUNT(DISTINCT ip)FROM visits WHERE DATE(visited_at)=CURDATE()")->fetchColumn();}catch(Exception$e){$visitor_total=$visitor_today=$visitor_unique_today=0;}
$stats=[];$s=$pdo->prepare("SELECT COUNT(*)total_students,SUM(CASE WHEN status='active' THEN 1 ELSE 0 END)active_students,SUM(CASE WHEN gender='male' THEN 1 ELSE 0 END)male_students,SUM(CASE WHEN gender='female' THEN 1 ELSE 0 END)female_students FROM students");$s->execute();$stats['students']=$s->fetch();
$s=$pdo->prepare("SELECT COUNT(*)total_teachers,SUM(CASE WHEN status='active' THEN 1 ELSE 0 END)active_teachers,AVG(experience_years)avg_experience FROM teachers");$s->execute();$stats['teachers']=$s->fetch();
$s=$pdo->prepare("SELECT COUNT(*)total_classes,SUM(capacity)total_capacity FROM classes WHERE status='active'");$s->execute();$stats['classes']=$s->fetch();
$s=$pdo->prepare("SELECT COUNT(*)total_fees,SUM(amount)total_amount,SUM(paid_amount)total_paid,SUM(CASE WHEN status='paid' THEN 1 ELSE 0 END)paid_fees,SUM(CASE WHEN status='pending' THEN 1 ELSE 0 END)pending_fees,SUM(CASE WHEN status='overdue' THEN 1 ELSE 0 END)overdue_fees FROM fees");$s->execute();$stats['fees']=$s->fetch();
$s=$pdo->prepare("SELECT COUNT(*)total_attendance,SUM(CASE WHEN status='present' THEN 1 ELSE 0 END)present_count,SUM(CASE WHEN status='absent' THEN 1 ELSE 0 END)absent_count,ROUND((SUM(CASE WHEN status='present' THEN 1 ELSE 0 END)*100.0/COUNT(*)),2)attendance_rate FROM attendance WHERE date>=DATE_SUB(CURDATE(),INTERVAL 30 DAY)");$s->execute();$stats['attendance']=$s->fetch();
$ra=$pdo->prepare("SELECT 'student' type,CONCAT(first_name,' ',last_name)name,created_at date FROM students WHERE created_at>=DATE_SUB(NOW(),INTERVAL 7 DAY)UNION ALL SELECT 'teacher' type,CONCAT(first_name,' ',last_name)name,created_at date FROM teachers WHERE created_at>=DATE_SUB(NOW(),INTERVAL 7 DAY)ORDER BY date DESC LIMIT 10");$ra->execute();$recent_activities=$ra->fetchAll();
$rm=$pdo->prepare("SELECT r.*,s.first_name,s.last_name,sub.name subject_name FROM results r JOIN students s ON r.student_id=s.id JOIN subjects sub ON r.subject_id=sub.id ORDER BY r.created_at DESC LIMIT 5");$rm->execute();$recent_marks=$rm->fetchAll();
$ue=$pdo->prepare("SELECT*FROM exams WHERE exam_date>=CURDATE()ORDER BY exam_date ASC LIMIT 5");$ue->execute();$upcoming_exams=$ue->fetchAll();
try{$bks=$pdo->prepare("SELECT COUNT(*)total_banks FROM bank_accounts WHERE status='active'");$bks->execute();$bank_stats=$bks->fetch();}catch(Exception$e){$bank_stats=['total_banks'=>0];}
try{$pts=$pdo->prepare("SELECT COUNT(*)pending_transactions FROM bank_transactions WHERE status='pending'");$pts->execute();$pending_transactions_stats=$pts->fetch();}catch(Exception$e){$pending_transactions_stats=['pending_transactions'=>0];}
try{$active_msgs=$pdo->query("SELECT * FROM messages WHERE is_active=1 ORDER BY display_order ASC,id ASC LIMIT 4")->fetchAll(PDO::FETCH_ASSOC);}catch(Exception$e){$active_msgs=[];}
$mt_opts=['principal'=>'প্রধান শিক্ষক','headmaster'=>'অধ্যক্ষ','super'=>'সুপার','chairman'=>'সভাপতি'];
?><!DOCTYPE html><html lang="bn"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width,initial-scale=1.0"><title>ড্যাশবোর্ড - <?=htmlspecialchars($system_name)?></title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet"><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" rel="stylesheet"><link href="assets/css/jessoreboard-theme.css" rel="stylesheet"><link href="assets/css/sidebar.css" rel="stylesheet"><link href="assets/css/custom-sidebar.css" rel="stylesheet">
<style>
:root{--g:#006747;--r:#F42A41;--b:#1565c0;--p:#6a1b9a;--o:#e65100;--t:#00838f}
body{background:#edf2f7;font-size:.85rem}
.dc{color:#fff;border-radius:10px;padding:10px 12px;box-shadow:0 3px 12px rgba(0,0,0,.12);transition:.25s;position:relative;overflow:hidden;animation:cf .4s ease-out forwards;cursor:pointer;border:none;margin-bottom:0}
.dc:hover{transform:translateY(-3px);box-shadow:0 8px 22px rgba(0,0,0,.2)}
@keyframes cf{from{opacity:0;transform:translateY(12px)}to{opacity:1;transform:translateY(0)}}
.dc:nth-child(1){animation-delay:.04s}.dc:nth-child(2){animation-delay:.08s}.dc:nth-child(3){animation-delay:.12s}.dc:nth-child(4){animation-delay:.16s}.dc:nth-child(5){animation-delay:.2s}.dc:nth-child(6){animation-delay:.24s}
.c-icon{font-size:1.3rem;opacity:.9;margin-bottom:2px}.c-num{font-size:1.3rem;font-weight:700;line-height:1.1}.c-tit{font-size:.72rem;opacity:.92}.c-sub{font-size:.62rem;opacity:.75;margin-top:1px}
.c-s{background:linear-gradient(135deg,#0d0142,#00a86b)}.c-t{background:linear-gradient(135deg,#c62828,var(--r))}.c-cl{background:linear-gradient(135deg,var(--b),#2196f3)}.c-at{background:linear-gradient(135deg,#2e7d32,#4caf50)}.c-f{background:linear-gradient(135deg,var(--o),#ff9800)}.c-v{background:linear-gradient(135deg,var(--t),#00bcd4)}.c-bk{background:linear-gradient(135deg,#1a237e,#3949ab)}.c-pd{background:linear-gradient(135deg,#880e4f,#e91e63)}.c-ex{background:linear-gradient(135deg,var(--p),#9c27b0)}.c-mk{background:linear-gradient(135deg,#004d40,#009688)}.c-bl{background:linear-gradient(135deg,#827717,#f9a825)}
.wl{background:linear-gradient(135deg,var(--g),#004d35);color:#fff;border-radius:10px;padding:12px 18px;margin-bottom:12px;position:relative;overflow:hidden;border-bottom:3px solid var(--r)}
.wl::before{content:'';position:absolute;top:-40%;left:-20%;width:160%;height:200%;background:radial-gradient(circle,rgba(255,255,255,.07)0%,transparent 65%);animation:fl 7s ease-in-out infinite}
@keyframes fl{0%,100%{transform:translateY(0)}50%{transform:translateY(-12px)}}
.wl h2{font-size:1.15rem;font-weight:700;position:relative;z-index:2;margin-bottom:2px}.wl p{font-size:.76rem;opacity:.9;position:relative;z-index:2;margin:0}
.qa{display:grid;grid-template-columns:repeat(auto-fill,minmax(88px,1fr));gap:7px}
.qa a{display:flex;flex-direction:column;align-items:center;justify-content:center;padding:9px 5px;border-radius:10px;color:#fff;text-decoration:none;font-size:.67rem;font-weight:600;text-align:center;gap:4px;transition:.2s;position:relative;overflow:hidden;border:none}
.qa a i{font-size:1.15rem}.qa a:hover{transform:translateY(-2px);box-shadow:0 5px 14px rgba(0,0,0,.25);color:#fff}
.qa a::before{content:'';position:absolute;top:0;left:-100%;width:100%;height:100%;background:linear-gradient(90deg,transparent,rgba(255,255,255,.15),transparent);transition:left .4s}
.qa a:hover::before{left:100%}.qb{position:absolute;top:4px;right:4px;background:var(--r);color:#fff;border-radius:50%;width:15px;height:15px;font-size:.55rem;display:flex;align-items:center;justify-content:center;font-weight:700;animation:pu 1.5s infinite}
@keyframes pu{0%{box-shadow:0 0 0 0 rgba(244,42,65,.7)}70%{box-shadow:0 0 0 5px rgba(244,42,65,0)}100%{box-shadow:0 0 0 0 rgba(244,42,65,0)}}
.qg{background:linear-gradient(135deg,var(--g),#00a86b)}.qb2{background:linear-gradient(135deg,var(--b),#2196f3)}.qo{background:linear-gradient(135deg,var(--o),#ff9800)}.qr{background:linear-gradient(135deg,#c62828,var(--r))}.qp{background:linear-gradient(135deg,var(--p),#9c27b0)}.qc{background:linear-gradient(135deg,var(--t),#00bcd4)}.qpk{background:linear-gradient(135deg,#880e4f,#e91e63)}.qi{background:linear-gradient(135deg,#283593,#3f51b5)}.qt{background:linear-gradient(135deg,#004d40,#009688)}.ql{background:linear-gradient(135deg,#827717,#c6a700)}
.ic{background:#fff;border-radius:10px;padding:12px;box-shadow:0 2px 10px rgba(0,0,0,.07);margin-bottom:12px;border-top:3px solid var(--g);transition:.2s}
.ic:hover{border-top-color:var(--r)}.ict{font-size:.8rem;font-weight:700;color:#333;margin-bottom:8px;display:flex;align-items:center;gap:6px}
.ai{display:flex;align-items:center;gap:8px;padding:5px 8px;border-radius:8px;margin-bottom:3px;background:#f8f9fa;font-size:.74rem;transition:.2s}
.ai:hover{background:#e8f4fd}.ai-icon{width:26px;height:26px;border-radius:50%;display:flex;align-items:center;justify-content:center;color:#fff;font-size:.65rem;flex-shrink:0;background:linear-gradient(135deg,var(--g),var(--b))}
.pr{width:48px;height:48px}.pr circle{fill:none;stroke-width:5;stroke-linecap:round;transform:rotate(-90deg);transform-origin:50% 50%}.pr .bg{stroke:#e9ecef}.pr .pg{stroke:var(--g);transition:stroke-dasharray .5s}
@media(max-width:575px){.c-icon{font-size:1rem}.c-num{font-size:1rem}.c-tit{font-size:.62rem}.qa{grid-template-columns:repeat(auto-fill,minmax(72px,1fr));gap:5px}.qa a{padding:7px 3px;font-size:.6rem}.qa a i{font-size:.9rem}}
</style></head>
<body>
<?php if(file_exists(__DIR__.'/includes/banner.php'))require_once __DIR__.'/includes/banner.php';?>
<div class="sidebar-container"><?=renderSidebar('index_with_sidebar.php',$user_role,$user_name)?>
<div class="main-content"><div class="content-header"><h1 class="content-title"><i class="fas fa-tachometer-alt me-2"></i>ড্যাশবোর্ড</h1>
<p class="content-breadcrumb"><i class="fas fa-home me-1"></i>হোম / ড্যাশবোর্ড<span class="ms-3 text-muted"><i class="fas fa-clock me-1"></i><?=date('d F Y, l')?></span></p></div>
<button class="sidebar-toggle-float" onclick="toggleSidebar()"><i class="fas fa-bars"></i></button>
<div class="content-body">

<?php if(!empty($active_msgs)):?>
<div class="row g-2 mb-3">
<?php foreach($active_msgs as$am):?>
<div class="col-6 col-md-3">
<div style="background:#fff;border-radius:10px;overflow:hidden;box-shadow:0 2px 10px rgba(0,0,0,.08);border-top:3px solid var(--g);text-align:center">
<?php if($am['photo']):?>
<img src="<?=htmlspecialchars($am['photo'])?>" alt="<?=htmlspecialchars($am['title'])?>" style="width:100%;height:120px;object-fit:cover">
<?php else:?>
<div style="width:100%;height:120px;background:linear-gradient(135deg,var(--g),var(--b));display:flex;align-items:center;justify-content:center"><i class="fas fa-user-tie" style="font-size:2.5rem;color:rgba(255,255,255,.7)"></i></div>
<?php endif;?>
<div style="padding:8px 6px">
<div style="font-size:.78rem;font-weight:700;color:#333;line-height:1.3"><?=htmlspecialchars($am['title'])?></div>
<div style="font-size:.68rem;color:var(--g);font-weight:600;margin-top:2px"><?=$mt_opts[$am['message_type']]??$am['message_type']?></div>
</div>
</div>
</div>
<?php endforeach;?>
</div>
<?php endif;?>

<div class="wl"><h2>স্বাগতম, <?=htmlspecialchars($user_name)?>!</h2><p><?=htmlspecialchars($site_name)?> ম্যানেজমেন্ট সিস্টেমে আপনাকে স্বাগতম</p></div>

<div class="row row-cols-2 row-cols-sm-3 row-cols-md-4 row-cols-lg-6 g-2 mb-3">
<div class="col"><a href="students/list.php" class="text-decoration-none"><div class="dc c-s"><div class="c-icon"><i class="fas fa-user-graduate"></i></div><div class="c-num"><?=$stats['students']['active_students']?:0?></div><div class="c-tit">সক্রিয় ছাত্র-ছাত্রী</div><div class="c-sub">মোট: <?=$stats['students']['total_students']?:0?> জন</div></div></a></div>
<div class="col"><a href="teachers/list.php" class="text-decoration-none"><div class="dc c-t"><div class="c-icon"><i class="fas fa-chalkboard-teacher"></i></div><div class="c-num"><?=$stats['teachers']['active_teachers']?:0?></div><div class="c-tit">সক্রিয় শিক্ষক</div><div class="c-sub">গড়: <?=round($stats['teachers']['avg_experience']?:0,1)?> বছর</div></div></a></div>
<div class="col"><a href="classes/list.php" class="text-decoration-none"><div class="dc c-cl"><div class="c-icon"><i class="fas fa-school"></i></div><div class="c-num"><?=$stats['classes']['total_classes']?:0?></div><div class="c-tit">মোট ক্লাস</div><div class="c-sub">আসন: <?=$stats['classes']['total_capacity']?:0?> টি</div></div></a></div>
<div class="col"><a href="attendance/report.php" class="text-decoration-none"><div class="dc c-at"><div class="c-icon"><i class="fas fa-calendar-check"></i></div><div class="c-num"><?=number_format($stats['attendance']['attendance_rate']?:0,1)?>%</div><div class="c-tit">উপস্থিতির হার</div><div class="c-sub">গত ৩০ দিন</div></div></a></div>
<div class="col"><div class="dc c-v"><div class="c-icon"><i class="fas fa-eye"></i></div><div class="c-num"><?=$visitor_today?></div><div class="c-tit">আজকের ভিজিট</div><div class="c-sub">মোট: <?=$visitor_total?></div></div></div>
<?php if($user_role=='admin'):?><div class="col"><a href="fees/dashboard.php" class="text-decoration-none"><div class="dc c-f"><div class="c-icon"><i class="fas fa-money-bill-wave"></i></div><div class="c-num">৳<?=number_format($stats['fees']['total_paid']?:0)?></div><div class="c-tit">সংগৃহীত ফি</div><div class="c-sub">বকেয়া: <?=$stats['fees']['pending_fees']?:0?> টি</div></div></a></div><?php endif;?>
</div>

<?php if($user_role=='admin'):?><div class="row row-cols-2 row-cols-sm-3 row-cols-lg-5 g-2 mb-3">
<div class="col"><a href="fees/verify_bank_transactions.php" class="text-decoration-none"><div class="dc c-pd"><div class="c-icon"><i class="fas fa-university"></i></div><div class="c-num"><?=$pending_transactions_stats['pending_transactions']?:0?></div><div class="c-tit">পেন্ডিং ট্রানজেকশন</div></div></a></div>
<div class="col"><a href="admin/bank_accounts.php" class="text-decoration-none"><div class="dc c-bk"><div class="c-icon"><i class="fas fa-piggy-bank"></i></div><div class="c-num"><?=$bank_stats['total_banks']?:0?></div><div class="c-tit">ব্যাংক একাউন্ট</div></div></a></div>
<div class="col"><a href="exams/index.php" class="text-decoration-none"><div class="dc c-ex"><div class="c-icon"><i class="fas fa-file-alt"></i></div><div class="c-num"><?=count($upcoming_exams)?></div><div class="c-tit">আসন্ন পরীক্ষা</div></div></a></div>
<div class="col"><a href="marks/entry.php" class="text-decoration-none"><div class="dc c-mk"><div class="c-icon"><i class="fas fa-pen-nib"></i></div><div class="c-num"><?=count($recent_marks)?></div><div class="c-tit">সাম্প্রতিক মার্কস</div></div></a></div>
<div class="col"><a href="reports/bulk_print_marksheets_separate_fourth.php" class="text-decoration-none"><div class="dc c-bl"><div class="c-icon"><i class="fas fa-print"></i></div><div class="c-num"><i class="fas fa-bolt" style="font-size:.85rem"></i></div><div class="c-tit">বাল্ক মার্কশীট</div></div></a></div>
</div><?php endif;?>

<div class="row g-3">
<div class="col-lg-8">
<div class="ic"><div class="ict"><i class="fas fa-bolt text-warning"></i> দ্রুত কার্যক্রম</div><div class="qa">
<a href="students/add.php" class="qg"><i class="fas fa-user-plus"></i>নতুন ভর্তি</a>
<a href="marks/entry.php" class="qb2"><i class="fas fa-edit"></i>মার্কস</a>
<a href="attendance/mark.php" class="qo"><i class="fas fa-clipboard-check"></i>উপস্থিতি</a>
<a href="reports/marksheet.php" class="qr"><i class="fas fa-file-alt"></i>মার্কশীট</a>
<a href="reports/custom_draggable_marksheet.php" class="qt"><i class="fas fa-magic"></i>কাস্টম</a>
<a href="students/list.php" class="qp"><i class="fas fa-users"></i>ছাত্র তালিকা</a>
<a href="reports/tabulation_sheet.php" class="qc"><i class="fas fa-table"></i>ট্যাবুলেশন</a>
<a href="certificates/dashboard.php" class="qpk"><i class="fas fa-certificate"></i>প্রত্যয়ন</a>
<a href="certificates/appreciation_certificate.php" class="ql"><i class="fas fa-award"></i>প্রশংসা পত্র</a>
<a href="students/bulk_subject_selection.php" class="qi"><i class="fas fa-list-check"></i>বাল্ক বিষয়</a>
<a href="csv_download.php" class="qt"><i class="fas fa-file-csv"></i>CSV</a>
<a href="fees/my_fees.php" class="qg"><i class="fas fa-money-bill"></i>আমার ফি</a>
<?php if($user_role=='admin'):?>
<a href="admin/messages.php" class="qi"><i class="fas fa-envelope"></i>বার্তা</a>
<a href="fees/student_fees.php" class="qt"><i class="fas fa-hand-holding-usd"></i>ফি সংগ্রহ</a>
<a href="admin/bank_transactions.php" class="qp" style="position:relative"><?=($pending_transactions_stats['pending_transactions']??0)>0?'<span class="qb">'.$pending_transactions_stats['pending_transactions'].'</span>':''?><i class="fas fa-exchange-alt"></i>ব্যাংক</a>
<a href="reports/all_subjects_marksheet.php" class="ql"><i class="fas fa-layer-group"></i>বাল্ক মার্কশীট</a>
<a href="reports/merit_position_pdf.php" class="qc"><i class="fas fa-trophy"></i>মেরিট</a>
<a href="reports/bulk_marksheet_printer.php" class="qr"><i class="fas fa-print"></i>প্রিন্টার</a>
<a href="exams/index.php" class="qr"><i class="fas fa-calendar-alt"></i>পরীক্ষা</a>
<a href="admin/custom_options.php" class="qp"><i class="fas fa-cog"></i>অপশন</a>
<a href="admin/bulk_roll_edit.php" class="qt"><i class="fas fa-sort-numeric-up"></i>বাল্ক রোল</a>
<a href="student_customer_list.php" class="ql"><i class="fas fa-id-card"></i>গ্রাহক</a>
<?php endif;?>
</div></div>

<div class="ic"><div class="ict"><i class="fas fa-venus-mars text-info"></i> ছাত্র-ছাত্রী বিতরণ</div><div class="row text-center g-2">
<?php $tl=max($stats['students']['total_students']?:1,1);$ml=$stats['students']['male_students']?:0;$fl=$stats['students']['female_students']?:0;$mp=round($ml/$tl*100);$fp=round($fl/$tl*100);$md=round($ml/$tl*157);$fd=round($fl/$tl*157);?>
<div class="col-6"><svg class="pr" viewBox="0 0 50 50"><circle class="bg" cx="25" cy="25" r="20"/><circle class="pg" cx="25" cy="25" r="20" stroke="#1976d2" stroke-dasharray="<?=$md?> 157"/></svg><div style="font-size:.74rem;font-weight:600;color:#1976d2"><?=$mp?>%</div><div style="font-size:.66rem;color:#666">ছাত্র (<?=$ml?>)</div></div>
<div class="col-6"><svg class="pr" viewBox="0 0 50 50"><circle class="bg" cx="25" cy="25" r="20"/><circle class="pg" cx="25" cy="25" r="20" stroke="#e91e63" stroke-dasharray="<?=$fd?> 157"/></svg><div style="font-size:.74rem;font-weight:600;color:#e91e63"><?=$fp?>%</div><div style="font-size:.66rem;color:#666">ছাত্রী (<?=$fl?>)</div></div>
</div></div>
</div>

<div class="col-lg-4"><div class="ic" style="height:100%"><div class="ict"><i class="fas fa-history text-success"></i> সাম্প্রতিক<?=!empty($recent_activities)?'<span class="badge ms-auto" style="background:var(--r);font-size:.6rem">'.count($recent_activities).'</span>':''?></div>
<div style="max-height:360px;overflow-y:auto"><?php if(empty($recent_activities)):?><div class="text-center text-muted py-3" style="font-size:.74rem"><i class="fas fa-inbox fa-2x mb-2 d-block"></i>কোন কার্যক্রম নেই</div><?php else:?><?php foreach($recent_activities as$a):?><div class="ai"><div class="ai-icon"><i class="fas fa-<?=$a['type']==='student'?'user-graduate':'chalkboard-teacher'?>"></i></div><div style="flex:1;min-width:0"><div style="font-size:.74rem;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis"><?=htmlspecialchars($a['name'])?></div><div style="font-size:.64rem;color:#888"><?=$a['type']==='student'?'শিক্ষার্থী':'শিক্ষক'?> · <?=date('d/m/Y',strtotime($a['date']))?></div></div></div><?php endforeach;?><?php endif;?>
<?php if(!empty($upcoming_exams)):?><div class="ict mt-3"><i class="fas fa-calendar-alt text-warning"></i> আসন্ন পরীক্ষা</div><?php foreach($upcoming_exams as$ex):?><div class="ai"><div class="ai-icon" style="background:linear-gradient(135deg,var(--p),#9c27b0)"><i class="fas fa-file-alt"></i></div><div style="flex:1;min-width:0"><div style="font-size:.74rem;font-weight:600"><?=htmlspecialchars($ex['name']??$ex['exam_name']??'পরীক্ষা')?></div><div style="font-size:.64rem;color:#888"><?=date('d M Y',strtotime($ex['exam_date']))?></div></div></div><?php endforeach;?><?php endif;?>
</div></div></div>
</div></div></div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script><script src="assets/js/sidebar.js"></script></body></html>