/**
 * Wikilink Graph View Styles
 *
 * 样式说明（Style Description）：
 * - 图视图覆盖层和面板样式
 * - 主题感知（light/dark）
 * - 响应式设计
 */

/* 图视图覆盖层（Graph View Overlay） */
.wikilink-graph-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 10000;
  justify-content: center;
  align-items: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.wikilink-graph-overlay.active {
  opacity: 1;
}

/* 图面板（Graph Panel） */
.graph-panel {
  width: 90vw;
  max-width: 1400px;
  height: 85vh;
  background: var(--base-background-color, #ffffff);
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(20px);
  transition: transform 0.3s ease;
}

.wikilink-graph-overlay.active .graph-panel {
  transform: translateY(0);
}

/* 图标题栏（Graph Header） */
.graph-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  border-bottom: 1px solid var(--mono-tint3, #ddd);
  background: var(--mono-tint3, #f5f5f5);
}

.graph-header h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  color: var(--heading-color, #333);
}

/* 图控制按钮（Graph Controls） */
.graph-controls {
  display: flex;
  gap: 12px;
  align-items: center;
}

.graph-controls button {
  background: var(--theme-color, #42b983);
  color: white;
  border: none;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.graph-controls button:hover {
  background: var(--theme-color-dark, #359268);
  transform: scale(1.05);
}

.graph-controls button:active {
  transform: scale(0.95);
}

/* 搜索容器（Search Container） */
.search-container {
  display: flex;
  align-items: center;
  position: relative;
}

.search-container input {
  padding: 8px 32px 8px 12px;
  border: 1px solid var(--mono-tint3, #ddd);
  border-radius: 6px;
  font-size: 14px;
  width: 220px;
  background: var(--base-background-color, #ffffff);
  color: var(--base-color, #333);
  transition: all 0.2s ease;
}

.search-container input:focus {
  outline: none;
  border-color: var(--theme-color, #42b983);
  box-shadow: 0 0 0 3px rgba(66, 185, 131, 0.1);
}

.search-container input::placeholder {
  color: var(--mono-shade1, #999);
}

/* 搜索清除按钮（Search Clear Button） */
.search-clear-btn {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent !important;
  color: var(--mono-shade1, #999) !important;
  padding: 4px 8px !important;
  font-size: 14px;
  opacity: 0.6;
  min-width: auto !important;
}

.search-clear-btn:hover {
  opacity: 1;
  background: transparent !important;
  transform: translateY(-50%) !important;
}

/* 搜索计数（Search Count） */
.search-count {
  font-size: 13px;
  color: var(--theme-color, #42b983);
  font-weight: 500;
  white-space: nowrap;
  margin-right: 12px;
  min-width: 80px;
  text-align: right;
}

/* 图容器（Graph Container） */
.graph-container {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: var(--base-background-color, #ffffff);
}

.graph-container svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* 图例（Graph Legend） */
.graph-legend {
  padding: 12px 24px;
  border-top: 1px solid var(--mono-tint3, #ddd);
  background: var(--mono-tint3, #f5f5f5);
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  align-items: center;
  font-size: 13px;
  color: var(--base-color, #666);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.legend-circle {
  display: inline-block;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--theme-color, #42b983);
  background: var(--node-color, #0366d6);
}

/* 图切换按钮（Graph Toggle Button） */
.graph-toggle-btn {
  position: fixed;
  top: 16px;
  right: 160px;
  z-index: 9998;
  background: var(--theme-color, #42b983);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 6px;
  user-select: none;
}

.graph-toggle-btn:hover {
  background: var(--theme-color-dark, #359268);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.graph-toggle-btn:active {
  transform: translateY(0);
}

.graph-toggle-btn::before {
  content: '🕸️';
  font-size: 16px;
}

/* 暗色主题适配（Dark Theme Adaptation） */
@media (prefers-color-scheme: dark) {
  .graph-panel {
    background: #2d2d2d;
  }

  .graph-header,
  .graph-legend {
    background: #1e1e1e;
    border-color: #444;
  }

  .graph-header h2 {
    color: #ffffff;
  }

  .graph-container {
    background: #2d2d2d;
  }

  .graph-legend {
    color: #cccccc;
  }

  .legend-circle {
    background: var(--node-color, #bb86fc);
    border-color: #ffffff;
  }

  .search-container input {
    background: #3d3d3d;
    color: #ffffff;
    border-color: #555;
  }

  .search-container input:focus {
    border-color: var(--theme-color, #42b983);
    box-shadow: 0 0 0 3px rgba(66, 185, 131, 0.2);
  }

  .search-clear-btn {
    color: #aaa !important;
  }
}

/* 响应式设计（Responsive Design） */
@media (max-width: 768px) {
  .graph-panel {
    width: 95vw;
    height: 90vh;
  }

  .graph-header {
    padding: 12px 16px;
  }

  .graph-header h2 {
    font-size: 18px;
  }

  .graph-toggle-btn {
    right: 16px;
    top: 60px;
    padding: 6px 12px;
    font-size: 13px;
  }

  .graph-legend {
    padding: 10px 16px;
    font-size: 12px;
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
  }
}

/* Wikilink样式增强（Wikilink Style Enhancement） */
a[href*="[["],
a[href*="]]"] {
  position: relative;
  text-decoration: none;
  border-bottom: 1px dotted var(--theme-color, #42b983);
}

a[href*="[["]:hover,
a[href*="]]"]:hover {
  border-bottom-style: solid;
  color: var(--theme-color-dark, #359268);
}

/* 加载动画（Loading Animation） */
@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

.graph-loading {
  animation: pulse 1.5s ease-in-out infinite;
}
