/* ==========================================================================
   mindmap-view.css — Mind-map view styles
   HMS Compass · mindmap-view.css
   All selectors scoped under #mindmap-view.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Canvas wrapper
   -------------------------------------------------------------------------- */
#mindmap-view .mm-canvas-wrap {
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;      /* prevent browser scroll interference */
}

#mindmap-view .mm-canvas-wrap.mm-panning {
  cursor: grabbing;
}

#mindmap-view .mm-canvas-wrap.mm-dragging {
  cursor: grabbing;
}

/* SVG fills wrapper */
#mindmap-view .mm-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* Also target by id since styles.css already sets these — reinforce */
#mm-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* --------------------------------------------------------------------------
   Nodes
   -------------------------------------------------------------------------- */
#mindmap-view .mm-node {
  cursor: pointer;
}

#mindmap-view .mm-node.mm-dragging {
  cursor: grabbing;
}

/* Card background */
#mindmap-view .mm-card {
  fill: var(--surface);
  stroke: var(--border);
  stroke-width: 1;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,0.07));
  transition: filter 120ms;
}

/* Selected state */
#mindmap-view .mm-node--selected .mm-card {
  stroke: var(--accent);
  stroke-width: 2;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.08));
}

/* Hover state */
#mindmap-view .mm-node:hover .mm-card {
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.10));
}

/* --------------------------------------------------------------------------
   Priority bands
   The band is an SVG <rect> so use `fill`, not `background`.
   -------------------------------------------------------------------------- */
#mindmap-view .mm-node[data-priority="1"] .mm-band { fill: var(--p1); }
#mindmap-view .mm-node[data-priority="2"] .mm-band { fill: var(--p2); }
#mindmap-view .mm-node[data-priority="3"] .mm-band { fill: var(--p3); }
#mindmap-view .mm-node[data-priority="4"] .mm-band { fill: var(--p4); }

/* --------------------------------------------------------------------------
   Card inner content (HTML inside foreignObject)
   -------------------------------------------------------------------------- */
#mindmap-view .mm-card-inner {
  font-size: 13px;
  color: var(--text);
  font-family: var(--font-sans);
  display: flex;
  flex-direction: column;
  gap: 4px;
  height: 100%;
  overflow: hidden;
  padding: 0;
}

#mindmap-view .mm-title {
  font-weight: 600;
  font-size: 13px;
  line-height: 1.35;
  color: var(--text);
  /* Clamp to 2 lines */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: break-word;
}

/* Due chip — mirrors list view style */
#mindmap-view .mm-due {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 500;
  padding: 1px 5px;
  border-radius: 4px;
  width: fit-content;
  flex-shrink: 0;
}

#mindmap-view .mm-due--today {
  color: var(--accent);
  background: rgba(219, 76, 63, 0.10);
}

#mindmap-view .mm-due--overdue {
  color: var(--p1);
  background: rgba(209, 69, 59, 0.12);
}

#mindmap-view .mm-due--future {
  color: var(--subtext);
  background: var(--hover);
}

/* --------------------------------------------------------------------------
   Completed nodes
   -------------------------------------------------------------------------- */
#mindmap-view .mm-node--complete .mm-card-inner {
  text-decoration: line-through;
  opacity: 0.55;
}

/* --------------------------------------------------------------------------
   Hover action buttons
   -------------------------------------------------------------------------- */
#mindmap-view .mm-actions {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 2px;
  opacity: 0;
  transition: opacity 120ms;
  pointer-events: none;
  height: 28px;
}

/* Show on hover or when node is selected */
#mindmap-view .mm-node:hover .mm-actions,
#mindmap-view .mm-node--selected .mm-actions {
  opacity: 1;
  pointer-events: auto;
}

#mindmap-view .mm-action-btn {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  background: transparent;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: var(--subtext);
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: background 100ms, color 100ms;
  font-family: var(--font-sans);
}

#mindmap-view .mm-action-btn:hover {
  background: var(--hover);
  color: var(--text);
}

#mindmap-view .mm-action-delete:hover {
  background: rgba(209, 69, 59, 0.10);
  color: var(--p1);
}

/* --------------------------------------------------------------------------
   Edges
   -------------------------------------------------------------------------- */
#mindmap-view .mm-edge {
  fill: none;
  stroke: var(--border);
  stroke-width: 1.5;
  pointer-events: none;
}

#mindmap-view .mm-edge--highlight {
  stroke: var(--accent);
  stroke-width: 2;
}

/* --------------------------------------------------------------------------
   Inline rename input
   -------------------------------------------------------------------------- */
#mindmap-view .mm-rename {
  width: 100%;
  border: none;
  border-bottom: 2px solid var(--accent);
  background: transparent;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  outline: none;
  padding: 0;
  margin: 0;
  line-height: 1.35;
}

#mindmap-view .mm-rename:focus {
  border-bottom-color: var(--accent);
}

/* --------------------------------------------------------------------------
   Mobile affordances — 640 px breakpoint
   -------------------------------------------------------------------------- */
@media (max-width: 640px) {
  /* Bigger, finger-friendly action buttons */
  #mindmap-view .mm-action-btn {
    width: 36px;
    height: 36px;
    font-size: 18px;
  }

  /* Always-visible actions — no hover on touch */
  #mindmap-view .mm-actions {
    opacity: 1 !important;
  }

  /* Let the toolbar wrap if cramped */
  .mm-toolbar {
    padding: 6px 8px;
    gap: 6px;
    flex-wrap: wrap;
  }

  /* Touch-sized toolbar buttons */
  .mm-btn {
    min-height: 36px;
    padding: 0 10px;
  }

  /* Hide scroll-to-zoom hint — doesn't apply on touch */
  .mm-hint {
    display: none;
  }
}
