/* Node Tooltip - Rich tooltip when hovering over graph nodes */

.node-tooltip {
  position: fixed;
  background: white;
  border-radius: 8px;
  /* Removed main border */
  padding: 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  pointer-events: auto;
  z-index: 10;
  min-width: 200px;
  max-width: 280px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.35s ease-in-out, visibility 0s linear 0.5s;
  /* Allow arrow to protrude */
  overflow: visible;
}

.node-tooltip.hidden {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transition: opacity 0.35s ease-in-out, visibility 0s linear 0.35s;
}

/* Arrow Element (Rotated Square) */
.node-tooltip::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  background: white;
  transform: rotate(45deg);
  z-index: -1; /* Behind the tooltip content */
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15); /* Match tooltip shadow roughly */
}

/* Position: Tooltip ABOVE node -> Arrow at BOTTOM */
.node-tooltip.arrow-bottom::after {
  bottom: -7px;
  left: 50%;
  margin-left: -7px;
}

/* Position: Tooltip BELOW node -> Arrow at TOP */
.node-tooltip.arrow-top::after {
  top: -7px;
  left: 50%;
  margin-left: -7px;
}

/* Position: Tooltip LEFT of node -> Arrow at RIGHT */
.node-tooltip.arrow-right::after {
  right: -7px;
  top: 50%;
  margin-top: -7px;
}

/* Position: Tooltip RIGHT of node -> Arrow at LEFT */
.node-tooltip.arrow-left::after {
  left: -7px;
  top: 50%;
  margin-top: -7px;
}

/* Type Badge Header */
.node-tooltip-type {
  display: flex; /* Block level flex to span width */
  align-items: baseline;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;

  /* Padding layout for header */
  padding: 12px 16px;
  margin: 0;
  background: #fff; /* Opaque bg needed for header */
  border-radius: 8px 8px 0 0; /* Match container radius */

  /* Full width bottom border */
  border-bottom: 1px solid #e0e0e0;
}

.node-tooltip-type-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Content Elements */
.node-tooltip-label {
  color: #222;
  line-height: 1.3;
  background: #fff; /* Opaque bg needed so arrow doesn't show thru */
}

.node-tooltip-id {
  font-size: 11px;
  color: #888;
  padding: 0 16px 4px 16px;
  background: #fff;
}

.node-tooltip-connections {
  font-size: 12px;
  color: #666;
  padding: 0 16px 16px 16px;
  background: #fff;
  border-radius: 0 0 8px 8px; /* Match container bottom radius */
}

/* Type-specific colors */
.node-type-theory {
  color: #66bb6a;
}
.node-type-quiz {
  color: #26c6da;
}
.node-type-pitfall {
  color: #fdd835;
}
.node-type-group {
  color: #78909c;
}

.node-type-theory .node-tooltip-type-dot {
  background: #66bb6a;
}
.node-type-quiz .node-tooltip-type-dot {
  background: #26c6da;
}
.node-type-pitfall .node-tooltip-type-dot {
  background: #fdd835;
}
.node-type-group .node-tooltip-type-dot {
  background: #78909c;
}

/* ── Edge Action Popup (tooltip style) ── */
.edge-action-popup {
  position: fixed;
  z-index: 1001;
  background: #fff;
  border-radius: 8px;
  padding: 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  overflow: visible;
  pointer-events: auto;
  display: flex;
  gap: 5px;
  padding: 12px 8px;
}

.edge-action-popup.hidden {
  display: none;
}

/* Arrow pointing down */
.edge-action-popup::after {
  content: "";
  position: absolute;
  bottom: -7px;
  left: 50%;
  margin-left: -7px;
  width: 14px;
  height: 14px;
  background: #fff;
  transform: rotate(45deg);
  z-index: -1;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.edge-action-label {
  font-size: 1rem;
  color: #666;
  white-space: nowrap;
  border-bottom: 1px solid #f0f0f0;
}

.edge-delete-btn {
  border: none;
  color: #FF3B30;
  cursor: pointer;
  transition: background 0.2s;
}

.edge-delete-btn:hover {
  filter: drop-shadow(0 0 0.75rem crimson);;
}

.edge-delete-btn svg {
  flex-shrink: 0;
}

/* ── Mobile Responsive ── */
@media (max-width: 480px) {
  .node-tooltip {
    min-width: 160px;
    max-width: min(90vw, 260px);
  }
}
