<!doctype html>
<?php
  $db =& get_instance();
  $userdetails=$db->Product_model->userdetails(); 
  $SiteSetting =$db->Product_model->getSiteSetting();
  
  // Sidebar data for horizontal menu
  $referlevel_status = $db->Product_model->getSettings('referlevel', 'status');
  $market_vendor_marketvendorstatus = $db->Product_model->getSettings('market_vendor', 'marketvendorstatus');
  $vendor_storestatus = $db->Product_model->getSettings('vendor', 'storestatus');
  $membership_status = $db->Product_model->getSettings('membership', 'status');
  $store_status = $db->Product_model->getSettings('store', 'status');
  $market_tools_status = $db->Product_model->getSettings('market_tools', 'status');
  $award_level_status = $db->Product_model->getSettings('award_level','status');
  
  $sidebar_data = array (
      'mlm_is_enable' => isset($referlevel_status['status']) ? $referlevel_status['status'] : 0,
      'saas_is_enable' => ($market_vendor_marketvendorstatus['marketvendorstatus'] == 1 || $vendor_storestatus['storestatus'] == 1) ? 1 : 0,
      'membership_is_enable' => isset($membership_status['status']) ? $membership_status['status'] : 0,
      'store_is_enable' => isset($store_status['status']) ? $store_status['status'] : 0,
      'award_level_is_enable' => isset($award_level_status['status']) ? $award_level_status['status'] : 0,
      'market_tools_is_enable' => isset($market_tools_status['status']) ? $market_tools_status['status'] : 1,
  );
  $db->Product_model->ping($userdetails['id']);
  $products = $db->Product_model;
  $settings = $db->Setting_model;
  $notifications = $products->getnotificationnew('admin', null, 5);
  $notifications_count = $products->getnotificationnew_count('admin', null);
  $license = $products->getLicese();
  $LanguageHtml = $products->getLanguageHtml();
  $CurrencyHtml = $products->getCurrencyHtml();
  $noti_order = $products->hold_noti();
  // Load utility helper for theme functions
  $this->load->helper('utility');
  
  // Old colors (keeping for compatibility but not using)
  $admin_side_bar_color = $products->getSettings('theme','admin_side_bar_color');
  $admin_side_bar_scroll_color = $products->getSettings('theme','admin_side_bar_scroll_color');
  $admin_top_bar_color = $products->getSettings('theme','admin_top_bar_color');
  $admin_logo_color = $products->getSettings('theme','admin_logo_color');
  $admin_side_font = $products->getSettings('site','admin_side_font');
  $admin_footer_color = $products->getSettings('theme','admin_footer_color');
  $admin_button_color = $products->getSettings('theme','admin_button_color'); 
  $admin_button_hover_color = $products->getSettings('theme','admin_button_hover_color');
  $allToDo = $settings->allToDo();

  // Use existing checkReq() function from system_status
  $serverErrors = checkReq();
  $required = '';
  $validate = empty($serverErrors);
  if (!$validate) {
    $required = implode("\n", array_keys($serverErrors));
  }

  $page_id = $products->page_id();
  $serverReq = $serverErrors;
  require APPPATH."config/breadcrumb.php";
  $pageKey = $db->Product_model->page_id();
  ?>
  <html lang="en" data-bs-theme="<?= isset($userdetails['theme_preference']) ? htmlspecialchars($userdetails['theme_preference']) : 'light' ?>">
  <script>
    (function(){var t=localStorage.getItem('v14_theme');if(t==='dark'||t==='light')document.documentElement.setAttribute('data-bs-theme',t);})();
  </script>
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <title><?= $SiteSetting['name'] ?> - <?= __('admin.menu_admin_panel') ?></title>
    <meta content="<?= $SiteSetting['meta_description'] ?>" name="description" />
    <meta content="<?= $SiteSetting['meta_author'] ?>" name="author" />
    <meta content="<?= $SiteSetting['meta_keywords'] ?>" name="keywords" />
    <input type="hidden" id="theme_Name" value="admin_theme">
    <?php if($SiteSetting['favicon']){ ?>
    <link rel="icon" href="<?= base_url('assets/images/site/'.$SiteSetting['favicon']) ?>" type="image/*" sizes="16x16">
    <?php } ?>

    <!-- CSS Files - Load First -->
    <!-- Local Fonts for Admin Panel -->
    <link rel="stylesheet" href="<?= base_url('assets/template/fonts/admin-fonts.css') ?>?v=<?= av() ?>">
    
    <!-- Bootstrap 5 CSS -->
    <link rel="stylesheet" href="<?= base_url('assets/template/css/bootstrap.min.css') ?>?v=<?= av() ?>">
    <link rel="stylesheet" href="<?= base_url('assets/template/css/bootstrap-icons.css') ?>?v=<?= av() ?>">
    <link rel="stylesheet" href="<?= base_url('assets/template/css/bootstrap-toggle.min.css') ?>?v=<?= av() ?>">
    <link rel="stylesheet" href="<?= base_url('assets/template/css/all.min.css') ?>?v=<?= av() ?>">
    
    <!-- Essential Plugin CSS -->
    <link href="<?= base_url('assets/plugins/datatable/select2.css') ?>?v=<?= av() ?>" rel="stylesheet"/>
    <link href="<?= base_url('assets/plugins/datetimepicker/jquery.datetimepicker.min.css') ?>?v=<?= av() ?>" rel="stylesheet"/>
    <link href="<?= base_url('assets/js/jquery-confirm.min.css') ?>?v=<?= av() ?>" rel="stylesheet"/>
    
    <!-- Admin Theme CSS Variables (Generated by Helper) -->
    <?= generate_admin_theme_css() ?>
    <link href="<?= base_url('assets/template/css/topnav-modern.css') ?>?v=<?= av() ?>" rel="stylesheet"/>
    <link href="<?= base_url('assets/template/css/sidebar-modern.css') ?>?v=<?= av() ?>" rel="stylesheet"/>
    <link href="<?= base_url('assets/template/css/footer-modern.css') ?>?v=<?= av() ?>" rel="stylesheet"/>
    <link href="<?= base_url('assets/template/css/horizontal-nav-modern.css') ?>?v=<?= av() ?>" rel="stylesheet"/>
    <link href="<?= base_url('assets/template/css/admin-dashboard-custom.css') ?>?v=<?= av() ?>" rel="stylesheet">
    <link href="<?= base_url('assets/template/css/admin-colors-dynamic.css') ?>?v=<?= av() ?>" rel="stylesheet"/>
    <link href='<?= base_url('assets/template/css/toast.css') ?>?v=<?= av() ?>' rel='stylesheet' type="text/css"/>
    
    <!-- V14 Theme & Animations -->
    <link href="<?= base_url('assets/template/css/theme-variables.css') ?>?v=<?= av() ?>" rel="stylesheet"/>
    <link href="<?= base_url('assets/template/css/dark-mode-overrides.css') ?>?v=<?= av() ?>" rel="stylesheet"/>
    <link href="<?= base_url('assets/template/css/dashboard-animations.css') ?>?v=<?= av() ?>" rel="stylesheet"/>
    
    <!-- Admin Integration Tools CSS -->
    <link href="<?= base_url('assets/template/css/admin-integration.css') ?>?v=<?= av() ?>" rel="stylesheet"/>

    <!-- Summernote CSS -->
    <link rel="stylesheet" href="<?= base_url('assets/template/summernote/summernote-lite.min.css') ?>?v=<?= av() ?>">

    <!-- JavaScript Files - Load After CSS -->
    <!-- Single jQuery Version (3.6.0) -->
    <script src="<?= base_url('assets/template/js/jquery-3.6.0.min.js'); ?>?v=<?= av() ?>"></script>
    
    <!-- Bootstrap 5 JS Bundle (includes Popper) -->
    <script src="<?= base_url('assets/template/js/bootstrap.bundle.min.js'); ?>?v=<?= av() ?>"></script>
    
    <!-- Essential Plugin JS -->
    <script src="<?= base_url('assets/plugins/datatable/select2.min.js'); ?>?v=<?= av() ?>"></script>
    <script src="<?= base_url('assets/plugins/datetimepicker/jquery.datetimepicker.full.min.js'); ?>?v=<?= av() ?>"></script>
    
    <!-- Navigation Positioning -->
    <script src="<?= base_url('assets/template/js/horizontal-nav-positioning.js'); ?>?v=<?= av() ?>"></script>

    <?php if($SiteSetting['google_analytics'] != '') echo $SiteSetting['google_analytics']; ?>

    <!-- Global Variables -->
    <script type="text/javascript">
      window.affiliatePro = {
        base_url:"<?= base_url() ?>"
      }
    </script>

    <!-- Essential Functions Only -->
    <script type="text/javascript">
      // Settings panel toggle
      function toggleSettingsPanel() {
        document.getElementById('settingsPanel').classList.toggle('open');
        document.getElementById('settingsOverlay').classList.toggle('show');
      }
      
      // Toggle configuration issues details
      function toggleIssues() {
        const details = document.getElementById('issuesDetails');
        if (details) {
          details.style.display = details.style.display === 'none' ? 'block' : 'none';
        }
      }
      

      // Notification reset
      function resetNotify() {
        // Notification reset logic here
      }
      
      // Show notification
      function shownofication(id, url) {
        window.location.href = url;
      }
      

    </script>

  <?php if(is_rtl()){ ?>
    <!-- RTL CSS code here -->
  <?php } ?>
