/**
 * Relationship Network Styles
 * Compact, minimalist relationship visualization
 */

/* Relationships Page Layout */
.wiki-relationships-page {
    max-width: 1400px;
    margin: 0 auto;
    padding: var(--space-4) var(--space-3);
}

/* Network Header */
.wiki-network-header {
    margin-bottom: var(--space-6);
    padding-bottom: var(--space-4);
    border-bottom: 1px solid var(--border-primary);
}

.wiki-network-meta {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-2);
}

.wiki-network-type {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    font-weight: 500;
}

.wiki-network-title {
    font-size: 28px;
    font-weight: 600;
    margin: 0 0 var(--space-2) 0;
    color: var(--text-primary);
}

.wiki-network-description {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin: 0 0 var(--space-3) 0;
}

.wiki-network-stats {
    display: flex;
    gap: var(--space-4);
    font-size: 12px;
    color: var(--text-secondary);
}

.wiki-network-stats .stat {
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

/* Network Controls */
.wiki-network-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-4);
    padding: var(--space-3);
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
}

.network-filters {
    display: flex;
    gap: var(--space-2);
}

.network-filters select {
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--border-primary);
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
    font-size: 12px;
    cursor: pointer;
}

/* Network Views */
.wiki-network-view {
    display: none;
}

.wiki-network-view.active {
    display: block;
}

/* Graph View */
.wiki-network-graph {
    position: relative;
}

.network-canvas-container {
    position: relative;
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    overflow: hidden;
}

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

/* Network Nodes */
.network-node {
    cursor: pointer;
    transition: all 0.2s;
}

.network-node circle {
    fill: var(--bg-primary);
    stroke: var(--accent);
    stroke-width: 2px;
    transition: all 0.2s;
}

.network-node.protagonist circle {
    stroke: #2383e2;
    stroke-width: 3px;
}

.network-node.antagonist circle {
    stroke: #e23838;
    stroke-width: 3px;
}

.network-node.supporting circle {
    stroke: #7e38e2;
}

.network-node.minor circle {
    stroke: var(--text-tertiary);
}

.network-node:hover circle {
    stroke-width: 4px;
    filter: brightness(1.2);
}

.network-node text {
    font-size: 11px;
    font-weight: 500;
    fill: var(--text-primary);
    pointer-events: none;
    text-anchor: middle;
}

/* Network Edges */
.network-edge {
    stroke-width: 1.5px;
    fill: none;
    opacity: 0.5;
    transition: all 0.2s;
}

.network-edge.hierarchical {
    stroke: #2383e2;
}

.network-edge.familial {
    stroke: #e238b6;
}

.network-edge.professional {
    stroke: #38b6e2;
}

.network-edge.social {
    stroke: #7e38e2;
}

.network-edge.romantic {
    stroke: #e23876;
}

.network-edge.adversarial {
    stroke: #e23838;
    stroke-dasharray: 4, 2;
}

.network-edge:hover {
    opacity: 1;
    stroke-width: 2.5px;
}

.network-edge.bidirectional {
    marker-start: url(#arrow-start);
}

.network-edge marker-end {
    fill: inherit;
}

/* Network Legend */
.network-legend {
    position: absolute;
    top: var(--space-3);
    right: var(--space-3);
    background: var(--bg-primary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-sm);
    padding: var(--space-3);
    box-shadow: var(--shadow-md);
    max-width: 180px;
}

.network-legend h3 {
    font-size: 12px;
    font-weight: 600;
    margin: 0 0 var(--space-2) 0;
    color: var(--text-primary);
}

.legend-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.legend-list li {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-1);
    font-size: 11px;
    color: var(--text-secondary);
}

.legend-line {
    width: 24px;
    height: 2px;
    display: block;
}

.legend-line.hierarchical { background: #2383e2; }
.legend-line.familial { background: #e238b6; }
.legend-line.professional { background: #38b6e2; }
.legend-line.social { background: #7e38e2; }
.legend-line.romantic { background: #e23876; }
.legend-line.adversarial {
    background: linear-gradient(to right, #e23838 50%, transparent 50%);
    background-size: 8px 2px;
}

/* Tree View */
.wiki-network-tree {
    padding: var(--space-4);
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
}

.relationship-tree {
    overflow-x: auto;
    padding: var(--space-4);
}

.tree-node {
    position: relative;
    padding-left: var(--space-6);
    margin-bottom: var(--space-3);
}

.tree-node.depth-0 {
    padding-left: 0;
}

.tree-node::before {
    content: '';
    position: absolute;
    left: 12px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border-primary);
}

.tree-node.depth-0::before {
    display: none;
}

.node-content {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    background: var(--bg-primary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-sm);
    margin-bottom: var(--space-2);
    width: fit-content;
}

.node-character {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    text-decoration: none;
}

.node-character:hover {
    color: var(--accent);
}

.node-role {
    font-size: 10px;
    padding: 2px var(--space-2);
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.node-children {
    margin-left: var(--space-4);
}

/* List View */
.wiki-network-list {
    display: grid;
    gap: var(--space-4);
}

.character-relationships {
    padding: var(--space-4);
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
}

.character-name {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin: 0 0 var(--space-3) 0;
    font-size: 16px;
    font-weight: 600;
}

.character-name a {
    color: var(--text-primary);
    text-decoration: none;
}

.character-name a:hover {
    color: var(--accent);
}

.character-role {
    font-size: 10px;
    padding: 2px var(--space-2);
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.relationship-items {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: var(--space-2);
}

.relationship-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    background: var(--bg-primary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-sm);
    font-size: 12px;
    transition: all 0.2s;
}

.relationship-item:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow-sm);
}

.rel-type-badge {
    font-size: 10px;
    padding: 3px var(--space-2);
    border-radius: var(--radius-sm);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.rel-type-badge.rel-hierarchical {
    background: rgba(35, 131, 226, 0.1);
    color: #2383e2;
}

.rel-type-badge.rel-familial {
    background: rgba(226, 56, 182, 0.1);
    color: #e238b6;
}

.rel-type-badge.rel-professional {
    background: rgba(56, 182, 226, 0.1);
    color: #38b6e2;
}

.rel-type-badge.rel-social {
    background: rgba(126, 56, 226, 0.1);
    color: #7e38e2;
}

.rel-type-badge.rel-romantic {
    background: rgba(226, 56, 118, 0.1);
    color: #e23876;
}

.rel-type-badge.rel-adversarial {
    background: rgba(226, 56, 56, 0.1);
    color: #e23838;
}

.rel-direction {
    color: var(--text-tertiary);
    font-weight: 600;
}

.rel-target {
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 500;
    flex: 1;
}

.rel-target:hover {
    color: var(--accent);
}

.rel-intensity {
    font-size: 10px;
    padding: 2px var(--space-2);
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    color: var(--text-tertiary);
}

.rel-intensity.intensity-very_high {
    background: rgba(226, 56, 56, 0.15);
    color: #e23838;
    font-weight: 600;
}

.rel-intensity.intensity-high {
    background: rgba(226, 120, 56, 0.15);
    color: #e27838;
}

/* Responsive */
@media (max-width: 768px) {
    .wiki-relationships-page {
        padding: var(--space-3) var(--space-2);
    }

    .wiki-network-controls {
        flex-direction: column;
        gap: var(--space-3);
    }

    .network-filters {
        width: 100%;
        flex-direction: column;
    }

    .network-filters select {
        width: 100%;
    }

    .network-canvas {
        height: 400px;
    }

    .network-legend {
        position: static;
        margin-top: var(--space-3);
        max-width: none;
    }

    .relationship-item {
        flex-wrap: wrap;
    }
}
