/* D3.js Network Graph Styles */

.graph-modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
}

.graph-container {
    position: relative;
    width: 90%;
    height: 90%;
    margin: 2% auto;
    background: var(--panel-bg);
    border: 2px solid var(--accent-blue);
    border-radius: 8px;
    box-shadow: 0 0 40px rgba(0, 212, 255, 0.5);
}

.graph-header {
    height: 60px;
    background: rgba(0, 0, 0, 0.5);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
}

.graph-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--accent-cyan);
}

.graph-controls {
    display: flex;
    gap: 10px;
}

.graph-control-btn {
    background: rgba(0, 212, 255, 0.1);
    border: 1px solid var(--accent-blue);
    color: var(--accent-blue);
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
    transition: all 0.3s ease;
}

.graph-control-btn:hover {
    background: rgba(0, 212, 255, 0.2);
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.5);
}

.graph-control-btn.active {
    background: rgba(0, 212, 255, 0.3);
    border-color: var(--accent-cyan);
}

.graph-close {
    position: absolute;
    right: 20px;
    top: 15px;
    font-size: 32px;
    font-weight: bold;
    color: var(--text-secondary);
    cursor: pointer;
    z-index: 10;
}

.graph-close:hover {
    color: var(--accent-red);
}

.graph-svg {
    width: 100%;
    height: calc(100% - 60px);
}

/* Node Styles */
.node {
    cursor: pointer;
    transition: all 0.3s ease;
}

.node:hover {
    filter: brightness(1.5);
}

.node-case {
    fill: var(--accent-blue);
    stroke: var(--accent-cyan);
    stroke-width: 2px;
}

.node-threat {
    fill: var(--accent-red);
    stroke: #ff0088;
    stroke-width: 2px;
}

.node-signal {
    fill: var(--accent-yellow);
    stroke: #ffd700;
    stroke-width: 1.5px;
}

.node-credential {
    fill: var(--accent-red);
    stroke: #ff0055;
    stroke-width: 1.5px;
}

.node-rule {
    fill: var(--accent-green);
    stroke: #00ff88;
    stroke-width: 2px;
}

.node-device {
    fill: var(--accent-cyan);
    stroke: #00d4ff;
    stroke-width: 1.5px;
}

.node-selected {
    stroke-width: 4px !important;
    filter: drop-shadow(0 0 10px currentColor);
}

/* Link Styles */
.link {
    stroke: var(--accent-blue);
    stroke-opacity: 0.6;
    stroke-width: 2px;
    fill: none;
}

.link-threat {
    stroke: var(--accent-red);
    stroke-opacity: 0.8;
}

.link-rule {
    stroke: var(--accent-green);
    stroke-opacity: 0.8;
    stroke-dasharray: 5, 5;
}

.link-device {
    stroke: var(--accent-cyan);
    stroke-opacity: 0.4;
}

.link:hover {
    stroke-opacity: 1;
    stroke-width: 3px;
}

/* Label Styles */
.node-label {
    fill: var(--text-primary);
    font-size: 11px;
    text-anchor: middle;
    pointer-events: none;
    text-shadow: 
        -1px -1px 0 var(--bg-dark),
        1px -1px 0 var(--bg-dark),
        -1px 1px 0 var(--bg-dark),
        1px 1px 0 var(--bg-dark);
}

.node-sublabel {
    fill: var(--text-secondary);
    font-size: 9px;
    text-anchor: middle;
    pointer-events: none;
}

/* Tooltip */
.graph-tooltip {
    position: absolute;
    background: var(--panel-bg);
    border: 1px solid var(--accent-blue);
    border-radius: 4px;
    padding: 10px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.5);
    z-index: 100;
    max-width: 300px;
}

.graph-tooltip.show {
    opacity: 1;
}

.tooltip-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--accent-cyan);
    margin-bottom: 5px;
}

.tooltip-content {
    font-size: 11px;
    color: var(--text-primary);
    line-height: 1.5;
}

/* Legend */
.graph-legend {
    position: absolute;
    bottom: 20px;
    left: 20px;
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 15px;
}

.legend-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--accent-cyan);
    margin-bottom: 10px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 5px;
    font-size: 11px;
    color: var(--text-primary);
}

.legend-icon {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

/* Info Panel */
.graph-info-panel {
    position: absolute;
    top: 80px;
    right: 20px;
    width: 300px;
    max-height: calc(100% - 100px);
    background: rgba(0, 0, 0, 0.9);
    border: 1px solid var(--accent-blue);
    border-radius: 4px;
    padding: 15px;
    overflow-y: auto;
    display: none;
}

.graph-info-panel.show {
    display: block;
}

.info-panel-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--accent-cyan);
    margin-bottom: 10px;
}

.info-panel-section {
    margin-bottom: 15px;
}

.info-panel-label {
    font-size: 10px;
    color: var(--text-secondary);
    margin-bottom: 3px;
}

.info-panel-value {
    font-size: 12px;
    color: var(--text-primary);
    margin-bottom: 8px;
}

/* Zoom Controls */
.zoom-controls {
    position: absolute;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.zoom-btn {
    width: 36px;
    height: 36px;
    background: rgba(0, 212, 255, 0.1);
    border: 1px solid var(--accent-blue);
    color: var(--accent-blue);
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.zoom-btn:hover {
    background: rgba(0, 212, 255, 0.2);
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.5);
}

/* Animation */
@keyframes nodeAppear {
    from {
        opacity: 0;
        transform: scale(0);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.node {
    animation: nodeAppear 0.5s ease-out;
}

@keyframes linkAppear {
    from {
        stroke-opacity: 0;
    }
    to {
        stroke-opacity: 0.6;
    }
}

.link {
    animation: linkAppear 0.5s ease-out;
}
