<?php defined('ABSPATH') || exit;
include __DIR__ . '/nav.php'; // loads $menu, $all_menu, $mode, $plan, $pg
?>
<div class="wrap dza-wrap" dir="rtl">
<div class="dza-layout">
<nav class="dza-side" id="dza-side">
<div class="dza-side-head">
<span class="dza-side-logo">⚡ DZQCOD</span>
<span class="dza-side-ver">v<?php echo esc_html(DZQCOD_VER); ?></span>
</div>
<div class="dza-side-menu">
<?php
$prev_group = '';
foreach ($all_menu as $m) {
    if ($mode === 'simple' && empty($m['simple'])) continue;
    if (($m['group'] ?? '') !== $prev_group) {
        $prev_group = $m['group'];
        echo '<div class="dza-side-sep">' . esc_html($prev_group) . '</div>';
    }
    $active = $pg === $m['slug'];
    echo '<a href="' . esc_url(admin_url('admin.php?page=' . $m['slug'])) . '" class="dza-side-link' . ($active ? ' active' : '') . '">';
    echo '<span class="dza-side-icon">' . esc_html($m['icon']) . '</span>';
    echo '<span class="dza-side-text">' . esc_html($m['label']) . '</span>';
    echo '</a>';
}
?>
</div>
<div class="dza-side-foot">
<div style="padding:6px 12px"><button onclick="dzToggleMode()" style="width:100%;padding:6px;border:1px solid #334155;border-radius:8px;background:transparent;color:#94a3b8;font-size:10px;cursor:pointer;font-family:inherit"><?php echo $mode === 'simple' ? '🔧 الوضع المتقدم' : '🟢 الوضع البسيط'; ?></button></div>
<div class="dza-side-plan <?php echo esc_attr($plan); ?>"><?php echo strtoupper(esc_html($plan)); ?></div>
<div style="text-align:center;padding:4px 12px 8px;font-size:9px;color:#64748b"><div style="font-weight:700">⚡ NIBRA TECHNOLOGY</div><a href="https://productes.nibra.cloud/product/dzqcod" target="_blank" style="color:#6366f1;text-decoration:none;font-weight:600;font-size:10px">🎧 الدعم</a></div>
</div>
</nav>
<div class="dza-main" id="dza-main">
<button class="dza-menu-btn" onclick="document.getElementById('dza-side').classList.toggle('open')">☰</button>
<script>function dzToggleMode(){jQuery.post(ajaxurl,{action:'dzqcod_toggle_mode',nonce:typeof dza!=='undefined'?dza.nonce:''},function(){location.reload()})}</script>
