/* Context Menu - Three-dot popover menu for bookmark actions */

/* Three-dot trigger button */
.context-menu-trigger {
  align-items: center;
  background: transparent;
  border: none;
  border-radius: var(--ls-radius-sm);
  color: var(--ls-text-tertiary);
  cursor: pointer;
  display: flex;
  justify-content: center;
  padding: 0.375rem;
  transition: background-color 0.1s ease, color 0.1s ease;
}

.context-menu-trigger:hover {
  background-color: var(--bg-secondary);
  color: var(--ls-text-primary);
}

.context-menu-trigger:focus-visible {
  outline: 2px solid var(--ls-accent);
  outline-offset: 1px;
}

/* Context menu popover */
.context-menu {
  background-color: var(--ls-surface-elevated);
  border: 1px solid var(--ls-border);
  border-radius: var(--ls-radius-md);
  box-shadow: var(--ls-shadow-lg);
  display: flex;
  flex-direction: column;
  inset: unset;
  inset-block-start: anchor(end);
  inset-inline-end: anchor(end);
  margin: 0;
  min-inline-size: 10rem;
  opacity: 0;
  padding: 0.25rem;
  position: fixed;
  /* stylelint-disable-next-line declaration-property-value-no-unknown */
  position-anchor: implicit;
  position-try-fallbacks: flip-block, flip-inline;
  transform: scale(0.95);
  transition:
    opacity 0.12s ease,
    transform 0.12s ease,
    overlay 0.12s allow-discrete,
    display 0.12s allow-discrete;
}

/* Open state */
.context-menu:popover-open {
  opacity: 1;
  transform: scale(1);
}

/* Entry animation */
@starting-style {
  .context-menu:popover-open {
    opacity: 0;
    transform: scale(0.95);
  }
}

/* Menu items */
.context-menu-item {
  align-items: center;
  background: transparent;
  border: none;
  border-radius: var(--ls-radius-sm);
  color: var(--ls-text-primary);
  cursor: pointer;
  display: flex;
  font-family: var(--minimalist-typography-body-family);
  font-size: 0.8125rem;
  gap: 0.5rem;
  inline-size: 100%;
  padding-block: 0.5rem;
  padding-inline: 0.625rem;
  text-align: start;
  transition: background-color 0.1s ease;
}

.context-menu-item:hover {
  background-color: var(--bg-secondary);
}

.context-menu-item:focus-visible {
  background-color: var(--bg-secondary);
  outline: none;
}

.context-menu-item svg {
  color: var(--ls-text-tertiary);
  flex-shrink: 0;
}

/* Destructive action (Remove) */
.context-menu-item.destructive {
  color: var(--ls-destructive);
}

.context-menu-item.destructive:hover {
  background-color: var(--ls-destructive-subtle);
}

.context-menu-item.destructive svg {
  color: var(--ls-destructive);
}

/* Bookmark actions layout */
.bookmark-actions {
  align-items: center;
  display: flex;
  gap: 0.375rem;
}

.bookmark-actions-primary {
  display: flex;
  flex: 1;
  gap: 0.375rem;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .context-menu {
    transition: none;
  }
}
