/* mindmap.css v4 - Dual Theme (Ocean + Classic), collapsible, responsive */

/* ===== Wrapper ===== */
.mindmap-wrapper {
  margin: 24px 0;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  transition: background 0.3s, border-color 0.3s, box-shadow 0.3s;
}

/* ===== Toolbar ===== */
.mindmap-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 18px;
  color: #fff;
  transition: background 0.3s;
  flex-wrap: wrap;
  gap: 6px;
}
.mindmap-toolbar-title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.5px;
}
.mindmap-toolbar-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.mindmap-toolbar-btn {
  padding: 5px 12px;
  border: 1px solid rgba(255,255,255,0.35);
  border-radius: 6px;
  background: rgba(255,255,255,0.12);
  color: #fff;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
  white-space: nowrap;
  line-height: 1.4;
}
.mindmap-toolbar-btn:hover {
  background: rgba(255,255,255,0.28);
  border-color: rgba(255,255,255,0.65);
  transform: translateY(-1px);
}
.mindmap-toolbar-btn:active { transform: translateY(0); }
.mindmap-theme-btn {
  background: rgba(255,255,255,0.22);
  border-color: rgba(255,255,255,0.5);
  font-weight: 500;
}

/* ===== Container ===== */
.mindmap-container {
  position: relative;
  overflow: hidden;
  transition: background 0.3s;
}

/* ===== SVG Overrides ===== */
.mindmap-container svg path {
  stroke-width: 1.8 !important;
  fill: none !important;
}
.mindmap-container svg g.markmap-node > text {
  font-size: 14px;
  fill: currentColor;
}
.mindmap-container svg {
  padding-left: 8px;
}

/* ===== Loading ===== */
.mindmap-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
}
.mindmap-loader { text-align: center; }
.mindmap-loader span {
  display: block;
  margin-top: 16px;
  font-size: 14px;
  opacity: 0.8;
}
.mindmap-wave {
  width: 60px;
  height: 30px;
  margin: 0 auto;
  position: relative;
}
.mindmap-wave::before,
.mindmap-wave::after {
  content: '';
  position: absolute;
  width: 60px;
  height: 30px;
  border-radius: 50%;
  border-bottom-color: transparent !important;
  animation: wave 1.4s ease-in-out infinite;
}
.mindmap-wave::after { animation-delay: 0.3s; }
@keyframes wave {
  0%, 100% { transform: translateY(0) scale(1); opacity: 1; }
  50% { transform: translateY(-8px) scale(1.1); opacity: 0.6; }
}
.mindmap-container.mindmap-loaded .mindmap-loader { display: none; }
.mindmap-container.mindmap-loaded .mindmap-wave { display: none; }

/* ===== Error ===== */
.mindmap-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 160px;
  gap: 6px;
}
.mindmap-error span { font-size: 15px; font-weight: 500; }
.mindmap-error small { font-size: 12px; opacity: 0.7; }

/* ===== Pre Block ===== */
pre.mindmap { display: none; }

/* ===== Block Collapse ===== */
.mindmap-wrapper.mindmap-collapsed .mindmap-container {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  padding: 0;
  margin: 0;
}
.mindmap-container {
  max-height: 2000px;
  opacity: 1;
  transition: max-height 0.4s ease, opacity 0.3s ease;
}
.mindmap-collapse-btn {
  min-width: 60px;
}

/* ================================================================
   OCEAN THEME
   ================================================================ */
