/* 杆杆响知识图谱 — 样式 */

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #1a1a2e;
  --bg-surface: #16213e;
  --bg-card: #0f3460;
  --text: #e6e6e6;
  --text-muted: #a0a0b0;
  --accent: #e94560;
  --accent-light: #ff6b81;
  --border: #2a2a4a;

  /* entity type colors */
  --color-concept: #2ECC71;
  --color-method: #3498DB;
  --color-artifact: #95A5A6;
  --color-data: #F39C12;
  --color-event: #1ABC9C;
  --color-organization: #E67E22;
  --color-content: #9B59B6;
  --color-UNKNOWN: #BDC3C7;
  --color-other: #E74C3C;
}

html, body { height: 100%; font-family: -apple-system, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif; background: var(--bg); color: var(--text); overflow: hidden; }

/* Header */
#header {
  display: flex; align-items: center; justify-content: space-between;
  height: 52px; padding: 0 16px;
  background: var(--bg-surface); border-bottom: 1px solid var(--border);
}
#header h1 { font-size: 16px; font-weight: 600; white-space: nowrap; }
.header-left { display: flex; align-items: center; gap: 12px; }
.header-nav { display: flex; gap: 4px; margin-left: 16px; }
.header-center { flex: 1; display: flex; justify-content: center; }
.header-right { display: flex; align-items: center; gap: 8px; }

.nav-link {
  padding: 8px 16px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  border-radius: 6px;
  transition: all 0.2s;
}
.nav-link:hover { color: var(--text); background: var(--bg-card); }
.nav-link.active { 
  color: var(--accent); 
  background: rgba(233, 69, 96, 0.15); 
  font-weight: 500;
}

.stats-badge {
  font-size: 12px; color: var(--text-muted);
  background: var(--bg-card); padding: 2px 8px; border-radius: 10px;
}

/* Search */
.search-box { display: flex; gap: 4px; }
.search-box input {
  width: 280px; padding: 6px 12px; border: 1px solid var(--border);
  border-radius: 4px; background: var(--bg); color: var(--text); font-size: 13px;
}
.search-box input::placeholder { color: var(--text-muted); }
.search-box input:focus { outline: none; border-color: var(--accent); }

button {
  cursor: pointer; border: none; border-radius: 4px;
  padding: 6px 12px; font-size: 13px; transition: background 0.2s;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-light); }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { color: var(--text); }
.btn-icon { background: var(--bg-card); color: var(--text); font-size: 16px; width: 32px; height: 32px; padding: 0; display: flex; align-items: center; justify-content: center; }
.btn-icon:hover { background: var(--border); }

/* Dropdown */
.dropdown { position: relative; }
.dropdown-menu {
  display: none; position: absolute; right: 0; top: 36px;
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: 4px; min-width: 120px; z-index: 100;
}
.dropdown-menu.show { display: block; }
.dropdown-menu a { display: block; padding: 8px 12px; color: var(--text); text-decoration: none; font-size: 13px; }
.dropdown-menu a:hover { background: var(--bg-card); }

/* Main layout */
#main { display: flex; height: calc(100vh - 52px); }

/* Sidebar */
#sidebar {
  width: 220px; min-width: 220px; padding: 12px;
  background: var(--bg-surface); border-right: 1px solid var(--border);
  overflow-y: auto;
}
.filter-section { margin-bottom: 16px; }
.filter-section h3 { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px; }

.filter-section label.type-checkbox {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; cursor: pointer; padding: 2px 0;
}
.filter-section label.type-checkbox input { accent-color: var(--accent); }
.type-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.type-count { color: var(--text-muted); font-size: 11px; margin-left: auto; }

select {
  width: 100%; padding: 6px 8px; border: 1px solid var(--border);
  border-radius: 4px; background: var(--bg); color: var(--text); font-size: 13px;
}
select:focus { outline: none; border-color: var(--accent); }

.slider-row { display: flex; align-items: center; gap: 8px; }
.slider-row input[type=range] { flex: 1; accent-color: var(--accent); }
.slider-row span { font-size: 13px; min-width: 20px; text-align: center; }

/* Legend */
#legend { display: flex; flex-wrap: wrap; gap: 4px; }
.legend-item { display: flex; align-items: center; gap: 4px; font-size: 11px; color: var(--text-muted); }

/* Cytoscape canvas */
#cy { flex: 1; background: var(--bg); }

/* Detail panel */
#detail-panel {
  position: absolute; right: 16px; bottom: 16px;
  width: 320px; max-height: 400px;
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: 8px; overflow-y: auto; z-index: 50;
}
#detail-panel.hidden { display: none; }
.panel-header { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.panel-header h3 { font-size: 14px; }
#detail-close { background: none; color: var(--text-muted); font-size: 18px; padding: 0 4px; }
.panel-body { padding: 10px 14px; }
.detail-row { display: flex; gap: 8px; margin-bottom: 6px; font-size: 13px; }
.detail-row label { color: var(--text-muted); min-width: 60px; }
.detail-desc { flex-direction: column; }
.detail-desc p { font-size: 12px; color: var(--text-muted); line-height: 1.5; margin-top: 4px; max-height: 120px; overflow-y: auto; }
#detail-expand { margin-top: 10px; width: 100%; }

/* Loading overlay */
#loading {
  position: fixed; inset: 0; background: rgba(26,26,46,0.92);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  z-index: 200;
}
#loading.hidden { display: none; }
.spinner {
  width: 40px; height: 40px; border: 3px solid var(--border);
  border-top-color: var(--accent); border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
#loading p { margin-top: 12px; color: var(--text-muted); font-size: 14px; }

/* Tippy overrides */
.tippy-box { background: var(--bg-card); border: 1px solid var(--border); color: var(--text); font-size: 12px; }
.tippy-arrow { color: var(--bg-card); }
.tippy-content { padding: 6px 10px; }
.tippy-content .tip-type { color: var(--accent); font-weight: 600; }
