/* ============================================================
   Per-row action menu — the "⋮" kebab in the last column of admin
   list tables. The trigger is an icon button; the menu is a
   fixed-positioned popover (placed by the `rowActionsMenu` Alpine
   factory) so it escapes the `.dt-scroll` overflow clip.
   ============================================================ */

.row-actions {
  display: inline-flex;
}

.row-actions-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background .12s ease, color .12s ease, border-color .12s ease;
  /* Card-row lists (categories/brands/units/terminals/…) lay a full-row
     `.{row}-link::before { position:absolute; inset:0 }` click overlay over
     the row to open the side editor, and lift interactive controls above it
     with `z-index` (the row toggle does the same). Put it on the TRIGGER, not
     `.row-actions` — lifting the wrapper would make it a stacking context and
     trap the fixed `.row-actions-menu` inside it (other rows' toggles would
     then paint over the open menu). Harmless in plain `<td>` table cells. */
  position: relative;
  z-index: 1;
}

.row-actions-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.row-actions-btn.is-open {
  background: var(--bg-active);
  color: var(--text-primary);
  border-color: var(--border-subtle);
}

.row-actions-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* The popover. `top`/`left` are written inline by JS — keep them out of
   here so the cascade never fights the computed position. */
.row-actions-menu {
  position: fixed;
  z-index: 200;
  min-width: 184px;
  max-width: min(280px, calc(100vw - 16px));
  padding: 6px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  box-shadow: var(--shadow-pop);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.dark .row-actions-menu {
  background: var(--bg-elevated);
}

.row-action {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  background: transparent;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.3;
  color: var(--text-primary);
  text-align: start;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background .1s ease;
}

.row-action:hover,
.row-action:focus-visible {
  background: var(--bg-hover);
  outline: none;
}

.row-action-icon {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  color: var(--text-tertiary);
}

.row-action-label {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Destructive items (delete / void) read in the danger colour. */
.row-action--danger,
.row-action--danger .row-action-icon {
  color: var(--danger);
}

.row-action--danger:hover,
.row-action--danger:focus-visible {
  background: var(--danger-soft);
}

/* Visual separator between groups of items (e.g. above Delete). */
.row-action-sep {
  height: 1px;
  margin: 4px 2px;
  background: var(--border-subtle);
  border: 0;
}
