/* Knowledge Graph Visualization Styles */
/* Color scheme based on #eeece2 */

:root {
    --bg-primary: #eeece2;
    --bg-secondary: #f5f3ed;
    --bg-panel: #ffffff;
    --text-primary: #3d3a33;
    --text-secondary: #5a5751;
    --text-muted: #8e8b82;
    --border-light: #d9d6ca;
    --border-medium: #c7c3b5;
    --accent-primary: #8b7355;
    --accent-secondary: #a68b5b;
    --shadow-light: rgba(61, 58, 51, 0.1);
    --shadow-medium: rgba(61, 58, 51, 0.15);
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
}

.container {
    height: 100vh;
    display: flex;
    flex-direction: column;
    max-width: none;
    padding: 0;
}

/* --- Header Styling (Full Section) --- */
header {
    background-color: #f8f8f8; /* Example light grey background - ADJUST THIS TO YOUR DESIRED COLOR */
    text-align: center;      /* Keeps the content centered */
    padding-top: 10px;       /* Reduced top padding */
    padding-bottom: 5px;     /* Reduced bottom padding */
    margin-bottom: 5px;      /* Reduces space below the entire header */
    border-bottom: 1px solid #eee; /* Optional: Adds a subtle line at the bottom of the header */
}

header h1 {
    font-size: 1.8em;        /* Slightly reduced font size for compactness */
    margin-top: 5px;         /* Reduced top margin for the title */
    margin-bottom: 5px;      /* Reduced bottom margin for the title */
    line-height: 1.1;        /* Tighter line spacing for the title */
    color: #333;             /* Example text color - adjust if needed */
}

header .subtitle {
    font-size: 0.9em;        /* Slightly reduced font size for compactness */
    margin-top: 0px;         /* Remove space above the subtitle */
    margin-bottom: 10px;     /* Small space below the subtitle */
    line-height: 1.1;        /* Tighter line spacing for the subtitle */
    color: #666;             /* Example text color - adjust if needed */
}

/* NEW: Dataset Selector Styling */
.dataset-selector-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 8px;
    margin-bottom: 12px;
}

.dataset-label {
    font-size: 0.9em;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.dataset-selector {
    padding: 6px 12px;
    border: 2px solid var(--border-light);
    border-radius: 6px;
    background: var(--bg-panel);
    color: var(--text-primary);
    font-size: 0.9em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 200px;
}

.dataset-selector:hover {
    border-color: var(--accent-primary);
    box-shadow: 0 2px 4px var(--shadow-light);
}

.dataset-selector:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(139, 115, 85, 0.1);
}

/* --- End Header Styling --- */

/* Main Content Layout */
.main-content {
    flex: 1;
    display: flex;
    min-height: 0; /* Important for flexbox */
}

.graph-container {
    flex: 2;
    position: relative;
    background: var(--bg-panel);
    border-right: 2px solid var(--border-light);
    margin: 0;
}

#graph {
    width: 100%;
    height: 100%;
    display: block;
}

.loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 18px;
    color: var(--text-secondary);
    text-align: center;
}

.error {
    color: #c44569;
    font-weight: 500;
}

/* Info Panel */
.info-panel {
    flex: 1;
    min-width: 350px;
    max-width: 450px;
    background: var(--bg-secondary);
    display: flex;
    flex-direction: column;
    border-left: 1px solid var(--border-light);
}

/* Tab Navigation */
.tab-nav {
    display: flex;
    background: var(--bg-panel);
    border-bottom: 2px solid var(--border-light);
}

.tab-btn {
    flex: 1;
    padding: 15px 20px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
}

.tab-btn:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.tab-btn.active {
    color: var(--accent-primary);
    border-bottom-color: var(--accent-primary);
    background: var(--bg-secondary);
}

/* Tab Content */
.tab-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
}

/* Info Tab Styles */
.info-tab h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: var(--accent-primary);
    font-size: 1.3em;
}

