/* Harris's List - Network View Stylesheet */

/* Header */
/*
.network-header {
    background-color: var(--burgundy);
    color: white;
    padding: 1.5rem 0;
    margin-top: 61px;
}
*/
[data-bs-theme="dark"] .network-header {
    background-color: #232729;
}

.network-header {
    background-color: white;
    border-bottom: 2px solid var(--burgundy);
    padding: 2rem 0 1.5rem;
}

.network-header h2 {
    color: var(--burgundy);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.network-header .lead {
    font-size: 1.25rem;
    opacity: 0.9;
    color: var(--text-light);
}

.btn-burgundy {
    background-color: var(--burgundy);
    border-color: var(--burgundy);
    color: white;
}

.btn-burgundy:hover {
    background-color: var(--dark-burgundy);
    border-color: var(--dark-burgundy);
    color: white;
}

.btn-outline-burgundy {
    color: var(--burgundy);
    border-color: var(--burgundy);
}

.btn-outline-burgundy:hover {
    background-color: var(--burgundy);
    border-color: var(--burgundy);
    color: white;
}

.bg-burgundy {
    background-color: var(--burgundy) !important;
}

/* Main Container */
.network-container-wrapper {
    display: flex;
    height: calc(100vh - 61px - 100px); /* viewport - navbar - header */
    position: relative;
}

/* Filter Sidebar (Left) */
.filter-sidebar {
    width: 320px;
    background-color: var(--cream);
    border-right: 1px solid rgba(0, 0, 0, 0.1);
    overflow-y: auto;
    padding: 1.5rem;
    flex-shrink: 0;
}

[data-bs-theme="dark"] .filter-sidebar {
    border-right-color: rgba(255, 255, 255, 0.1);
}

.filter-section {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

[data-bs-theme="dark"] .filter-section {
    border-bottom-color: rgba(255, 255, 255, 0.1);
}

.filter-section:last-child {
    border-bottom: none;
}

.filter-heading {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-dark);
}

/* Statistics Grid */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.stat-item {
    background: rgba(139, 35, 50, 0.05);
    padding: 0.5rem;
    border-radius: 4px;
    display: flex;
    flex-direction: column;
}

[data-bs-theme="dark"] .stat-item {
    background: rgba(139, 35, 50, 0.15);
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-light);
    font-weight: 500;
}

.stat-value {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--burgundy);
}

/* Edge Toggles */
.edge-toggles {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-check-label {
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.edge-color-indicator {
    display: inline-block;
    width: 16px;
    height: 3px;
    border-radius: 1px;
    flex-shrink: 0;
}

/* Network Canvas */
.network-canvas {
    flex: 1;
    position: relative;
    background-color: var(--cream);
    overflow: hidden;
}

.network-canvas svg {
    display: block;
    width: 100%;
    height: 100%;
}

/* Loading Overlay */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: var(--cream);
    z-index: 1000;
}

.loading-overlay.hidden {
    display: none;
}

.spinner-border.text-burgundy {
    color: var(--burgundy) !important;
}

/* Info Sidebar (Right) */
.info-sidebar {
    width: 350px;
    background-color: var(--cream);
    border-left: 1px solid rgba(0, 0, 0, 0.1);
    overflow-y: auto;
    padding: 1.5rem;
    flex-shrink: 0;
    position: relative;
    box-shadow: -2px 0 8px rgba(0, 0, 0, 0.05);
}

[data-bs-theme="dark"] .info-sidebar {
    border-left-color: rgba(255, 255, 255, 0.1);
    box-shadow: -2px 0 8px rgba(0, 0, 0, 0.2);
}

.info-sidebar.d-none {
    display: none !important;
}

.btn-close-custom {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-light);
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    line-height: 1;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.btn-close-custom:hover {
    opacity: 1;
}

.info-content {
    padding-right: 2rem;
}

#info-name {
    font-size: 1.25rem;
    color: var(--burgundy);
    font-weight: 600;
}

#info-id {
    font-size: 0.85rem;
}

.info-section {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

[data-bs-theme="dark"] .info-section {
    border-bottom-color: rgba(255, 255, 255, 0.08);
}

.info-section:last-child {
    border-bottom: none;
}

.info-section-title {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-light);
    margin-bottom: 0.75rem;
}

.info-dl {
    display: grid;
    grid-template-columns: 90px 1fr;
    gap: 0.5rem 1rem;
    margin: 0;
    font-size: 0.875rem;
}

.info-dl dt {
    font-weight: 500;
    color: var(--text-light);
}

.info-dl dd {
    margin: 0;
    color: var(--text-dark);
}

.connections-list {
    max-height: 200px;
    overflow-y: auto;
    font-size: 0.85rem;
}

.connection-item {
    padding: 0.5rem;
    margin-bottom: 0.5rem;
    background: rgba(139, 35, 50, 0.05);
    border-radius: 4px;
    border-left: 3px solid;
    cursor: pointer;
    transition: background-color 0.2s;
}

.connection-item:hover {
    background: rgba(139, 35, 50, 0.1);
}

[data-bs-theme="dark"] .connection-item {
    background: rgba(139, 35, 50, 0.15);
}

[data-bs-theme="dark"] .connection-item:hover {
    background: rgba(139, 35, 50, 0.25);
}

