<!doctype html>
<!-- Copyright (c) Microsoft Corporation.
 Licensed under the MIT License. -->

<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Macros Library - TypeAgent</title>
    <link rel="stylesheet" href="../vendor/bootstrap/bootstrap.min.css" />
    <link rel="stylesheet" href="../vendor/prism/prism.css" />
    <link
      rel="stylesheet"
      href="https://cdn.jsdelivr.net/npm/bootstrap-icons/font/bootstrap-icons.css"
    />
    <link rel="stylesheet" href="macrosLibrary.css" />
  </head>
  <body>
    <div class="app-shell">
      <!-- Top Navigation -->
      <nav class="top-navigation">
        <div class="brand">
          <i class="bi bi-collection-fill"></i>
          Macros Library
        </div>

        <div class="search-container">
          <input
            type="text"
            id="globalSearchInput"
            class="search-input"
            placeholder="Search actions by name, description, or website..."
            autocomplete="off"
          />
        </div>

        <div class="controls">
          <div class="view-mode-toggle">
            <button id="viewModeGrid" class="active" title="Grid view">
              <i class="bi bi-grid-3x3-gap"></i>
            </button>
            <button id="viewModeList" title="List view">
              <i class="bi bi-list"></i>
            </button>
          </div>
        </div>
      </nav>

      <!-- Sidebar -->
      <aside class="sidebar">
        <!-- Filters -->
        <div class="filter-section">
          <h6>Filters</h6>

          <div class="filter-group">
            <label for="authorFilter">Author</label>
            <select id="authorFilter" class="filter-select">
              <option value="all">All Authors</option>
              <option value="user">User Created</option>
              <option value="discovered">Auto Discovered</option>
            </select>
          </div>

          <div class="filter-group">
            <label for="domainFilter">Website</label>
            <select id="domainFilter" class="filter-select">
              <option value="all">All Websites</option>
            </select>
          </div>

          <div class="filter-group">
            <label for="categoryFilter">Category</label>
            <select id="categoryFilter" class="filter-select">
              <option value="all">All Categories</option>
            </select>
          </div>

          <button id="clearFiltersBtn" class="clear-filters-btn">
            <i class="bi bi-funnel"></i> Clear All Filters
          </button>
        </div>
      </aside>

      <!-- Main Content -->
      <main class="main-content">
        <!-- Content Header -->
        <div class="content-header">
          <div>
            <!-- Removed the "actions available" label as requested -->
          </div>
        </div>

        <!-- Bulk Operations -->
        <div id="bulkOperationsContainer" class="bulk-operations">
          <div class="bulk-operations-content">
            <div class="bulk-info">
              <strong id="selectedMacrosCount">0</strong> macro(s) selected
            </div>
            <div class="bulk-controls">
              <button id="selectAllBtn" title="Select all visible actions">
                <i class="bi bi-check-all"></i> Select All
              </button>
              <button
                id="deselectAllBtn"
                title="Deselect all actions"
                style="display: none"
              >
                <i class="bi bi-square"></i> Deselect All
              </button>
              <button
                id="bulkDeleteBtn"
                class="btn-danger"
                title="Delete selected macros"
                style="display: none"
              >
                <i class="bi bi-trash"></i> Delete Selected
              </button>
            </div>
          </div>
        </div>

        <!-- Macros Container -->
        <div id="macrosContainer">
          <!-- Loading state -->
          <div class="loading-state">
            <div class="spinner"></div>
            <h6>Loading Macros</h6>
            <p>Please wait while we load your macro library...</p>
          </div>
        </div>
      </main>
    </div>

    <!-- Macro Details Modal -->
    <div class="modal fade" id="actionDetailsModal" tabindex="-1">
      <div class="modal-dialog modal-xl modal-dialog-centered">
        <div class="modal-content">
          <div class="modal-header" id="actionDetailsModalHeader">
            <h5 class="modal-title" id="actionDetailsModalTitle">
              Action Details
            </h5>
            <button
              type="button"
              class="btn-close"
              data-bs-dismiss="modal"
            ></button>
          </div>
          <div
            class="modal-body p-0"
            id="actionDetailsModalBody"
            style="height: 80vh"
          >
            <!-- Iframe will be inserted here -->
          </div>
        </div>
      </div>
    </div>

    <!-- Scripts -->
    <script src="macrosLibrary.js"></script>
    <script src="../vendor/bootstrap/bootstrap.bundle.min.js"></script>
    <script src="../vendor/prism/prism.js"></script>
    <script src="../vendor/prism/prism-typescript.js"></script>
    <script src="../vendor/prism/prism-json.js"></script>
  </body>
</html>
