/* =========================================
   Multi Topic Analysis (Network Graph) Panel
   ========================================= */

.network-panel {
    width: 0;
    overflow: hidden;
    background-color: #f8fafc;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    z-index: 15;
}

.network-panel.open {
    width: 480px;
}

.network-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    background: white;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.network-panel-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.network-panel-title h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.close-network-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 4px;
    border-radius: 6px;
    transition: background 0.2s;
}

.close-network-btn:hover {
    background: var(--hover-bg);
}

.close-network-btn i {
    width: 18px;
    height: 18px;
}

.network-search-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: white;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.network-query-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 13px;
    font-family: inherit;
    color: var(--text-primary);
}

.network-query-input:focus {
    outline: none;
    border-color: #3b82f6;
}

.network-analyze-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #3b82f6, #4f46e5);
    color: white;
    border: none;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    cursor: pointer;
    flex-shrink: 0;
    transition: box-shadow 0.2s, transform 0.2s;
}

.network-analyze-btn:hover {
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.35);
    transform: translateY(-1px);
}

.network-analyze-btn i {
    width: 16px;
    height: 16px;
}

.network-quick-actions {
    padding: 10px 16px;
    background: white;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.network-quick-btn {
    background: var(--hover-bg);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.network-quick-btn:hover {
    background: #eef2ff;
    color: #4f46e5;
}

.network-results {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Flex items shrink by default; once this panel's content (Connection Layers
   + a fixed-height graph + the node-detail box + a long topic list) exceeds
   the panel's height, flexbox was squashing every child — including the
   graph down to a sliver — instead of just letting the panel scroll (which
   overflow-y:auto above is already there for). Every direct child keeps its
   natural/declared size; overflow scrolls the panel instead. */
.network-results > * {
    flex-shrink: 0;
}

.network-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 40px 0;
    color: var(--text-secondary);
    font-size: 14px;
}

.network-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
    font-size: 13.5px;
    line-height: 1.5;
}

.network-graph-container {
    width: 100%;
    height: 380px;
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    background: #0f172a;
    flex-shrink: 0;
}

/* Graph toolbar (zoom in/out, fit-to-screen, open-in-new-tab) — previously
   rendered with Font Awesome classes and no supporting CSS at all (this app
   only loads Lucide), so the buttons were invisible/unstyled. Inline SVGs +
   this styling make them clearly visible against the dark graph background. */
.graph-toolbar {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.graph-tool-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 8px;
    color: #1e293b;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    transition: background 0.15s, transform 0.1s;
}

.graph-tool-btn:hover {
    background: #fff;
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.35);
}

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

.graph-tool-btn svg {
    width: 16px;
    height: 16px;
    pointer-events: none;
}

/* Node hover details — sits BELOW the graph box in normal document flow (the
   white space), not as a floating tooltip inside .network-graph-container:
   that container has overflow:hidden, so a mouse-position tooltip near an
   edge got clipped and unreadable. */
.network-node-info {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 12px 14px;
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-primary);
    min-height: 20px;
}

.network-node-info-placeholder {
    color: var(--text-secondary);
    font-style: italic;
}

.network-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.network-list-item {
    background: white;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    padding: 12px;
    transition: box-shadow 0.2s, transform 0.2s;
}

.network-topic-item {
    cursor: pointer;
}

.network-topic-item:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
    transform: translateY(-1px);
    border-color: #3b82f6;
}

.network-list-item-title {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.network-list-item-text {
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-primary);
    margin-bottom: 6px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.network-list-item-meta {
    font-size: 11.5px;
    color: #94a3b8;
}

/* ── SQL Topic Bar Chart ─────────────────────────────────────────── */
.sql-topic-chart {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sql-topic-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
    cursor: pointer;
    padding: 6px 8px;
    border-radius: 8px;
    transition: background 0.15s;
}

.sql-topic-row:hover {
    background: var(--hover-bg, rgba(79, 142, 247, 0.07));
}

.sql-topic-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-primary, #111);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sql-topic-bar-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 16px;
}

.sql-topic-bar {
    height: 10px;
    border-radius: 5px;
    background: linear-gradient(90deg, #4f8ef7, #8b5cf6);
    min-width: 3px;
    transition: width 0.4s ease;
    flex-shrink: 0;
}

.sql-topic-count {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary, #6b7280);
    white-space: nowrap;
}

/* ── Connection Layers (topic network graph) ───────────────────────── */
.connection-layers {
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 10px 12px;
    margin: 8px 0 10px;
    background: var(--panel-bg, #f9fafb);
}

.connection-layers-title {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--text-secondary, #6b7280);
    margin-bottom: 8px;
}

.connection-layers-group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 12px;
    margin-bottom: 6px;
}

.connection-layers-group:last-child {
    margin-bottom: 0;
}

.connection-layers-group-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-primary, #111);
    width: 100%;
}

.layer-toggle-row {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11.5px;
    color: var(--text-primary, #111);
    cursor: pointer;
    user-select: none;
}

.layer-toggle-row input[type="checkbox"] {
    accent-color: #3b82f6;
    width: 13px;
    height: 13px;
    cursor: pointer;
}

.layer-swatch {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    flex-shrink: 0;
}
