<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <title>{% block title %}Xfront{% endblock %}</title>
  {% if project_description %}
  <meta name="description" content="{{ project_description }}">
  <meta property="og:description" content="{{ project_description }}">
  <meta property="twitter:description" content="{{ project_description }}">
  {% endif %}
  {% if project_image_url %}
  <meta property="og:image" content="{{ project_image_url }}">
  <meta property="twitter:image" content="{{ project_image_url }}">
  {% endif %}
  
  <!-- Google Fonts -->
  <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=Poppins:wght@400;500;600;700&family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
  
  <!-- Font Awesome -->
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css">
  
  {% load static %}
  <link rel="stylesheet" href="{% static 'css/custom.css' %}?v={{ deployment_timestamp }}">
  {% block head %}{% endblock %}
</head>

<body class="b2b-layout">
  <div class="sidebar-container">
    <div class="sidebar">
      <div class="sidebar-header">
        <a href="/" class="b2b-logo">Xfront AI</a>
      </div>
      <ul class="sidebar-nav">
        <li><a href="#" data-target="overview-sidebar"><i class="fas fa-chart-pie"></i> Overview</a></li>
        <li><a href="#" data-target="businesses-sidebar"><i class="fas fa-briefcase"></i> Businesses</a></li>
        <li><a href="#" data-target="call-system-sidebar"><i class="fas fa-phone-alt"></i> Call System</a></li>
        <li><a href="#" data-target="appointments-sidebar"><i class="far fa-calendar-alt"></i> Appointments</a></li>
        <li><a href="#" data-target="knowledge-base-sidebar"><i class="fas fa-book"></i> Knowledge Base</a></li>
        <li><a href="#" data-target="analytics-sidebar"><i class="fas fa-chart-line"></i> Analytics</a></li>
        <li><a href="#" data-target="settings-sidebar"><i class="fas fa-cog"></i> Settings</a></li>
      </ul>
    </div>
  </div>

  <div class="secondary-sidebar-container">
    <div id="overview-sidebar" class="secondary-sidebar active">
      <h3>Overview</h3>
      <ul class="secondary-sidebar-nav">
        <li><a href="#">Dashboard Summary</a></li>
        <li><a href="#">Recent Activity</a></li>
        <li><a href="#">Alerts & Notifications</a></li>
      </ul>
    </div>
    <div id="businesses-sidebar" class="secondary-sidebar">
      <h3>Businesses</h3>
      <ul class="secondary-sidebar-nav">
        <li><a href="#">All Businesses</a></li>
        <li><a href="#">Add New Business</a></li>
      </ul>
    </div>
    </div>

  <div class="main-content">
    {% block content %}{% endblock %}
  </div>

  <script>
    document.addEventListener('DOMContentLoaded', function() {
      const primaryNavLinks = document.querySelectorAll('.sidebar-nav a');
      const secondarySidebars = document.querySelectorAll('.secondary-sidebar');

      primaryNavLinks.forEach(link => {
        link.addEventListener('click', function(event) {
          event.preventDefault();
          
          primaryNavLinks.forEach(navLink => navLink.classList.remove('active'));
          this.classList.add('active');
          
          const targetId = this.getAttribute('data-target');
          
          secondarySidebars.forEach(sidebar => {
            if (sidebar.id === targetId) {
              sidebar.classList.add('active');
            } else {
              sidebar.classList.remove('active');
            }
          });
        });
      });

      // Set initial active state
      if(primaryNavLinks.length > 0) {
        primaryNavLinks[0].classList.add('active');
      }
    });
  </script>
</body>

</html>