/* Node Context Menu - Rectangular right-click style menu */

.node-context-menu {
  position: absolute; /* positioned by JS via top/left to canvas coords */
  min-width: 220px;
  padding: 6px;
  background: rgba(22, 24, 35, 0.96);
  border: 1px solid rgba(100, 130, 240, 0.45);
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  pointer-events: none;
  z-index: 1001;
  transform: scale(0.96);
  transform-origin: top left;
  opacity: 0;
  transition: transform 0.15s cubic-bezier(.34,1.56,.64,1), opacity 0.12s ease;
}

.node-context-menu:not(.hidden) {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}
.node-context-menu.hidden {
  display: block; /* keep in flow for animation; pointer-events off */
  pointer-events: none;
}

/* Vertical list container */
.context-ring {
  display: flex;
  flex-direction: column;
  gap: 1px;
  pointer-events: auto;
}

/* No-op elements retained from radial version */
.context-ring::after { display: none; }
.context-center { display: none; }

/* Each action is a full-width row */
.context-btn-wrap {
  display: block;
  width: 100%;
}

.context-btn {
  width: 100%;
  min-height: 32px;
  padding: 7px 12px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: #e0e6ff;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  transition: background-color 0.12s, color 0.12s;
  pointer-events: auto;
}

.context-btn:hover {
  background: rgba(100, 130, 240, 0.22);
  color: #ffffff;
}
.context-btn:active { opacity: 0.8; }

.context-btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  pointer-events: none;
}

.context-btn-label {
  flex: 1;
  white-space: nowrap;
  pointer-events: none;
}