.mindmap-wrapper.theme-ocean {
  background: linear-gradient(135deg, #f0f8ff 0%, #e6f4fb 100%);
  border: 1px solid #c5e3f0;
}
.theme-ocean .mindmap-toolbar {
  background: linear-gradient(90deg, #023e8a 0%, #0077b6 60%, #00b4d8 100%);
}
.theme-ocean .mindmap-container {
  background: linear-gradient(180deg, #f8fdff 0%, #eef7fc 100%);
}
.theme-ocean .mindmap-container svg g.markmap-node > text { fill: #1a3a4a; }
.theme-ocean .mindmap-loader { color: #0077b6; }
.theme-ocean .mindmap-wave::before { border: 3px solid #00b4d8; border-bottom-color: transparent; }
.theme-ocean .mindmap-wave::after  { border: 3px solid #48cae4; border-bottom-color: transparent; }
.theme-ocean .mindmap-error { color: #0077b6; }

/* ================================================================
   CLASSIC THEME
   ================================================================ */
.mindmap-wrapper.theme-classic {
  background: linear-gradient(135deg, #faf8f0 0%, #f5eed8 100%);
  border: 1px solid #e0d5b5;
}
.theme-classic .mindmap-toolbar {
  background: linear-gradient(90deg, #3d2e1f 0%, #6b4f1d 60%, #8b6914 100%);
}
.theme-classic .mindmap-container {
  background: linear-gradient(180deg, #fdfcf7 0%, #f8f4e8 100%);
}
.theme-classic .mindmap-container svg g.markmap-node > text { fill: #3d2e1f; }
.theme-classic .mindmap-container svg path { stroke: #333 !important; }
.theme-classic .mindmap-loader { color: #8b6914; }
.theme-classic .mindmap-wave::before { border: 3px solid #b8860b; border-bottom-color: transparent; }
.theme-classic .mindmap-wave::after  { border: 3px solid #daa520; border-bottom-color: transparent; }
.theme-classic .mindmap-error { color: #8b6914; }

/* ================================================================
   DARK MODE
   ================================================================ */
[data-theme="dark"] .mindmap-wrapper.theme-ocean {
  background: linear-gradient(135deg, #0a1628 0%, #0d2137 100%);
  border-color: #1a3a5c;
}
[data-theme="dark"] .theme-ocean .mindmap-toolbar {
  background: linear-gradient(90deg, #001d3d 0%, #003566 60%, #0077b6 100%);
}
[data-theme="dark"] .theme-ocean .mindmap-container {
  background: linear-gradient(180deg, #0a1628 0%, #0d1f33 100%);
}
[data-theme="dark"] .theme-ocean .mindmap-container svg g.markmap-node > text { fill: #caf0f8; }
[data-theme="dark"] .theme-ocean .mindmap-loader { color: #48cae4; }
[data-theme="dark"] .theme-ocean .mindmap-wave::before { border-color: #0077b6; border-bottom-color: transparent; }
[data-theme="dark"] .theme-ocean .mindmap-wave::after  { border-color: #00b4d8; border-bottom-color: transparent; }
[data-theme="dark"] .theme-ocean .mindmap-error { color: #48cae4; }

[data-theme="dark"] .mindmap-wrapper.theme-classic {
  background: linear-gradient(135deg, #1a1510 0%, #231c12 100%);
  border-color: #3a3020;
}
[data-theme="dark"] .theme-classic .mindmap-toolbar {
  background: linear-gradient(90deg, #2a1f14 0%, #4a3518 60%, #6b4f1d 100%);
}
[data-theme="dark"] .theme-classic .mindmap-container {
  background: linear-gradient(180deg, #1a1510 0%, #211b12 100%);
}
[data-theme="dark"] .theme-classic .mindmap-container svg g.markmap-node > text { fill: #f4e8c1; }
[data-theme="dark"] .theme-classic .mindmap-container svg path { stroke: #a89060 !important; }
[data-theme="dark"] .theme-classic .mindmap-loader { color: #daa520; }
[data-theme="dark"] .theme-classic .mindmap-wave::before { border-color: #8b6914; border-bottom-color: transparent; }
[data-theme="dark"] .theme-classic .mindmap-wave::after  { border-color: #b8860b; border-bottom-color: transparent; }
[data-theme="dark"] .theme-classic .mindmap-error { color: #daa520; }

/* Dark shared buttons */
[data-theme="dark"] .mindmap-toolbar-btn {
  border-color: rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.08);
}
[data-theme="dark"] .mindmap-toolbar-btn:hover {
  background: rgba(255,255,255,0.18);
}

/* ================================================================
   RESPONSIVE
   ================================================================ */
@media (max-width: 768px) {
  .mindmap-wrapper { margin: 16px 0; border-radius: 10px; }
  .mindmap-toolbar { padding: 8px 12px; }
  .mindmap-toolbar-title { font-size: 14px; }
  .mindmap-toolbar-btn { padding: 4px 9px; font-size: 12px; }
  .mindmap-container svg g.markmap-node > text { font-size: 13px; }
  .mindmap-container svg { touch-action: pan-x pan-y; }
}
@media (max-width: 480px) {
  .mindmap-wrapper { margin: 12px -4px; border-radius: 8px; }
  .mindmap-toolbar { padding: 8px 10px; }
  .mindmap-toolbar-title { font-size: 13px; }
  .mindmap-toolbar-btn { padding: 3px 7px; font-size: 11px; }
  .mindmap-container svg g.markmap-node > text { font-size: 12px; }
  .mindmap-container { min-height: 320px; }
}
