/* ============================================
   Mac BrandOS - 品牌策划体系全景图
   ============================================ */

/* === 页面容器 === */
.map-container {
  max-width: var(--max-width-wide);
  margin: 0 auto;
  padding: var(--space-8) var(--space-6) var(--space-20);
}

/* === 脑图概览 === */
.mindmap-section {
  margin-bottom: var(--space-8);
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.mindmap-title-bar {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--color-border);
}

.mindmap-title-bar svg {
  color: var(--color-primary);
  flex-shrink: 0;
}

.mindmap-hint {
  margin-left: auto;
  font-size: var(--text-xs);
  font-weight: 400;
  color: var(--color-text-light);
}

.mindmap-canvas {
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}

.mindmap-svg {
  width: 100%;
  height: auto;
  min-width: 760px;
  display: block;
}

/* SVG node interactions */
.mm-stage {
  transition: opacity 0.2s ease;
}

.mm-stage:hover .mm-stage-rect {
  filter: url(#mm-shadow) brightness(1.08);
}

.mm-sub {
  transition: opacity 0.2s ease;
}

.mm-sub:hover .mm-sub-rect {
  fill: #f9fafb;
  stroke-opacity: 0.5;
}

.mm-link {
  transition: opacity 0.3s ease;
}

.mm-stage:hover ~ .mm-link[data-stage],
.mm-sub:hover ~ .mm-sublink[data-stage] {
  opacity: 0.7;
}

/* Flash animation when jumping from mindmap */
@keyframes flash-highlight {
  0%, 100% { box-shadow: var(--shadow-sm); }
  50% { box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.25), var(--shadow-md); }
}

.stage-row.flash {
  animation: flash-highlight 0.6s ease-in-out 3;
}

/* === 页面头部 === */
.map-header {
  text-align: center;
  margin-bottom: var(--space-10);
  padding-top: var(--space-6);
}

.map-header h1 {
  font-size: var(--text-3xl);
  font-weight: 700;
  margin-bottom: var(--space-3);
}

.map-header-desc {
  font-size: var(--text-lg);
  color: var(--color-text-dim);
  max-width: 640px;
  margin: 0 auto var(--space-6);
  line-height: 1.6;
}

/* === 工具栏 === */
.map-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-bottom: var(--space-8);
  padding: var(--space-4) var(--space-5);
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.map-legend {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.map-legend-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--color-text-dim);
  cursor: pointer;
  transition: color var(--transition-fast);
  user-select: none;
}

.map-legend-item:hover {
  color: var(--color-text);
}

.map-legend-item.active {
  color: var(--color-primary);
  font-weight: 600;
}

