/* Wide canvas layout for the course portal mind-map workspace. */
.mind-map-page {
  --mind-accent: #9a645c;
  display: grid;
  gap: 18px;
}

.container.wide-container {
  width: min(1680px, calc(100% - 32px));
}

.mind-map-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

.mind-map-header h1 {
  margin: 4px 0 8px;
}

.mind-map-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(92px, 1fr));
  gap: 8px;
  min-width: 330px;
}

.mind-map-summary > div {
  display: grid;
  gap: 3px;
  padding: 12px 14px;
  border: 1px solid #dfd4c6;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.88);
}

.mind-map-summary b {
  color: #8a554d;
  font-size: 24px;
}

.mind-map-summary span {
  color: #776d65;
  font-size: 12px;
  font-weight: 800;
}

.mind-map-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  grid-template-areas:
    "list workspace"
    "inspector workspace";
  align-items: start;
  gap: 14px;
}

.mind-map-list-panel {
  grid-area: list;
}

.mind-map-workspace {
  grid-area: workspace;
}

.mind-map-inspector {
  grid-area: inspector;
}

.mind-map-list-panel {
  position: sticky;
  top: 86px;
  max-height: calc(100vh - 110px);
  overflow-y: auto;
}

.mind-map-panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.mind-map-panel-heading p,
.mind-map-toolbar p {
  margin: 0 0 3px;
  color: #a06c62;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.mind-map-panel-heading h2,
.mind-map-panel-heading h3,
.mind-map-toolbar h2 {
  margin: 0;
}

.mind-map-list-panel .mind-map-panel-heading h2 {
  font-size: 20px;
  white-space: nowrap;
}

.mind-map-toolbar h2 {
  font-size: 22px;
  white-space: nowrap;
}

.mind-map-list {
  display: grid;
  gap: 8px;
}

.mind-map-list-item {
  display: grid;
  gap: 5px;
  width: 100%;
  padding: 12px;
  border: 1px solid #ddd3c7;
  border-radius: 11px;
  background: #fff;
  color: #493f39;
  text-align: left;
  cursor: pointer;
}

.mind-map-list-item:hover {
  border-color: #bd8b81;
  background: #fffaf8;
}

.mind-map-list-item.active {
  border-color: #9a645c;
  background: #fbf1ee;
  box-shadow: 0 0 0 2px rgba(154, 100, 92, 0.1);
}

.mind-map-list-item strong {
  font-size: 14px;
  line-height: 1.4;
}

.mind-map-list-item span {
  color: #81756d;
  font-size: 11px;
}

.mind-map-workspace {
  display: grid;
  min-width: 0;
  gap: 14px;
}

.mind-map-meta-panel {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
}

.mind-map-meta-fields {
  display: grid;
  grid-template-columns: minmax(180px, 0.75fr) minmax(240px, 1.25fr);
  gap: 10px;
  flex: 1;
}

.mind-map-meta-fields label,
.mind-map-inspector-fields label {
  display: grid;
  gap: 6px;
  color: #5f554e;
  font-size: 12px;
  font-weight: 800;
}

.mind-map-meta-fields input,
.mind-map-inspector-fields input,
.mind-map-inspector-fields textarea,
.mind-map-inspector-fields select,
.mind-map-add-controls select {
  width: 100%;
  padding: 10px 11px;
  border: 1px solid #d8cec2;
  border-radius: 10px;
  background: #fff;
  color: #423a35;
  font: inherit;
}

.mind-map-inspector-fields textarea {
  resize: vertical;
  line-height: 1.55;
}

.mind-map-meta-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
}

.mind-map-meta-actions > span {
  color: #4d7864;
  font-size: 12px;
  font-weight: 900;
}

.mind-map-meta-actions > span.dirty {
  color: #ad6b22;
}

.mind-map-canvas-panel {
  min-width: 0;
  padding: 16px;
}

.mind-map-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 7px;
}

.mind-map-toolbar-actions,
.mind-map-add-controls,
.mind-map-zoom-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.mind-map-zoom-controls {
  padding: 4px;
  border: 1px solid #d9cec2;
  border-radius: 11px;
  background: #fffaf8;
}