.connection-item.type-temporal { border-left-color: #6a4c93; }
.connection-item.type-spatial { border-left-color: #2a9d8f; }
.connection-item.type-social { border-left-color: #e76f51; }
.connection-item.type-skill { border-left-color: #f4a261; }
.connection-item.type-cultural { border-left-color: #e9c46a; }
.connection-item.type-trait { border-left-color: #a8dadc; }
.connection-item.type-price { border-left-color: #457b9d; }
.connection-item.type-origin { border-left-color: #264653; }

.connection-name {
    font-weight: 500;
    color: var(--text-dark);
}

.connection-type {
    font-size: 0.75rem;
    color: var(--text-light);
}

/* Search Results */
.search-results {
    max-height: 200px;
    overflow-y: auto;
}

.search-result-item {
    padding: 0.5rem;
    cursor: pointer;
    border-radius: 4px;
    font-size: 0.875rem;
    transition: background-color 0.2s;
}

.search-result-item:hover {
    background-color: rgba(139, 35, 50, 0.1);
}

.search-result-name {
    font-weight: 500;
}

.search-result-meta {
    font-size: 0.75rem;
    color: var(--text-light);
}

/* D3 Network Styles */
.node {
    cursor: pointer;
}

.node circle {
    transition: r 0.3s ease, stroke-width 0.3s ease;
}

.node:hover circle {
    stroke-width: 3px !important;
}

.node text {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 11px;
    fill: var(--text-dark);
    pointer-events: none;
    user-select: none;
}

.link {
    stroke-linecap: round;
    transition: stroke-width 0.2s ease, stroke-opacity 0.2s ease;
}

.link-temporal {
    stroke-dasharray: none;
}

.link-spatial {
    stroke-dasharray: 6, 4;
}

.link-social {
    stroke-dasharray: none;
}

.link-skill {
    stroke-dasharray: 2, 3;
}

.link-cultural {
    stroke-dasharray: 8, 4, 2, 4;
}

.link-trait {
    stroke-dasharray: 2, 3;
}

.link-price {
    stroke-dasharray: 2, 3;
}

.link-origin {
    stroke-dasharray: 3, 3;
}

/* Node states */
.node.selected circle {
    stroke-width: 4px !important;
    filter: drop-shadow(0 0 8px rgba(139, 35, 50, 0.6));
}

.node.highlighted circle {
    filter: drop-shadow(0 0 4px rgba(139, 35, 50, 0.4));
}

.node.dimmed {
    opacity: 0.2;
}

.link.dimmed {
    opacity: 0.1;
}

/* Tooltip */
.network-tooltip {
    position: absolute;
    padding: 0.5rem 0.75rem;
    background: rgba(0, 0, 0, 0.85);
    color: white;
    border-radius: 4px;
    font-size: 0.8rem;
    pointer-events: none;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.2s;
}

[data-bs-theme="dark"] .network-tooltip {
    background: rgba(255, 255, 255, 0.9);
    color: var(--dark-slate);
}

.network-tooltip.visible {
    opacity: 1;
}

/* Responsive Design */
@media (max-width: 992px) {
    .network-container-wrapper {
        flex-direction: column;
        height: auto;
    }

    .filter-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid rgba(0, 0, 0, 0.1);
        max-height: 400px;
    }

    .network-canvas {
        height: 600px;
    }

    .info-sidebar {
        width: 100%;
        border-left: none;
        border-top: 1px solid rgba(0, 0, 0, 0.1);
        max-height: 400px;
    }
}

/* Scrollbar Styling */
.filter-sidebar::-webkit-scrollbar,
.info-sidebar::-webkit-scrollbar,
.connections-list::-webkit-scrollbar,
.search-results::-webkit-scrollbar {
    width: 6px;
}

.filter-sidebar::-webkit-scrollbar-track,
.info-sidebar::-webkit-scrollbar-track,
.connections-list::-webkit-scrollbar-track,
.search-results::-webkit-scrollbar-track {
    background: transparent;
}

.filter-sidebar::-webkit-scrollbar-thumb,
.info-sidebar::-webkit-scrollbar-thumb,
.connections-list::-webkit-scrollbar-thumb,
.search-results::-webkit-scrollbar-thumb {
    background: rgba(139, 35, 50, 0.3);
    border-radius: 3px;
}

.filter-sidebar::-webkit-scrollbar-thumb:hover,
.info-sidebar::-webkit-scrollbar-thumb:hover,
.connections-list::-webkit-scrollbar-thumb:hover,
.search-results::-webkit-scrollbar-thumb:hover {
    background: rgba(139, 35, 50, 0.5);
}

/* Dark mode adjustments for SVG */
[data-bs-theme="dark"] .node circle {
    stroke: #fff;
}

[data-bs-theme="dark"] .node text {
    fill: #e1e1e1;
}

/* Legend */
.network-legend {
    position: absolute;
    bottom: 20px;
    left: 340px;
    background: rgba(255, 255, 255, 0.95);
    padding: 1rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    font-size: 0.85rem;
    max-width: 300px;
    z-index: 100;
}

[data-bs-theme="dark"] .network-legend {
    background: rgba(26, 29, 31, 0.95);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.legend-title {
    font-weight: 600;
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.legend-line {
    width: 30px;
    height: 2px;
    flex-shrink: 0;
}

.legend-label {
    font-size: 0.8rem;
}

/* Accessibility */
.node:focus {
    outline: 2px solid var(--burgundy);
    outline-offset: 2px;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}
