<!-- views/partials/customer_bottom_nav.ejs -->
<% if (typeof isLoggedIn !== 'undefined' && isLoggedIn) { %>
<style>
  .customer-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 70px;
    background: rgba(30, 41, 59, 0.95);
    backdrop-filter: blur(10px);
    border-top: 1px solid #334155;
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 1050;
    padding-bottom: env(safe-area-inset-bottom);
    box-shadow: 0 -12px 35px rgba(0, 0, 0, 0.45);
  }

  .nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    text-decoration: none;
    font-size: 11px;
    font-weight: 500;
    transition: all 0.3s ease;
    flex: 1;
    height: 100%;
  }

  .nav-item i {
    font-size: 20px;
    margin-bottom: 2px;
  }

  .nav-item.active i {
    transform: translateY(-2px);
    color: #6366f1;
  }

  .nav-item.active::after {
    content: '';
    position: absolute;
    bottom: 8px;
    width: 4px;
    height: 4px;
    background: #6366f1;
    border-radius: 50%;
  }

  .nav-item {
    position: relative;
  }

  /* Hide on desktop, show only on mobile */
  @media (min-width: 992px) {
    .customer-bottom-nav {
      display: none;
    }
    body {
      padding-bottom: 0 !important;
    }
  }
</style>

<nav class="customer-bottom-nav">
  <a href="/customer/dashboard#home-section" class="nav-item <%= activeNav === 'home' ? 'active' : '' %>">
    <i class="bi bi-house-door-fill"></i>
    <span><%= t('customer.nav.home', 'Beranda') %></span>
  </a>
  <a href="/customer/dashboard#billing-section" class="nav-item <%= activeNav === 'billing' ? 'active' : '' %>">
    <i class="bi bi-receipt-cutoff"></i>
    <span><%= t('customer.nav.billing', 'Tagihan') %></span>
  </a>
  <a href="/customer/dashboard#ticket-section" class="nav-item <%= activeNav === 'ticket' ? 'active' : '' %>">
    <i class="bi bi-headset"></i>
    <span><%= t('customer.nav.help', 'Bantuan') %></span>
  </a>
  <a href="/customer/dashboard#settings-section" class="nav-item <%= activeNav === 'settings' ? 'active' : '' %>">
    <i class="bi bi-gear-fill"></i>
    <span><%= t('customer.nav.wifi', 'WiFi') %></span>
  </a>
</nav>

<script>
  // Script to handle active state based on hash
  function updateActiveNav() {
    const hash = window.location.hash;
    document.querySelectorAll('.customer-bottom-nav .nav-item').forEach(item => {
      item.classList.remove('active');
      if (item.getAttribute('href').includes(hash) && hash !== '') {
        item.classList.add('active');
      }
    });
    
    if (hash === '' || hash === '#home-section') {
       const homeNav = document.querySelector('.customer-bottom-nav a[href*="home-section"]');
       if (homeNav) homeNav.classList.add('active');
    }
  }

  window.addEventListener('hashchange', updateActiveNav);
  window.addEventListener('load', updateActiveNav);
</script>
<% } %>
