/**
 * shared-bottom-nav.js — 하단 네비게이션 공유 컴포넌트
 * 각 페이지에서 <script src="/static/js/shared-bottom-nav.js"></script> 로드하면 자동 생성
 */
(function() {
  var SVG_ATTR = 'viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"';
  var NAV_ITEMS = [
    {
      href: '/pages/dashboard-new.html',
      label: '홈',
      icon: '<svg ' + SVG_ATTR + '><path d="M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"/><polyline points="9 22 9 12 15 12 15 22"/></svg>'
    },
    {
      href: 'https://tkreport.technicalkorea.net/',
      label: '신고',
      icon: '<svg ' + SVG_ATTR + '><path d="M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"/><line x1="12" y1="9" x2="12" y2="13"/><line x1="12" y1="17" x2="12.01" y2="17"/></svg>'
    },
    {
      href: '/pages/purchase/request-mobile.html',
      label: '소모품',
      icon: '<svg ' + SVG_ATTR + '><path d="M6 2L3 6v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6l-3-4z"/><line x1="3" y1="6" x2="21" y2="6"/><path d="M16 10a4 4 0 0 1-8 0"/></svg>'
    }
  ];

  var currentPath = location.pathname;
  var nav = document.createElement('nav');
  nav.className = 'm-bottom-nav';
  nav.innerHTML = NAV_ITEMS.map(function(item) {
    var active = currentPath === item.href ? ' active' : '';
    return '<a href="' + item.href + '" class="m-nav-item' + active + '">'
      + item.icon + '<span class="m-nav-label">' + item.label + '</span></a>';
  }).join('');
  document.body.appendChild(nav);
})();