/* Delete danger style */
.context-btn.danger { color: #f87171; }
.context-btn.danger:hover { background: rgba(248, 113, 113, 0.18); color: #fca5a5; }

/* Privacy toggle group — only one button shows at a time */
.privacy-group { display: block; }

/* Default (Public state): Show "Set Private" (Lock) */
.node-context-menu:not(.is-private) .privacy-globe { display: none; }
.node-context-menu:not(.is-private) .privacy-lock { display: flex; }

/* Private state: Show "Set Public" (Globe) */
.node-context-menu.is-private .privacy-lock { display: none; }
.node-context-menu.is-private .privacy-globe { display: flex; }

/* Pending — dim non-always-active rows */
.node-context-menu.is-pending .context-btn-wrap:not(.always-active) .context-btn {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Approved — dim privacy toggle and force globe */
.node-context-menu.is-approved .privacy-group .context-btn {
  opacity: 0.4;
  cursor: not-allowed;
}
.node-context-menu.is-approved .privacy-lock { display: none !important; }
.node-context-menu.is-approved .privacy-globe { display: flex !important; }

/* Tooltips */
/* tooltip.js uses standard tooltip CSS, we ensure they appear correctly inside absolute wraps */
.tooltip-content {
  z-index: 1005;
}

/* Inline Confirm Popup */
/* Inline Confirm Popover */
.nm-confirm-popover {
  position: absolute;
  z-index: 1010;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
  border: 1.5px solid #ef4444; /* Specific to delete by default, but we can override */
  pointer-events: all;
  
  animation: nm-popup-in 0.18s cubic-bezier(.34,1.3,.64,1) both;
}

/* Delete confirm — appears to the right of the rectangular menu */
.nm-popover-delete {
  top: 0;
  left: calc(100% + 8px);
  transform-origin: top left;
}

/* Rename confirm — appears above the rectangular menu */
.nm-popover-rename {
  bottom: calc(100% + 8px);
  left: 0;
  transform-origin: bottom left;
  border-color: #5d78ff; /* Blue for rename */
}

.nm-popover-content {
  padding: 18px 22px;
  min-width: 200px;
}

/* Arrows */
.nm-popover-arrow {
  content: '';
  position: absolute;
  width: 12px;
  height: 12px;
  background: #fff;
  z-index: -1;
}

/* Arrow for Delete (points left back to the menu row) */
.nm-popover-delete .nm-popover-arrow {
  top: 14px;
  left: -7px;
  transform: rotate(45deg);
  border-left: 1.5px solid #ef4444;
  border-bottom: 1.5px solid #ef4444;
}

/* Arrow for Rename (points down to the menu) */
.nm-popover-rename .nm-popover-arrow {
  bottom: -7px;
  left: 20px;
  transform: rotate(45deg);
  border-right: 1.5px solid #5d78ff;
  border-bottom: 1.5px solid #5d78ff;
}

@keyframes nm-popup-in {
  from { transform: scale(0.8) translateY(10px); opacity: 0; }
  to   { transform: scale(1) translateY(0);   opacity: 1; }
}


.nm-confirm-popover h4 {
  margin: 0 0 14px;
  font-size: 15px;
  font-weight: 600;
  color: #111;
  text-align: center;
}
.nm-confirm-popover .nm-confirm-btns {
  display: flex;
  gap: 10px;
}
.nm-confirm-popover .nm-btn-cancel,
.nm-confirm-popover .nm-btn-confirm {
  flex: 1;
  padding: 9px 0;
  border-radius: 10px;
  border: none;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}
.nm-confirm-popover .nm-btn-cancel { background: #f3f4f6; color: #4b5563; }
.nm-confirm-popover .nm-btn-cancel:hover { background: #e5e7eb; }

.nm-popover-delete .nm-btn-confirm { background: #ef4444; color: #fff; }
.nm-popover-delete .nm-btn-confirm:hover { background: #dc2626; }

.nm-popover-rename .nm-btn-confirm { background: #5d78ff; color: #fff; }
.nm-popover-rename .nm-btn-confirm:hover { background: #4866ff; }

/* Copy ID Popup */
.nm-copy-popup {
  position: absolute;
  /* Appear to the right of the rectangular menu */
  top: 0;
  left: calc(100% + 8px);
  z-index: 1010;

  background: #fff;
  border: 1.5px solid #5d78ff;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 220px;
  
  transform-origin: center left;
  animation: nm-popup-in-right 0.18s cubic-bezier(.34,1.3,.64,1) both;
}

@keyframes nm-popup-in-right {
  from { transform: scale(0.8) translateX(-10px); opacity: 0; }
  to   { transform: scale(1) translateX(0);   opacity: 1; }
}

.nm-copy-popup::after {
  content: '';
  position: absolute;
  top: 14px;
  left: -6px;
  width: 10px;
  height: 10px;
  background: #fff;
  border-left: 1.5px solid #5d78ff;
  border-bottom: 1.5px solid #5d78ff;
  transform: rotate(45deg);
}

.nm-copy-val {
  font-family: 'Outfit', sans-serif;
  font-size: 14px; /* Smaller font */
  color: #666;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis; /* Handle long UUIDs */
  white-space: nowrap;
  flex: 1;
}

.nm-copy-val strong {
  color: #111;
  margin-right: 4px;
}

.nm-btn-copy-exec {
  background: #f0f2ff;
  border: none;
  color: #5d78ff;
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  flex-shrink: 0;
}

.nm-btn-copy-exec:hover {
  background: #5d78ff;
  color: #fff;
}

.nm-btn-copy-exec svg {
  width: 16px;
  height: 16px;
}

/* ── Mobile Responsive ── */
@media (max-width: 480px) {
  .context-btn-label-wrap {
    max-width: min(80vw, 220px);
  }
}

/* ── Node Rename Overlay ── */
.node-rename-overlay {
  position: absolute;
  z-index: 500;
  display: flex;
  align-items: center;
  pointer-events: auto;
  transform: translate(-50%, 0);
}

.node-rename-overlay.hidden {
  display: none;
}

.node-rename-input {
  background: #1e293b;
  color: #fff;
  border: 2px solid #4a5fc1;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 14px;
  font-family: Inter, -apple-system, sans-serif;
  font-weight: 500;
  outline: none;
  min-width: 120px;
  max-width: 320px;
  text-align: center;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}

.node-rename-input:focus {
  border-color: #6d7ff5;
  box-shadow: 0 0 0 3px rgba(74, 95, 193, 0.3), 0 4px 16px rgba(0, 0, 0, 0.35);
}

.node-rename-input::placeholder {
  color: #94a3b8;
}