.info-tab h4 {
    margin: 20px 0 10px 0;
    color: var(--text-primary);
    font-size: 1.1em;
}

.info-tab p {
    margin-bottom: 15px;
    color: var(--text-secondary);
}

/* Enhanced Filters Tab Styles */
.filter-result-summary {
    background: var(--bg-panel);
    border: 2px solid var(--border-light);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 20px;
    text-align: center;
}

.result-numbers {
    display: flex;
    justify-content: space-around;
    margin-bottom: 8px;
}

.result-stat {
    text-align: center;
}

.stat-number {
    font-size: 20px;
    font-weight: bold;
    color: var(--accent-primary);
    display: block;
}

.stat-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-group {
    margin-bottom: 20px;
}

.filter-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    display: block;
}

.filter-select {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid var(--border-light);
    border-radius: 8px;
    font-size: 14px;
    background: var(--bg-panel);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(139, 115, 85, 0.1);
}

.filter-select:hover {
    border-color: var(--border-medium);
}

.multi-select {
    position: relative;
}

.selected-items {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
    min-height: 20px;
}

.item-chip {
    background: var(--accent-primary);
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 4px;
    animation: fadeIn 0.2s ease;
}

.item-chip .remove {
    cursor: pointer;
    font-weight: bold;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.item-chip .remove:hover {
    opacity: 1;
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.8); }
    to { opacity: 1; transform: scale(1); }
}

.toggle-group {
    display: flex;
    gap: 4px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.toggle-btn {
    flex: 1;
    min-width: 60px;
    padding: 8px 12px;
    border: 2px solid var(--border-light);
    background: var(--bg-panel);
    color: var(--text-secondary);
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    text-align: center;
    transition: all 0.2s ease;
}

.toggle-btn:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.toggle-btn.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
}

.clear-filters {
    width: 100%;
    padding: 10px;
    background: transparent;
    border: 2px solid #dc3545;
    color: #dc3545;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    margin-top: 10px;
}

.clear-filters:hover {
    background: #dc3545;
    color: white;
}

.filter-count {
    font-size: 12px;
    color: var(--text-muted);
    margin-left: 8px;
}

.filter-status {
    font-size: 12px;
    color: var(--text-secondary);
    text-align: center;
}

/* Query Interface Styles */
.query-section {
    padding: 5px 0;
}

.query-help {
    color: var(--text-secondary);
    font-size: 0.9em;
    margin-bottom: 20px;
}

