<!DOCTYPE html>
<html lang="ar" dir="rtl">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title><?php echo $__env->yieldContent('title', 'نظام مراسلات'); ?></title>
  <link href="https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;500;600;700;900&display=swap" rel="stylesheet">
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/line-awesome/1.3.0/line-awesome/css/line-awesome.min.css">
  <style>
    *,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
    :root{
      --bg:#f0f3f8;--white:#ffffff;
      --sidebar-w:240px;--header-h:58px;
      --teal:#00b09b;--teal-dk:#008f7a;--teal-lt:rgba(0,176,155,.10);
      --blue:#1a8fff;--gold:#f5a623;--red:#e74c3c;--purple:#7c6fcd;--green:#28d094;
      --text:#2c3e50;--text-mid:#546e7a;--muted:#90a4ae;
      --border:#e0e7ef;--sh:0 2px 10px rgba(0,0,0,.07);--sh-md:0 4px 20px rgba(0,0,0,.09);
    }
    html,body{height:100%;font-family:'Cairo',sans-serif;background:var(--bg);color:var(--text);direction:rtl;overflow-x:hidden}
    ::-webkit-scrollbar{width:5px}::-webkit-scrollbar-track{background:var(--bg)}::-webkit-scrollbar-thumb{background:#cdd5e0;border-radius:10px}
    .app-shell{display:flex;min-height:100vh}

    /* SIDEBAR */
    .sidebar{width:var(--sidebar-w);min-height:100vh;background:var(--white);border-left:1px solid var(--border);display:flex;flex-direction:column;position:fixed;top:0;right:0;z-index:200;box-shadow:2px 0 12px rgba(0,0,0,.05);transition:transform .3s}
    .sb-brand{height:var(--header-h);display:flex;align-items:center;gap:10px;padding:0 18px;border-bottom:1px solid var(--border);flex-shrink:0}
    .sb-icon{width:36px;height:36px;background:linear-gradient(135deg,var(--teal),var(--teal-dk));border-radius:9px;display:flex;align-items:center;justify-content:center;font-size:17px;box-shadow:0 3px 10px rgba(0,176,155,.3)}
    .sb-name{font-size:17px;font-weight:900;color:var(--text)}.sb-name span{color:var(--teal)}
    .sb-nav{flex:1;padding:8px 0;overflow-y:auto}
    .nav-sep{font-size:10px;font-weight:700;letter-spacing:1.5px;color:var(--muted);padding:14px 18px 4px;text-transform:uppercase}
    .nav-item{list-style:none}
    .nav-link{display:flex;align-items:center;gap:9px;padding:9px 16px;color:var(--text-mid);text-decoration:none;font-size:13px;font-weight:500;border-radius:9px;margin:2px 8px;transition:background .16s,color .16s,padding-right .16s;position:relative;cursor:pointer}
    .nav-link i{font-size:17px;width:20px;text-align:center;color:var(--muted);flex-shrink:0;transition:color .16s}
    .nav-link:hover{background:var(--bg);color:var(--teal);padding-right:20px}
    .nav-link:hover i{color:var(--teal)}
    .nav-link.active{background:var(--teal-lt);color:var(--teal);font-weight:700}
    .nav-link.active i{color:var(--teal)}
    .nav-link.active::before{content:'';position:absolute;right:0;top:20%;height:60%;width:3px;background:var(--teal);border-radius:10px 0 0 10px}
    .nbadge{margin-right:auto;background:var(--teal);color:#fff;font-size:10px;font-weight:800;padding:2px 7px;border-radius:20px;min-width:20px;text-align:center}
    .nbadge.r{background:var(--red)}.nbadge.g{background:var(--gold);color:#333}
    .has-sub>.nav-link::after{content:'\f107';font-family:'Line Awesome Free';font-weight:900;margin-right:auto;font-size:13px;color:var(--muted);transition:transform .2s}
    .has-sub.open>.nav-link::after{transform:rotate(180deg)}
    .submenu{display:none}
    .has-sub.open .submenu{display:block}
    .submenu .nav-link{font-size:12.5px;padding:8px 16px;margin-right:26px;color:var(--muted)}
    .submenu .nav-link::before{display:none!important}
    .submenu .nav-link i{font-size:13px}

    /* HEADER */
    .header{position:fixed;top:0;right:var(--sidebar-w);left:0;height:var(--header-h);background:var(--white);border-bottom:1px solid var(--border);display:flex;align-items:center;justify-content:space-between;padding:0 20px;z-index:100;box-shadow:var(--sh)}
    .hdr-l{display:flex;align-items:center;gap:12px}
    .hdr-r{display:flex;align-items:center;gap:8px}
    .ibtn{width:34px;height:34px;background:var(--bg);border:1px solid var(--border);border-radius:8px;display:flex;align-items:center;justify-content:center;color:var(--muted);cursor:pointer;font-size:15px;transition:background .16s,color .16s,border-color .16s;text-decoration:none}
    .ibtn:hover{background:var(--teal-lt);color:var(--teal);border-color:rgba(0,176,155,.3)}
    .hdr-date{font-size:12px;color:var(--muted);display:flex;align-items:center;gap:5px}
    .notif-w{position:relative}
    .ndot{position:absolute;top:6px;left:6px;width:7px;height:7px;background:var(--red);border-radius:50%;border:2px solid #fff}
    .upill{position:relative}
    .ubtn{display:flex;align-items:center;gap:8px;padding:5px 10px 5px 8px;background:var(--bg);border:1px solid var(--border);border-radius:10px;cursor:pointer;transition:background .16s}
    .ubtn:hover{background:#e8ecf4}
    .uavatar{width:30px;height:30px;border-radius:50%;background:linear-gradient(135deg,var(--teal),var(--teal-dk));display:flex;align-items:center;justify-content:center;font-size:12px;font-weight:700;color:#fff}
    .uname{font-size:12.5px;font-weight:700;color:var(--text)}
    .urole{font-size:10.5px;color:var(--muted)}
    .uddrop{position:absolute;top:calc(100% + 6px);left:0;background:var(--white);border:1px solid var(--border);border-radius:10px;width:190px;box-shadow:var(--sh-md);overflow:hidden;display:none;z-index:500;animation:dropIn .18s ease}
    @keyframes dropIn{from{opacity:0;transform:translateY(-6px)}to{opacity:1;transform:translateY(0)}}
    .upill.open .uddrop{display:block}
    .dditem{display:flex;align-items:center;gap:9px;padding:10px 14px;color:var(--text-mid);text-decoration:none;font-size:12.5px;font-weight:500;transition:background .14s}
    .dditem:hover{background:var(--bg)}
    .dditem i{font-size:15px;color:var(--muted)}
    .ddsep{height:1px;background:var(--border);margin:3px 0}
    .dditem.danger{color:var(--red)}.dditem.danger i{color:var(--red)}.dditem.danger:hover{background:rgba(231,76,60,.07)}

    /* MAIN */
    .main{margin-right:var(--sidebar-w);margin-top:var(--header-h);flex:1;display:flex;flex-direction:column;min-height:calc(100vh - var(--header-h))}
    .content{flex:1;padding:22px 22px 0;animation:fadeUp .35s ease both}
    @keyframes fadeUp{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:translateY(0)}}
    .alert{border-radius:10px;padding:12px 15px;font-size:13px;margin-bottom:16px;display:flex;align-items:flex-start;gap:9px}
    .alert i{font-size:17px;flex-shrink:0}
    .alert-danger{background:rgba(231,76,60,.08);border:1px solid rgba(231,76,60,.2);color:#c0392b}
    .alert-success{background:rgba(40,208,148,.08);border:1px solid rgba(40,208,148,.25);color:#1a7a5e}
    .alert ul{padding-right:15px}
    .footer{padding:13px 22px;border-top:1px solid var(--border);background:var(--white);display:flex;align-items:center;justify-content:space-between;font-size:11.5px;color:var(--muted);margin-top:22px}
    .ftbrand{display:flex;align-items:center;gap:5px;font-weight:600;color:var(--text-mid)}
    .ftbrand i{color:var(--teal)}

    /* mobile */
    .sb-overlay{display:none;position:fixed;inset:0;background:rgba(0,0,0,.35);z-index:190}
    @media(max-width:768px){
      .sidebar{transform:translateX(100%)}
      .sidebar.open{transform:translateX(0)}
      .sidebar.open~.sb-overlay{display:block}
      .header{right:0}.main{margin-right:0}.content{padding:14px 14px 0}.hdr-date{display:none}
    }
  </style>
  <?php echo $__env->yieldContent('styles'); ?>
</head>
<body>
<div class="app-shell">

  <aside class="sidebar" id="sidebar">
    <div class="sb-brand">
      <div class="sb-icon">✉️</div>
      <div class="sb-name"><span>مراسلات</span></div>
    </div>
    <nav class="sb-nav">
      <ul style="list-style:none">
        <li class="nav-sep">رئيسي</li>
        <li class="nav-item">
          <a class="nav-link <?php echo e(request()->routeIs('admin.dashboard') ? 'active' : ''); ?>" href="<?php echo e(route('admin.dashboard')); ?>">
            <i class="las la-th-large"></i><span>الرئيسية</span>
          </a>
        </li>

        <?php if(auth()->user()->role_id == 3): ?>
          <li class="nav-sep">المراسلات</li>
          <li class="nav-item"><a class="nav-link" href="<?php echo e(route('orders.index')); ?>"><i class="las la-check-circle"></i><span>طلبات الموافقة</span></a></li>
          <li class="nav-item"><a class="nav-link" href="<?php echo e(route('reports.index')); ?>"><i class="las la-file-alt"></i><span>تقارير التصاريح</span></a></li>

        <?php elseif(auth()->user()->role_id == 2): ?>
          <li class="nav-sep">المراسلات</li>
          <li class="nav-item"><a class="nav-link" href="#"><i class="las la-envelope"></i><span>الكتب الواردة</span><span class="nbadge">7</span></a></li>
          <li class="nav-item"><a class="nav-link" href="#"><i class="las la-paper-plane"></i><span>الكتب الصادرة</span></a></li>
          <li class="nav-item"><a class="nav-link" href="#"><i class="las la-random"></i><span>التحويلات والإحالات</span><span class="nbadge">3</span></a></li>
          <li class="nav-item"><a class="nav-link" href="#"><i class="las la-clipboard-list"></i><span>معاملاتي</span><span class="nbadge g">12</span></a></li>
          <li class="nav-sep">الأرشفة</li>
          <li class="nav-item"><a class="nav-link" href="#"><i class="las la-archive"></i><span>الأرشيف الإلكتروني</span></a></li>
          <li class="nav-sep">الإدارة</li>
          <li class="nav-item"><a class="nav-link" href="#"><i class="las la-chart-bar"></i><span>التقارير</span></a></li>
          <li class="nav-item has-sub <?php echo e(request()->routeIs('permits.*')?'open':''); ?>">
            <a class="nav-link" href="#" onclick="toggleSub(this);return false;"><i class="las la-id-card"></i><span>التصاريح</span></a>
            <ul class="submenu">
              <li class="nav-item"><a class="nav-link" href="<?php echo e(route('permits.index')); ?>"><i class="las la-list"></i>كل التصاريح</a></li>
              <li class="nav-item"><a class="nav-link" href="<?php echo e(route('permits.create')); ?>"><i class="las la-plus-circle"></i>إضافة تصريح</a></li>
            </ul>
          </li>
          <li class="nav-item"><a class="nav-link" href="<?php echo e(route('logs_permits')); ?>"><i class="las la-sign-in-alt"></i><span>تسجيلات الدخول</span></a></li>
          <li class="nav-sep">بيانات أساسية</li>
          <li class="nav-item has-sub">
            <a class="nav-link" href="#" onclick="toggleSub(this);return false;"><i class="las la-database"></i><span>بيانات أساسية</span></a>
            <ul class="submenu">
              <li class="nav-item"><a class="nav-link" href="<?php echo e(route('permitAreas.index')); ?>"><i class="las la-map-marker"></i>مناطق التصاريح</a></li>
              <li class="nav-item"><a class="nav-link" href="<?php echo e(route('orgas.index')); ?>"><i class="las la-building"></i>جهات العمل</a></li>
              <li class="nav-item"><a class="nav-link" href="<?php echo e(route('purpose.index')); ?>"><i class="las la-door-open"></i>أغراض الدخول</a></li>
            </ul>
          </li>

        <?php elseif(auth()->user()->role_id == 1): ?>
          <li class="nav-sep">المراسلات</li>
          <li class="nav-item"><a class="nav-link" href="#"><i class="las la-envelope"></i><span>الكتب الواردة</span><span class="nbadge">7</span></a></li>
          <li class="nav-item"><a class="nav-link" href="#"><i class="las la-paper-plane"></i><span>الكتب الصادرة</span></a></li>
          <li class="nav-item"><a class="nav-link" href="#"><i class="las la-random"></i><span>التحويلات والإحالات</span><span class="nbadge">3</span></a></li>
          <li class="nav-item"><a class="nav-link" href="#"><i class="las la-clipboard-list"></i><span>معاملاتي</span><span class="nbadge g">12</span></a></li>
          <li class="nav-sep">الأرشفة</li>
          <li class="nav-item"><a class="nav-link" href="#"><i class="las la-archive"></i><span>الأرشيف الإلكتروني</span></a></li>
          <li class="nav-sep">الإدارة</li>
          <li class="nav-item"><a class="nav-link" href="#"><i class="las la-chart-bar"></i><span>التقارير</span></a></li>
          <li class="nav-item"><a class="nav-link" href="#"><i class="las la-users-cog"></i><span>المستخدمون والصلاحيات</span></a></li>
          <li class="nav-item"><a class="nav-link" href="#"><i class="las la-sitemap"></i><span>الأقسام والجهات</span></a></li>
          <li class="nav-item"><a class="nav-link" href="#"><i class="las la-envelope-open-text"></i><span>قوالب الكتب</span></a></li>
          <li class="nav-sep">النظام</li>
          <li class="nav-item"><a class="nav-link" href="#"><i class="las la-bell"></i><span>الإشعارات</span><span class="nbadge r">5</span></a></li>
          <li class="nav-item"><a class="nav-link" href="#"><i class="las la-history"></i><span>سجل العمليات</span></a></li>
          <li class="nav-item"><a class="nav-link" href="#"><i class="las la-search"></i><span>البحث الشامل</span></a></li>
          <li class="nav-item has-sub">
            <a class="nav-link" href="#" onclick="toggleSub(this);return false;"><i class="las la-cog"></i><span>الإعدادات</span></a>
            <ul class="submenu">
              <li class="nav-item"><a class="nav-link" href="<?php echo e(route('groups.index')); ?>"><i class="las la-list"></i>الجروبات</a></li>
              <li class="nav-item"><a class="nav-link" href="<?php echo e(route('documents.index')); ?>"><i class="las la-file-alt"></i>المستندات</a></li>
              <li class="nav-item"><a class="nav-link" href="<?php echo e(route('users.index')); ?>"><i class="las la-users"></i>المستخدمين</a></li>
            </ul>
          </li>
        <?php endif; ?>
      </ul>
    </nav>
  </aside>

  <div class="sb-overlay" id="sbOverlay" onclick="closeSB()"></div>

  <header class="header">
    <div class="hdr-l">
      <div class="ibtn" onclick="toggleSB()"><i class="las la-bars"></i></div>
      <div>
        <div style="font-size:14px;font-weight:800;color:var(--text)"><?php echo $__env->yieldContent('page-title','لوحة التحكم'); ?></div>
        <div style="font-size:11px;color:var(--muted)"><?php echo $__env->yieldContent('breadcrumb','رئيسي'); ?></div>
      </div>
    </div>
    <div class="hdr-r">
      <div class="hdr-date"><i class="las la-calendar-alt"></i><span id="hdrDate"></span></div>
      <div class="notif-w ibtn"><i class="las la-bell"></i><span class="ndot"></span></div>
      <a class="ibtn" onclick="toggleFS()"><i class="las la-expand"></i></a>
      <div class="upill" id="upill">
        <div class="ubtn" onclick="toggleU()">
          <div class="uavatar"><?php echo e(mb_substr(Auth::user()->name,0,1)); ?></div>
          <div><div class="uname"><?php echo e(Auth::user()->name); ?></div><div class="urole"><?php if(auth()->user()->role_id==1): ?>مدير النظام <?php elseif(auth()->user()->role_id==2): ?>مستخدم <?php else: ?> مشرف <?php endif; ?></div></div>
          <i class="las la-angle-down" style="color:var(--muted);font-size:12px"></i>
        </div>
        <div class="uddrop">
          <a class="dditem" href="<?php echo e(route('admin.edit')); ?>"><i class="las la-user-edit"></i>تعديل البيانات</a>
          <div class="ddsep"></div>
          <a class="dditem danger" href="<?php echo e(route('logout')); ?>"><i class="las la-power-off"></i>تسجيل الخروج</a>
        </div>
      </div>
    </div>
  </header>

  <div class="main">
    <div class="content">
      <?php if($errors->count()): ?><div class="alert alert-danger"><i class="las la-exclamation-circle"></i><div><ul><?php $__currentLoopData = $errors->all(); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $e): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?><li><?php echo e($e); ?></li><?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?></ul></div></div><?php endif; ?>
      <?php if(session()->has('success')): ?><div class="alert alert-success"><i class="las la-check-circle"></i><div><?php echo e(session('success')); ?></div></div><?php endif; ?>
      <?php if(session()->has('error')): ?><div class="alert alert-danger"><i class="las la-exclamation-circle"></i><div><?php echo e(session('error')); ?></div></div><?php endif; ?>
      <?php echo $__env->yieldContent('content'); ?>
    </div>
    <footer class="footer">
      <span>جميع الحقوق محفوظة &copy; <?php echo e(date('Y')); ?> — نظام مراسلات</span>
      <div class="ftbrand"><i class="las la-envelope"></i><span>مراسلات</span></div>
    </footer>
  </div>
</div>
<script>
  function toggleSub(el){el.closest('.has-sub').classList.toggle('open')}
  function toggleU(){document.getElementById('upill').classList.toggle('open')}
  document.addEventListener('click',e=>{const m=document.getElementById('upill');if(m&&!m.contains(e.target))m.classList.remove('open')})
  function toggleSB(){document.getElementById('sidebar').classList.toggle('open')}
  function closeSB(){document.getElementById('sidebar').classList.remove('open')}
  function toggleFS(){if(!document.fullscreenElement)document.documentElement.requestFullscreen?.();else document.exitFullscreen?.()}
  const _d=new Date();
  document.getElementById('hdrDate').textContent=_d.toLocaleDateString('ar-SA',{weekday:'long',year:'numeric',month:'long',day:'numeric'});
  setTimeout(()=>{document.querySelectorAll('.alert').forEach(a=>{a.style.transition='opacity .5s';a.style.opacity='0';setTimeout(()=>a.remove(),500)})},4500)
</script>
<?php echo $__env->yieldContent('scripts'); ?>
</body>
</html><?php /**PATH /home/gamcoiraq/sctl.gamcoiraq.com/resources/views/admin/includes/sidebar.blade.php ENDPATH**/ ?>