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

  <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>
      {% block title %}Butler_DDOCHI{% endblock %}
    </title>
    {% include "components/_favicon.html" %}
    <!-- Bootstrap CSS 추가 -->
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
    <!-- fontawesome 추가 -->
    <script src="https://kit.fontawesome.com/77d81e5d17.js" crossorigin="anonymous"></script>
  </head>

  <body class="bg-light">
    <!-- 네비게이션 바 -->
    <header class="bg-dark py-3 d-flex align-items-stretch border-bottom border-dark">
      {% include "components/_nav.html" %}
      <!-- Toggle Button for Sidebar -->

    </header>
    <!-- Circle Toggle Button -->

    <!-- Main Content with Sidebar -->
    <div class="container-fluid">
      <div class="row">
        <!-- Sidebar -->
        <aside id="sidebar" class="col-12 col-md-3 col-lg-2 bg-light p-3">
          {% include "components/_sidebar.html" %}
        </aside>
        <!-- Main Section -->
        <div id="main_section" class="min-vh-100 col-12 col-md-9 col-lg-10 bg-body p-3">
          <button id="toggleSidebar" class="btn btn-light rounded-circle position-absolute">
            ☰
          </button>
          <section id="content" class="pt-4">
            {% if not request.user.is_authenticated %}
              <h5 class='text-danger pt-4'>로그인이 필요합니다. NHN Cloud 계정, 테넌트 정보가 있어야 정상 동작합니다.</h3>
            {% endif %}
            {% block main_area %}{% endblock %}
          </section>
        </div>
      </div>
    </div>

    <!-- Footer -->
    <div class="container-fluid">
      {% include "components/_footer.html" %}
    </div>

    <!-- Bootstrap JavaScript 추가 -->
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous"></script>
    <!-- Sidebar JavaScript 추가 -->
    <script>
      document
        .getElementById('toggleSidebar')
        .addEventListener('click', function () {
          const sidebar = document.getElementById('sidebar');
          const mainSection = document.getElementById('main_section');

          if (sidebar.style.display === 'none') {
            sidebar.style.display = 'block';
            mainSection
              .classList
              .remove('col-lg-12');
            mainSection
              .classList
              .add('col-lg-10');
          } else {
            sidebar.style.display = 'none';
            mainSection
              .classList
              .remove('col-lg-10');
            mainSection
              .classList
              .add('col-lg-12');

          }
        });
    </script>

  </body>

</html>
