/* Unified context menu styles */

/* Base context menu container */
.tab-context-menu,
.context-menu {
  position: fixed;
  border-radius: 4px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
  padding: 0.5rem 0;
  list-style: none;
  user-select: none;
  margin: -0.25rem 0 0 0.125rem;
  min-width: 9.5rem;
  z-index: 1000;
  background-color: var(--popup-secondary-bg-color, #fff);
  border: 1px solid var(--button-gray-3, #ccc);
  cursor: default;
}

/* Context menu list */
.context-menu {
  padding: 0;
  margin: 0;
}

/* Button text color */
.tab-context-menu button {
  color: var(--popup-text-color, #333);
}

/* Menu items */
.tab-context-menu .menu-item,
.context-menu-item {
  position: relative;
  width: 100%;
  min-width: 9.5rem;
  margin: 0;
  padding: 0.25rem 1rem 0.25rem 1.25rem;
  text-align: start;
  border-radius: 0;
  background-color: transparent;
  border: none;
  white-space: nowrap;
  font-family: inherit;
  cursor: pointer;
}

/* Menu item layout for tab context menu */
.tab-context-menu .menu-item {
  display: grid;
  grid-template-columns: 1fr 0.2fr;
  align-items: center;
}

/* Menu item layout for context menu */
.context-menu-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Menu item label */
.tab-context-menu .menu-item .menu-item__label {
  justify-self: start;
  margin-inline-end: 20px;
}

.context-menu-item__label {
  flex: 1;
}

/* Delete item styling */
.tab-context-menu .menu-item.delete .menu-item__label,
.context-menu-item.dangerous {
  color: #e53935;
}

/* Hover states */
.tab-context-menu .menu-item:hover,
.context-menu-item:hover {
  color: var(--popup-bg-color, #fff);
  background-color: var(--select-highlight-color, #f5f5f5);
}

/* Dangerous hover states */
.tab-context-menu .menu-item.delete:hover,
.context-menu-item.dangerous:hover {
  background-color: #e53935;
}

.tab-context-menu .menu-item.delete:hover .menu-item__label,
.context-menu-item.dangerous:hover {
  color: var(--popup-bg-color, #fff);
}

/* Focus state */
.tab-context-menu .menu-item:focus {
  z-index: 1;
}

/* Separator */
.context-menu-item-separator {
  margin: 0.25rem 0;
  border: none;
  border-top: 1px solid var(--button-gray-3, #ccc);
}

/* Shortcut display */
.context-menu-item__shortcut {
  margin-left: 1rem;
  color: var(--text-color-secondary, #666);
  font-size: 0.8rem;
}

/* Checkmark for selected items */
.context-menu-item.checkmark::before {
  content: "✓";
  position: absolute;
  left: 0.5rem;
}

/* Form styling for rename functionality */
.tab-context-menu form {
  padding: 0.5rem 1rem;
  display: flex;
}

.tab-context-menu form input {
  flex: 1;
  padding: 0.25rem 0.5rem;
  border: 1px solid var(--button-gray-3, #ccc);
  border-radius: 4px;
  margin-right: 0.25rem;
  background-color: var(--input-bg-color, #fff);
  color: var(--text-color-primary, #333);
}

.tab-context-menu form button {
  background-color: var(--color-surface-primary-container, #4285f4);
  color: var(--color-on-primary-container, white);
  border: none;
  border-radius: 4px;
  padding: 0.25rem 0.5rem;
  cursor: pointer;
}

.tab-context-menu form button:hover {
  background-color: var(--color-primary-light, #3367d6);
}

/* Responsive adjustments */
@media (max-width: 640px) {
  .tab-context-menu .menu-item {
    display: block;
  }
  
  .tab-context-menu .menu-item .menu-item__label {
    margin-inline-end: 0;
  }
}