.mind-map-zoom-controls button {
  min-width: 34px;
  height: 34px;
  padding: 0 9px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: #fff;
  color: #5b4d46;
  font-size: 18px;
  font-weight: 900;
  cursor: pointer;
}

.mind-map-zoom-controls button:hover {
  border-color: #bd8b81;
  color: #8c5148;
}

.mind-map-zoom-controls strong {
  min-width: 50px;
  color: #765c55;
  font-size: 12px;
  text-align: center;
}

.mind-map-zoom-controls .mind-map-fit-button {
  min-width: 74px;
  border-left-color: #e5dad0;
  font-size: 11px;
}

.mind-map-add-controls select {
  width: auto;
  min-width: 92px;
  padding: 8px 9px;
  font-size: 12px;
  font-weight: 800;
}

.mind-map-help {
  margin: 0 0 9px;
  padding: 8px 10px;
  border: 1px solid #e8ded5;
  border-radius: 9px;
  background: #fffaf7;
  color: #74675f;
  font-size: 12px;
  line-height: 1.5;
}

.mind-map-canvas {
  position: relative;
  height: clamp(780px, calc(100vh - 150px), 980px);
  overflow: auto;
  border: 2px solid #d8cabd;
  border-radius: 13px;
  background-color: #fff;
  background-image: radial-gradient(circle, rgba(155, 119, 105, 0.22) 1px, transparent 1px);
  background-size: 22px 22px;
  box-shadow: inset 0 0 30px rgba(96, 67, 56, 0.06);
  touch-action: none;
}

.mind-map-canvas:focus {
  outline: 2px solid #b67c72;
  outline-offset: 2px;
}

.mind-map-canvas.connecting {
  border-color: #b05c94;
  box-shadow: inset 0 0 36px rgba(176, 92, 148, 0.1), 0 0 0 3px rgba(176, 92, 148, 0.08);
}

.mind-map-stage {
  position: relative;
  width: 2200px;
  height: 1300px;
  margin-inline: auto;
}

.mind-map-world {
  position: absolute;
  inset: 0 auto auto 0;
  width: 2200px;
  height: 1300px;
  transform-origin: 0 0;
}

.mind-map-edges,
.mind-map-nodes {
  position: absolute;
  inset: 0;
  width: 2200px;
  height: 1300px;
}

.mind-map-edges {
  z-index: 1;
  overflow: visible;
}

.mind-map-nodes {
  z-index: 2;
  pointer-events: none;
}

.mind-map-edge-group {
  color: #aa9891;
  cursor: pointer;
}

.mind-map-edge-group.selected {
  color: #a94283;
}

.mind-map-edge-line {
  fill: none;
  stroke: currentColor;
  stroke-width: 3;
}

.mind-map-edge-hit {
  fill: none;
  stroke: transparent;
  stroke-width: 18;
  pointer-events: stroke;
}

.mind-map-edge-label {
  fill: #6e5c55;
  font-size: 12px;
  font-weight: 900;
  text-anchor: middle;
}