.query-builder {
    background: var(--bg-panel);
    border: 2px solid var(--border-light);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.query-row {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
}

.query-row label {
    width: 80px;
    font-weight: 600;
    color: var(--text-primary);
}

.query-select {
    flex: 1;
    padding: 8px 12px;
    border: 2px solid var(--border-light);
    border-radius: 6px;
    background: white;
    color: var(--text-primary);
    font-size: 14px;
}

.query-execute-btn {
    width: 100%;
    padding: 12px;
    background: var(--accent-primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 10px;
}

.query-execute-btn:hover {
    background: var(--accent-secondary);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px var(--shadow-medium);
}

.query-results {
    background: var(--bg-panel);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: 15px;
    max-height: 300px;
    overflow-y: auto;
}

.query-results h4 {
    margin-top: 0;
    margin-bottom: 15px;
    color: var(--text-primary);
}

.no-results {
    color: var(--text-muted);
    text-align: center;
    padding: 20px;
}

.results-count {
    color: var(--text-secondary);
    margin-bottom: 10px;
    font-size: 0.9em;
}

.result-item {
    padding: 10px;
    margin-bottom: 8px;
    background: var(--bg-secondary);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}

.result-item:hover {
    background: var(--bg-primary);
    transform: translateX(5px);
}

.result-type {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 12px;
    color: white;
    font-weight: 600;
}

.result-name {
    flex: 1;
    font-size: 14px;
}

.result-risk {
    font-size: 11px;
    font-weight: 600;
}

.more-results {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9em;
    margin-top: 10px;
}

.query-actions {
    margin-top: 20px;
    display: flex;
    gap: 10px;
}

.export-btn {
    flex: 1;
    padding: 10px;
    background: transparent;
    border: 2px solid var(--accent-primary);
    color: var(--accent-primary);
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.export-btn:hover {
    background: var(--accent-primary);
    color: white;
}

/* Node Info Display */
.node-info {
    display: none;
}

.node-info.active {
    display: block;
}

#node-title, #edge-title {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

.entity-tag {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 11px;
    font-weight: bold;
    color: white;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.entity-event { background: #c44569; }
.entity-observable { background: #2d98da; }
.entity-actor { background: #3867d6; }
.entity-location { background: #20bf6b; }
.entity-theme { background: #eb4d4b; }
.entity-resource { background: #8854d0; }

.relationship-tag {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 11px;
    font-weight: bold;
    color: white;
    background: var(--accent-primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.node-detail-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 20px;
    padding: 15px;
    background: var(--bg-panel);
    border-radius: 8px;
    border: 1px solid var(--border-light);
}

.detail-item {
    font-size: 14px;
}

.detail-item strong {
    color: var(--text-primary);
    font-weight: 600;
}

.risk-high {
    color: #c44569;
    font-weight: bold;
}

.risk-medium {
    color: #f39c12;
    font-weight: bold;
}

.risk-low {
    color: #20bf6b;
    font-weight: bold;
}

.strength-high {
    color: #c44569;
    font-weight: bold;
}

.strength-medium {
    color: #f39c12;
    font-weight: bold;
}

.strength-low {
    color: #20bf6b;
    font-weight: bold;
}

.description {
    padding: 15px;
    background: var(--bg-panel);
    border-radius: 8px;
    border: 1px solid var(--border-light);
    margin-bottom: 20px;
    font-size: 14px;
    line-height: 1.6;
}

.back-btn {
    background: var(--accent-primary);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.back-btn:hover {
    background: var(--accent-secondary);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px var(--shadow-medium);
}

/* Legend */
.legend {
    margin: 20px 0;
    padding: 15px;
    background: var(--bg-panel);
    border-radius: 8px;
    border: 1px solid var(--border-light);
}

.legend h4 {
    margin-top: 0;
    margin-bottom: 15px;
    color: var(--text-primary);
}

.legend-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 1px solid var(--border-medium);
    flex-shrink: 0;
}

/* Statistics */
.stats {
    padding: 15px;
    background: var(--bg-panel);
    border-radius: 8px;
    border: 1px solid var(--border-light);
    margin-top: 20px;
}

.stats h4 {
    margin-top: 0;
    margin-bottom: 15px;
}

.stats p {
    margin: 8px 0;
    font-size: 14px;
}

.entity-breakdown {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.entity-stat {
    background: var(--accent-primary);
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
}

.relationship-breakdown {
    margin-top: 15px;
}

.relationship-stat {
    background: var(--accent-secondary);
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    margin-right: 8px;
    margin-bottom: 5px;
    display: inline-block;
}

/* Tooltip styles */
.tooltip {
    position: absolute;
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 8px;
    border-radius: 4px;
    font-size: 12px;
    pointer-events: none;
    z-index: 1000;
    max-width: 250px;
    line-height: 1.4;
}

/* D3 Graph SVG Styling */
.entity-node.entity-event { fill: #c44569; }
.entity-node.entity-observable { fill: #2d98da; }
.entity-node.entity-actor { fill: #3867d6; }
.entity-node.entity-location { fill: #20bf6b; }
.entity-node.entity-theme { fill: #eb4d4b; }
.entity-node.entity-resource { fill: #8854d0; }
.entity-node { stroke: #fff; stroke-width: 2; cursor: pointer; }

.relationship-link { stroke: #8e8b82; stroke-opacity: 0.6; }
.relationship-link.strength-high { stroke-width: 3; }
.relationship-link.strength-medium { stroke-width: 2; }
.relationship-link.strength-low { stroke-width: 1; }

.relationship-label {
    font-size: 9px;
    fill: #5a5751;
    text-anchor: middle;
    pointer-events: none;
}

.node-label {
    font-size: 10px;
    font-weight: 600;
    fill: #3d3a33;
    text-anchor: middle;
    pointer-events: none;
}

/* Highlighting (optional, for interactivity) */
.entity-node.dimmed,
.node-label.dimmed {
    opacity: 0.2;
}
.relationship-link.dimmed,
.relationship-label.dimmed {
    opacity: 0.1;
}
.entity-node.highlighted,
.node-label.highlighted,
.relationship-link.highlighted,
.relationship-label.highlighted {
    opacity: 1 !important;
}

/* Fan Chart Panel */
.fan-chart-panel-container {
  display: none;
  margin: 16px 0;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
  border: 1px solid var(--border-light);
  padding: 12px 8px 8px 8px;
}
.fan-chart-panel-canvas {
  width: 100%;
  max-width: 400px;
  min-height: 180px;
  background: #fff;
  border-radius: 6px;
}
.fan-chart-panel-nodata {
  display: none;
  color: #888;
  font-size: 0.95em;
  margin-top: 8px;
}

/* FIXED: Results table scrolling - no more nested scrollbars */

/* Remove max-height from results container - let parent handle scrolling */
.results-table-container {
    border: 1px solid var(--border-light);
    border-radius: 6px;
    margin-top: 10px;
    /* REMOVED: max-height and overflow-y */
}

.results-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    background: white;
    /* REMOVED: any overflow properties */
}

.results-table thead {
    background: var(--bg-secondary);
    /* REMOVED: position sticky - was causing scroll issues */
}

.results-table th {
    padding: 8px 12px;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 2px solid var(--border-medium);
    border-right: 1px solid var(--border-light);
}

.results-table th:last-child {
    border-right: none;
}

.results-table td {
    padding: 6px 12px;
    border-bottom: 1px solid var(--border-light);
    border-right: 1px solid var(--border-light);
    color: var(--text-secondary);
    vertical-align: top;
    word-wrap: break-word;
    max-width: 200px;
}

.results-table td:last-child {
    border-right: none;
}

.results-table tbody tr:hover {
    background: var(--bg-primary);
}

.results-table tbody tr:last-child td {
    border-bottom: none;
}

/* If you need height limits, do it intelligently based on viewport */
@media (max-height: 800px) {
    .results-table-container {
        max-height: 300px;
        overflow-y: auto;
    }

    .results-table thead {
        position: sticky;
        top: 0;
        z-index: 10;
    }
}

/* For tall screens, no height restrictions needed */
@media (min-height: 801px) {
    .results-table-container {
        /* Let it flow naturally */
    }
}

/* Status and export styling */
.query-status {
    padding: 8px 12px;
    background: var(--bg-panel);
    border: 1px solid var(--border-light);
    border-radius: 6px;
    margin: 10px 0;
    font-size: 13px;
    color: var(--text-secondary);
}

.export-section {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid var(--border-light);
}

.export-actions {
    display: flex;
    gap: 10px;
}

.query-clear-btn {
    flex: 1;
    padding: 10px;
    background: transparent;
    border: 2px solid var(--text-muted);
    color: var(--text-muted);
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.query-clear-btn:hover {
    background: var(--text-muted);
    color: white;
}

/* Cypher UI Styling Fixes */
.query-examples {
    margin-bottom: 15px;
    padding: 12px;
    background: var(--bg-panel);
    border: 1px solid var(--border-light);
    border-radius: 6px;
}

.query-examples strong {
    display: block;
    margin-bottom: 8px;
    color: var(--text-primary);
    font-size: 13px;
}

.example-queries {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.example-chip {
    background: var(--accent-primary);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 15px;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: capitalize;
}

.example-chip:hover {
    background: var(--accent-secondary);
    transform: translateY(-1px);
}

/* Query Input Area */
.query-input-area {
    margin: 15px 0;
    position: relative; /* Important for auto-complete positioning */
}

.query-textarea {
    width: 100%;
    min-height: 120px;
    max-height: 200px;
    padding: 12px;
    border: 2px solid var(--border-light);
    border-radius: 8px;
    font-family: 'Courier New', Monaco, monospace;
    font-size: 13px;
    line-height: 1.4;
    background: var(--bg-panel);
    color: var(--text-primary);
    resize: vertical;
    transition: border-color 0.2s ease;
}

.query-textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(139, 115, 85, 0.1);
}

.query-textarea::placeholder {
    color: var(--text-muted);
    font-style: italic;
}

/* NEW: Smart Auto-Complete Dropdown Styles */
.cypher-suggestions-dropdown {
    position: absolute;
    background: white;
    border: 2px solid var(--accent-primary);
    border-radius: 8px;
    box-shadow: 0 4px 12px var(--shadow-medium);
    z-index: 1000;
    max-height: 200px;
    overflow-y: auto;
    min-width: 200px;
}

.suggestion-item {
    padding: 8px 12px;
    cursor: pointer;
    font-family: 'Courier New', Monaco, monospace;
    font-size: 13px;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-light);
    transition: all 0.2s ease;
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item:hover,
.suggestion-item.highlighted {
    background: var(--accent-primary);
    color: white;
}

.suggestion-item.highlighted {
    font-weight: 600;
}

/* Query Action Buttons */
.execute-btn {
    flex: 2;
    padding: 12px 20px;
    background: var(--accent-primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.execute-btn:hover {
    background: var(--accent-secondary);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px var(--shadow-medium);
}

.clear-btn {
    flex: 1;
    padding: 12px 15px;
    background: transparent;
    color: var(--text-muted);
    border: 2px solid var(--border-medium);
    border-radius: 8px;
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.clear-btn:hover {
    background: var(--text-muted);
    color: white;
    border-color: var(--text-muted);
}

/* Cypher Section Overall */
.cypher-section {
    padding: 5px 0;
}

.cypher-section h3 {
    margin-top: 0;
    margin-bottom: 10px;
    color: var(--accent-primary);
}

.cypher-help {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 15px;
    line-height: 1.5;
}

/* Results styling improvements */
.cypher-results {
    margin-top: 15px;
    max-height: 350px;
    overflow-y: auto;
}

.results-placeholder {
    text-align: center;
    color: var(--text-muted);
    padding: 30px 20px;
    font-style: italic;
}

/* Status message styling */
#cypherStatus {
    padding: 10px 12px;
    background: var(--bg-panel);
    border: 1px solid var(--border-light);
    border-radius: 6px;
    margin: 10px 0;
    font-size: 13px;
    color: var(--text-secondary);
    min-height: 20px;
}

/* Interactive node links in results table */
.node-link {
    color: var(--accent-primary) !important;
    text-decoration: none;
    font-weight: 500;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 3px;
    transition: all 0.2s ease;
    display: inline-block;
}

.node-link:hover {
    color: white !important;
    background: var(--accent-primary);
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px var(--shadow-light);
}

.node-link:active {
    transform: translateY(0);
    background: var(--accent-secondary);
}

/* Enhanced table styling for interactive elements */
.results-table td {
    position: relative;
}

.results-table td:has(.node-link) {
    padding: 4px 8px;
}

/* Tooltip-like effect for node links */
.node-link::after {
    content: "📍";
    margin-left: 6px;
    opacity: 0;
    font-size: 10px;
    transition: opacity 0.2s ease;
}

.node-link:hover::after {
    opacity: 1;
}

/* Ensure links don't inherit table text color */
.results-table .node-link {
    color: var(--accent-primary) !important;
}

/* Optional: Add a subtle background to link cells */
.results-table td:has(.node-link) {
    background: rgba(139, 115, 85, 0.05);
}

/* Modern toggle switch and slider */
.graph-controls {
    background: var(--bg-panel);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: 16px;
    margin: 20px 0;
}

.graph-controls h4 {
    margin: 0 0 15px 0;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 600;
}

.control-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
}

.control-item:last-child {
    margin-bottom: 0;
}

.control-label {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Modern Toggle Switch */
.toggle-switch {
    position: relative;
    width: 48px;
    height: 24px;
    background: var(--border-medium);
    border-radius: 12px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.toggle-switch.active {
    background: var(--accent-primary);
}

.toggle-slider {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.toggle-switch.active .toggle-slider {
    transform: translateX(24px);
}

/* Range Slider */
.spacing-control {
    width: 100%;
}

.slider-container {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

.slider-label {
    font-size: 11px;
    color: var(--text-muted);
    min-width: 45px;
    text-align: center;
}

.spacing-slider {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: var(--border-light);
    outline: none;
    cursor: pointer;
    -webkit-appearance: none;
}

.spacing-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent-primary);
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    transition: background 0.2s ease;
}

.spacing-slider::-webkit-slider-thumb:hover {
    background: var(--accent-secondary);
}

.spacing-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent-primary);
    cursor: pointer;
    border: none;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

/* Responsive Design */
@media (max-width: 1200px) {
    .info-panel {
        min-width: 300px;
        max-width: 350px;
    }
}

@media (max-width: 900px) {
    .main-content {
        flex-direction: column;
    }

    .graph-container {
        flex: none;
        height: 60vh;
        border-right: none;
        border-bottom: 2px solid var(--border-light);
    }

    .info-panel {
        flex: none;
        min-width: auto;
        max-width: none;
        height: 40vh;
        border-left: none;
    }

    h1 {
        font-size: 1.8em;
    }

    .subtitle {
        font-size: 1em;
    }

    /* NEW: Responsive dataset selector */
    .dataset-selector-container {
        flex-direction: column;
        gap: 4px;
    }

    .dataset-selector {
        min-width: 180px;
    }
}

@media (max-width: 600px) {
    header {
        padding: 15px 10px;
    }

    .tab-content {
        padding: 15px;
    }

    .legend-grid {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    }

    /* NEW: Mobile dataset selector */
    .dataset-selector {
        min-width: 160px;
        font-size: 0.8em;
    }
}


/* Example Patterns Styling */
.example-patterns {
    margin-top: 10px;
}

.pattern-item {
    background: var(--bg-panel);
    border: 1px solid var(--border-light);
    border-radius: 6px;
    padding: 10px;
    margin-bottom: 8px;
}

.pattern-desc {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.pattern-hint {
    font-size: 12px;
    color: var(--text-muted);
    font-style: italic;
}

/* Query Row Input Styling */
.query-row input[type="text"] {
    padding: 8px 12px;
    border: 2px solid var(--border-light);
    border-radius: 6px;
    background: white;
    color: var(--text-primary);
    font-size: 14px;
    width: 100%;
}

.query-row input[type="text"]:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(139, 115, 85, 0.1);
}

.query-row input[type="text"]::placeholder {
    color: var(--text-muted);
    font-style: italic;
}

/* Advanced Section Styling */
.advanced-section {
    background: var(--bg-panel);
    border-radius: 8px;
    padding: 15px;
    border: 1px solid var(--border-light);
}

.advanced-section h4 {
    margin-top: 0;
    margin-bottom: 10px;
    color: var(--accent-primary);
}

.cypher-examples {
    margin-top: 10px;
}

.cypher-examples strong {
    display: block;
    margin-bottom: 8px;
    color: var(--text-primary);
    font-size: 13px;
}