/* ===========================================
   GESTIOLEX - Context Menu (Tasto Destro)
   =========================================== */

/* ===========================================
   MENU CONTAINER
   =========================================== */
.context-menu {
  position: fixed;
  z-index: 10000;
  min-width: 180px;
  max-width: 280px;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15),
              0 4px 10px rgba(0, 0, 0, 0.1);
  padding: 6px 0;
  opacity: 0;
  visibility: hidden;
  transform: scale(0.95);
  transform-origin: top left;
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
}

.context-menu.show {
  opacity: 1;
  visibility: visible;
  transform: scale(1);
}

/* ===========================================
   MENU HEADER (opzionale)
   =========================================== */
.context-menu-header {
  padding: 8px 12px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid #e5e7eb;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ===========================================
   MENU ITEMS
   =========================================== */
.context-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  font-size: 0.875rem;
  color: #374151;
  cursor: pointer;
  transition: background-color 0.1s ease;
  text-decoration: none;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.context-menu-item:hover {
  background-color: #f3f4f6;
  color: #111827;
}

.context-menu-item:active {
  background-color: #e5e7eb;
}

.context-menu-item.disabled {
  color: #9ca3af;
  cursor: not-allowed;
}

.context-menu-item.disabled:hover {
  background-color: transparent;
}

/* Icona item */
.context-menu-item-icon {
  width: 18px;
  text-align: center;
  font-size: 0.95rem;
  flex-shrink: 0;
}

/* Testo item */
.context-menu-item-text {
  flex: 1;
  white-space: nowrap;
}

/* Shortcut hint */
.context-menu-item-shortcut {
  font-size: 0.7rem;
  color: #9ca3af;
  margin-left: auto;
}

/* ===========================================
   DANGER ITEMS (Elimina, etc.)
   =========================================== */
.context-menu-item.danger {
  color: #dc2626;
}

.context-menu-item.danger:hover {
  background-color: #fef2f2;
  color: #b91c1c;
}

/* ===========================================
   DIVIDER
   =========================================== */
.context-menu-divider {
  height: 1px;
  background-color: #e5e7eb;
  margin: 4px 0;
}

/* ===========================================
   SUBMENU (per espansioni future)
   =========================================== */
.context-menu-item.has-submenu::after {
  content: '›';
  margin-left: auto;
  font-size: 1rem;
  color: #9ca3af;
}

/* ===========================================
   DARK MODE
   =========================================== */
[data-bs-theme="dark"] .context-menu {
  background: #212529;
  border-color: #3d4349;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4),
              0 4px 10px rgba(0, 0, 0, 0.3);
}

[data-bs-theme="dark"] .context-menu-header {
  color: #9ca3af;
  border-bottom-color: #3d4349;
}

[data-bs-theme="dark"] .context-menu-item {
  color: #e5e7eb;
}

[data-bs-theme="dark"] .context-menu-item:hover {
  background-color: #2d3339;
  color: #fff;
}

[data-bs-theme="dark"] .context-menu-item:active {
  background-color: #3d4349;
}

[data-bs-theme="dark"] .context-menu-item.disabled {
  color: #6b7280;
}

[data-bs-theme="dark"] .context-menu-item.danger {
  color: #f87171;
}

[data-bs-theme="dark"] .context-menu-item.danger:hover {
  background-color: rgba(220, 38, 38, 0.15);
  color: #fca5a5;
}

[data-bs-theme="dark"] .context-menu-divider {
  background-color: #3d4349;
}

[data-bs-theme="dark"] .context-menu-item-shortcut {
  color: #6b7280;
}

/* ===========================================
   ANIMAZIONE APERTURA
   =========================================== */
@keyframes contextMenuIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.context-menu.show {
  animation: contextMenuIn 0.15s ease forwards;
}

/* ===========================================
   ELEMENTI CON CONTEXT MENU
   =========================================== */
[data-context-menu] {
  cursor: context-menu;
}

/* Highlight quando menu è aperto */
.context-menu-active {
  outline: 2px solid rgba(11, 94, 112, 0.3);
  outline-offset: -2px;
  border-radius: 4px;
}

[data-bs-theme="dark"] .context-menu-active {
  outline-color: rgba(77, 208, 225, 0.3);
}