<?= render_js_error_listener() ?>
</head>

<body class="body-common-class admin_side_bar_color" 
      style="font-family: <?= $admin_side_font['admin_side_font'] ?> !important;" 
      data-demo-mode="<?php echo (ENVIRONMENT === 'demo') ? 'true' : 'false'; ?>">

    <?php 
    $fbmessager_status = (array)json_decode($SiteSetting['fbmessager_status'],1);
    if(in_array('admin', $fbmessager_status))
      echo $SiteSetting['fbmessager_script'];
    ?>
    <?php show_messenger_button($SiteSetting, 'admin'); ?>

    <?php if (ENVIRONMENT === 'demo'): ?>
    <div class="position-fixed top-0 start-0 w-100 bg-warning text-dark text-center border-bottom border-dark shadow-sm m-0 p-0" style="font-size: 0.75rem; z-index: 1060; line-height: 28px; height: 28px;">
        <i class="fas fa-exclamation-triangle me-1"></i>
        <span class="fw-bold">DEMO MODE</span>
        <span class="d-none d-md-inline ms-2">|</span>
        <span class="d-none d-md-inline ms-2"><?= __('admin.demo_mode_notice') ?></span>
    </div>
    <?php endif; ?>

    <div class="admin-wrapper" style="<?php if (ENVIRONMENT === 'demo') echo 'margin-top: 28px;'; ?>">
        <!-- Sidebar will be inserted here by sidebar.php -->
        
        <!-- Main Content -->
        <div class="main-content">
            <!-- Top Navigation Bar -->
            <div class="admin-topbar">
                <div class="topbar-content">
                    <!-- Left Side - Dynamic Page Title -->
                    <div class="topbar-left">
                        <a href="<?= base_url('admincontrol/dashboard') ?>" class="text-decoration-none">
                            <h4 class="mb-0 d-none d-md-block text-white">
                                <?php 
                                // Show dynamic page title from breadcrumb config, or fallback
                                if (isset($pageSetting[$pageKey]['title']) && $pageSetting[$pageKey]['title']) {
                                    echo $pageSetting[$pageKey]['title'];
                                } else {
                                    echo isset($lang['dashboard_overview']) ? $lang['dashboard_overview'] : 'Dashboard Overview';
                                }
                                ?>
                            </h4>
                        </a>
                    </div>

                    <!-- Right Side -->
                    <div class="topbar-right">
                        <!-- Mobile Menu Toggle (visible only on small screens) -->
                        <button class="btn btn-outline-light d-lg-none mobile-menu-toggle" type="button" data-bs-toggle="collapse" data-bs-target="#mobileNavMenu" aria-expanded="false" aria-controls="mobileNavMenu">
                            <i class="fas fa-bars"></i>
                        </button>

                        <!-- Dark Mode Toggle -->
                        <button class="theme-toggle-btn" title="<?= __('admin.toggle_dark_mode') ?>">
                            <i class="fas fa-moon"></i>
                            <i class="fas fa-sun"></i>
                        </button>

                        <!-- Currency Dropdown -->
                        <div class="dropdown">
                            <button class="topbar-btn dropdown-toggle" data-bs-toggle="dropdown">
                                <i class="fas fa-dollar-sign"></i>
                                <span class="d-none d-md-inline" id="current-currency"><?= isset($_SESSION['userCurrency']) ? $_SESSION['userCurrency'] : 'USD' ?></span>
                            </button>
                            <ul class="dropdown-menu dropdown-menu-end">
                                <li><h6 class="dropdown-header"><i class="fas fa-coins me-2"></i><?= __('admin.select_currency') ?></h6></li>
                                <?php 
                                $currencies = $this->db->query("SELECT * FROM currency WHERE status=1")->result_array();
                                $currency_icons = ['fa-dollar-sign text-success', 'fa-euro-sign text-primary', 'fa-pound-sign text-warning', 'fa-yen-sign text-danger', 'fa-bitcoin text-info'];
                                foreach($currencies as $key => $curr): 
                                    $icon_class = $currency_icons[$key % count($currency_icons)];
                                ?>
                                <li><a class="dropdown-item" href="<?= base_url('Admincontrol/change_currency/'.$curr['code']) ?>">
                                    <i class="fas <?= $icon_class ?>"></i> <?= $curr['code'] ?> - <?= $curr['title'] ?>
                                </a></li>
                                <?php endforeach; ?>
                            </ul>
                        </div>

                        <!-- Language Dropdown -->
                        <div class="dropdown">
                            <button class="topbar-btn dropdown-toggle" data-bs-toggle="dropdown">
                                <i class="fas fa-language"></i>
                                <span class="d-none d-md-inline" id="current-language"><?= isset($_SESSION['userLangName']) ? $_SESSION['userLangName'] : 'English' ?></span>
                            </button>
                            <ul class="dropdown-menu dropdown-menu-end">
                                <li><h6 class="dropdown-header"><i class="fas fa-globe me-2"></i><?= __('admin.select_language') ?></h6></li>
                                <?php 
                                $languages = $this->db->query("SELECT * FROM language WHERE status=1")->result_array();
                                foreach($languages as $lang): ?>
                                <li><a class="dropdown-item" href="<?= base_url('Admincontrol/change_language/'.$lang['id']) ?>">
                                    <img src="<?= base_url($lang['flag']) ?>" alt="<?= $lang['name'] ?>" class="language-flag">
                                    <?= $lang['name'] ?>
                                </a></li>
                                <?php endforeach; ?>
                            </ul>
                        </div>

                        <!-- Hidden backend elements for compatibility -->
                        <div style="display: none;">
                          <?= $CurrencyHtml ?>
                          <?= $LanguageHtml ?>
                        </div>

                        <!-- Notifications -->
                        <div class="dropdown">
                            <button class="topbar-btn position-relative" data-bs-toggle="dropdown" onclick="resetNotify();">
                                <i class="fas fa-bell"></i>
                                <span class="d-none d-lg-inline"><?= __('admin.notifications') ?></span>
                                <?php if($notifications_count > 0): ?>
                                    <span class="notification-badge"><?= $notifications_count; ?></span>
                                <?php endif; ?>
                            </button>
                            <div class="dropdown-menu dropdown-menu-end notification-dropdown">
                                <div class="dropdown-header">
                                    <i class="fas fa-bell me-2"></i><?= __('admin.notification') ?> (<?= $notifications_count; ?>)
                                </div>
                                <?php
                                $last_id_notifications = 0;
                                $icon_types = ['fas fa-user-plus text-success', 'fas fa-shield-alt text-warning', 'fas fa-dollar-sign text-success', 'fas fa-cog text-info', 'fas fa-sync-alt text-primary'];
                                foreach ($notifications as $key => $notification) {
                                    if ($last_id_notifications <= $notification['notification_id']) {
                                        $last_id_notifications = $notification['notification_id'];
                                    }
                                    $icon_class = $icon_types[$key % count($icon_types)];
                                    $notif_url = $notification['notification_url'];
                                    if (strpos($notif_url, '/membership/') !== false) {
                                        $notification_full_url = base_url() . ltrim($notif_url, '/');
                                    } else {
                                        $notification_full_url = base_url('admincontrol') . $notif_url;
                                    }
                                ?>
                                    <a class="dropdown-item" href="javascript:void(0)" onclick="shownofication(<?= $notification['notification_id'] . ',\'' . $notification_full_url . '\''; ?>)">
                                        <i class="<?= $icon_class ?>"></i>
                                        <div>
                                            <div class="fw-bold"><?= $notification['notification_title']; ?></div>
                                            <small class="text-muted"><?= $notification['notification_description']; ?></small>
                                        </div>
                                    </a>
                                <?php } ?>
                                <input type="hidden" id="last_id_notifications" value="<?= $last_id_notifications ?>">
                                <div class="dropdown-divider"></div>
                                <a class="dropdown-item text-center fw-bold" href="<?= base_url('admincontrol/notification') ?>">
                                    <i class="fas fa-eye me-2"></i><?= __('admin.view_all_notifications') ?>
                                </a>
                            </div>
                        </div>

                        <!-- User Dropdown -->
                        <div class="dropdown">
                            <button class="btn d-flex align-items-center text-white border-0 p-2" data-bs-toggle="dropdown" style="background: rgba(255,255,255,0.1); border-radius: 8px;">
                                <i class="fas fa-user-circle me-2"></i>
                                <div class="text-start d-none d-lg-block">
                                    <div class="fw-bold" style="font-size: 0.9rem; line-height: 1.2;"><?= htmlspecialchars($userdetails['firstname']) ?></div>
                                    <small style="font-size: 0.75rem; opacity: 0.8; line-height: 1;"><?= __('admin.super_administrator') ?></small>
                                </div>
                                <i class="fas fa-chevron-down ms-2 small"></i>
                            </button>
                            <ul class="dropdown-menu dropdown-menu-end">
                                <li><h6 class="dropdown-header"><i class="fas fa-user-circle me-2"></i><?= __('admin.account_settings') ?></h6></li>
                                <li><a class="dropdown-item" href="<?= base_url('admincontrol/editProfile'); ?>"><i class="fas fa-user text-primary"></i> <?= __('admin.top_profile') ?></a></li>
                                <li><a class="dropdown-item" href="<?= base_url('admincontrol/changePassword'); ?>"><i class="fas fa-lock text-warning"></i> <?= __('admin.top_change_password') ?></a></li>
                                <li><a class="dropdown-item" href="<?= base_url('admincontrol/mywallet'); ?>"><i class="fas fa-wallet text-success"></i> <?= __('admin.top_my_wallet') ?></a></li>
                                <li><a class="dropdown-item" href="<?= base_url('admincontrol/paymentsetting'); ?>"><i class="fas fa-cog text-info"></i> <?= __('admin.top_settings') ?></a></li>
                                <li><hr class="dropdown-divider"></li>
                                <li><a class="dropdown-item text-danger" href="<?= base_url('admincontrol/logout'); ?>"><i class="fas fa-sign-out-alt text-danger"></i> <?= __('admin.top_logout') ?></a></li>
                            </ul>
                        </div>

                        <!-- System Health Badge -->
                        <?php 
                        $missing_count = !empty($required) ? count(explode("\n", trim($required))) : 0;
                        if ($missing_count > 0): 
                        ?>
                        <div class="position-relative me-2">
                            <a href="<?= base_url('admincontrol/system_issues') ?>" class="btn btn-warning btn-sm position-relative" style="background: rgba(255,255,255,0.1); border: none; border-radius: 8px; padding: 8px 12px;">
                                <i class="fas fa-exclamation-triangle text-warning"></i>
                                <span class="position-absolute top-0 start-100 translate-middle badge rounded-pill bg-danger" style="font-size: 0.7rem; transform: translate(-50%, -50%);">
                                    <?= $missing_count ?>
                                </span>
                            </a>
                        </div>
                         <?php endif; ?>

                        <!-- Settings Panel Toggle -->
                        <button class="btn text-white border-0 p-2" onclick="toggleSettingsPanel()" style="background: rgba(255,255,255,0.1); border-radius: 8px;">
                            <i class="fas fa-ellipsis-v"></i>
                        </button>
                    </div>
                </div>
            </div>

            <!-- Mobile Navigation Menu (Collapsible) - Full parity with desktop -->
            <div class="collapse d-lg-none" id="mobileNavMenu">
                <div class="mobile-nav-menu">
                    <div class="container-fluid">
                        <div class="row">
                            <div class="col-12">
                                <div class="mobile-nav-items">
                                    <!-- Dashboard -->
                                    <a href="<?= base_url('admincontrol/dashboard') ?>" class="mobile-nav-item">
                                        <i class="fas fa-home"></i>
                                        <span><?= __('admin.menu_dashboard') ?></span>
                                    </a>
                                    <a href="<?= base_url('admincontrol/analytics_dashboard') ?>" class="mobile-nav-item">
                                        <i class="fas fa-chart-line"></i>
                                        <span><?= __('admin.analytics') ?></span>
                                    </a>

                                    <!-- Marketing Section -->
                                    <div class="mobile-nav-section">
                                        <button class="mobile-nav-section-header" type="button" data-bs-toggle="collapse" data-bs-target="#mobileMarketingCollapse" aria-expanded="false">
                                            <i class="fas fa-rocket"></i>
                                            <span><?= __('admin.nav_marketing') ?></span>
                                        </button>
                                        <div class="collapse" id="mobileMarketingCollapse">
                                            <div class="mobile-nav-section-items">
                                                <?php if($sidebar_data['market_tools_is_enable'] == 1): ?>
                                                <a href="<?= base_url('integration/integration_tools') ?>" class="mobile-nav-subitem">
                                                    <i class="fas fa-bullhorn"></i>
                                                    <span><?= __('admin.nav_campaigns') ?></span>
                                                </a>
                                                <?php endif; ?>
                                                <?php if($sidebar_data['store_is_enable'] == 1): ?>
                                                <a href="<?= base_url('admincontrol/store_dashboard') ?>" class="mobile-nav-subitem">
                                                    <i class="fas fa-store"></i>
                                                    <span><?= __('admin.nav_store') ?></span>
                                                </a>
                                                <?php endif; ?>
                                                <?php if($sidebar_data['membership_is_enable'] == 1): ?>
                                                <a href="<?= base_url('membership/membership_orders') ?>" class="mobile-nav-subitem">
                                                    <i class="fas fa-crown"></i>
                                                    <span><?= __('admin.nav_membership') ?></span>
                                                </a>
                                                <?php endif; ?>
                                                <?php if($sidebar_data['mlm_is_enable'] == 1): ?>
                                                <a href="<?= base_url('admincontrol/mlm_settings') ?>" class="mobile-nav-subitem">
                                                    <i class="fas fa-project-diagram"></i>
                                                    <span><?= __('admin.nav_mlm') ?></span>
                                                </a>
                                                <?php endif; ?>
                                                <?php if($sidebar_data['award_level_is_enable'] == 1): ?>
                                                <a href="<?= base_url('admincontrol/award_level') ?>" class="mobile-nav-subitem">
                                                    <i class="fas fa-award"></i>
                                                    <span><?= __('admin.nav_rewards') ?></span>
                                                </a>
                                                <?php endif; ?>
                                                <?php if($sidebar_data['saas_is_enable'] == 1): ?>
                                                <a href="<?= base_url('admincontrol/saas_setting') ?>" class="mobile-nav-subitem">
                                                    <i class="fas fa-building"></i>
                                                    <span><?= __('admin.nav_saas') ?></span>
                                                </a>
                                                <?php endif; ?>
                                                <a href="<?= base_url('admincontrol/sales_funnels') ?>" class="mobile-nav-subitem">
                                                    <i class="fas fa-filter"></i>
                                                    <span><?= __('admin.nav_sales_funnels') ?></span>
                                                </a>
                                            </div>
                                        </div>
                                    </div>

                                    <!-- Users Section -->
                                    <div class="mobile-nav-section">
                                        <button class="mobile-nav-section-header" type="button" data-bs-toggle="collapse" data-bs-target="#mobileUsersCollapse" aria-expanded="false">
                                            <i class="fas fa-users"></i>
                                            <span><?= __('admin.nav_users') ?></span>
                                        </button>
                                        <div class="collapse" id="mobileUsersCollapse">
                                            <div class="mobile-nav-section-items">
                                                <a href="<?= base_url('admincontrol/userslist') ?>" class="mobile-nav-subitem">
                                                    <i class="fas fa-list"></i>
                                                    <span><?= __('admin.nav_all_affiliates') ?></span>
                                                </a>
                                                <a href="<?= base_url('admincontrol/usergroup') ?>" class="mobile-nav-subitem">
                                                    <i class="fas fa-users-cog"></i>
                                                    <span><?= __('admin.nav_user_groups') ?></span>
                                                </a>
                                                <a href="<?= base_url('admincontrol/userslisttree') ?>" class="mobile-nav-subitem">
                                                    <i class="fas fa-sitemap"></i>
                                                    <span><?= __('admin.nav_referral_tree') ?></span>
                                                </a>
                                                <a href="<?= base_url('admincontrol/userslistmail') ?>" class="mobile-nav-subitem">
                                                    <i class="fas fa-envelope"></i>
                                                    <span><?= __('admin.nav_email_list') ?></span>
                                                </a>
                                                <a href="<?= base_url('admincontrol/tickets') ?>" class="mobile-nav-subitem">
                                                    <i class="fas fa-ticket-alt"></i>
                                                    <span><?= __('admin.nav_support_tickets') ?></span>
                                                </a>
                                                <?php if($userdetails['id'] == 1): ?>
                                                <a href="<?= base_url('admincontrol/admin_user') ?>" class="mobile-nav-subitem">
                                                    <i class="fas fa-user-shield"></i>
                                                    <span><?= __('admin.nav_manage_admins') ?></span>
                                                </a>
                                                <?php endif; ?>
                                            </div>
                                        </div>
                                    </div>

                                    <!-- Reports Section -->
                                    <div class="mobile-nav-section">
                                        <button class="mobile-nav-section-header" type="button" data-bs-toggle="collapse" data-bs-target="#mobileReportsCollapse" aria-expanded="false">
                                            <i class="fas fa-chart-bar"></i>
                                            <span><?= __('admin.nav_reports') ?></span>
                                        </button>
                                        <div class="collapse" id="mobileReportsCollapse">
                                            <div class="mobile-nav-section-items">
                                                <a href="<?= base_url('admincontrol/store_orders') ?>" class="mobile-nav-subitem">
                                                    <i class="fas fa-shopping-cart"></i>
                                                    <span><?= __('admin.nav_all_orders') ?></span>
                                                </a>
                                                <a href="<?= base_url('admincontrol/store_logs') ?>" class="mobile-nav-subitem">
                                                    <i class="fas fa-stream"></i>
                                                    <span><?= __('admin.nav_activity_logs') ?></span>
                                                </a>
                                                <a href="<?= base_url('admincontrol/s2s_analytics') ?>" class="mobile-nav-subitem">
                                                    <i class="fas fa-server"></i>
                                                    <span><?= __('admin.nav_s2s_analytics') ?? 'S2S Analytics' ?></span>
                                                </a>
                                                <a href="<?= base_url('incomereport') ?>" class="mobile-nav-subitem">
                                                    <i class="fas fa-chart-bar"></i>
                                                    <span><?= __('admin.nav_user_statistics') ?></span>
                                                </a>
                                                <a href="<?= base_url('reportController/admin_transaction') ?>" class="mobile-nav-subitem">
                                                    <i class="fas fa-file-invoice-dollar"></i>
                                                    <span><?= __('admin.nav_transactions') ?></span>
                                                </a>
                                                <a href="<?= base_url('reportController/admin_statistics') ?>" class="mobile-nav-subitem">
                                                    <i class="fas fa-chart-area"></i>
                                                    <span><?= __('admin.nav_graphs') ?></span>
                                                </a>
                                                <a href="<?= base_url('admincontrol/mywallet') ?>" class="mobile-nav-subitem">
                                                    <i class="fas fa-wallet"></i>
                                                    <span><?= __('admin.nav_wallet') ?></span>
                                                </a>
                                                <a href="<?= base_url('admincontrol/vendor_deposits') ?>" class="mobile-nav-subitem">
                                                    <i class="fas fa-hand-holding-usd"></i>
                                                    <span><?= __('admin.nav_vendor_deposits') ?></span>
                                                </a>
                                            </div>
                                        </div>
                                    </div>

                                    <!-- Settings Section -->
                                    <div class="mobile-nav-section">
                                        <button class="mobile-nav-section-header" type="button" data-bs-toggle="collapse" data-bs-target="#mobileSettingsCollapse" aria-expanded="false">
                                            <i class="fas fa-cog"></i>
                                            <span><?= __('admin.nav_settings') ?></span>
                                        </button>
                                        <div class="collapse" id="mobileSettingsCollapse">
                                            <div class="mobile-nav-section-items">
                                                <a href="<?= base_url('admincontrol/paymentsetting') ?>" class="mobile-nav-subitem">
                                                    <i class="fas fa-sliders-h"></i>
                                                    <span><?= __('admin.nav_general_settings') ?></span>
                                                </a>
                                                <a href="<?= base_url('admincontrol/payment_gateway') ?>" class="mobile-nav-subitem">
                                                    <i class="fas fa-credit-card"></i>
                                                    <span><?= __('admin.nav_payment_gateway') ?></span>
                                                </a>
                                                <a href="<?= base_url('admincontrol/addons') ?>" class="mobile-nav-subitem">
                                                    <i class="fas fa-puzzle-piece"></i>
                                                    <span><?= __('admin.nav_addons') ?></span>
                                                </a>
                                                <a href="<?= base_url('admincontrol/affiliate_theme') ?>" class="mobile-nav-subitem">
                                                    <i class="fas fa-paint-brush"></i>
                                                    <span><?= __('admin.nav_affiliate_theme') ?></span>
                                                </a>
                                                <a href="<?= base_url('admincontrol/language') ?>" class="mobile-nav-subitem">
                                                    <i class="fas fa-language"></i>
                                                    <span><?= __('admin.nav_language') ?></span>
                                                </a>
                                                <a href="<?= base_url('admincontrol/currency_list') ?>" class="mobile-nav-subitem">
                                                    <i class="fas fa-coins"></i>
                                                    <span><?= __('admin.nav_currency') ?></span>
                                                </a>
                                                <a href="<?= base_url('admincontrol/countries_and_states') ?>" class="mobile-nav-subitem">
                                                    <i class="fas fa-flag"></i>
                                                    <span><?= __('admin.nav_countries') ?></span>
                                                </a>
                                                <a href="<?= base_url('admincontrol/system_status') ?>" class="mobile-nav-subitem">
                                                    <i class="fas fa-heartbeat"></i>
                                                    <span><?= __('admin.nav_system_status') ?></span>
                                                </a>
                                                <a href="<?= base_url('admincontrol/geolocation_status') ?>" class="mobile-nav-subitem">
                                                    <i class="fas fa-map-marker-alt"></i>
                                                    <span><?= __('admin.nav_geolocation') ?></span>
                                                </a>
                                                <a href="<?= base_url('admincontrol/cron') ?>" class="mobile-nav-subitem">
                                                    <i class="fas fa-clock"></i>
                                                    <span><?= __('admin.nav_cron_job') ?></span>
                                                </a>
                                                <a href="<?= base_url('admincontrol/troubleshoot') ?>" class="mobile-nav-subitem">
                                                    <i class="fas fa-wrench"></i>
                                                    <span><?= __('admin.nav_troubleshoot') ?></span>
                                                </a>
                                                <a href="<?= base_url('admincontrol/todolist') ?>" class="mobile-nav-subitem">
                                                    <i class="fas fa-tasks"></i>
                                                    <span><?= __('admin.nav_todo_list') ?></span>
                                                </a>
                                                <a href="<?= base_url('admincontrol/backup') ?>" class="mobile-nav-subitem">
                                                    <i class="fas fa-download"></i>
                                                    <span><?= __('admin.nav_backup') ?></span>
                                                </a>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <!-- Main Content Area Starts Here -->
            <div class="horizontal-nav">
                <div class="container-fluid">
                    <nav class="nav-menu d-flex flex-wrap gap-2">
                        <!-- DASHBOARD -->
                        <a href="<?= base_url('admincontrol/dashboard') ?>" class="nav-item px-3 py-2 text-decoration-none rounded d-flex align-items-center">
                            <i class="fas fa-home me-2"></i>
                            <span><?= __('admin.menu_dashboard') ?></span>
                        </a>
                        
                        <a href="<?= base_url('admincontrol/analytics_dashboard') ?>" class="nav-item px-3 py-2 text-decoration-none rounded d-flex align-items-center">
                            <i class="fas fa-chart-line me-2"></i>
                            <span><?= __('admin.analytics') ?></span>
                        </a>

                        <!-- MARKETING (formerly BUSINESS) -->
                        <div class="nav-dropdown dropdown">
                            <a href="#" class="nav-item px-3 py-2 text-decoration-none rounded d-flex align-items-center dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
                                <i class="fas fa-rocket me-2"></i>
                                <span><?= __('admin.nav_marketing') ?></span>
                            </a>
                            <div class="dropdown-menu">
                                <?php if($sidebar_data['market_tools_is_enable'] == 1): ?>
                                <a class="dropdown-item" href="<?= base_url('integration/integration_tools') ?>">
                                    <i class="fas fa-bullhorn"></i> <?= __('admin.nav_campaigns') ?>
                                </a>
                                <?php endif; ?>

                                <?php if($sidebar_data['store_is_enable'] == 1): ?>
                                <a class="dropdown-item" href="<?= base_url('admincontrol/store_dashboard') ?>">
                                    <i class="fas fa-store"></i> <?= __('admin.nav_store') ?>
                                </a>
                                <?php endif; ?>

                                <?php if($sidebar_data['membership_is_enable'] == 1): ?>
                                <a class="dropdown-item" href="<?= base_url('membership/membership_orders') ?>">
                                    <i class="fas fa-crown"></i> <?= __('admin.nav_membership') ?>
                                </a>
                                <?php endif; ?>

                                <?php if($sidebar_data['mlm_is_enable'] == 1): ?>
                                <a class="dropdown-item" href="<?= base_url('admincontrol/mlm_settings') ?>">
                                    <i class="fas fa-project-diagram"></i> <?= __('admin.nav_mlm') ?>
                                </a>
                                <?php endif; ?>

                                <?php if($sidebar_data['award_level_is_enable'] == 1): ?>
                                <a class="dropdown-item" href="<?= base_url('admincontrol/award_level') ?>">
                                    <i class="fas fa-award"></i> <?= __('admin.nav_rewards') ?>
                                </a>
                                <?php endif; ?>

                                <?php if($sidebar_data['saas_is_enable'] == 1): ?>
                                <a class="dropdown-item" href="<?= base_url('admincontrol/saas_setting') ?>">
                                    <i class="fas fa-building"></i> <?= __('admin.nav_saas') ?>
                                </a>
                                <?php endif; ?>

                                <a class="dropdown-item" href="<?= base_url('admincontrol/sales_funnels') ?>">
                                    <i class="fas fa-filter"></i> <?= __('admin.nav_sales_funnels') ?>
                                </a>
                            </div>
                        </div>

                        <!-- USERS -->
                        <div class="nav-dropdown dropdown">
                            <a href="#" class="nav-item px-3 py-2 text-decoration-none rounded d-flex align-items-center dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
                                <i class="fas fa-users me-2"></i>
                                <span><?= __('admin.nav_users') ?></span>
                            </a>
                            <div class="dropdown-menu">
                                <a class="dropdown-item" href="<?= base_url('admincontrol/userslist') ?>">
                                    <i class="fas fa-list"></i> <?= __('admin.nav_all_affiliates') ?>
                                </a>
                                <a class="dropdown-item" href="<?= base_url('admincontrol/usergroup') ?>">
                                    <i class="fas fa-users-cog"></i> <?= __('admin.nav_user_groups') ?>
                                </a>
                                <a class="dropdown-item" href="<?= base_url('admincontrol/userslisttree') ?>">
                                    <i class="fas fa-sitemap"></i> <?= __('admin.nav_referral_tree') ?>
                                </a>
                                <a class="dropdown-item" href="<?= base_url('admincontrol/userslistmail') ?>">
                                    <i class="fas fa-envelope"></i> <?= __('admin.nav_email_list') ?>
                                </a>
                                <a class="dropdown-item" href="<?= base_url('admincontrol/tickets') ?>">
                                    <i class="fas fa-ticket-alt"></i> <?= __('admin.nav_support_tickets') ?>
                                </a>
                                <?php if($userdetails['id'] == 1): ?>
                                <div class="dropdown-divider"></div>
                                <a class="dropdown-item" href="<?= base_url('admincontrol/admin_user') ?>">
                                    <i class="fas fa-user-shield"></i> <?= __('admin.nav_manage_admins') ?>
                                </a>
                                <?php endif; ?>
                            </div>
                        </div>

                        <!-- REPORTS (consolidated: orders, logs, analytics, financial) -->
                        <div class="nav-dropdown dropdown">
                            <a href="#" class="nav-item px-3 py-2 text-decoration-none rounded d-flex align-items-center dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
                                <i class="fas fa-chart-bar me-2"></i>
                                <span><?= __('admin.nav_reports') ?></span>
                            </a>
                            <div class="dropdown-menu">
                                <a class="dropdown-item" href="<?= base_url('admincontrol/store_orders') ?>">
                                    <i class="fas fa-shopping-cart"></i> <?= __('admin.nav_all_orders') ?>
                                </a>
                                <a class="dropdown-item" href="<?= base_url('admincontrol/store_logs') ?>">
                                    <i class="fas fa-stream"></i> <?= __('admin.nav_activity_logs') ?>
                                </a>
                                <a class="dropdown-item" href="<?= base_url('admincontrol/s2s_analytics') ?>">
                                    <i class="fas fa-server"></i> <?= __('admin.nav_s2s_analytics') ?? 'S2S Analytics' ?>
                                </a>

                                <div class="dropdown-divider"></div>
                                <h6 class="dropdown-header"><i class="fas fa-chart-pie me-1"></i> <?= __('admin.nav_section_analytics') ?></h6>
                                <a class="dropdown-item" href="<?= base_url('incomereport') ?>">
                                    <i class="fas fa-chart-bar"></i> <?= __('admin.nav_user_statistics') ?>
                                </a>
                                <a class="dropdown-item" href="<?= base_url('reportController/admin_transaction') ?>">
                                    <i class="fas fa-file-invoice-dollar"></i> <?= __('admin.nav_transactions') ?>
                                </a>
                                <a class="dropdown-item" href="<?= base_url('reportController/admin_statistics') ?>">
                                    <i class="fas fa-chart-area"></i> <?= __('admin.nav_graphs') ?>
                                </a>

                                <div class="dropdown-divider"></div>
                                <h6 class="dropdown-header"><i class="fas fa-wallet me-1"></i> <?= __('admin.nav_section_financial') ?></h6>
                                <a class="dropdown-item" href="<?= base_url('admincontrol/mywallet') ?>">
                                    <i class="fas fa-wallet"></i> <?= __('admin.nav_wallet') ?>
                                </a>
                                <a class="dropdown-item" href="<?= base_url('admincontrol/vendor_deposits') ?>">
                                    <i class="fas fa-hand-holding-usd"></i> <?= __('admin.nav_vendor_deposits') ?>
                                </a>

                                <div class="dropdown-divider"></div>
                                <a class="dropdown-item" href="<?= base_url('debug/sysupdatereport') ?>" target="_blank">
                                    <i class="fas fa-clipboard-list"></i> <?= __('admin.nav_system_logs') ?>
                                </a>
                            </div>
                        </div>

                        <!-- SETTINGS (gear icon - replaces old SYSTEM with 14 items) -->
                        <div class="nav-dropdown dropdown">
                            <a href="#" class="nav-item px-3 py-2 text-decoration-none rounded d-flex align-items-center dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
                                <i class="fas fa-cog me-2"></i>
                                <span><?= __('admin.nav_settings') ?></span>
                            </a>
                            <div class="dropdown-menu dropdown-menu-end">
                                <a class="dropdown-item" href="<?= base_url('admincontrol/paymentsetting') ?>">
                                    <i class="fas fa-sliders-h"></i> <?= __('admin.nav_general_settings') ?>
                                </a>
                                <a class="dropdown-item" href="<?= base_url('admincontrol/payment_gateway') ?>">
                                    <i class="fas fa-credit-card"></i> <?= __('admin.nav_payment_gateway') ?>
                                </a>
                                <a class="dropdown-item" href="<?= base_url('admincontrol/addons') ?>">
                                    <i class="fas fa-puzzle-piece"></i> <?= __('admin.nav_addons') ?>
                                </a>

                                <div class="dropdown-divider"></div>
                                <h6 class="dropdown-header"><i class="fas fa-palette me-1"></i> <?= __('admin.nav_section_appearance') ?></h6>
                                <a class="dropdown-item" href="<?= base_url('admincontrol/affiliate_theme') ?>">
                                    <i class="fas fa-paint-brush"></i> <?= __('admin.nav_affiliate_theme') ?>
                                </a>

                                <div class="dropdown-divider"></div>
                                <h6 class="dropdown-header"><i class="fas fa-globe me-1"></i> <?= __('admin.nav_section_localization') ?></h6>
                                <a class="dropdown-item" href="<?= base_url('admincontrol/language') ?>">
                                    <i class="fas fa-language"></i> <?= __('admin.nav_language') ?>
                                </a>
                                <a class="dropdown-item" href="<?= base_url('admincontrol/currency_list') ?>">
                                    <i class="fas fa-coins"></i> <?= __('admin.nav_currency') ?>
                                </a>
                                <a class="dropdown-item" href="<?= base_url('admincontrol/countries_and_states') ?>">
                                    <i class="fas fa-flag"></i> <?= __('admin.nav_countries') ?>
                                </a>

                                <div class="dropdown-divider"></div>
                                <h6 class="dropdown-header"><i class="fas fa-server me-1"></i> <?= __('admin.nav_section_system') ?></h6>
                                <a class="dropdown-item" href="<?= base_url('admincontrol/system_status') ?>">
                                    <i class="fas fa-heartbeat"></i> <?= __('admin.nav_system_status') ?>
                                </a>
                                <a class="dropdown-item" href="<?= base_url('admincontrol/geolocation_status') ?>">
                                    <i class="fas fa-map-marker-alt"></i> <?= __('admin.nav_geolocation') ?>
                                </a>
                                <a class="dropdown-item" href="<?= base_url('admincontrol/cron') ?>">
                                    <i class="fas fa-clock"></i> <?= __('admin.nav_cron_job') ?>
                                </a>
                                <a class="dropdown-item" href="<?= base_url('admincontrol/troubleshoot') ?>">
                                    <i class="fas fa-wrench"></i> <?= __('admin.nav_troubleshoot') ?>
                                </a>

                                <div class="dropdown-divider"></div>
                                <h6 class="dropdown-header"><i class="fas fa-toolbox me-1"></i> <?= __('admin.nav_section_tools') ?></h6>
                                <a class="dropdown-item" href="<?= base_url('admincontrol/todolist') ?>">
                                    <i class="fas fa-tasks"></i> <?= __('admin.nav_todo_list') ?>
                                </a>
                                <a class="dropdown-item" href="<?= base_url('admincontrol/backup') ?>">
                                    <i class="fas fa-download"></i> <?= __('admin.nav_backup') ?>
                                </a>
                                <a class="dropdown-item" href="<?= base_url('/api-home') ?>" target="_blank">
                                    <i class="fas fa-book"></i> <?= __('admin.nav_api_home') ?>
                                </a>
                                <a class="dropdown-item" href="<?= base_url('/api-document') ?>" target="_blank">
                                    <i class="fas fa-code"></i> <?= __('admin.nav_api_docs') ?>
                                </a>
                                <a class="dropdown-item" href="<?= base_url('/admin-api-document') ?>" target="_blank">
                                    <i class="fas fa-shield-alt text-danger"></i> <?= __('admin.nav_admin_api_docs') ?>
                                </a>
                                <a class="dropdown-item" href="<?= base_url('admincontrol/tutorial') ?>">
                                    <i class="fas fa-graduation-cap"></i> <?= __('admin.nav_tutorial') ?>
                                </a>
                            </div>
                        </div>
                    </nav>
                </div>
            </div>

            <!-- Settings Panel -->
            <div class="settings-panel" id="settingsPanel">
                <div class="settings-panel-header">
                    <h5 class="mb-0">
                        <i class="fas fa-robot me-2"></i><?= __('admin.admin_assistant') ?>
                    </h5>
                    <button class="btn btn-sm btn-outline-light" onclick="toggleSettingsPanel()">
                        <i class="fas fa-times"></i>
                    </button>
                </div>
                <div class="settings-panel-body">
                    <!-- Dynamic Notifications -->
                    <div class="settings-section">
                        <h6 class="settings-section-title">
                            <i class="fas fa-bell me-2 text-primary"></i><?= __('admin.recent_activity') ?>
                        </h6>
                        <?php if($notifications_count > 0): ?>
                            <div class="settings-item">
                                <div class="d-flex justify-content-between align-items-center">
                                    <div>
                                        <div class="fw-bold"><?= __('admin.unread_notifications') ?></div>
                                        <small class="text-primary"><?= $notifications_count ?> <?= __('admin.new_items') ?></small>
                                    </div>
                                    <a href="<?= base_url('admincontrol/notification') ?>" class="btn btn-sm btn-primary">
                                        <i class="fas fa-eye me-1"></i><?= __('admin.view') ?>
                                    </a>
                                </div>
                            </div>
                        <?php else: ?>
                            <div class="settings-item">
                                <div class="text-center text-muted">
                                    <i class="fas fa-check-circle fs-4 mb-2"></i>
                                    <div><?= __('admin.all_caught_up') ?></div>
                                </div>
                            </div>
                        <?php endif; ?>
                    </div>

                    <!-- System Health -->
                    <div class="settings-section">
                        <h6 class="settings-section-title">
                            <i class="fas fa-heartbeat me-2 text-success"></i><?= __('admin.system_health') ?>
                        </h6>
                        <div class="settings-item">
                            <div class="d-flex justify-content-between align-items-center">
                                <div>
                                    <div class="fw-bold"><?= __('admin.php_version') ?></div>
                                    <small class="text-success"><?= phpversion() ?> ✓</small>
                                </div>
                                <div class="badge bg-success">
                                    <i class="fas fa-check"></i>
                                </div>
                            </div>
                        </div>
                        <div class="settings-item">
                            <div class="d-flex justify-content-between align-items-center">
                                <div>
                                    <div class="fw-bold"><?= __('admin.database') ?></div>
                                    <small class="text-success"><?= __('admin.connected') ?> ✓</small>
                                </div>
                                <div class="badge bg-success">
                                    <i class="fas fa-database"></i>
                                </div>
                            </div>
                        </div>
                        <?php if($required): ?>
                        <div class="settings-item">
                            <div class="d-flex justify-content-between align-items-center mb-2">
                                <div>
                                    <div class="fw-bold"><?= __('admin.configuration_issues') ?></div>
                                    <small class="text-warning"><?= count(explode("\n", trim($required))) ?> <?= __('admin.settings_missing') ?></small>
                                </div>
                                <button class="btn btn-sm btn-outline-warning" onclick="toggleIssues()">
                                    <i class="fas fa-eye me-1"></i><?= __('admin.details') ?>
                                </button>
                            </div>
                            <div id="issuesDetails" style="display: none;">
                                <div class="border-top pt-2">
                                    <?php 
                                    $missing_list = explode("\n", trim($required));
                                    foreach($missing_list as $missing): 
                                        if(trim($missing)):
                                            $parts = explode(" - ", trim($missing));
                                            $section = $parts[0] ?? '';
                                            $field = $parts[1] ?? '';
                                    ?>
                                    <div class="d-flex align-items-center justify-content-between py-1">
                                        <div class="small">
                                            <span class="text-muted"><?= ucfirst($section) ?>:</span>
                                            <span class="fw-medium"><?= ucfirst(str_replace('_', ' ', $field)) ?></span>
                                        </div>
                                        <a href="<?= base_url('admincontrol/paymentsetting') ?>#<?= $section ?>" class="btn btn-sm btn-outline-primary">
                                            <i class="fas fa-arrow-right"></i>
                                        </a>
                                    </div>
                                    <?php endif; endforeach; ?>
                                </div>
                            </div>
                        </div>
                        <?php endif; ?>
                    </div>

                    <!-- Quick Actions -->
                    <div class="settings-section">
                        <h6 class="settings-section-title">
                            <i class="fas fa-bolt me-2 text-warning"></i><?= __('admin.quick_actions') ?>
                        </h6>
                        <div class="d-grid gap-2">
                            <a href="<?= base_url('admincontrol/paymentsetting') ?>" class="btn btn-outline-primary btn-sm">
                                <i class="fas fa-cog me-2"></i><?= __('admin.system_settings') ?>
                            </a>
                            <a href="<?= base_url('admincontrol/backup') ?>" class="btn btn-outline-warning btn-sm">
                                <i class="fas fa-download me-2"></i><?= __('admin.backup_system') ?>
                            </a>
                            <a href="<?= base_url('admincontrol/todolist') ?>" class="btn btn-outline-info btn-sm">
                                <i class="fas fa-tasks me-2"></i><?= __('admin.to_do_list') ?>
                            </a>
                            <a href="<?= base_url('admincontrol/system_status') ?>" class="btn btn-outline-success btn-sm">
                                <i class="fas fa-server me-2"></i><?= __('admin.system_status') ?>
                            </a>
                        </div>
                    </div>



                    <!-- AI Assistant Placeholder -->
                    <div class="settings-section">
                        <h6 class="settings-section-title">
                            <i class="fas fa-robot me-2 text-info"></i><?= __('admin.ai_assistant') ?>
                        </h6>
                        <div class="settings-item">
                            <div class="text-center text-muted">
                                <i class="fas fa-sparkles fs-4 mb-2"></i>
                                <div class="fw-bold mb-1"><?= __('admin.coming_soon') ?></div>
                                <small><?= __('admin.ai_powered_suggestions') ?></small>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <!-- Settings Panel Overlay -->
            <div class="settings-overlay" id="settingsOverlay" onclick="toggleSettingsPanel()"></div>
            
            <!-- Content Area -->
            <div class="content-area">
            </div>