<?php
// template-modern.php - قالب مدرن و مینیمال برای دانشگاه

$siteName = 'سامانه مدیریت اساتید';
$institutionName = 'دانشگاه علمی کاربردی';
$pageTitle = 'داشبورد مدیریت';

// ===== داده‌های نمونه =====
$stats = [
    ['title' => 'اساتید', 'value' => '۱۲۴', 'icon' => 'fa-users', 'color' => '#3b82f6'],
    ['title' => 'دروس', 'value' => '۲۴۸', 'icon' => 'fa-book', 'color' => '#8b5cf6'],
    ['title' => 'تراکنش‌ها', 'value' => '۸۹۷', 'icon' => 'fa-credit-card', 'color' => '#10b981'],
    ['title' => 'تیکت‌ها', 'value' => '۱۲', 'icon' => 'fa-ticket', 'color' => '#ef4444'],
];

$menuItems = [
    ['icon' => 'fa-chart-pie', 'label' => 'داشبورد', 'active' => true],
    ['icon' => 'fa-users', 'label' => 'اساتید'],
    ['icon' => 'fa-book', 'label' => 'دروس'],
    ['icon' => 'fa-calendar-check', 'label' => 'جلسات'],
    ['icon' => 'fa-coins', 'label' => 'تراکنش‌ها'],
    ['icon' => 'fa-file-invoice', 'label' => 'گزارش‌ها'],
    ['icon' => 'fa-ticket-alt', 'label' => 'تیکت‌ها', 'badge' => '۳'],
    ['icon' => 'fa-sliders-h', 'label' => 'تنظیمات'],
];

