<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title><%= typeof title !== 'undefined' ? title : 'Admin' %> · ZUCE Group</title>
  <link rel="stylesheet" href="/css/site.css">
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/quill/1.3.7/quill.snow.css">
</head>
<body class="admin">
  <div class="admin-shell">
    <aside class="admin-sidebar">
      <a href="/admin" class="brand">ZUCE Admin</a>

      <% if (typeof currentUser !== 'undefined' && currentUser) { %>
        <div class="admin-account-card">
          <span class="admin-avatar"><%= currentUser.name ? currentUser.name.charAt(0).toUpperCase() : '?' %></span>
          <span class="admin-account-info">
            <span class="admin-account-name"><%= currentUser.name %></span>
            <span class="admin-account-email"><%= currentUser.email %></span>
          </span>
        </div>
      <% } %>

      <nav>
        <a href="/admin" class="<%= currentPath === '/admin' ? 'active' : '' %>">
          <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="7" height="9"></rect><rect x="14" y="3" width="7" height="5"></rect><rect x="14" y="12" width="7" height="9"></rect><rect x="3" y="16" width="7" height="5"></rect></svg>
          Overview
        </a>

        <p class="admin-nav-divider">Admin</p>

        <a href="/admin/hero-slides" class="<%= currentPath && currentPath.indexOf('/admin/hero-slides') === 0 ? 'active' : '' %>">
          <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="18" height="14" rx="2"></rect><circle cx="8.5" cy="9" r="1.5"></circle><path d="M21 15l-5-5-9 9"></path></svg>
          Hero Slides
        </a>
        <a href="/admin/countries" class="<%= currentPath && currentPath.indexOf('/admin/countries') === 0 ? 'active' : '' %>">
          <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"></circle><line x1="2" y1="12" x2="22" y2="12"></line><path d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"></path></svg>
          Countries
        </a>
        <a href="/admin/divisions" class="<%= currentPath && currentPath.indexOf('/admin/divisions') === 0 ? 'active' : '' %>">
          <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="7" height="18"></rect><rect x="14" y="3" width="7" height="8"></rect><rect x="14" y="14" width="7" height="7"></rect></svg>
          Services
        </a>
        <a href="/admin/pages" class="<%= currentPath && currentPath.indexOf('/admin/pages') === 0 ? 'active' : '' %>">
          <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path><polyline points="14 2 14 8 20 8"></polyline></svg>
          Pages
        </a>
        <a href="/admin/posts" class="<%= currentPath && currentPath.indexOf('/admin/posts') === 0 ? 'active' : '' %>">
          <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 20h9"></path><path d="M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4Z"></path></svg>
          Blog
        </a>
        <a href="/admin/work" class="<%= currentPath && currentPath.indexOf('/admin/work') === 0 ? 'active' : '' %>">
          <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="2" y="7" width="20" height="14" rx="2"></rect><path d="M16 21V5a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16"></path></svg>
          Our Work
        </a>
        <a href="/admin/categories" class="<%= currentPath && currentPath.indexOf('/admin/categories') === 0 ? 'active' : '' %>">
          <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M20.59 13.41 13.41 20.59a2 2 0 0 1-2.82 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82Z"></path><line x1="7" y1="7" x2="7.01" y2="7"></line></svg>
          Categories
        </a>
        <a href="/admin/comments" class="<%= currentPath && currentPath.indexOf('/admin/comments') === 0 ? 'active' : '' %>">
          <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 11.5a8.38 8.38 0 0 1-.9 3.8 8.5 8.5 0 0 1-7.6 4.7 8.38 8.38 0 0 1-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 0 1-.9-3.8 8.5 8.5 0 0 1 4.7-7.6 8.38 8.38 0 0 1 3.8-.9h.5a8.48 8.48 0 0 1 8 8v.5Z"></path></svg>
          Comments
        </a>
        <a href="/admin/messages" class="<%= currentPath && currentPath.indexOf('/admin/messages') === 0 ? 'active' : '' %>">
          <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m22 6-10 7L2 6"></path><rect x="2" y="4" width="20" height="16" rx="2"></rect></svg>
          Messages
        </a>
        <a href="/admin/settings" class="<%= currentPath && currentPath.indexOf('/admin/settings') === 0 ? 'active' : '' %>">
          <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="3"></circle><path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1Z"></path></svg>
          Settings
        </a>
        <!-- Future: HR, Finance, CRM -->
      </nav>

      <div class="admin-sidebar-footer">
        <a href="/" class="admin-sidebar-viewsite" target="_blank" rel="noopener">
          <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"></path><polyline points="15 3 21 3 21 9"></polyline><line x1="10" y1="14" x2="21" y2="3"></line></svg>
          View site
        </a>
        <a href="/logout" class="admin-sidebar-signout">
          <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"></path><polyline points="16 17 21 12 16 7"></polyline><line x1="21" y1="12" x2="9" y2="12"></line></svg>
          Sign out
        </a>
      </div>
    </aside>
    <div class="admin-content">
      <% if (typeof messages !== 'undefined' && messages.error && messages.error.length) { %>
        <div class="flash flash-error"><%= messages.error[0] %></div>
      <% } %>
      <% if (typeof messages !== 'undefined' && messages.success && messages.success.length) { %>
        <div class="flash flash-success"><%= messages.success[0] %></div>
      <% } %>
      <%- body %>
    </div>
  </div>
</body>
</html>
