<?php
include_once __DIR__ . "/config.php";

$scDocRoot = isset($_SERVER['DOCUMENT_ROOT']) ? str_replace('\\', '/', rtrim($_SERVER['DOCUMENT_ROOT'], '/')) : '';
$scHeaderDir = str_replace('\\', '/', __DIR__);
$scBasePath = '';

$isLocal = (strpos($_SERVER['HTTP_HOST'] ?? '', 'localhost') !== false || strpos($_SERVER['HTTP_HOST'] ?? '', '127.0.0.1') !== false);
if ($isLocal && $scDocRoot !== '' && strpos($scHeaderDir, $scDocRoot) === 0) {
  $scBasePath = substr($scHeaderDir, strlen($scDocRoot));
}
$scBasePath = '/' . trim($scBasePath, '/');
if ($scBasePath === '/') {
  $scBasePath = '';
}

function scAssetUrl($path) {
  global $scBasePath;
  return ($scBasePath === '' ? '' : $scBasePath) . '/' . ltrim($path, '/');
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8"/>
  <meta name="viewport" content="width=device-width, initial-scale=1"/>
  <meta name="robots" content="index, follow"/>
  <title>SureCertificate: Professional Bootcamps and Certification Courses</title>
  <meta name="description" content="Browse through classroom and online training courses offered by SureCertificate. PMP, CSM, CSPO, Agile, Scrum, Data Science, Cloud, DevOps and more."/>
  <link rel="preconnect" href="https://fonts.googleapis.com"/>
  <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin/>
  <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap" rel="stylesheet"/>
  <base href="<?php echo defined('BASE_URL') ? BASE_URL : ($scBasePath === '' ? '/' : ($scBasePath . '/')); ?>"/>
  <link rel="icon" href="<?php echo scAssetUrl('favicon.ico'); ?>" type="image/x-icon"/>
  <!-- Legacy SureCertificate-like styles (many internal pages rely on these classnames) -->
  <link rel="stylesheet" href="https://assets.surecertificate.com/567/_next/static/css/f3b0c3e2f7fba9fa.css"/>
  <link rel="stylesheet" href="https://assets.surecertificate.com/567/_next/static/css/14d4e7e18841f8f1.css"/>
  <link rel="stylesheet" href="https://assets.surecertificate.com/567/_next/static/css/86e5d2e6bac97301.css"/>
  <link rel="stylesheet" href="https://assets.surecertificate.com/567/_next/static/css/654bf998fbd06bd1.css"/>
  <link rel="stylesheet" href="https://assets.surecertificate.com/567/_next/static/css/7959a72a87c3e2c3.css"/>
  <link rel="stylesheet" href="https://assets.surecertificate.com/567/_next/static/css/8dd3b6838f426478.css"/>
  <?php
    $brandCss = scAssetUrl('assets/css/custom-brand.css');
  ?>
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css">
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/all.min.css">
  <link rel="stylesheet" href="<?php echo $brandCss; ?>?v=5">
  <link rel="stylesheet" href="<?php echo scAssetUrl('assets/css/hero-animations.css'); ?>">
  <script src="<?php echo scAssetUrl('assets/js/hero-animations.js'); ?>"></script>

  <!--Start of Tawk.to Script-->
  <script type="text/javascript">
  var Tawk_API=Tawk_API||{}, Tawk_LoadStart=new Date();
  (function(){
  var s1=document.createElement("script"),s0=document.getElementsByTagName("script")[0];
  s1.async=true;
  s1.src='https://embed.tawk.to/69cbc0fe91b2531c36cf744e/1jl1ujpmf';
  s1.charset='UTF-8';
  s1.setAttribute('crossorigin','*');
  s0.parentNode.insertBefore(s1,s0);
  })();
  </script>
  <!--End of Tawk.to Script-->

  <style>
    :root { --sc-green:#5DA363; --sc-dark:#2C4765; --sc-border:#e5e7eb; --sc-bg:#F8FAF9; }
    body { margin:0; font-family:"Inter","Segoe UI",Arial,sans-serif; overflow-x:hidden; color:#223047; }
    .sc-topbar { background:var(--sc-dark); color:#fff; font-size:13px; padding:10px 12px; display:flex; justify-content:space-between; align-items:center; flex-wrap:wrap; }
    .sc-topbar-left { display:flex; gap:20px; align-items:center; }
    .sc-topbar-left a { color:#fff; text-decoration:none; font-weight:600; display:flex; align-items:center; gap:6px; }
    .sc-topbar-left a:hover { color:#7EC88A; }
    .sc-topbar-center { flex:1; text-align:center; font-weight:500; }
    .sc-topbar-center a { color:#7EC88A; font-weight:800; text-decoration:underline; }
    @media (max-width: 768px) {
      .sc-topbar { flex-direction:column; gap:8px; justify-content:center; }
      .sc-topbar-left { width:100%; justify-content:center; }
    }

    .sc-header { position:sticky; top:0; z-index:9999; background:#fff; border-bottom:1px solid var(--sc-border); }
    .sc-header.sc-shadow { box-shadow:0 2px 22px rgba(0,0,0,0.08); }
    .sc-wrap { max-width:1400px; margin:0 auto; padding:0 20px; }
    .sc-nav { display:flex; align-items:center; gap:10px; height:120px; }
    .sc-logo img {
      height: 87px;
      width: auto;
      object-fit: contain;
      margin: 5px 10px;
      display: block;
      transform: scale(1.3);
      transform-origin: left center;
    }
    .sc-all-btn {
      display:flex; align-items:center; gap:8px; padding:9px 14px; border:1.5px solid #d1d5db; border-radius:10px;
      background:#fff; cursor:pointer; font-size:13px; font-weight:800; color:#111; white-space:nowrap;
    }
    .sc-all-btn.active { border-color:var(--sc-green); background:#F0F9F1; color:var(--sc-green); }

    .sc-links { display:flex; align-items:center; gap:2px; flex:1; min-width:0; }
    .sc-link, .sc-dd-btn {
      padding:9px 12px; border-radius:10px; border:0; background:transparent; cursor:pointer;
      font-size:13px; font-weight:600; color:#334155; white-space:nowrap;
    }
    .sc-link:hover, .sc-dd-btn:hover { background:#f3f4f6; }

    .sc-dd { position:relative; }
    .sc-dd-panel {
      display:none; position:absolute; top:calc(100% + 6px); left:0; z-index:9999;
      background:#fff; border:1px solid var(--sc-border); border-radius:12px; min-width:260px;
      box-shadow:0 14px 40px rgba(0,0,0,0.14); padding:6px 0;
      animation: scDrop 0.16s ease;
    }
    /* Invisible bridge to prevent hover loss */
    .sc-dd-panel::before {
      content: ''; position: absolute; top: -10px; left: 0; right: 0; height: 10px;
    }
    @keyframes scDrop { from { opacity:0; transform:translateY(-6px); } to { opacity:1; transform:translateY(0); } }
    .sc-dd:hover .sc-dd-panel { display:block; }
    .sc-dd-panel a { display:block; padding:10px 16px; color:#334155; text-decoration:none; font-size:13px; }
    .sc-dd-panel a:hover { background:#F0F9F1; color:var(--sc-green); }

    .sc-search { display:flex; align-items:center; position:relative; margin-left:6px; }
    .sc-search input {
      width:260px; max-width:34vw; height:40px; padding:0 40px 0 14px; border:1.5px solid #d1d5db;
      border-radius:10px; font-size:13px; outline:none; transition:border-color .2s;
    }
    .sc-search input:focus { border-color:var(--sc-green); }
    .sc-search button { position:absolute; right:10px; background:none; border:0; cursor:pointer; color:#6b7280; }

    .sc-cta { display:flex; gap:8px; margin-left:8px; }
    .sc-cta a {
      display:inline-flex; align-items:center; justify-content:center; height:40px; padding:0 14px; border-radius:10px;
      text-decoration:none; font-size:13px; font-weight:800; white-space:nowrap;
    }
    .sc-cta .sc-outline { border:1.5px solid var(--sc-dark); color:var(--sc-dark); background:#fff; }
    .sc-cta .sc-solid { background:var(--sc-green); color:#fff; }

    /* Mega menu */
    .sc-mega-overlay { display:none; position:fixed; inset:0; background:rgba(0,0,0,0.28); z-index:9998; }
    .sc-mega-overlay.active { display:block; }
    #sc-mega {
      display:none; position:fixed; left:0; right:0; top:100px; z-index:9999;
      padding:14px 0;
    }
    #sc-mega.open { display:block; }
    .sc-mega-card {
      max-width:1400px; margin:0 auto; background:#fff; border:1px solid var(--sc-border); border-radius:16px;
      box-shadow:0 22px 56px rgba(0,0,0,0.18); overflow:hidden; display:flex; min-height:520px;
    }
    .sc-mega-left {
      width:270px; background:var(--sc-bg); border-right:1px solid #E8EEE9; overflow:auto; padding:10px 0;
    }
    .sc-mega-item {
      display:flex; align-items:center; gap:10px; padding:11px 16px; cursor:pointer; user-select:none;
      font-size:13px; font-weight:600; color:#334155;
    }
    .sc-mega-item:hover { background:#fff; }
    .sc-mega-item.active { background:#fff; border-right:3px solid var(--sc-green); color:var(--sc-green); font-weight:800; }
    .sc-mega-ic { width:30px; height:30px; border-radius:8px; background:#E8F5E9; display:flex; align-items:center; justify-content:center; color:var(--sc-green); font-weight:900; }
    .sc-mega-right { flex:1; overflow:auto; padding:22px 24px; }
    .sc-mega-title { margin:0 0 12px; font-size:15px; font-weight:900; color:var(--sc-dark); }
    .sc-mega-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:6px 10px; }
    .sc-mega-link {
      display:flex; gap:8px; align-items:flex-start; padding:8px 10px; border-radius:10px;
      text-decoration:none; color:#334155; font-size:13px;
    }
    .sc-mega-link:hover { background:#F0F9F1; color:var(--sc-green); }
    .sc-dot { width:7px; height:7px; border-radius:50%; background:var(--sc-green); margin-top:6px; flex-shrink:0; }
    .sc-mega-actions { margin-top:16px; display:flex; gap:10px; flex-wrap:wrap; }
    .sc-mega-actions a { text-decoration:none; font-weight:800; font-size:12.5px; }
    .sc-browse { background:var(--sc-green); color:#fff; padding:9px 14px; border-radius:10px; display:inline-flex; }
    .sc-view { color:var(--sc-green); padding:9px 10px; }

    @media (max-width: 1100px) {
      .sc-search input { width:200px; }
      .sc-mega-card { min-height:480px; }
      .sc-mega-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
    }

    @media (max-width: 768px) {
      /* Safely fallback 12-column grids lacking mobile col-12 to a vertical stack */
      .grid-cols-12 { display: flex !important; flex-direction: column !important; width: 100% !important; }
      .grid-cols-12 > * { width: 100% !important; max-width: 100% !important; }

      /* ── Inside-page: course card grid → 1 col on tablet ── */
      [class*="grid-cols-1"][class*="md:grid-cols-3"] {
        grid-template-columns: 1fr !important;
        display: grid !important;
      }
      [class*="grid-cols-1"][class*="md:grid-cols-4"] {
        grid-template-columns: 1fr !important;
        display: grid !important;
      }
      /* Stats bar (4 items in a flex row) — wrap and show 2 per row */
      .grow.shrink.basis-0.self-stretch.justify-start.items-start {
        flex-wrap: wrap !important;
      }
      .grow.shrink.basis-0.self-stretch.justify-start.items-start > div {
        flex: 0 0 50% !important;
        max-width: 50% !important;
        box-sizing: border-box;
      }
    }

    /* ── Mobile: all multi-column grids → 2 cols max (inside pages) ── */
    @media (max-width: 640px) {
      /* Course card grids: 1 column on mobile */
      [class*="grid-cols-1"][class*="md:grid-cols-3"],
      [class*="grid-cols-1"][class*="md:grid-cols-4"] {
        grid-template-columns: 1fr !important;
        display: grid !important;
        gap: 16px !important;
      }

      /* Image aspect ratio inside cards on small screens */
      [class*="grid-cols-1"][class*="md:grid-cols-3"] img,
      [class*="grid-cols-1"][class*="md:grid-cols-4"] img {
        aspect-ratio: 4/3;
      }

      /* Course card body padding reduced on small screens */
      .rounded-xl .p-spacing20, .rounded-xl [class*="p-spacing"] {
        padding: 10px !important;
      }

      /* Stats bar: 2x2 grid on phone */
      .grow.shrink.basis-0.self-stretch.justify-start.items-start {
        flex-wrap: wrap !important;
        gap: 0 !important;
      }
      .grow.shrink.basis-0.self-stretch.justify-start.items-start > div {
        flex: 0 0 50% !important;
        max-width: 50% !important;
        padding: 8px !important;
        box-sizing: border-box;
      }

      /* Search box in course listing header on small screens */
      .w-100 { width: auto !important; min-width: 120px !important; }

      /* Section title + search bar: stack vertically on mobile */
      #explorecourses { flex-direction: column !important; align-items: flex-start !important; gap: 12px !important; }
      #explorecourses .w-100 { width: 100% !important; }
      /* Fix h2/div font size inside section title on mobile */
      #explorecourses .text-3xl { font-size: 1.5rem !important; line-height: 1.3 !important; }
    }

    @media (max-width: 900px) {
      .sc-nav { height: 80px; justify-content: space-between; }
      .sc-logo img { height: 50px; transform: scale(1.1); max-width: 55vw; }
      .sc-links { display:none; }
      .sc-search { display:none; }
      .sc-cta { display:none; }
      
      /* Mobile Mega Menu Fix: Normal scrolling list */
      #sc-mega { top:80px; bottom:0; height:calc(100vh - 80px); overflow-y:auto; padding:0; background:#f9fafb; margin:0; }
      .sc-mega-card { min-height:auto; display:block; border-radius:0; border:none; box-shadow:none; background:transparent;}
      .sc-mega-left { display:none; }
      .sc-mega-right { padding:0; display:block; height:auto; overflow:visible; }
      .sc-mega-pane { display:block !important; padding:20px 16px; border-bottom:8px solid #e5e7eb; background:#fff; margin-bottom:0; }
      .sc-mega-title { font-size:18px; margin-bottom:16px; border-bottom:1px solid #e5e7eb; padding-bottom:12px; color:var(--sc-green); }
      .sc-mega-grid { grid-template-columns: 1fr; gap:12px; }
      .sc-mega-link { background:#f9fafb; padding:12px 14px; border:1px solid #e5e7eb; border-radius:8px; font-weight:600; font-size:14px; display:flex;}
      .sc-browse { display:none; }
      .sc-view { text-align:center; display:block; padding:12px; border:1.5px solid var(--sc-green); border-radius:8px; margin-top:12px; }
    }

    /* Voucher Blinking Button */
    .sc-blinker {
      background: #f59e0b !important;
      color: #fff !important;
      font-weight: 900 !important;
      animation: scBlink 1.2s infinite;
      border: none !important;
    }
    @keyframes scBlink {
      0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.7); }
      50% { opacity: 0.85; box-shadow: 0 0 0 8px rgba(245, 158, 11, 0); }
    }
    .mobile-voucher { display: none; }
    @media (max-width: 900px) {
      .mobile-voucher {
        display: inline-flex;
        align-items: center;
        height: 36px;
        padding: 0 12px;
        border-radius: 8px;
        font-size: 13px;
        text-decoration: none;
        margin: 0 auto;
      }
    }
  </style>

  <!-- jQuery & AutoComplete -->
  <link rel="stylesheet" href="https://code.jquery.com/ui/1.13.2/themes/base/jquery-ui.css">
  <script src="https://code.jquery.com/jquery-3.7.1.min.js"></script>
  <script src="https://code.jquery.com/ui/1.13.2/jquery-ui.min.js"></script>
  <style>
    .ui-autocomplete { z-index: 1000000 !important; max-height: 250px; overflow-y: auto; overflow-x: hidden; border-radius: 8px; box-shadow: 0 10px 25px rgba(0,0,0,0.1); border: 1px solid #e5e7eb; }
    .ui-menu-item { font-family: "Inter", sans-serif; font-size: 13px; font-weight: 600; padding: 4px; }
    .ui-menu-item-wrapper.ui-state-active { background: #F0F9F1 !important; color: #5DA363 !important; border: none !important; margin: 0 !important; border-radius: 4px; }
  </style>
  <!-- Mobile chart overflow fix: Soaring Demand salary chart -->
  <style>
    /* Salary chart card: enable horizontal scroll on mobile so the
       inline-flex chart row (min ~680px) doesn't crush its columns */
    @media (max-width: 768px) {
      /* Target the white rounded card wrapping the salary chart */
      .rounded-xl.bg-white { overflow-x: auto !important; -webkit-overflow-scrolling: touch !important; }

      /* The inline-flex chart row: enforce minimum usable width */
      .inline-flex.w-full.justify-start.items-start,
      .gap-spacing32.pt-spacing48.w-full.justify-start.items-start {
        min-width: 680px !important;
        flex-wrap: nowrap !important;
      }

      /* Each column in the chart row */
      .inline-flex.w-full.justify-start.items-start > div,
      .gap-spacing32.pt-spacing48.w-full.justify-start.items-start > div {
        flex-shrink: 0 !important;
        min-width: 160px !important;
      }

      /* grow shrink basis-0 children (salary columns) */
      .grow.shrink.basis-0.flex-col {
        min-width: 150px !important;
        flex-shrink: 0 !important;
      }
    }
  </style>
  <script>
    // JS fallback: ensure salary chart scrolls on mobile
    document.addEventListener('DOMContentLoaded', function() {
      if (window.innerWidth > 768) return;
      // Find all inline-flex rows that contain salary chart data
      var inlineFlexRows = document.querySelectorAll('div');
      inlineFlexRows.forEach(function(el) {
        var cls = el.className || '';
        if (cls.includes('inline-flex') && cls.includes('w-full') && cls.includes('justify-start') && cls.includes('items-start')) {
          // This is the salary chart row — set min-width
          el.style.minWidth = '680px';
          el.style.flexWrap = 'nowrap';
          // Make its parent scrollable
          var parent = el.parentElement;
          while (parent) {
            parent.style.overflowX = 'auto';
            parent.style.webkitOverflowScrolling = 'touch';
            if (parent.className && parent.className.includes('rounded-xl')) break;
            parent = parent.parentElement;
          }
        }
        // Also fix grow/shrink/basis-0/flex-col columns
        if (cls.includes('grow') && cls.includes('shrink') && cls.includes('basis-0') && cls.includes('flex-col')) {
          el.style.minWidth = '150px';
          el.style.flexShrink = '0';
        }
      });
    });

    // ================================================================
    // CATEGORY PAGE HERO FIX
    // The banner image has position:absolute with inline style which
    // can't be overridden by CSS. JS directly fixes the layout.
    // ================================================================
    document.addEventListener('DOMContentLoaded', function() {

      // Find the category banner images (col-md-5 with absolute img)
      var imageWrappers = document.querySelectorAll('.col-12.col-md-5');
      imageWrappers.forEach(function(colWrapper) {
        // Find the relative h-full inner wrapper
        var innerDiv = colWrapper.querySelector('div.relative');
        if (!innerDiv) return;

        // Find the absolutely-positioned image
        var img = innerDiv.querySelector('img');
        if (!img) return;

        var isMobile = window.innerWidth < 768;
        var imgHeight = isMobile ? '220px' : '380px';

        // Fix inner div: give it a proper height
        innerDiv.style.cssText += ';width:100%;height:' + imgHeight + ';min-height:' + imgHeight + ';display:block;overflow:hidden;border-radius:12px;';

        // Fix image: convert from absolute to static with object-fit
        img.style.cssText = 'position:relative;width:100%;height:100%;object-fit:cover;object-position:center;display:block;';

        // Fix outer column wrapper height
        colWrapper.style.cssText += ';min-height:' + imgHeight + ';width:100%;';
      });

      // Fix the grid container: md:grid grid-cols-1 md:gap-5 md:grid-cols-12
      // Tailwind not compiled → it renders as a flex column. On desktop make it 2-col.
      var heroGrids = document.querySelectorAll('.col-12.col-md-5');
      heroGrids.forEach(function(col5) {
        var gridRow = col5.parentElement;
        if (!gridRow) return;
        var cls = gridRow.className || '';
        if (!cls.includes('grid-cols-12') && !cls.includes('col-md-5')) return;

        if (window.innerWidth >= 768) {
          // Desktop: 2-column grid with image on right, text on left
          gridRow.style.cssText += ';display:grid;grid-template-columns:5fr 7fr;gap:32px;align-items:center;';
        } else {
          // Mobile: flex column stack
          gridRow.style.cssText += ';display:flex;flex-direction:column;gap:0;';
          // Image col first
          col5.style.order = '-1';

          // Text col full width
          var col7 = gridRow.querySelector('.col-12.col-md-7');
          if (col7) {
            col7.style.cssText += ';width:100%;padding-top:20px;';
          }
        }
      });

      // Category banner h1: ensure full width (w-62.5 = 250px clips text)
      var bannerH1s = document.querySelectorAll('.category-banner h1');
      bannerH1s.forEach(function(h1) {
        h1.style.cssText += ';width:100%;max-width:100%;';
        if (window.innerWidth < 768) {
          h1.style.fontSize = '1.6rem';
          h1.style.lineHeight = '1.3';
        }
      });

    }); // end category hero fix

    // ================================================================
    // INNER SECTION GRID FIX (Prerequisites, Eligibilities, etc.)
    // All section content grids (grid-cols-12 grid gap-5) need proper
    // column widths — since Tailwind grid is not compiled, children
    // collapse to minimal widths. Fix all at once.
    // ================================================================
    document.addEventListener('DOMContentLoaded', function() {

      // Fix all inner section grids
      var innerGrids = document.querySelectorAll('.grid.grid-cols-12, .grid-cols-12.grid');
      innerGrids.forEach(function(grid) {
        var children = Array.from(grid.children);
        if (children.length === 0) return;

        if (window.innerWidth >= 768) {
          // Desktop: make a proper grid. Detect col-md-7/col-md-5 split
          var has7and5 = children.some(function(c) { return c.classList.contains('col-md-7'); }) &&
                         children.some(function(c) { return c.classList.contains('col-md-5'); });
          var has7only = children.some(function(c) { return c.classList.contains('col-md-7'); }) &&
                         !children.some(function(c) { return c.classList.contains('col-md-5'); });

          if (has7and5) {
            grid.style.cssText += ';display:grid;grid-template-columns:7fr 5fr;gap:32px;align-items:center;width:100%;';
          } else {
            grid.style.cssText += ';display:block;width:100%;';
          }

          // Ensure all column children are full width inside their cell
          children.forEach(function(child) {
            child.style.cssText += ';width:100%;max-width:100%;min-width:0;box-sizing:border-box;';
          });

        } else {
          // Mobile: stack everything
          grid.style.cssText += ';display:flex;flex-direction:column;gap:16px;width:100%;';
          children.forEach(function(child) {
            child.style.cssText += ';width:100%;max-width:100%;';
          });
        }
      });

      // Fix ratings row: prevent "4." / "8/" / "5" 3-line break
      // The ratings row has flex + gap-spacing20 + border-y
      var ratingRows = document.querySelectorAll('div[class*="gap-spacing20"][class*="py-spacing16"]');
      ratingRows.forEach(function(row) {
        row.style.cssText += ';flex-wrap:wrap;gap:12px 20px;';
        Array.from(row.children).forEach(function(child) {
          child.style.cssText += ';white-space:nowrap;flex:0 0 auto;';
          // Also fix text within each rating item
          var textEls = child.querySelectorAll('span, div, p');
          textEls.forEach(function(el) {
            el.style.whiteSpace = 'nowrap';
          });
        });
      });

      // Fix max-w-133 containers (Tailwind not compiled, no constraint applied)
      var maxW133 = document.querySelectorAll('.max-w-133');
      maxW133.forEach(function(el) {
        el.style.cssText += ';max-width:100%;width:100%;';
      });

    }); // end inner section grid fix
  </script>
</head>
<body>

<?php
  $MEGA = [
    'ai' => [
      'label' => 'Artificial Intelligence',
      'icon' => 'AI',
      'browse' => 'artificial-intelligence-courses.php',
      'links' => [
        ['Applied Agentic AI Certification', 'data-science/applied-agentic-ai-certification-course.php'],
        ['Generative AI & Prompt Engineering', 'data-science/generative-ai-and-prompt-engineering-course.php'],
        ['Machine Learning with Python', 'data-science/machine-learning-with-python-certification-training.php'],
        ['Deep Learning Certification', 'data-science/deep-learning-certification-training.php'],
        ['Natural Language Processing (NLP)', 'data-science/learn-natural-language-processing-with-python-nlp-course.php'],
        ['TensorFlow Certification', 'data-science/tensorflow-certification-training.php'],
        ['AI Product Management', 'data-science/ai-product-management-course.php'],
        ['Gen AI for Scrum Masters', 'agile-management/gen-ai-for-scrum-masters.php'],
        ['Gen AI for Project Managers', 'agile-management/generative-ai-course-for-project-managers.php'],
        ['Gen AI for Product Owners/Managers', 'agile-management/generative-ai-course-for-product-managers.php'],
        ['Gen AI for Enterprise Agilist', 'agile-management/generative-ai-course-for-enterprise.php'],
        ['AI Powered Software Development', 'programming/ai-in-software-development.php'],
        ['No-Code AI Agents & Automation', 'programming/no-code-ai-agents-and-automation-course.php'],
      ],
    ],
    'agile' => [
      'label' => 'Agile Management',
      'icon' => 'Ag',
      'browse' => 'agile-management.php',
      'links' => [
        ['CSM Certification', 'agile-management/csm-certification-training.php'],
        ['CSPO Certification', 'agile-management/cspo-certification-c.php'],
        ['PSM Certification', 'agile-management/psm-certification-training.php'],
        ['Leading SAFe 6.0', 'agile-management/leading-safe-6-0-certification-training.php'],
        ['SAFe POPM', 'agile-management/safe40popm-certification-training.php'],
        ['SAFe Scrum Master', 'agile-management/safe40scrum-master-course.php'],
        ['SAFe RTE', 'agile-management/safe-release-train-engineer-certification-training.php'],
        ['PMI-ACP', 'agile-management/pmi-acp-certification-training.php'],
        ['ICP-ACC', 'agile-management/icp-agile-certified-coach-icp-acc-training.php'],
        ['Kanban with Jira', 'agile-management/kanban-development-with-atlassian-jira-agile.php'],
        ['Agile User Stories', 'agile-management/agile-user-stories-training.php'],
        ['Advanced CSPO', 'agile-management/advanced-certified-scrum-product-owner-training.php'],
      ],
    ],
    'pm' => [
      'label' => 'Project Management',
      'icon' => 'PM',
      'browse' => 'project-management-certifications.php',
      'links' => [
        ['PMP Certification', 'project-management/pmp-certification-training.php'],
        ['CAPM Certification', 'project-management/capm-certification-training.php'],
        ['PRINCE2 Foundation', 'project-management/prince2-foundation-certification-training.php'],
        ['PRINCE2 Practitioner', 'project-management/prince2-practitioner-certification-training.php'],
        ['PgMP Certification', 'project-management/pgmp-certification-training.php'],
        ['PfMP Certification', 'project-management/pfmp-certification-training.php'],
        ['PMI-RMP', 'project-management/pmi-rmp-certification-training.php'],
        ['Product Management', 'project-management/product-management-certification-training.php'],
        ['Change Management Foundation', 'project-management/change-management-foundation-certification-course.php'],
        ['Microsoft Project', 'project-management/microsoft-project-2013-training.php'],
      ],
    ],
    'cyber' => [
      'label' => 'Cyber Security',
      'icon' => 'Cy',
      'browse' => 'cyber-security-courses.php',
      'links' => [
        ['CISSP Training', 'cyber-security/cissp-certification-training.php'],
        ['CEH Ethical Hacking', 'it-security/ceh-ethical-hacking-certification-course.php'],
        ['CISA Training', 'it-security/cisa-certification-training.php'],
        ['CISM Training', 'it-security/cism-training.php'],
        ['CCSP Training', 'it-security/ccsp-certification-training.php'],
        ['PCI-DSS', 'it-security/pci-data-security-standard-training.php'],
        ['COBIT 5 Foundation', 'it-security/cobit-5-foundation-training.php'],
      ],
    ],
    'cloud' => [
      'label' => 'Cloud Computing',
      'icon' => 'Cl',
      'browse' => 'cloud-computing-courses.php',
      'links' => [
        ['AWS Solutions Architect', 'cloud-computing/aws-solution-architect-certification-training.php'],
        ['AWS Cloud Practitioner', 'cloud-computing/aws-cloud-practitioner-essentials-certification.php'],
        ['AWS SysOps Administrator', 'cloud-computing/aws-sysops-administrator-associate-certification-training.php'],
        ['Azure Fundamentals (AZ-900)', 'cloud-computing/microsoft-azure-fundamentals-training.php'],
        ['Azure Administrator (AZ-104)', 'cloud-computing/microsoft-azure-administrator-training.php'],
        ['Azure Data Engineer (DP-203)', 'cloud-computing/microsoft-azure-data-engineering-certification-training.php'],
        ['Azure Security Engineer (AZ-500)', 'cloud-computing/microsoft-azure-security-engineer-certification-training.php'],
        ['AWS Cloud Architect Masters', 'cloud-computing/aws-cloud-architect-masters-program-certification.php'],
      ],
    ],
    'itsm' => [
      'label' => 'IT Service Management',
      'icon' => 'IT',
      'browse' => 'itsm-certifications.php',
      'links' => [
        ['ITIL V4 Foundation', 'it-service-management/itil-foundation-certification-training.php'],
        ['ITIL Strategist: DPI', 'it-service-management/itil-strategist-direct-plan-improve-training.php'],
        ['ITIL Practitioner', 'it-service-management/itil-practitioner.php'],
      ],
    ],
    'ds' => [
      'label' => 'Data Science',
      'icon' => 'DS',
      'browse' => 'data-science-courses.php',
      'links' => [
        ['Data Science with Python', 'data-science/data-science-with-python-certification-training.php'],
        ['Python for Data Science', 'data-science/python-for-data-science-certification-training.php'],
        ['Machine Learning with Python', 'data-science/machine-learning-with-python-certification-training.php'],
        ['Deep Learning', 'data-science/deep-learning-certification-training.php'],
        ['SQL for Data Analytics', 'data-science/sql-for-data-analytics-course.php'],
        ['Data Science with R', 'data-science/data-science-with-r-certification-training.php'],
      ],
    ],
    'devops' => [
      'label' => 'DevOps',
      'icon' => 'Dv',
      'browse' => 'devops-courses.php',
      'links' => [
        ['DevOps Certification', 'devops/devops-training.php'],
        ['Docker Training', 'devops/docker-training.php'],
        ['Kubernetes Training', 'devops/kubernetes-training.php'],
        ['Jenkins Training', 'devops/jenkins-training.php'],
        ['Ansible Training', 'devops/ansible-training.php'],
      ],
    ],
    'web' => [
      'label' => 'Web Development',
      'icon' => 'WD',
      'browse' => 'web-development-courses.php',
      'links' => [
        ['Node.js Training', 'web-development/node-js-training.php'],
        ['Front-End Bootcamp', 'web-development/front-end-development-bootcamp-training/schedule.php'],
        ['Fullstack Bootcamp', 'web-development/fullstack-development-bootcamp-training/schedule.php'],
        ['Back-End Bootcamp', 'web-development/back-end-development-bootcamp-training/schedule.php'],
      ],
    ],
  ];
?>

<div class="sc-topbar">
  <div class="sc-topbar-left">
    <a href="tel:18887658856"><i class="fa-solid fa-phone"></i> 1-888-765-8856</a>
    <a href="mailto:info@surecertificate.online"><i class="fa-solid fa-envelope"></i> info@surecertificate.online</a>
  </div>
  <div class="sc-topbar-center">
    Level Up Sale — Save up to 50% on top certifications!
    <a href="<?php echo BASE_URL; ?>courses.php">Explore now →</a>
  </div>
  <div style="width:180px;" class="d-none d-md-block"></div> <!-- Spacer for balance -->
</div>

<header id="sc-header" class="sc-header">
  <div class="sc-wrap">
    <nav class="sc-nav">
      <a class="sc-logo" href="<?php echo BASE_URL; ?>index.php">
        <img src="<?php echo scAssetUrl('infinity_images/logo.png'); ?>" alt="SureCertificate logo">
      </a>

      <a href="<?php echo BASE_URL; ?>voucher.php" class="sc-blinker mobile-voucher">Get Voucher</a>

      <button id="sc-all-courses-btn" class="sc-all-btn" type="button" aria-expanded="false">
        All Courses
      </button>

      <div class="sc-links">
        <div class="sc-dd">
          <button class="sc-dd-btn" type="button">Domains</button>
          <div class="sc-dd-panel">
            <a href="<?php echo BASE_URL; ?>artificial-intelligence-courses.php">Artificial Intelligence</a>
            <a href="<?php echo BASE_URL; ?>agile-management.php">Agile Management</a>
            <a href="<?php echo BASE_URL; ?>project-management-certifications.php">Project Management</a>
            <a href="<?php echo BASE_URL; ?>cyber-security-courses.php">Cyber Security</a>
            <a href="<?php echo BASE_URL; ?>cloud-computing-courses.php">Cloud Computing</a>
            <a href="<?php echo BASE_URL; ?>itsm-certifications.php">IT Service Management</a>
            <a href="<?php echo BASE_URL; ?>data-science-courses.php">Data Science</a>
            <a href="<?php echo BASE_URL; ?>devops-courses.php">DevOps</a>
            <a href="<?php echo BASE_URL; ?>web-development-courses.php">Web Development</a>
          </div>
        </div>

        <div class="sc-dd">
          <button class="sc-dd-btn" type="button">AI Courses</button>
          <div class="sc-dd-panel">
            <a href="<?php echo BASE_URL; ?>data-science/applied-agentic-ai-certification-course.php">Applied Agentic AI</a>
            <a href="<?php echo BASE_URL; ?>agile-management/gen-ai-for-scrum-masters.php">Gen AI for Scrum Masters</a>
            <a href="<?php echo BASE_URL; ?>agile-management/generative-ai-course-for-project-managers.php">Gen AI for Project Managers</a>
            <a href="<?php echo BASE_URL; ?>programming/no-code-ai-agents-and-automation-course.php">No-Code AI Agents &amp; Automation</a>
            <a href="<?php echo BASE_URL; ?>artificial-intelligence-courses.php" style="font-weight:800;color:var(--sc-green);border-top:1px solid #eef2f7;margin-top:6px;">View all AI courses →</a>
          </div>
        </div>

        <div class="sc-dd">
          <button class="sc-dd-btn" type="button">ISACA</button>
          <div class="sc-dd-panel" style="max-height: 400px; overflow-y: auto;">
            <a href="<?php echo BASE_URL; ?>isaca/cisa-certification-training.php">CISA — Certified Information Systems Auditor</a>
            <a href="<?php echo BASE_URL; ?>isaca/cism-certification-training.php">CISM — Certified Information Security Manager</a>
            <a href="<?php echo BASE_URL; ?>isaca/crisc-certification-training.php">CRISC — Risk and Information Systems</a>
            <a href="<?php echo BASE_URL; ?>isaca/cgeit-certification-training.php">CGEIT — Governance of Enterprise IT</a>
            <a href="<?php echo BASE_URL; ?>isaca/cdpse-certification-training.php">CDPSE — Data Privacy Solutions Engineer</a>
            <a href="<?php echo BASE_URL; ?>isaca/ccoa-certification-training.php">CCOA — Cybersecurity Operations Analyst</a>
            <a href="<?php echo BASE_URL; ?>isaca/aaia-certification-training.php">AAIA — Advanced in AI Audit</a>
            <a href="<?php echo BASE_URL; ?>isaca/aaism-certification-training.php">AAISM — Advanced in AI Security</a>
            <a href="<?php echo BASE_URL; ?>isaca/aair-certification-training.php">AAIR — Advanced in AI Risk</a>
            <a href="<?php echo BASE_URL; ?>isaca/itca-certification-training.php">ITCA — IT Certified Associate</a>
            <a href="<?php echo BASE_URL; ?>isaca/cet-certification-training.php">CET — Emerging Technology</a>
            <a href="<?php echo BASE_URL; ?>isaca/csxp-certification-training.php">CSX-P — Cybersecurity Practitioner</a>
            <a href="<?php echo BASE_URL; ?>isaca/ccp-certification-training.php">CCP — Certified CMMC Professional</a>
            <a href="<?php echo BASE_URL; ?>isaca/cca-certification-training.php">CCA — Certified CMMC Assessor</a>
            <a href="<?php echo BASE_URL; ?>isaca/lcca-certification-training.php">LCCA — Lead CMMC Certified Assessor</a>
          </div>
        </div>

        <a class="sc-link" href="<?php echo BASE_URL; ?>online.php">Self-Paced</a>

        <div class="sc-dd">
          <button class="sc-dd-btn" type="button">Enterprise</button>
          <div class="sc-dd-panel">
            <a href="<?php echo BASE_URL; ?>corporate-training.php">Corporate Training</a>
            <a href="<?php echo BASE_URL; ?>safe-transformation.php">SAFe Implementation</a>
            <a href="<?php echo BASE_URL; ?>agile-services.php">Agile Solutions</a>
            <a href="<?php echo BASE_URL; ?>enterprise">Enterprise Services</a>
          </div>
        </div>
      </div>

      <form class="sc-search" action="search.php" method="GET" id="sc-global-search">
        <input name="q" id="sc-q-input" type="text" placeholder="Search courses…" autocomplete="off" />
        <button type="submit" aria-label="Search">⌕</button>
      </form>

      <div class="sc-cta">
        <a class="sc-outline" href="<?php echo BASE_URL; ?>contact-us.php">Contact Us</a>
        <a class="sc-solid sc-blinker" href="<?php echo BASE_URL; ?>voucher.php">Get Voucher</a>
      </div>
    </nav>
  </div>
</header>

<div id="sc-mega-overlay" class="sc-mega-overlay"></div>
<div id="sc-mega">
  <div class="sc-mega-card">
    <div class="sc-mega-left" id="sc-mega-left">
      <?php $firstKey = array_key_first($MEGA); ?>
      <?php foreach ($MEGA as $key => $cfg): ?>
        <div class="sc-mega-item <?php echo $key === $firstKey ? 'active' : ''; ?>" data-key="<?php echo $key; ?>">
          <span class="sc-mega-ic"><?php echo $cfg['icon']; ?></span>
          <span><?php echo $cfg['label']; ?></span>
        </div>
      <?php endforeach; ?>
    </div>
    <div class="sc-mega-right" id="sc-mega-right">
      <?php foreach ($MEGA as $key => $cfg): ?>
        <div class="sc-mega-pane" data-key="<?php echo $key; ?>" style="<?php echo $key === $firstKey ? '' : 'display:none;'; ?>">
          <h3 class="sc-mega-title"><?php echo $cfg['label']; ?> — Top Courses</h3>
          <div class="sc-mega-grid">
            <?php foreach ($cfg['links'] as $link): ?>
              <a class="sc-mega-link" href="<?php echo BASE_URL . ltrim($link[1], '/'); ?>"><span class="sc-dot"></span><span><?php echo $link[0]; ?></span></a>
            <?php endforeach; ?>
          </div>
          <div class="sc-mega-actions">
            <a class="sc-browse" href="<?php echo BASE_URL . ltrim($cfg['browse'], '/'); ?>">Browse all in <?php echo $cfg['label']; ?> →</a>
            <a class="sc-view" href="<?php echo BASE_URL; ?>courses.php">Explore all courses →</a>
          </div>
        </div>
      <?php endforeach; ?>
    </div>
  </div>
</div>

<script>
  (function () {
    var header = document.getElementById('sc-header');
    function onScroll() {
      if (!header) return;
      header.classList.toggle('sc-shadow', window.scrollY > 10);
    }
    window.addEventListener('scroll', onScroll, { passive: true });
    onScroll();

    var btn = document.getElementById('sc-all-courses-btn');
    var mega = document.getElementById('sc-mega');
    var overlay = document.getElementById('sc-mega-overlay');
    var open = false;

    function setOpen(next) {
      open = next;
      mega.classList.toggle('open', open);
      overlay.classList.toggle('active', open);
      btn.classList.toggle('active', open);
      btn.setAttribute('aria-expanded', open ? 'true' : 'false');
    }

    btn.addEventListener('click', function (e) {
      e.preventDefault();
      setOpen(!open);
    });
    overlay.addEventListener('click', function () { setOpen(false); });
    document.addEventListener('keydown', function (e) { if (e.key === 'Escape') setOpen(false); });

    var items = document.querySelectorAll('.sc-mega-item');
    var panes = document.querySelectorAll('.sc-mega-pane');

    function show(key) {
      items.forEach(function (it) { it.classList.toggle('active', it.getAttribute('data-key') === key); });
      panes.forEach(function (p) { p.style.display = p.getAttribute('data-key') === key ? 'block' : 'none'; });
    }

    items.forEach(function (it) {
      it.addEventListener('mouseenter', function () { show(it.getAttribute('data-key')); });
      it.addEventListener('click', function () { show(it.getAttribute('data-key')); });
    });
  })();
</script>

<script>
  // Global image fallback for broken/missing internal images
  (function () {
    // Stable Unsplash fallback pool — no API, instant load
    var SC_FALLBACK_POOL = [
      'photo-1523240795612-9a054b0db644','photo-1503676260728-1c00da094a0b',
      'photo-1522202176988-66273c2fd55f','photo-1551288049-bebda4e38f71',
      'photo-1498050108023-c5249f4df085','photo-1517694712202-14dd9538aa97',
      'photo-1461749280684-dccba630e2f6','photo-1552664730-d307ca884978',
      'photo-1454165804606-c3d57bc86b40','photo-1516321318423-f06f85e504b3',
      'photo-1542744173-8e7e53415bb0','photo-1563206767541-3eb2c5952d76',
      'photo-1451187580459-43490279c0fa','photo-1544197150-b99a580bb7a8',
      'photo-1525547719571-a2d4ac8945e2','photo-1488590528505-98d2b5aba04b',
      'photo-1571171637578-41bc2dd41cd2','photo-1515879218367-8466d910aaa4',
      'photo-1531482615713-2afd69097998','photo-1504868584819-f8e8b4ecca53'
    ];

    function hashCode(str) {
      if (!str) return 0;
      var h = 0;
      for (var i = 0; i < str.length; i++) { h = ((h << 5) - h) + str.charCodeAt(i); h |= 0; }
      return Math.abs(h);
    }

    function pickFallbackSrc(img) {
      var title = (img.getAttribute('alt') || '').trim();
      if (!title || title.length < 3) {
        var container = img.closest('a, div[class*="card"], li, article');
        if (container) {
          var h = container.querySelector('h1,h2,h3,h4,h5,strong');
          if (h) title = (h.innerText || h.textContent || '').trim();
        }
      }
      if (!title || title.length < 3) title = 'certification training ' + Math.floor(Math.random()*9999);
      var idx = hashCode(title) % SC_FALLBACK_POOL.length;
      return 'https://images.unsplash.com/' + SC_FALLBACK_POOL[idx] + '?ixlib=rb-4.0.3&auto=format&fit=crop&w=800&q=80';
    }

    function fallbackFor(img) {
      if (img.dataset && img.dataset.scFb === '2') return; // already double-retried
      if (img.dataset && img.dataset.scFb === '1') {
        img.dataset.scFb = '2';
        img.src = 'https://images.unsplash.com/photo-1522202176988-66273c2fd55f?ixlib=rb-4.0.3&auto=format&fit=crop&w=800&q=80';
        return;
      }
      img.dataset.scFb = '1';
      img.src = pickFallbackSrc(img);
      img.srcset = '';
      img.removeAttribute('data-srcset');
      img.removeAttribute('data-src');
      img.removeAttribute('srcset');
    }

    document.addEventListener('error', function (e) {
      if (e.target && e.target.tagName === 'IMG') {
        var t = e.target;
        // Skip tiny icons, data URIs, and SVGs
        if (!t.src || t.src.startsWith('data:') || t.src.endsWith('.svg') || t.src.includes('cloudfront.net')) return;
        if (t.naturalWidth > 0) return; // already loaded fine
        fallbackFor(t);
      }
    }, true);

    document.addEventListener('DOMContentLoaded', function () {
      setTimeout(function () {
        document.querySelectorAll('img').forEach(function (img) {
          var s = img.getAttribute('src') || '';
          if (!s || s === '' || s.includes('invalid-force-fallback') || s.includes('pollinations.ai')) {
            fallbackFor(img);
          }
        });
      }, 100);
    });
  })();
</script>

<?php if ($isLocal && $scBasePath !== ''): ?>
<script>
  // LOCAL DEV ONLY: rewrite absolute /path → /aaa/path for images & links
  // (Body HTML has /aaa/ stripped for live-server compatibility)
  (function () {
    var base = '<?php echo rtrim($scBasePath, '/'); ?>';
    if (!base || base === '/') return;
    function fixEl(el, attr) {
      var v = el.getAttribute(attr);
      if (!v) return;
      // Only fix paths starting with / but NOT // (protocol-relative) and NOT already prefixed
      if (v.charAt(0) === '/' && v.charAt(1) !== '/' && v.indexOf(base + '/') !== 0 && v.indexOf(base + '?') !== 0 && v !== base) {
        el.setAttribute(attr, base + v);
      }
    }
    document.addEventListener('DOMContentLoaded', function () {
      document.querySelectorAll('img[src]').forEach(function(el){ fixEl(el,'src'); });
      document.querySelectorAll('source[src]').forEach(function(el){ fixEl(el,'src'); });
      document.querySelectorAll('a[href]').forEach(function(el){ fixEl(el,'href'); });
    });
    // Also handle dynamically loaded images via MutationObserver
    if (window.MutationObserver) {
      var mo = new MutationObserver(function(muts){
        muts.forEach(function(m){
          m.addedNodes.forEach(function(n){
            if(n.nodeType!==1) return;
            if(n.tagName==='IMG'||n.tagName==='SOURCE') fixEl(n,'src');
            if(n.tagName==='A') fixEl(n,'href');
            n.querySelectorAll&&n.querySelectorAll('img[src],source[src]').forEach(function(el){fixEl(el,'src');});
            n.querySelectorAll&&n.querySelectorAll('a[href]').forEach(function(el){fixEl(el,'href');});
          });
        });
      });
      mo.observe(document.body||document.documentElement, {childList:true, subtree:true});
    }
  })();
</script>
<?php endif; ?>

<style>
@keyframes phonePulse {
  0%,100% { opacity:1; transform:scale(1); }
  50% { opacity:0.4; transform:scale(1.18); }
}
@keyframes phoneBlink {
  0%,100% { background:#16a34a; box-shadow:0 0 0 0 rgba(22,163,74,0.7); }
  50% { background:#22c55e; box-shadow:0 0 0 10px rgba(22,163,74,0); }
}
.sc-phone-blink {
  display:inline-flex;align-items:center;gap:6px;
  background:#16a34a;color:#fff;font-weight:900;font-size:13px;
  padding:7px 14px;border-radius:999px;cursor:pointer;
  animation:phoneBlink 1.4s ease-in-out infinite;
  border:none;width:100%;justify-content:center;margin-bottom:4px;
}
.sc-phone-icon { animation:phonePulse 1.4s ease-in-out infinite; }
.sc-cert-badge {
  display:inline-block;background:#f0fdf4;border:1px solid #bbf7d0;
  color:#15803d;border-radius:6px;padding:2px 8px;font-size:11px;font-weight:800;margin:2px;
}
</style>

<div id="sc-lead-popup" style="display:none;position:fixed;inset:0;z-index:100000;background:rgba(0,0,0,0.65);align-items:center;justify-content:center;backdrop-filter:blur(5px);">
  <div style="background:#fff;border-radius:20px;width:94%;max-width:440px;padding:26px 28px 24px;box-shadow:0 30px 60px rgba(0,0,0,0.25);position:relative;max-height:95vh;overflow-y:auto;">
    <button type="button" onclick="document.getElementById('sc-lead-popup').style.display='none'" style="position:absolute;top:12px;right:14px;background:none;border:none;font-size:26px;cursor:pointer;color:#aaa;line-height:1;">&times;</button>

    <!-- Header -->
    <div style="text-align:center;margin-bottom:16px;">
      <div style="font-size:26px;margin-bottom:4px;">🎓</div>
      <h3 style="font-size:19px;font-weight:900;color:#111;margin:0 0 4px;line-height:1.3;">Get Certified Faster!</h3>
      <p style="font-size:12.5px;color:#555;margin:0 0 10px;line-height:1.6;">Get the best available discount on top certifications like:</p>
      <div style="margin-bottom:10px;">
        <span class="sc-cert-badge">AWS</span>
        <span class="sc-cert-badge">PMP</span>
        <span class="sc-cert-badge">Cisco</span>
        <span class="sc-cert-badge">CompTIA</span>
        <span class="sc-cert-badge">Oracle</span>
      </div>
    </div>

    <!-- Blinking phone CTA -->
    <a href="tel:+18887658856" class="sc-phone-blink">
      <span class="sc-phone-icon">📞</span>
      Call Now: +1 (888) 765-8856
    </a>

    <div style="text-align:center;font-size:12px;color:#888;margin:6px 0 14px;">— or fill the form below —</div>

    <form id="sc-popup-form" onsubmit="return window.submitPopupLead(event)" style="display:flex;flex-direction:column;gap:11px;">
      <div>
        <label style="display:block;font-size:11px;font-weight:800;color:#444;margin-bottom:4px;">👉 Enter your WhatsApp number: *</label>
        <input type="tel" id="popPhone" required placeholder="e.g. +91 98765 43210" style="width:100%;padding:10px 12px;border:2px solid #d1d5db;border-radius:10px;font-size:14px;outline:none;box-sizing:border-box;transition:border-color .2s;"
          onfocus="this.style.borderColor='#22c55e'" onblur="this.style.borderColor='#d1d5db'" />
      </div>
      <div>
        <label style="display:block;font-size:11px;font-weight:800;color:#444;margin-bottom:4px;">Email ID *</label>
        <input type="email" id="popEmail" required placeholder="you@email.com" style="width:100%;padding:10px 12px;border:2px solid #d1d5db;border-radius:10px;font-size:14px;outline:none;box-sizing:border-box;transition:border-color .2s;"
          onfocus="this.style.borderColor='#22c55e'" onblur="this.style.borderColor='#d1d5db'" />
      </div>
      <div>
        <label style="display:block;font-size:11px;font-weight:800;color:#444;margin-bottom:4px;">Course *</label>
        <input type="text" id="popCourse" required placeholder="Which certification are you interested in?" style="width:100%;padding:10px 12px;border:2px solid #d1d5db;border-radius:10px;font-size:14px;outline:none;box-sizing:border-box;transition:border-color .2s;"
          onfocus="this.style.borderColor='#22c55e'" onblur="this.style.borderColor='#d1d5db'" />
      </div>

      <!-- Benefits -->
      <div style="background:#f0fdf4;border:2px solid #bbf7d0;border-radius:12px;padding:14px 16px;color:#166534;">
        <div style="font-size:15px;font-weight:900;margin-bottom:6px;color:#14532d;">🎁 What You Get:</div>
        <div style="font-size:14px;font-weight:800;margin-bottom:5px;">✅ Free Consultation</div>
        <div style="font-size:14px;font-weight:800;margin-bottom:5px;">✅ Examination Fees Discount</div>
        <div style="font-size:14px;font-weight:800;">✅ Guaranteed Pass</div>
      </div>

      <div style="display:grid;grid-template-columns:1fr 130px;gap:10px;align-items:end;">
        <div>
          <label id="sc-captcha-label" style="display:block;font-size:11px;font-weight:800;color:#444;margin-bottom:4px;">Captcha *</label>
          <input type="text" id="popCaptcha" inputmode="numeric" autocomplete="off" required style="width:100%;padding:10px 12px;border:2px solid #d1d5db;border-radius:10px;font-size:14px;outline:none;box-sizing:border-box;" />
          <input type="hidden" id="popCaptchaExpected" value="" />
          <input type="hidden" id="popMessage" value="Enquiry from popup" />
        </div>
        <button type="button" onclick="window.scRefreshCaptcha && window.scRefreshCaptcha()" style="height:42px;border:1.5px solid #d1d5db;border-radius:10px;background:#f9fafb;font-weight:800;font-size:12px;cursor:pointer;white-space:nowrap;">🔄 Refresh</button>
      </div>

      <button type="submit" style="width:100%;height:46px;border:0;border-radius:12px;background:#16a34a;color:#fff;font-weight:900;font-size:15px;cursor:pointer;letter-spacing:0.02em;transition:background .2s;"
        onmouseover="this.style.background='#15803d'" onmouseout="this.style.background='#16a34a'">🚀 Get My Free Quote Now</button>
      <div id="sc-popup-res" style="display:none;font-size:13px;font-weight:800;text-align:center;"></div>
    </form>
  </div>
</div>

<script>
  window.scRefreshCaptcha = function () {
    var a = Math.floor(Math.random() * 9) + 1;   // 1..9
    var b = Math.floor(Math.random() * 9) + 1;   // 1..9
    var label = document.getElementById('sc-captcha-label');
    var expected = document.getElementById('popCaptchaExpected');
    var input = document.getElementById('popCaptcha');
    if (label) label.textContent = 'Captcha * (What is ' + a + ' + ' + b + '?)';
    if (expected) expected.value = String(a + b);
    if (input) input.value = '';
  };

  window.submitPopupLead = function (e) {
    e.preventDefault();
    var email = document.getElementById('popEmail').value.trim();
    var phone = document.getElementById('popPhone').value.trim();
    var course = document.getElementById('popCourse').value.trim();
    var message = (document.getElementById('popMessage') ? document.getElementById('popMessage').value.trim() : '');
    var captcha = document.getElementById('popCaptcha') ? document.getElementById('popCaptcha').value.trim() : '';
    var captchaExpected = document.getElementById('popCaptchaExpected') ? document.getElementById('popCaptchaExpected').value.trim() : '';
    var res = document.getElementById('sc-popup-res');

    if (!captchaExpected) {
      window.scRefreshCaptcha && window.scRefreshCaptcha();
      captchaExpected = document.getElementById('popCaptchaExpected') ? document.getElementById('popCaptchaExpected').value.trim() : '';
    }
    if (!captcha || captcha !== captchaExpected) {
      res.style.display = 'block';
      res.style.color = '#dc2626';
      res.textContent = 'Captcha incorrect. Please try again.';
      window.scRefreshCaptcha && window.scRefreshCaptcha();
      return false;
    }

    var body = new URLSearchParams();
    body.append('name', 'Website Visitor');
    body.append('email', email);
    body.append('phone', phone);
    body.append('course', course);
    body.append('message', message);
    body.append('captcha', captcha);
    body.append('captcha_expected', captchaExpected);

    fetch('<?php echo scAssetUrl('submit_popup_lead.php'); ?>', {
      method: 'POST',
      headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
      body: body.toString()
    }).then(function (r) { return r.json(); })
      .then(function (data) {
        res.style.display = 'block';
        res.style.color = data.status === 'success' ? '#16a34a' : '#dc2626';
        res.textContent = data.message || (data.status === 'success' ? 'Submitted.' : 'Error.');
        if (data.status === 'success') {
          setTimeout(function () { document.getElementById('sc-lead-popup').style.display = 'none'; }, 900);
        }
      })
      .catch(function () {
        res.style.display = 'block';
        res.style.color = '#dc2626';
        res.textContent = 'Something went wrong. Please try again.';
      });
    return false;
  };

  // Auto-open on first load after 10 second delay
  (function () {
    try {
      var key = 'sc_lead_popup_shown_v1';
      if (sessionStorage.getItem(key)) return;
      sessionStorage.setItem(key, '1');
      window.addEventListener('load', function () {
        setTimeout(function () {
          var el = document.getElementById('sc-lead-popup');
          window.scRefreshCaptcha && window.scRefreshCaptcha();
          if (el) el.style.display = 'flex';
        }, 10000); // 10 second delay
      });
    } catch (e) {
      // fallback: show after 10s
      window.addEventListener('load', function () {
        setTimeout(function () {
          var el = document.getElementById('sc-lead-popup');
          window.scRefreshCaptcha && window.scRefreshCaptcha();
          if (el) el.style.display = 'flex';
        }, 10000);
      });
    }
  })();
</script>

<script>
  // Ensure footer appears even on legacy pages that forget to include it
  (function () {
    function hasFooter() { return !!document.getElementById('sc-global-footer') || !!document.querySelector('footer'); }
    // Avoid injecting on fragments/JSON endpoints
    if (location.pathname.endsWith('submit_popup_lead.php') || location.pathname.endsWith('submit_lead.php')) return;

    // Wait until the full document is parsed; otherwise pages that include footer at the bottom
    // will get a duplicate footer (one injected + one included).
    document.addEventListener('DOMContentLoaded', function () {
      if (hasFooter()) return;
      fetch('<?php echo scAssetUrl('footer.php'); ?>', { cache: 'no-store' })
        .then(function (r) { return r.text(); })
        .then(function (html) {
          html = html.replace(/<\/body>\s*<\/html>\s*$/i, '');
          var wrap = document.createElement('div');
          wrap.innerHTML = html;
          document.body.appendChild(wrap);
        })
        .catch(function(){});
    });
  })();
</script>

<?php
$allCourseTitles = [];
if (isset($MEGA)) {
    foreach ($MEGA as $cat) {
        foreach ($cat['links'] as $link) {
            if (!in_array($link[0], $allCourseTitles)) {
                $allCourseTitles[] = $link[0];
            }
        }
    }
}
?>
<script>
  $(function() {
      // 1. Auto-complete for the inputs
      var courses = <?php echo json_encode($allCourseTitles); ?>;
      
      $('#sc-q-input').autocomplete({
          source: courses,
          select: function(event, ui) {
              $('#sc-q-input').val(ui.item.value);
              $('#sc-global-search').submit();
          }
      });
      
      $('#popCourse').autocomplete({
          source: courses,
          appendTo: "#sc-lead-popup"
      });

      // 2. Button redirection & popups strategy
      $(document).on('click', function(e) {
         let rawTargetText = $(e.target).text().trim().toLowerCase();
         let exactTargetOptions = ['explore courses', 'speak to solution expert', 'contact learning advisor', 'enroll now', 'get quote', 'start from'];
         
         // Direct hit on inner span/div containing these words
         if (exactTargetOptions.includes(rawTargetText) || exactTargetOptions.some(opt => rawTargetText.includes('start from') || rawTargetText.includes('get quote'))) {
             if (rawTargetText.includes('start from') || rawTargetText.includes('get quote')) {
                 e.preventDefault();
                 $('#sc-lead-popup').css('display', 'flex');
                 return false;
             }
         }

         let btnOrA = $(e.target).closest('a, button, .kh-btn, .sc-solid, .sc-outline');
         if (!btnOrA.length) return;

         let btnText = btnOrA.text().trim().toLowerCase();

         // ── NEVER intercept these – let them work normally ──────────────────
         if (
           btnOrA.hasClass('sc-all-btn')      || // mega menu toggle
           btnOrA.hasClass('sc-dd-btn')       || // dropdown toggles
           btnOrA.hasClass('pagination-btn')  || // page 1,2,3…, Prev, Next
           btnOrA.hasClass('sc-filter-btn')   || // category tab filters
           btnOrA.hasClass('sc-popup-trigger')|| // already wired directly
           btnOrA.hasClass('sc-quote-btn')    || // already wired directly
           btnOrA.attr('type') === 'submit'   ||
           btnOrA.closest('.sc-search').length ||
           btnOrA.closest('#sc-lead-popup').length
         ) { return; }

         // ── Redirect contact / counselling ──────────────────────────────────
         if (btnText.includes('contact us') || btnText === 'contact') {
             if (btnOrA[0].tagName.toLowerCase() === 'a' && btnOrA.attr('href') && btnOrA.attr('href').includes('contact')) return;
             e.preventDefault(); window.location.href = 'contact-us.php'; return false;
         }
         if (btnText.includes('counselling') || btnText.includes('counseling')) {
             if (btnOrA[0].tagName.toLowerCase() === 'a' && btnOrA.attr('href') && btnOrA.attr('href').includes('counselling')) return;
             e.preventDefault(); window.location.href = 'counselling.php'; return false;
         }

         // ── Open popup only for explicitly listed CTA phrases ───────────────
         if (exactTargetOptions.some(opt => btnText === opt || (btnText.length < 60 && btnText.includes(opt)))) {
             e.preventDefault();
             $('#sc-lead-popup').css('display', 'flex');
             window.scRefreshCaptcha && window.scRefreshCaptcha();
             return false;
         }

         // ── Let course name links navigate naturally ─────────────────────────
         // (don't catch stray <a> tags that link to actual pages)
      });
  });
</script>