/* ============================================================
   IntelliTC Solutions — Mind Map Styles
   ============================================================ */

/* Mind Map Toggle (matches Learn Mode pattern) */
.mindmap-toggle-wrap {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.mindmap-toggle-label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  user-select: none;
  cursor: pointer;
}
.mindmap-toggle-label .mindmap-icon {
  display: inline-block;
  width: 16px;
  height: 16px;
  vertical-align: -3px;
  margin-right: 4px;
}
.mindmap-toggle {
  position: relative;
  width: 40px;
  height: 22px;
  background: var(--color-border);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: background var(--transition-interactive);
  flex-shrink: 0;
}
.mindmap-toggle::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  background: var(--color-surface);
  border-radius: 50%;
  transition: transform var(--transition-interactive);
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.mindmap-toggle.active {
  background: var(--color-primary);
}
.mindmap-toggle.active::after {
  transform: translateX(18px);
}

/* Fullscreen Overlay */
.mindmap-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--color-bg, #f7f6f2);
  animation: mindmapFadeIn 300ms ease-out;
}
.mindmap-overlay.visible {
  display: flex;
  flex-direction: column;
}

@keyframes mindmapFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Overlay Header */
.mindmap-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-5);
  border-bottom: 1px solid var(--color-divider);
  background: var(--color-surface);
  flex-shrink: 0;
}
.mindmap-header-left {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.mindmap-header-title {
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--color-primary);
}
.mindmap-header-subtitle {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}
.mindmap-close-btn {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition-interactive);
  font-family: inherit;
}
.mindmap-close-btn:hover {
  background: var(--color-primary-hover, #0c4e54);
}
.mindmap-close-btn svg {
  width: 16px;
  height: 16px;
}

/* Map Container */
.mindmap-container {
  flex: 1;
  overflow: hidden;
  position: relative;
}
.mindmap-container svg {
  width: 100%;
  height: 100%;
}

/* Hint text */
.mindmap-hint {
  position: absolute;
  bottom: var(--space-4);
  left: 50%;
  transform: translateX(-50%);
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  background: var(--color-surface);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  border: 1px solid var(--color-divider);
  pointer-events: none;
  opacity: 0.8;
}

/* ---- Markmap Theme Overrides ---- */

/* Light mode node styling */
.mindmap-container .markmap-node text {
  font-family: var(--font-body, 'Inter', sans-serif);
  font-size: 14px;
  fill: var(--color-text, #28251d);
}
.mindmap-container .markmap-node circle {
  stroke-width: 2;
}
.mindmap-container .markmap-link {
  stroke-opacity: 0.5;
}

/* Dark mode overrides */
[data-theme="dark"] .mindmap-overlay {
  background: var(--color-bg, #171614);
}
[data-theme="dark"] .mindmap-header {
  background: var(--color-surface, #1c1b19);
  border-color: var(--color-divider, #393836);
}
[data-theme="dark"] .mindmap-container .markmap-node text {
  fill: var(--color-text, #cdccca);
}
[data-theme="dark"] .mindmap-hint {
  background: var(--color-surface, #1c1b19);
  border-color: var(--color-divider, #393836);
  color: var(--color-text-faint, #5a5957);
}

/* ---- Mobile FAB (floating action button) ---- */
.mindmap-fab {
  display: none; /* hidden on desktop */
  position: fixed;
  bottom: 80px; /* above the Feedback button */
  left: 16px;
  z-index: 900;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  background: var(--color-primary, #01696f);
  color: #fff;
  border: none;
  border-radius: var(--radius-full, 999px);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0,0,0,0.25);
  transition: background 0.2s, transform 0.2s;
}
.mindmap-fab:hover {
  background: var(--color-primary-hover, #0c4e54);
}
.mindmap-fab:active {
  transform: scale(0.95);
}
.mindmap-fab svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}
@media (max-width: 600px) {
  .mindmap-fab { display: flex; }
}

/* ---- Mobile overlay tweaks ---- */
@media (max-width: 600px) {
  .mindmap-header {
    padding: var(--space-2) var(--space-3);
  }
  .mindmap-header-title {
    font-size: var(--text-sm);
  }
  .mindmap-close-btn {
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-xs);
  }
  .mindmap-hint {
    font-size: 11px;
    padding: var(--space-1) var(--space-2);
    bottom: var(--space-2);
  }
}

/* Print: hide mind map */
@media print {
  .mindmap-toggle-wrap, .mindmap-overlay, .mindmap-fab { display: none !important; }
}