.map-legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.map-legend-dot.decision { background: #2563EB; }
.map-legend-dot.methodology { background: #7C3AED; }
.map-legend-dot.tool { background: #F59E0B; }

.map-actions {
  display: flex;
  gap: var(--space-2);
}

/* === 全景图主体 === */
.map-board {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

/* === 阶段行 === */
.stage-row {
  --stage-color: #2563EB;
  --stage-bg: rgba(37, 99, 235, 0.04);
  --stage-border: rgba(37, 99, 235, 0.15);
  background: var(--stage-bg);
  border: 1px solid var(--stage-border);
  border-left: 4px solid var(--stage-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--transition-base);
}

.stage-row[data-stage="1"] { --stage-color: #2563EB; --stage-bg: rgba(37, 99, 235, 0.04); --stage-border: rgba(37, 99, 235, 0.15); }
.stage-row[data-stage="2"] { --stage-color: #0D9488; --stage-bg: rgba(13, 148, 136, 0.04); --stage-border: rgba(13, 148, 136, 0.15); }
.stage-row[data-stage="3"] { --stage-color: #F59E0B; --stage-bg: rgba(245, 158, 11, 0.04); --stage-border: rgba(245, 158, 11, 0.15); }
.stage-row[data-stage="4"] { --stage-color: #10B981; --stage-bg: rgba(16, 185, 129, 0.04); --stage-border: rgba(16, 185, 129, 0.15); }
.stage-row[data-stage="5"] { --stage-color: #7C3AED; --stage-bg: rgba(124, 58, 237, 0.04); --stage-border: rgba(124, 58, 237, 0.15); }
.stage-row[data-stage="6"] { --stage-color: #6B7280; --stage-bg: rgba(107, 114, 128, 0.04); --stage-border: rgba(107, 114, 128, 0.15); }

.stage-row:hover {
  box-shadow: var(--shadow-md);
}

/* === 阶段头部 === */
.stage-header {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-5);
  cursor: pointer;
  user-select: none;
  transition: background var(--transition-fast);
}

.stage-header:hover {
  background: rgba(0, 0, 0, 0.02);
}

.stage-num {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--stage-color);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-base);
  font-weight: 700;
  flex-shrink: 0;
}

.stage-title-group {
  flex-grow: 1;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.stage-name {
  font-size: var(--text-xl);
  font-weight: 600;
  color: var(--color-text);
}

.stage-layer-tag {
  display: inline-block;
  padding: 2px var(--space-3);
  background: var(--stage-color);
  color: #fff;
  font-size: var(--text-xs);
  font-weight: 600;
  border-radius: var(--radius-full);
  white-space: nowrap;
}

.stage-summary {
  font-size: var(--text-sm);
  color: var(--color-text-dim);
  margin-left: auto;
}

.stage-toggle-icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-light);
  transition: transform var(--transition-base);
  flex-shrink: 0;
}

.stage-row.collapsed .stage-toggle-icon {
  transform: rotate(-90deg);
}

/* === 阶段内容区 === */
.stage-body {
  display: grid;
  grid-template-columns: 1fr 1.2fr 0.8fr;
  gap: var(--space-4);
  padding: 0 var(--space-5) var(--space-5);
  transition: all var(--transition-base);
  overflow: hidden;
}

.stage-row.collapsed .stage-body {
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  opacity: 0;
}

/* === 三列通用 === */
.stage-col {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.stage-col-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-light);
  padding-bottom: var(--space-2);
  border-bottom: 1px dashed var(--color-border);
}

.stage-col-header svg {
  width: 14px;
  height: 14px;
}

/* === 决策问题卡片 === */
.decision-item {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  transition: all var(--transition-fast);
  cursor: default;
  position: relative;
}

.decision-item:hover {
  border-color: var(--stage-color);
  box-shadow: var(--shadow-sm);
}

.decision-item-q {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text);
  line-height: 1.5;
}

.decision-item-desc {
  font-size: var(--text-xs);
  color: var(--color-text-dim);
  margin-top: var(--space-1);
  line-height: 1.5;
  display: none;
}

.decision-item:hover .decision-item-desc {
  display: block;
}

/* === 方法论卡片 === */
.method-item {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  transition: all var(--transition-fast);
  cursor: pointer;
  position: relative;
}

.method-item:hover {
  border-color: var(--stage-color);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.method-item-name {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.method-item-name::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--stage-color);
  flex-shrink: 0;
}

.method-item-desc {
  font-size: var(--text-xs);
  color: var(--color-text-dim);
  margin-top: var(--space-1);
  line-height: 1.5;
}

.method-item-arrow {
  position: absolute;
  top: 50%;
  right: var(--space-3);
  transform: translateY(-50%);
  color: var(--color-text-light);
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.method-item:hover .method-item-arrow {
  opacity: 1;
}

/* === 工具标签 === */
.tool-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text);
  transition: all var(--transition-fast);
  cursor: pointer;
  text-decoration: none;
}

.tool-item:hover {
  background: var(--stage-color);
  border-color: var(--stage-color);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.tool-item svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

/* === 连接箭头 === */
.stage-connector {
  display: flex;
  justify-content: center;
  padding: var(--space-1) 0;
}

.stage-connector svg {
  width: 20px;
  height: 24px;
  color: var(--color-text-light);
  opacity: 0.4;
}

/* === 底部知识库区 === */
.knowledge-base-section {
  margin-top: var(--space-12);
  padding: var(--space-8) var(--space-6);
  background: var(--color-bg-alt);
  border-radius: var(--radius-xl);
  text-align: center;
}

.knowledge-base-section h3 {
  font-size: var(--text-xl);
  font-weight: 700;
  margin-bottom: var(--space-2);
}

.knowledge-base-section p {
  font-size: var(--text-sm);
  color: var(--color-text-dim);
  margin-bottom: var(--space-6);
}

.kb-category-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-4);
  max-width: 800px;
  margin: 0 auto;
}

.kb-category-card {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  text-align: center;
  transition: all var(--transition-base);
  cursor: pointer;
  text-decoration: none;
  display: block;
}

.kb-category-card:hover {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.kb-category-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--space-3);
}

.kb-category-icon svg {
  width: 24px;
  height: 24px;
}

.kb-category-icon.bg-primary { background: var(--color-primary-light); color: var(--color-primary); }
.kb-category-icon.bg-accent { background: var(--color-accent-light); color: var(--color-accent); }
.kb-category-icon.bg-highlight { background: var(--color-highlight-light); color: var(--color-highlight); }
.kb-category-icon.bg-success { background: var(--color-success-light); color: var(--color-success); }

.kb-category-name {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: var(--space-1);
}

.kb-category-count {
  font-size: var(--text-xs);
  color: var(--color-text-light);
}

/* === 侧边详情面板 === */
.detail-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.3);
  z-index: 1500;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-base);
}

.detail-overlay.show {
  opacity: 1;
  visibility: visible;
}

.detail-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 420px;
  max-width: 90vw;
  height: 100vh;
  background: #fff;
  box-shadow: var(--shadow-xl);
  z-index: 1600;
  transform: translateX(100%);
  transition: transform var(--transition-base);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.detail-panel.show {
  transform: translateX(0);
}

