/* ==================== ROW MENU (List Page Pattern, Sep 2026) ====================
 * Kebab button + native popover panel for a table row's secondary actions
 * (duplicate / deactivate / delete). Primary queue verbs stay visible
 * buttons. The panel renders in the browser's top layer, so
 * .table-container's overflow cannot clip it. Behaviour: static/js/row-menu.js.
 * Spec: docs/superpowers/specs/2026-09-05-list-page-pattern-design.md §8
 *
 *   <div class="row-menu" data-row-menu>
 *     <button type="button" class="row-menu-toggle btn btn-outline-secondary btn-sm btn-icon"
 *             popovertarget="menu-1" aria-label="More actions for OVIA">
 *       <i class="bi bi-three-dots-vertical" aria-hidden="true"></i>
 *     </button>
 *     <div class="row-menu-panel" id="menu-1" popover role="menu">
 *       <a class="row-menu-item" role="menuitem" href="…">Duplicate</a>
 *       <form method="post" action="…" data-confirm-title="Delete rate card">{% csrf_token %}
 *         <button type="submit" class="row-menu-item is-danger" role="menuitem">Delete</button>
 *       </form>
 *     </div>
 *   </div>
 * ============================================================================== */

.row-menu {
  position: relative;
  display: inline-flex;
}

.row-menu-toggle[aria-expanded="true"] {
  background: var(--pk-gray-100);
  border-color: var(--pk-gray-400);
}

/* Closed state is display:none in every browser (the UA sheet says so for
 * [popover]; this restates it for any that lack popover, where the menu
 * simply never opens and the actions remain on the detail page). */
.row-menu-panel {
  display: none;
  min-width: 180px;
  margin: 0;
  padding: var(--space-1);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--pk-white);
  box-shadow: var(--shadow-card-hover);
  color: var(--pk-gray-700);
}

.row-menu-panel:popover-open {
  display: flex;
  flex-direction: column;
}

/* POST items are wrapped in a form; keep them in the column */
.row-menu-panel form {
  display: contents;
}

.row-menu-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  padding: 8px 12px;
  border: 0;
  border-radius: var(--radius-md);
  background: none;
  font: inherit;
  font-size: var(--text-sm);
  color: inherit;
  text-align: left;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}

.row-menu-item .bi {
  font-size: var(--text-sm);
  color: var(--pk-gray-500);
}

.row-menu-item:hover {
  background: var(--pk-gray-100);
  color: var(--pk-gray-900);
}

.row-menu-item:focus-visible {
  outline: none;
  background: var(--pk-gray-100);
  box-shadow: inset 0 0 0 2px var(--pk-orange);
}

.row-menu-item.is-danger,
.row-menu-item.is-danger .bi {
  color: var(--pk-error);
}

.row-menu-item.is-danger:hover,
.row-menu-item.is-danger:focus-visible {
  background: var(--pk-error-light);
}