.mind-map-node {
  --mind-node-accent: #db759f;
  --mind-node-surface: #fff1f7;
  position: absolute;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
  width: 260px;
  min-height: 150px;
  padding: 18px 20px;
  border: 3px solid var(--mind-node-accent);
  border-radius: 18px;
  background: linear-gradient(145deg, #fff, var(--mind-node-surface));
  box-shadow: 0 10px 25px rgba(78, 57, 49, 0.16);
  pointer-events: auto;
  cursor: grab;
  user-select: none;
}

.mind-map-node.color-purple {
  --mind-node-accent: #9d7bc5;
  --mind-node-surface: #f5efff;
}

.mind-map-node.color-blue {
  --mind-node-accent: #669fc9;
  --mind-node-surface: #edf8ff;
}

.mind-map-node.color-green {
  --mind-node-accent: #68ae8b;
  --mind-node-surface: #eefbf5;
}

.mind-map-node.color-yellow {
  --mind-node-accent: #cfaa4f;
  --mind-node-surface: #fff9e7;
}

.mind-map-node.root {
  border-width: 4px;
  transform: scale(1.04);
  box-shadow: 0 12px 28px rgba(153, 76, 117, 0.2);
}

.mind-map-node.selected {
  box-shadow: 0 0 0 4px rgba(141, 91, 121, 0.14), 0 12px 26px rgba(78, 57, 49, 0.18);
}

.mind-map-node.connecting {
  animation: mind-map-pulse 1s ease-in-out infinite alternate;
}

@keyframes mind-map-pulse {
  from { box-shadow: 0 0 0 3px rgba(176, 73, 139, 0.12); }
  to { box-shadow: 0 0 0 8px rgba(176, 73, 139, 0.22); }
}

.mind-map-node:active {
  cursor: grabbing;
}

.mind-map-node h4 {
  margin: 0;
  color: #403630;
  font-size: 21px;
  font-weight: 900;
  line-height: 1.28;
  overflow-wrap: anywhere;
}

.mind-map-node p {
  margin: 0;
  color: #5e514b;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.mind-map-node p.empty {
  color: #9f938c;
  font-weight: 600;
}

.mind-map-inspector {
  min-height: 190px;
}

.mind-map-inspector-empty {
  display: grid;
  place-items: center;
  min-height: 160px;
  color: #887c75;
  font-size: 12px;
  line-height: 1.7;
  text-align: center;
}

.mind-map-inspector-fields {
  display: grid;
  gap: 11px;
}

.mind-map-root-check {
  display: flex !important;
  align-items: center;
  gap: 7px !important;
}

.mind-map-root-check input {
  width: auto;
}

.mind-map-connection-name {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 5px;
  padding: 9px;
  border: 1px solid #e2d6cc;
  border-radius: 10px;
  background: #fffaf7;
  color: #675952;
  font-size: 11px;
  font-weight: 900;
  text-align: center;
}

.mind-map-connection-name b {
  color: #a34a82;
  font-size: 16px;
}

.mind-map-page.presentation-mode {
  position: fixed;
  z-index: 1000;
  inset: 0;
  overflow: auto;
  padding: 18px;
  background: #f7f2ec;
}

.mind-map-page.presentation-mode .mind-map-header,
.mind-map-page.presentation-mode .mind-map-list-panel,
.mind-map-page.presentation-mode .mind-map-inspector,
.mind-map-page.presentation-mode .mind-map-meta-panel {
  display: none;
}

.mind-map-page.presentation-mode .mind-map-layout,
.mind-map-page.presentation-mode .mind-map-workspace {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.mind-map-page.presentation-mode .mind-map-canvas-panel,
.mind-map-page.presentation-mode .mind-map-toolbar,
.mind-map-page.presentation-mode .mind-map-canvas {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.mind-map-page.presentation-mode .mind-map-toolbar {
  flex-wrap: wrap;
}

.mind-map-page.presentation-mode .mind-map-toolbar-actions {
  justify-content: flex-end;
  margin-left: auto;
}

.mind-map-page.presentation-mode .mind-map-canvas {
  height: calc(100vh - 112px);
}

.mind-map-page.presentation-mode .mind-map-help {
  display: none;
}

@media (max-width: 1160px) {
  .mind-map-header {
    align-items: stretch;
    flex-direction: column;
  }

  .mind-map-summary {
    width: 100%;
    min-width: 0;
  }

  .mind-map-layout {
    grid-template-columns: 1fr;
    grid-template-areas:
      "list"
      "workspace"
      "inspector";
  }

  .mind-map-list-panel,
  .mind-map-inspector {
    position: static;
    max-height: none;
  }

  .mind-map-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .mind-map-page {
    gap: 14px;
  }

  .mind-map-summary {
    grid-template-columns: repeat(3, 1fr);
  }

  .mind-map-summary > div {
    padding: 9px;
  }

  .mind-map-summary b {
    font-size: 19px;
  }

  .mind-map-summary span {
    font-size: 10px;
  }

  .mind-map-list {
    grid-template-columns: 1fr;
  }

  .mind-map-meta-panel,
  .mind-map-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .mind-map-meta-fields {
    grid-template-columns: 1fr;
  }

  .mind-map-meta-actions,
  .mind-map-toolbar-actions {
    justify-content: flex-start;
  }

  .mind-map-add-controls {
    width: 100%;
  }

  .mind-map-canvas {
    height: 620px;
  }
}