.detail-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: var(--space-6);
  border-bottom: 1px solid var(--color-border);
}

.detail-panel-stage-tag {
  display: inline-block;
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
  font-weight: 600;
  border-radius: var(--radius-full);
  color: #fff;
  margin-bottom: var(--space-2);
}

.detail-panel-title {
  font-size: var(--text-xl);
  font-weight: 700;
  line-height: 1.4;
}

.detail-panel-close {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  color: var(--color-text-light);
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.detail-panel-close:hover {
  background: var(--color-bg-alt);
  color: var(--color-text);
}

.detail-panel-body {
  flex-grow: 1;
  padding: var(--space-6);
  overflow-y: auto;
}

.detail-section {
  margin-bottom: var(--space-6);
}

.detail-section-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-light);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-3);
}

.detail-summary {
  font-size: var(--text-sm);
  color: var(--color-text-dim);
  line-height: 1.7;
}

.detail-concept-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.detail-concept-tag {
  display: inline-block;
  padding: var(--space-1) var(--space-3);
  background: var(--color-bg-alt);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  color: var(--color-text-dim);
}

.detail-link-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.detail-link-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3);
  background: var(--color-bg-alt);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  color: var(--color-text);
  text-decoration: none;
  transition: all var(--transition-fast);
}

.detail-link-item:hover {
  background: var(--color-primary-lighter);
  color: var(--color-primary);
}

.detail-link-item svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--color-text-light);
}

.detail-panel-footer {
  padding: var(--space-5) var(--space-6);
  border-top: 1px solid var(--color-border);
  display: flex;
  gap: var(--space-3);
}

/* === 底部CTA === */
.map-cta {
  margin-top: var(--space-12);
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
  border-radius: var(--radius-xl);
  padding: var(--space-10) var(--space-8);
  text-align: center;
  color: #fff;
}

.map-cta h3 {
  color: #fff;
  font-size: var(--text-xl);
  margin-bottom: var(--space-2);
}

.map-cta p {
  color: rgba(255, 255, 255, 0.85);
  font-size: var(--text-sm);
  margin-bottom: var(--space-5);
}

.map-cta-buttons {
  display: flex;
  gap: var(--space-3);
  justify-content: center;
  flex-wrap: wrap;
}

/* === 筛选高亮效果 === */
.map-board.filter-methodology .decision-item,
.map-board.filter-methodology .tool-item {
  opacity: 0.35;
}

.map-board.filter-decision .method-item,
.map-board.filter-decision .tool-item {
  opacity: 0.35;
}

.map-board.filter-tool .decision-item,
.map-board.filter-tool .method-item {
  opacity: 0.35;
}

/* === 响应式 === */
@media (max-width: 1024px) {
  .stage-body {
    grid-template-columns: 1fr 1fr;
  }
  .stage-col-tools {
    grid-column: 1 / -1;
    flex-direction: row;
    flex-wrap: wrap;
  }
  .stage-col-tools .stage-col-header {
    width: 100%;
  }
}

@media (max-width: 768px) {
  .map-container {
    padding: var(--space-4) var(--space-4) var(--space-16);
  }
  .mindmap-section {
    padding: var(--space-4);
  }
  .mindmap-title-bar {
    font-size: var(--text-sm);
  }
  .mindmap-hint {
    display: none;
  }
  .mindmap-canvas {
    margin: 0 calc(-1 * var(--space-4));
    width: calc(100% + 2 * var(--space-4));
    padding: 0 var(--space-4);
    position: relative;
  }
  .mindmap-canvas::after {
    content: '← 左右滑动查看 →';
    display: block;
    text-align: center;
    font-size: var(--text-xs);
    color: var(--color-text-light);
    padding: var(--space-2) 0;
  }
  .map-header h1 {
    font-size: var(--text-2xl);
  }
  .map-header-desc {
    font-size: var(--text-base);
  }
  .map-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .map-legend {
    justify-content: center;
  }
  .map-actions {
    justify-content: center;
  }
  .stage-body {
    grid-template-columns: 1fr;
  }
  .stage-col-tools {
    grid-column: auto;
    flex-direction: column;
  }
  .stage-summary {
    display: none;
  }
  .stage-name {
    font-size: var(--text-base);
  }
  .kb-category-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .detail-panel {
    width: 100vw;
  }
}

@media (max-width: 480px) {
  .map-header h1 {
    font-size: var(--text-xl);
  }
  .stage-header {
    padding: var(--space-3);
  }
  .stage-num {
    width: 28px;
    height: 28px;
    font-size: var(--text-sm);
  }
  .stage-layer-tag {
    font-size: 10px;
  }
  .kb-category-grid {
    grid-template-columns: 1fr;
  }
  .mindmap-svg {
    min-width: 600px;
  }
}
