/* ========================================
 * Graph Explorer Module Styles
 * Interactive code graph visualization with tabs
 * ======================================== */

/* ========================================
 * Graph Explorer Layout
 * ======================================== */
.graph-explorer-view {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 150px);
  min-height: 600px;
  overflow: hidden;
}

.graph-explorer-view.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* ========================================
 * Graph Explorer Header with Tabs
 * ======================================== */
.graph-explorer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 0;
  margin-bottom: 1rem;
  border-bottom: 1px solid hsl(var(--border));
  flex-shrink: 0;
}

.graph-explorer-header h2 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.125rem;
  font-weight: 600;
  color: hsl(var(--foreground));
  margin: 0;
}

.graph-explorer-header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.graph-explorer-header-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Graph Tabs */
.graph-tabs {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding-left: 1rem;
  border-left: 1px solid hsl(var(--border));
}

.graph-tab {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: hsl(var(--muted-foreground));
  background: transparent;
  border: 1px solid hsl(var(--border));
  border-radius: 0.375rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.graph-tab:hover {
  background: hsl(var(--hover));
  color: hsl(var(--foreground));
}

.graph-tab.active {
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  border-color: hsl(var(--primary));
}

.graph-tab i {
  font-size: 0.875rem;
}

/* Graph Controls */
.graph-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Filter Dropdown */
.filter-dropdown {
  position: relative;
  display: inline-block;
}

.filter-dropdown-btn {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 0.875rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: hsl(var(--foreground));
  background: hsl(var(--background));
  border: 1px solid hsl(var(--border));
  border-radius: 0.375rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.filter-dropdown-btn:hover {
  background: hsl(var(--hover));
  border-color: hsl(var(--primary) / 0.3);
}

.filter-dropdown-btn i {
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
}

.filter-dropdown-menu {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  min-width: 200px;
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: 0.5rem;
  box-shadow: 0 4px 12px hsl(var(--foreground) / 0.15);
  z-index: 100;
  display: none;
  overflow: hidden;
}

.filter-dropdown.open .filter-dropdown-menu {
  display: block;
  animation: dropdownFadeIn 0.2s ease;
}

@keyframes dropdownFadeIn {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.filter-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 0.875rem;
  font-size: 0.8125rem;
  color: hsl(var(--foreground));
  cursor: pointer;
  transition: background 0.15s ease;
}

.filter-item:hover {
  background: hsl(var(--hover));
}

.filter-item input[type="checkbox"] {
  width: 14px;
  height: 14px;
  cursor: pointer;
}

.filter-item label {
  flex: 1;
  cursor: pointer;
  user-select: none;
}

/* Note: .graph-main and .cytoscape-container styles are defined in the Additional Classes section below */

#cy {
  width: 100%;
  height: 100%;
}

/* Graph Empty State */
.graph-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 2rem;
  text-align: center;
  color: hsl(var(--muted-foreground));
}

.graph-empty-state i {
  font-size: 3rem;
  opacity: 0.3;
  margin-bottom: 1rem;
}

.graph-empty-state h3 {
  font-size: 1rem;
  font-weight: 600;
  color: hsl(var(--foreground));
  margin-bottom: 0.5rem;
}

.graph-empty-state p {
  font-size: 0.875rem;
  max-width: 300px;
}

/* Graph Error State */
.graph-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 2rem;
  text-align: center;
  color: hsl(0 84% 60%);
}

.graph-error i {
  font-size: 3rem;
  opacity: 0.5;
  margin-bottom: 1rem;
}

.graph-error h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.graph-error p {
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
  max-width: 300px;
}

/* ========================================
 * Node Details Panel (Right Sidebar)
 * ======================================== */
.node-details-panel {
  width: 320px;
  flex-direction: column;
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-left: none;
  border-radius: 0 0.75rem 0.75rem 0;
  overflow: hidden;
  max-height: 100%;
}

.node-details-panel.hidden {
  display: none;
}

.node-details-panel:not(.hidden) {
  display: flex;
  animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Node Detail Header */
.node-detail-header {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1rem;
  border-bottom: 1px solid hsl(var(--border));
  background: hsl(var(--muted) / 0.3);
}

.node-detail-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.5rem;
  flex-shrink: 0;
}