$activities = [
    ['user' => 'دکتر علی رضایی', 'action' => 'درس جدید ثبت کرد', 'time' => '۲ دقیقه پیش'],
    ['user' => 'مریم احمدی', 'action' => 'تراکنش جدید ثبت کرد', 'time' => '۱۵ دقیقه پیش'],
    ['user' => 'دکتر حسین کریمی', 'action' => 'تیکت جدید ارسال کرد', 'time' => '۴۵ دقیقه پیش'],
];
?>
<!DOCTYPE html>
<html lang="fa" dir="rtl">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>پیش‌نمایش | <?= htmlspecialchars($siteName) ?></title>
    <script src="https://cdn.tailwindcss.com"></script>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.0/css/all.min.css">
    <link href="https://fonts.googleapis.com/css2?family=Vazirmatn:wght@300;400;500;600;700;800;900&display=swap" rel="stylesheet">
    <style>
        /* ===== تنظیمات پایه ===== */
        * { margin: 0; padding: 0; box-sizing: border-box; }
        body { 
            font-family: 'Vazirmatn', sans-serif; 
            background: #f1f5f9; 
            min-height: 100vh;
            display: flex;
        }
        
        /* ===== سایدبار ===== */
        .sidebar {
            width: 250px;
            background: #ffffff;
            min-height: 100vh;
            padding: 24px 16px;
            border-left: 1px solid #e9edf4;
            position: fixed;
            right: 0;
            top: 0;
            bottom: 0;
            overflow-y: auto;
            z-index: 100;
            transition: all 0.3s ease;
        }
        .sidebar::-webkit-scrollbar { width: 3px; }
        .sidebar::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 10px; }
        
        .sidebar-brand {
            display: flex;
            align-items: center;
            gap: 12px;
            padding-bottom: 24px;
            border-bottom: 1px solid #e9edf4;
            margin-bottom: 20px;
        }
        .sidebar-brand .logo {
            width: 42px;
            height: 42px;
            background: linear-gradient(135deg, #3b82f6, #8b5cf6);
            border-radius: 12px;
            display: flex;
            align-items: center;
            justify-content: center;
            color: #fff;
            font-size: 18px;
            flex-shrink: 0;
        }
        .sidebar-brand .brand-text h2 {
            font-size: 16px;
            font-weight: 800;
            color: #0f172a;
            margin: 0;
            line-height: 1.2;
        }
        .sidebar-brand .brand-text h2 span { color: #3b82f6; }
        .sidebar-brand .brand-text small {
            font-size: 10px;
            color: #94a3b8;
            display: block;
            margin-top: 2px;
        }
        
        .sidebar .nav-item {
            display: flex;
            align-items: center;
            gap: 12px;
            padding: 10px 14px;
            border-radius: 10px;
            color: #64748b;
            text-decoration: none;
            font-size: 14px;
            font-weight: 500;
            transition: all 0.2s ease;
            cursor: pointer;
            margin: 2px 0;
            position: relative;
        }
        .sidebar .nav-item:hover {
            background: #f1f5f9;
            color: #0f172a;
        }
        .sidebar .nav-item.active {
            background: #eff6ff;
            color: #3b82f6;
            font-weight: 600;
        }
        .sidebar .nav-item.active::before {
            content: '';
            position: absolute;
            right: 0;
            top: 50%;
            transform: translateY(-50%);
            width: 4px;
            height: 24px;
            background: #3b82f6;
            border-radius: 0 4px 4px 0;
        }
        .sidebar .nav-item i { width: 20px; font-size: 15px; text-align: center; }
        .sidebar .nav-item .badge {
            margin-right: auto;
            background: #ef4444;
            color: #fff;
            font-size: 10px;
            padding: 1px 8px;
            border-radius: 12px;
            font-weight: 600;
        }
        
        .sidebar .nav-divider {
            height: 1px;
            background: #e9edf4;
            margin: 12px 0;
        }
        .sidebar .nav-label {
            font-size: 10px;
            font-weight: 700;
            color: #94a3b8;
            text-transform: uppercase;
            letter-spacing: 0.5px;
            padding: 8px 14px 4px;
        }
        
        .sidebar-footer {
            margin-top: 20px;
            padding-top: 16px;
            border-top: 1px solid #e9edf4;
        }
        .sidebar-footer .user-card {
            display: flex;
            align-items: center;
            gap: 12px;
            padding: 10px 14px;
            border-radius: 12px;
            background: #f8fafc;
        }
        .sidebar-footer .user-card .avatar {
            width: 36px;
            height: 36px;
            border-radius: 50%;
            background: linear-gradient(135deg, #3b82f6, #8b5cf6);
            display: flex;
            align-items: center;
            justify-content: center;
            color: #fff;
            font-weight: 700;
            font-size: 14px;
            flex-shrink: 0;
        }
        .sidebar-footer .user-card .info .name {
            font-size: 13px;
            font-weight: 600;
            color: #0f172a;
        }
        .sidebar-footer .user-card .info .role {
            font-size: 11px;
            color: #94a3b8;
        }
        
        /* ===== محتوای اصلی ===== */
        .main {
            margin-right: 250px;
            flex: 1;
            padding: 28px 32px;
            min-height: 100vh;
        }
        
        /* ===== هدر بالا ===== */
        .top-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            margin-bottom: 28px;
        }
        .top-header .page-title h1 {
            font-size: 22px;
            font-weight: 800;
            color: #0f172a;
        }
        .top-header .page-title p {
            font-size: 14px;
            color: #94a3b8;
            margin-top: 2px;
        }
        .top-header .header-actions {
            display: flex;
            align-items: center;
            gap: 16px;
        }
        .top-header .header-actions .icon-btn {
            width: 40px;
            height: 40px;
            border-radius: 50%;
            border: none;
            background: #fff;
            color: #64748b;
            cursor: pointer;
            transition: all 0.2s;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 16px;
            position: relative;
            box-shadow: 0 1px 3px rgba(0,0,0,0.04);
        }
        .top-header .header-actions .icon-btn:hover {
            background: #f1f5f9;
        }
        .top-header .header-actions .icon-btn .dot {
            position: absolute;
            top: 10px;
            right: 10px;
            width: 7px;
            height: 7px;
            background: #ef4444;
            border-radius: 50%;
            border: 2px solid #fff;
        }
        
        .top-header .user-badge {
            display: flex;
            align-items: center;
            gap: 10px;
            background: #fff;
            padding: 6px 14px 6px 6px;
            border-radius: 40px;
            box-shadow: 0 1px 3px rgba(0,0,0,0.04);
            cursor: pointer;
            transition: all 0.2s;
        }
        .top-header .user-badge:hover {
            box-shadow: 0 4px 12px rgba(0,0,0,0.06);
        }
        .top-header .user-badge .avatar {
            width: 32px;
            height: 32px;
            border-radius: 50%;
            background: linear-gradient(135deg, #3b82f6, #8b5cf6);
            display: flex;
            align-items: center;
            justify-content: center;
            color: #fff;
            font-weight: 700;
            font-size: 13px;
        }
        .top-header .user-badge .name {
            font-size: 13px;
            font-weight: 600;
            color: #0f172a;
        }
        .top-header .user-badge .role {
            font-size: 11px;
            color: #94a3b8;
        }
        
        /* ===== کارت‌های آماری ===== */
        .stats-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
            gap: 16px;
            margin-bottom: 28px;
        }
        .stat-card {
            background: #fff;
            border-radius: 14px;
            padding: 18px 20px;
            border: 1px solid #e9edf4;
            transition: all 0.2s;
        }
        .stat-card:hover {
            transform: translateY(-3px);
            box-shadow: 0 8px 30px rgba(0,0,0,0.04);
        }
        .stat-card .top {
            display: flex;
            align-items: center;
            justify-content: space-between;
        }
        .stat-card .top .icon {
            width: 42px;
            height: 42px;
            border-radius: 12px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 18px;
            color: #fff;
        }
        .stat-card .top .change {
            font-size: 12px;
            font-weight: 600;
            color: #10b981;
            background: #ecfdf5;
            padding: 2px 10px;
            border-radius: 20px;
        }
        .stat-card .value {
            font-size: 26px;
            font-weight: 800;
            color: #0f172a;
            margin-top: 8px;
        }
        .stat-card .title {
            font-size: 13px;
            color: #94a3b8;
            font-weight: 500;
        }
        
        /* ===== بخش دو ستونی ===== */
        .two-col {
            display: grid;
            grid-template-columns: 2fr 1fr;
            gap: 24px;
            margin-bottom: 28px;
        }
        .card {
            background: #fff;
            border-radius: 14px;
            padding: 20px 22px;
            border: 1px solid #e9edf4;
        }
        .card .card-title {
            font-size: 15px;
            font-weight: 700;
            color: #0f172a;
            margin-bottom: 16px;
            display: flex;
            align-items: center;
            gap: 8px;
        }
        .card .card-title i { color: #3b82f6; }
        
        /* ===== لیست فعالیت‌ها ===== */
        .activity-item {
            display: flex;
            align-items: center;
            gap: 12px;
            padding: 10px 0;
            border-bottom: 1px solid #f1f5f9;
        }
        .activity-item:last-child { border-bottom: none; }
        .activity-item .dot {
            width: 8px;
            height: 8px;
            border-radius: 50%;
            flex-shrink: 0;
        }
        .activity-item .dot.blue { background: #3b82f6; }
        .activity-item .dot.green { background: #10b981; }
        .activity-item .dot.purple { background: #8b5cf6; }
        .activity-item .text { flex: 1; font-size: 13px; color: #0f172a; }
        .activity-item .text strong { font-weight: 600; }
        .activity-item .time { font-size: 12px; color: #94a3b8; }
        
        /* ===== لیست کارها ===== */
        .task-item {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 8px 0;
            border-bottom: 1px solid #f1f5f9;
        }
        .task-item:last-child { border-bottom: none; }
        .task-item .info { display: flex; align-items: center; gap: 10px; }
        .task-item .info .circle {
            width: 6px;
            height: 6px;
            border-radius: 50%;
            flex-shrink: 0;
        }
        .task-item .info .circle.red { background: #ef4444; }
        .task-item .info .circle.yellow { background: #eab308; }
        .task-item .info .text { font-size: 13px; color: #0f172a; }
        .task-item .count {
            font-size: 13px;
            font-weight: 600;
            color: #64748b;
            background: #f1f5f9;
            padding: 0 12px;
            border-radius: 12px;
        }
        .task-item .count.urgent { background: #fef2f2; color: #ef4444; }
        
        /* ===== دکمه‌ها ===== */
        .btn {
            padding: 9px 20px;
            border: none;
            border-radius: 10px;
            font-size: 13px;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.2s;
            display: inline-flex;
            align-items: center;
            gap: 8px;
            font-family: 'Vazirmatn', sans-serif;
        }
        .btn-primary { background: #3b82f6; color: #fff; }
        .btn-primary:hover { background: #2563eb; transform: translateY(-1px); box-shadow: 0 4px 16px rgba(59,130,246,0.25); }
        .btn-success { background: #10b981; color: #fff; }
        .btn-success:hover { background: #059669; transform: translateY(-1px); }
        .btn-outline { background: transparent; color: #64748b; border: 1.5px solid #e2e8f0; }
        .btn-outline:hover { background: #f1f5f9; }
        .btn-danger { background: #ef4444; color: #fff; }
        .btn-danger:hover { background: #dc2626; transform: translateY(-1px); }
        
        .btn-group { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; padding-top: 16px; border-top: 1px solid #e9edf4; }
        
        /* ===== فوتر ===== */
        .footer {
            margin-top: 28px;
            padding: 14px 20px;
            background: #fff;
            border-radius: 12px;
            border: 1px solid #e9edf4;
            text-align: center;
            font-size: 12px;
            color: #94a3b8;
        }
        .footer span { color: #3b82f6; font-weight: 500; }
        
        /* ===== واکنش‌گرایی ===== */
        @media (max-width: 1024px) {
            .two-col { grid-template-columns: 1fr; }
        }
        @media (max-width: 768px) {
            .sidebar {
                transform: translateX(100%);
                width: 280px;
            }
            .sidebar.open { transform: translateX(0); }
            .main { margin-right: 0; padding: 16px; }
            .stats-grid { grid-template-columns: repeat(2, 1fr); }
            .top-header { flex-direction: column; align-items: flex-start; gap: 12px; }
            .top-header .header-actions { width: 100%; justify-content: space-between; }
            .hamburger { display: block !important; }
        }
        .hamburger {
            display: none;
            background: none;
            border: none;
            font-size: 20px;
            color: #0f172a;
            cursor: pointer;
            padding: 4px;
        }
        .badge-preview {
            background: #fef3c7;
            color: #92400e;
            font-size: 10px;
            font-weight: 700;
            padding: 2px 12px;
            border-radius: 12px;
            display: inline-block;
        }
    </style>
</head>
<body>

<!-- ===== سایدبار ===== -->
<div class="sidebar" id="sidebar">
    <div class="sidebar-brand">
        <div class="logo"><i class="fas fa-graduation-cap"></i></div>
        <div class="brand-text">
            <h2>سامانه <span>اساتید</span></h2>
            <small>دانشگاه علمی کاربردی</small>
        </div>
    </div>
    
    <div class="nav-label">منوی اصلی</div>
    <?php foreach ($menuItems as $item): ?>
    <div class="nav-item <?= isset($item['active']) ? 'active' : '' ?>">
        <i class="fas <?= $item['icon'] ?>"></i>
        <?= $item['label'] ?>
        <?php if (isset($item['badge'])): ?>
            <span class="badge"><?= $item['badge'] ?></span>
        <?php endif; ?>
    </div>
    <?php endforeach; ?>
    
    <div class="nav-divider"></div>
    
    <div class="nav-label">سیستم</div>
    <div class="nav-item" style="color:#ef4444;">
        <i class="fas fa-sign-out-alt"></i> خروج
    </div>
    
    <div class="sidebar-footer">
        <div class="user-card">
            <div class="avatar">م</div>
            <div class="info">
                <div class="name">مدیر سیستم</div>
                <div class="role">مدیر سامانه</div>
            </div>
        </div>
    </div>
</div>

<!-- ===== محتوای اصلی ===== -->
<div class="main">

    <!-- ===== هدر ===== -->
    <div class="top-header">
        <div class="page-title">
            <div style="display:flex;align-items:center;gap:10px;margin-bottom:2px;">
                <button class="hamburger" onclick="document.getElementById('sidebar').classList.toggle('open')">
                    <i class="fas fa-bars"></i>
                </button>
                <h1><?= $pageTitle ?></h1>
                <span class="badge-preview">✨ پیش‌نمایش</span>
            </div>
            <p>مدیریت جامع اساتید و دروس</p>
        </div>
        <div class="header-actions">
            <button class="icon-btn"><i class="far fa-bell"></i><span class="dot"></span></button>
            <button class="icon-btn"><i class="far fa-envelope"></i></button>
            <div class="user-badge">
                <div class="avatar">م</div>
                <div>
                    <div class="name">مدیر سیستم</div>
                    <div class="role">مدیر</div>
                </div>
            </div>
        </div>
    </div>

    <!-- ===== کارت‌های آماری ===== -->
    <div class="stats-grid">
        <?php foreach ($stats as $stat): ?>
        <div class="stat-card">
            <div class="top">
                <div class="icon" style="background:<?= $stat['color'] ?>;">
                    <i class="fas <?= $stat['icon'] ?>"></i>
                </div>
                <span class="change">▲ ۸٪</span>
            </div>
            <div class="value"><?= $stat['value'] ?></div>
            <div class="title"><?= $stat['title'] ?></div>
        </div>
        <?php endforeach; ?>
    </div>

    <!-- ===== بخش دو ستونی ===== -->
    <div class="two-col">
        
        <!-- ===== فعالیت‌ها ===== -->
        <div class="card">
            <div class="card-title"><i class="fas fa-clock"></i> آخرین فعالیت‌ها</div>
            <?php foreach ($activities as $activity): ?>
            <div class="activity-item">
                <span class="dot <?= ['blue','green','purple'][rand(0,2)] ?>"></span>
                <span class="text"><strong><?= $activity['user'] ?></strong> <?= $activity['action'] ?></span>
                <span class="time"><?= $activity['time'] ?></span>
            </div>
            <?php endforeach; ?>
            <button class="btn btn-outline" style="width:100%;justify-content:center;margin-top:12px;">
                مشاهده همه
            </button>
        </div>

        <!-- ===== کارها ===== -->
        <div class="card">
            <div class="card-title"><i class="fas fa-tasks"></i> کارهای در انتظار</div>
            <div class="task-item">
                <div class="info">
                    <span class="circle red"></span>
                    <span class="text">تأیید شماره شبا</span>
                </div>
                <span class="count urgent">۸</span>
            </div>
            <div class="task-item">
                <div class="info">
                    <span class="circle yellow"></span>
                    <span class="text">بررسی دروس بدون جلسه</span>
                </div>
                <span class="count">۱۵</span>
            </div>
            <div class="task-item">
                <div class="info">
                    <span class="circle red"></span>
                    <span class="text">پاسخ به تیکت‌ها</span>
                </div>
                <span class="count urgent">۵</span>
            </div>
            <div class="task-item">
                <div class="info">
                    <span class="circle yellow"></span>
                    <span class="text">بروزرسانی اطلاعات مدرسین</span>
                </div>
                <span class="count">۱۲</span>
            </div>
            
            <div class="btn-group">
                <button class="btn btn-primary"><i class="fas fa-check"></i> تأیید همه</button>
                <button class="btn btn-success"><i class="fas fa-file-export"></i> خروجی</button>
                <button class="btn btn-outline"><i class="fas fa-print"></i> چاپ</button>
            </div>
        </div>
    </div>

    <!-- ===== دکمه‌های نمونه ===== -->
    <div style="display:flex;flex-wrap:wrap;gap:10px;margin-top:8px;">
        <button class="btn btn-primary"><i class="fas fa-plus"></i> افزودن جدید</button>
        <button class="btn btn-success"><i class="fas fa-file-excel"></i> خروجی اکسل</button>
        <button class="btn btn-danger"><i class="fas fa-file-pdf"></i> خروجی PDF</button>
        <button class="btn btn-outline"><i class="fas fa-download"></i> دانلود</button>
    </div>

    <!-- ===== فوتر ===== -->
    <div class="footer">
        <i class="fas fa-shield-alt" style="color:#3b82f6;margin-left:6px;"></i>
        تمامی حقوق محفوظ است <span>دانشگاه علمی کاربردی</span>
        <span style="color:#cbd5e1;"> | </span>
        توسعه: <span>تیم فناوری</span>
        <span style="color:#cbd5e1;"> | </span>
        <?= date('Y') ?>
    </div>

</div>

</body>
</html>