.node-detail-icon.module {
  background: hsl(267 84% 95%);
  color: hsl(267 84% 50%);
}

.node-detail-icon.class {
  background: hsl(var(--primary) / 0.1);
  color: hsl(var(--primary));
}

.node-detail-icon.function {
  background: hsl(142 71% 92%);
  color: hsl(142 71% 40%);
}

.node-detail-icon.method {
  background: hsl(38 92% 90%);
  color: hsl(38 92% 35%);
}

.node-detail-icon.variable {
  background: hsl(204 71% 92%);
  color: hsl(204 71% 40%);
}

.node-detail-info {
  flex: 1;
  min-width: 0;
}

.node-detail-name {
  font-size: 0.9375rem;
  font-weight: 600;
  color: hsl(var(--foreground));
  margin-bottom: 0.25rem;
  word-break: break-word;
}

.node-detail-type {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.125rem 0.5rem;
  font-size: 0.6875rem;
  font-weight: 600;
  color: hsl(var(--primary));
  background: hsl(var(--primary) / 0.1);
  border-radius: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.node-detail-close {
  padding: 0.375rem;
  background: transparent;
  border: none;
  color: hsl(var(--muted-foreground));
  cursor: pointer;
  border-radius: 0.375rem;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.node-detail-close:hover {
  background: hsl(var(--muted));
  color: hsl(var(--foreground));
}

/* Node Detail Body */
.node-detail-body {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  min-height: 0;
}

.node-detail-section {
  margin-bottom: 1.5rem;
}

.node-detail-section:last-child {
  margin-bottom: 0;
}

.node-detail-section h4 {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: hsl(var(--foreground));
  margin: 0 0 0.75rem 0;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid hsl(var(--border));
}

.node-detail-section h4 i {
  font-size: 0.75rem;
  color: hsl(var(--primary));
}

/* Location Info */
.location-info {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.location-item {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.75rem;
}

.location-item i {
  color: hsl(var(--muted-foreground));
  margin-top: 0.125rem;
  flex-shrink: 0;
}

.location-item span {
  color: hsl(var(--foreground));
  font-family: var(--font-mono);
  word-break: break-all;
}

/* Docstring Info */
.docstring-content {
  padding: 0.75rem;
  background: hsl(var(--muted) / 0.3);
  border-radius: 0.5rem;
  font-size: 0.75rem;
  color: hsl(var(--foreground));
  line-height: 1.6;
  white-space: pre-wrap;
  word-wrap: break-word;
  max-height: 200px;
  overflow-y: auto;
}

.no-docstring {
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
  font-style: italic;
}

/* Connections List */
.connections-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.connection-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.625rem;
  background: hsl(var(--background));
  border: 1px solid hsl(var(--border));
  border-radius: 0.375rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.connection-item:hover {
  background: hsl(var(--hover));
  border-color: hsl(var(--primary) / 0.3);
}

.connection-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 0.375rem;
  flex-shrink: 0;
}

.connection-icon.caller {
  background: hsl(142 71% 92%);
  color: hsl(142 71% 40%);
}

.connection-icon.callee {
  background: hsl(38 92% 90%);
  color: hsl(38 92% 35%);
}

.connection-icon.import {
  background: hsl(204 71% 92%);
  color: hsl(204 71% 40%);
}

.connection-icon.export {
  background: hsl(267 84% 95%);
  color: hsl(267 84% 50%);
}

.connection-info {
  flex: 1;
  min-width: 0;
}

.connection-name {
  font-size: 0.8125rem;
  font-weight: 500;
  color: hsl(var(--foreground));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.connection-meta {
  font-size: 0.6875rem;
  color: hsl(var(--muted-foreground));
  margin-top: 0.125rem;
}

.no-connections {
  padding: 1rem;
  text-align: center;
  color: hsl(var(--muted-foreground));
  font-size: 0.75rem;
  font-style: italic;
}

/* Node Detail Actions */
.node-detail-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem;
  border-top: 1px solid hsl(var(--border));
  background: hsl(var(--muted) / 0.15);
}

.node-detail-actions .btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  padding: 0.5rem 0.875rem;
  font-size: 0.8125rem;
  font-weight: 500;
  border-radius: 0.375rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-impact {
  background: hsl(var(--primary) / 0.1);
  border: 1px solid hsl(var(--primary) / 0.3);
  color: hsl(var(--primary));
}

.btn-impact:hover {
  background: hsl(var(--primary) / 0.2);
  border-color: hsl(var(--primary));
}

.btn-expand {
  background: hsl(var(--muted));
  border: 1px solid hsl(var(--border));
  color: hsl(var(--foreground));
}

.btn-expand:hover {
  background: hsl(var(--hover));
  border-color: hsl(var(--primary) / 0.3);
}

/* ========================================
 * Graph Legend
 * ======================================== */
.graph-legend {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.625rem 1rem;
  border-top: 1px solid hsl(var(--border));
  background: hsl(var(--muted) / 0.15);
  flex-shrink: 0;
}

.legend-group {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.legend-group-title {
  font-size: 0.6875rem;
  font-weight: 600;
  color: hsl(var(--muted-foreground));
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.legend-items {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.75rem;
  color: hsl(var(--foreground));
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.legend-item:hover {
  opacity: 0.7;
}

.legend-item.disabled {
  opacity: 0.4;
}

/* Legend Dots (for node types) */
.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.legend-dot.module {
  background: hsl(267 84% 65%);
  border: 2px solid hsl(267 84% 50%);
}

.legend-dot.class {
  background: hsl(var(--primary));
  border: 2px solid hsl(var(--primary));
}

.legend-dot.function {
  background: hsl(142 71% 45%);
  border: 2px solid hsl(142 71% 40%);
}

.legend-dot.method {
  background: hsl(38 92% 50%);
  border: 2px solid hsl(38 92% 40%);
}

.legend-dot.variable {
  background: hsl(204 71% 50%);
  border: 2px solid hsl(204 71% 40%);
}

/* Legend Lines (for edge types) */
.legend-line {
  width: 20px;
  height: 2px;
  flex-shrink: 0;
}

.legend-line.calls {
  background: hsl(var(--primary));
}

.legend-line.imports {
  background: hsl(142 71% 45%);
}

.legend-line.exports {
  background: hsl(204 71% 50%);
}

.legend-line.inherits {
  background: hsl(267 84% 65%);
  background-image: linear-gradient(90deg, transparent 50%, hsl(var(--background)) 50%);
  background-size: 8px 2px;
}

/* ========================================
 * Search Process Tab
 * ======================================== */
.search-process-container {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding: 1.5rem;
  overflow-y: auto;
}

/* Pipeline Stages */
.pipeline-stages {
  display: flex;
  align-items: stretch;
  gap: 0;
  padding: 1rem;
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: 0.75rem;
  overflow-x: auto;
}

.pipeline-stage {
  display: flex;
  flex-direction: column;
  min-width: 200px;
  padding: 1rem;
  background: hsl(var(--background));
  border: 1px solid hsl(var(--border));
  border-radius: 0.5rem;
  flex: 1;
}

.pipeline-stage-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.stage-number {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  font-size: 0.875rem;
  font-weight: 700;
  color: hsl(var(--primary-foreground));
  background: hsl(var(--primary));
  border-radius: 50%;
  flex-shrink: 0;
}

.stage-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: hsl(var(--foreground));
}

.stage-description {
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
  line-height: 1.5;
}

.stage-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  color: hsl(var(--muted-foreground));
}

.stage-arrow i {
  font-size: 1.25rem;
}

/* Chunk Hierarchy */
.chunk-hierarchy {
  padding: 1rem;
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: 0.75rem;
}

.chunk-hierarchy-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid hsl(var(--border));
}

.chunk-hierarchy-header h3 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9375rem;
  font-weight: 600;
  color: hsl(var(--foreground));
  margin: 0;
}

.chunk-hierarchy-header h3 i {
  color: hsl(var(--primary));
}

.chunk-tree {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.chunk-node {
  display: flex;
  flex-direction: column;
  padding: 0.75rem;
  background: hsl(var(--background));
  border: 1px solid hsl(var(--border));
  border-left: 3px solid hsl(var(--primary));
  border-radius: 0.5rem;
  transition: all 0.15s ease;
}

.chunk-node:hover {
  background: hsl(var(--hover));
  border-color: hsl(var(--primary) / 0.3);
}

.chunk-node-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.375rem;
}

.chunk-node-type {
  padding: 0.125rem 0.5rem;
  font-size: 0.6875rem;
  font-weight: 600;
  color: hsl(var(--primary));
  background: hsl(var(--primary) / 0.1);
  border-radius: 0.25rem;
  text-transform: uppercase;
}

.chunk-node-name {
  font-size: 0.8125rem;
  font-weight: 500;
  color: hsl(var(--foreground));
  font-family: var(--font-mono);
}

.chunk-node-details {
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
  margin-top: 0.25rem;
}

.chunk-node-children {
  margin-left: 1.5rem;
  margin-top: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Callers and Callees */
.callers-callees {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.callers-section,
.callees-section {
  padding: 1rem;
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: 0.75rem;
}

.callers-section h3,
.callees-section h3 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9375rem;
  font-weight: 600;
  color: hsl(var(--foreground));
  margin: 0 0 1rem 0;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid hsl(var(--border));
}

.callers-section h3 i,
.callees-section h3 i {
  color: hsl(var(--primary));
}

.caller-item,
.callee-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.625rem;
  margin-bottom: 0.5rem;
  background: hsl(var(--background));
  border: 1px solid hsl(var(--border));
  border-radius: 0.375rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.caller-item:hover,
.callee-item:hover {
  background: hsl(var(--hover));
  border-color: hsl(var(--primary) / 0.3);
}

.caller-item:last-child,
.callee-item:last-child {
  margin-bottom: 0;
}

.caller-icon,
.callee-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 0.375rem;
  background: hsl(var(--primary) / 0.1);
  color: hsl(var(--primary));
  flex-shrink: 0;
}

.caller-name,
.callee-name {
  flex: 1;
  font-size: 0.8125rem;
  font-weight: 500;
  color: hsl(var(--foreground));
  font-family: var(--font-mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ========================================
 * Responsive Design
 * ======================================== */
@media (max-width: 1400px) {
  .node-details-panel {
    width: 280px;
  }
}

@media (max-width: 1024px) {
  .graph-explorer-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .graph-tabs {
    padding-left: 0;
    border-left: none;
    border-top: 1px solid hsl(var(--border));
    padding-top: 0.75rem;
    width: 100%;
  }

  .graph-main {
    flex-direction: column;
  }

  .node-details-panel {
    width: 100%;
    max-height: 400px;
    border-left: 1px solid hsl(var(--border));
    border-radius: 0.75rem 0.75rem 0 0;
  }

  .node-details-panel.visible {
    animation: slideInBottom 0.3s ease;
  }

  @keyframes slideInBottom {
    from {
      opacity: 0;
      transform: translateY(20px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  .callers-callees {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .graph-explorer-view {
    height: auto;
    min-height: 500px;
  }

  .graph-tabs {
    flex-direction: column;
    align-items: stretch;
  }

  .graph-tab {
    justify-content: center;
  }

  .graph-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .filter-dropdown {
    width: 100%;
  }

  .filter-dropdown-btn {
    width: 100%;
    justify-content: space-between;
  }

  .pipeline-stages {
    flex-direction: column;
    gap: 0.5rem;
  }

  .pipeline-stage {
    min-width: 0;
  }

  .stage-arrow {
    display: none;
  }

  .graph-legend {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .legend-group {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    width: 100%;
  }

  .legend-items {
    flex-wrap: wrap;
    gap: 0.75rem;
  }
}

/* ========================================
 * Animations
 * ======================================== */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.connection-item,
.chunk-node,
.caller-item,
.callee-item {
  animation: fadeIn 0.3s ease;
}

/* Loading State */
.graph-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 2rem;
  text-align: center;
  color: hsl(var(--muted-foreground));
}

.graph-loading i {
  font-size: 2.5rem;
  opacity: 0.5;
  margin-bottom: 1rem;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.graph-loading p {
  font-size: 0.875rem;
  margin: 0;
}

/* ========================================
 * Additional Classes for JS Compatibility
 * ======================================== */

/* Explorer Tabs */
.graph-explorer-tabs {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.tab-btn {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: hsl(var(--muted-foreground));
  background: transparent;
  border: 1px solid hsl(var(--border));
  border-radius: 0.375rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.tab-btn:hover {
  background: hsl(var(--hover));
  color: hsl(var(--foreground));
}

.tab-btn.active {
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  border-color: hsl(var(--primary));
}

/* Tab Content */
.graph-explorer-content {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.tab-content {
  display: none;
  width: 100%;
  height: 100%;
}

.tab-content.active {
  display: flex;
}

/* Graph View Layout */
.graph-view {
  display: flex;
  width: 100%;
  height: 100%;
  gap: 1rem;
  padding: 0;
}

.graph-sidebar {
  width: 280px;
  min-width: 280px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow-y: auto;
  padding: 0.5rem 1.25rem 0.5rem 0;
  border-right: 1px solid hsl(var(--border));
  margin-right: 1rem;
}

.graph-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100%;
}

.graph-controls-section,
.graph-legend-section {
  padding: 0;
}

.graph-controls-section h3,
.graph-legend-section h3 {
  font-size: 0.75rem;
  font-weight: 600;
  color: hsl(var(--muted-foreground));
  margin: 0 0 1rem 0;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.graph-legend-section {
  border-top: 1px solid hsl(var(--border));
  padding-top: 1.5rem;
  margin-top: 1.5rem;
}

/* Graph Legend */
.graph-legend {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.legend-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: hsl(var(--muted-foreground));
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
  margin-top: 0.5rem;
}

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

.legend-line {
  width: 20px;
  height: 3px;
  border-radius: 2px;
  flex-shrink: 0;
}

.filter-color {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Graph Toolbar */
.graph-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: 0.5rem 0.5rem 0 0;
  border-bottom: none;
}

.graph-toolbar-left,
.graph-toolbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.graph-stats {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.8125rem;
  color: hsl(var(--muted-foreground));
}

/* Data Source Selector */
.data-source-select {
  padding: 0.375rem 0.75rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: hsl(var(--foreground));
  background: hsl(var(--background));
  border: 1px solid hsl(var(--border));
  border-radius: 0.375rem;
  cursor: pointer;
  transition: all 0.15s ease;
  outline: none;
}

.data-source-select:hover {
  background: hsl(var(--hover));
  border-color: hsl(var(--primary) / 0.3);
}

.data-source-select:focus {
  border-color: hsl(var(--primary));
  box-shadow: 0 0 0 2px hsl(var(--primary) / 0.1);
}

.btn-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  background: transparent;
  border: 1px solid hsl(var(--border));
  border-radius: 0.375rem;
  color: hsl(var(--muted-foreground));
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-icon:hover {
  background: hsl(var(--hover));
  color: hsl(var(--foreground));
  border-color: hsl(var(--primary) / 0.3);
}

/* Filter Checkboxes */
.filter-dropdowns {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.filter-group > label {
  font-size: 0.75rem;
  font-weight: 600;
  color: hsl(var(--muted-foreground));
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
}

.filter-checkbox {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5rem 0;
  font-size: 0.8125rem;
  color: hsl(var(--foreground));
  cursor: pointer;
  transition: background 0.15s ease;
  border-radius: 0.25rem;
}

.filter-checkbox:hover {
  background: hsl(var(--hover));
  padding-left: 0.375rem;
  padding-right: 0.375rem;
}

.filter-checkbox input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: hsl(var(--primary));
  flex-shrink: 0;
}

.filter-checkbox span {
  flex: 1;
  user-select: none;
}

/* Scope Filter */
.scope-filter {
  padding-bottom: 1rem;
  border-bottom: 1px solid hsl(var(--border));
  margin-bottom: 0.5rem;
}

.scope-selector {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  margin-top: 0.5rem;
}

.filter-radio {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5rem 0;
  font-size: 0.8125rem;
  color: hsl(var(--foreground));
  cursor: pointer;
  transition: background 0.15s ease;
  border-radius: 0.25rem;
}

.filter-radio:hover {
  background: hsl(var(--hover));
  padding-left: 0.375rem;
  padding-right: 0.375rem;
}

.filter-radio input[type="radio"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: hsl(var(--primary));
  flex-shrink: 0;
}

.filter-radio span {
  flex: 1;
  user-select: none;
}

/* Filter Select Dropdown */
.filter-select {
  width: 100%;
  padding: 0.625rem 0.75rem;
  margin-top: 0.5rem;
  font-size: 0.8125rem;
  font-weight: 400;
  color: hsl(var(--foreground));
  background: hsl(var(--background));
  border: 1px solid hsl(var(--border));
  border-radius: 0.375rem;
  cursor: pointer;
  transition: all 0.15s ease;
  outline: none;
}

.filter-select:hover {
  background: hsl(var(--hover));
  border-color: hsl(var(--primary) / 0.3);
}

.filter-select:focus {
  border-color: hsl(var(--primary));
  box-shadow: 0 0 0 3px hsl(var(--primary) / 0.1);
}

.filter-select option {
  padding: 0.5rem;
}

/* Legend Items */
.legend-section {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}

.legend-section-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: hsl(var(--muted-foreground));
  margin-bottom: 0.375rem;
  margin-top: 0.5rem;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.375rem 0;
  font-size: 0.8125rem;
  color: hsl(var(--foreground));
}

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

/* Search Process View */
.search-process-view {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  gap: 1rem;
  padding: 1rem;
  overflow-y: auto;
}

.search-process-header {
  text-align: center;
  padding: 1rem;
}

.search-process-header h3 {
  font-size: 1rem;
  font-weight: 600;
  color: hsl(var(--foreground));
  margin: 0 0 0.5rem 0;
}

.search-process-header p {
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
  margin: 0;
}

.search-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  text-align: center;
  color: hsl(var(--muted-foreground));
}

.search-empty-state i {
  margin-bottom: 1rem;
  opacity: 0.5;
}

/* Search Process Empty State */
.search-process-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  text-align: center;
  color: hsl(var(--muted-foreground));
  padding: 2rem;
}

.search-process-empty i {
  margin-bottom: 1rem;
  opacity: 0.5;
}

.search-process-empty p {
  font-size: 0.875rem;
  margin: 0;
}

/* Search Process Timeline */
.search-process-timeline {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.search-step {
  display: flex;
  gap: 1rem;
  padding: 1rem;
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: 0.5rem;
}

.search-step-number {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  border-radius: 50%;
  font-weight: 600;
  font-size: 0.875rem;
  flex-shrink: 0;
}

.search-step-content {
  flex: 1;
}

.search-step-content h4 {
  font-size: 0.875rem;
  font-weight: 600;
  color: hsl(var(--foreground));
  margin: 0 0 0.25rem 0;
}

.search-step-content p {
  font-size: 0.8125rem;
  color: hsl(var(--muted-foreground));
  margin: 0;
}

.search-step-results {
  margin-top: 0.5rem;
}

.result-count {
  font-size: 0.75rem;
  color: hsl(var(--primary));
  font-weight: 500;
}

/* Cytoscape Container */
.cytoscape-container {
  flex: 1;
  min-height: 400px;
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: 0.5rem;
  position: relative;
}

/* Cytoscape Empty State */
.cytoscape-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  min-height: 400px;
  text-align: center;
  color: hsl(var(--muted-foreground));
}

.cytoscape-empty i {
  margin-bottom: 1rem;
  opacity: 0.5;
}

.cytoscape-empty p {
  font-size: 0.875rem;
  margin: 0;
}

/* Graph Empty State */
.graph-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  text-align: center;
  color: hsl(var(--muted-foreground));
}

.graph-empty-state i {
  margin-bottom: 1rem;
  opacity: 0.5;
}

.graph-empty-state p {
  font-size: 0.875rem;
  margin: 0;
}

/* Hidden class */
.hidden {
  display: none !important;
}
