/* Dashboard D3 host-virus charts */
.oh-dashboard-relation-chart {
    overflow: hidden;
}

.oh-dashboard-d3-chord-svg,
.oh-dashboard-d3-network-svg {
    width: 100%;
    height: 100%;
    display: block;
    font-family: inherit;
}

.d3-chart-title {
    fill: #061d45;
    font-size: 18px;
    font-weight: 1000;
}

.d3-chart-note,
.d3-chart-help {
    fill: #64748b;
    font-size: 11px;
    font-weight: 800;
}

.d3-chart-help {
    fill: #475569;
}

.d3-chord-group path,
.d3-chord-ribbon,
.d3-network-node,
.d3-network-link {
    cursor: pointer;
}

.d3-chord-group path:hover,
.d3-network-node:hover circle {
    filter: drop-shadow(0 8px 14px rgba(15, 23, 42, .18));
}

.d3-chord-ribbon {
    mix-blend-mode: multiply;
    transition: fill-opacity .15s ease, stroke-opacity .15s ease, filter .15s ease;
}

.d3-chord-ribbon:hover,
.d3-chord-ribbon.is-focused {
    fill-opacity: .78 !important;
    stroke-opacity: .55 !important;
    filter: drop-shadow(0 3px 8px rgba(15, 23, 42, .22));
}

.d3-chord-ribbon.is-dimmed {
    fill-opacity: .045 !important;
    stroke-opacity: .04 !important;
}

.d3-chord-label {
    fill: #0f274d;
    font-size: 11px;
    font-weight: 900;
    paint-order: stroke;
    stroke: #fff;
    stroke-width: 3px;
    stroke-linejoin: round;
}

.d3-chord-label.pathogen-label {
    font-size: 10.2px;
}

.d3-chord-legend text {
    fill: #334155;
    font-size: 12px;
    font-weight: 850;
}

.d3-network-link {
    stroke-linecap: round;
    mix-blend-mode: multiply;
}

.d3-network-link:hover {
    stroke-opacity: .72 !important;
    stroke-width: 4px;
}

.d3-network-node circle {
    stroke: #fff;
    stroke-width: 3px;
    filter: drop-shadow(0 7px 13px rgba(15, 23, 42, .13));
}

.d3-network-node.is-root text {
    fill: #fff;
    font-size: 13px;
    font-weight: 1000;
    pointer-events: none;
}

.d3-network-label {
    fill: #0f274d;
    font-size: 10.5px;
    font-weight: 900;
    paint-order: stroke;
    stroke: #fff;
    stroke-width: 3px;
    stroke-linejoin: round;
    pointer-events: none;
}

.d3-network-node.is-host .d3-network-label {
    font-size: 11px;
}

.oh-dashboard-graph-empty {
    min-height: 100%;
}

/* Stage 8: D3 hover focus and virus-only taxonomy network */
.d3-chord-group,
.d3-chord-group path,
.d3-chord-label,
.d3-network-node,
.d3-network-link {
    transition: opacity .16s ease, fill-opacity .16s ease, stroke-opacity .16s ease, filter .16s ease;
}

.d3-chord-group.is-dimmed path,
.d3-chord-label.is-dimmed {
    opacity: .16;
}

.d3-chord-group.is-focused path,
.d3-chord-label.is-focused {
    opacity: 1;
    filter: drop-shadow(0 7px 13px rgba(15, 23, 42, .17));
}

.d3-chord-ribbon.is-focused {
    fill-opacity: .72 !important;
    stroke-opacity: .48 !important;
}

.d3-chord-legend g {
    cursor: pointer;
}

.d3-network-node.is-dimmed {
    opacity: .15;
}

.d3-network-node.is-focused {
    opacity: 1;
}

.d3-network-link.is-dimmed {
    stroke-opacity: .035 !important;
}

.d3-network-link.is-focused {
    stroke-opacity: .7 !important;
}

.d3-network-node.is-branch circle {
    stroke-width: 2.5px;
}

.d3-network-node.is-leaf circle {
    stroke-width: 2px;
}

/* Stage 9: comparative virus network resize/zoom support */
#onehealth-dashboard-virus-network.oh-dashboard-relation-chart,
.oh-dashboard-relation-chart.network-chart {
    height: var(--network-chart-height, 560px);
    min-height: 560px;
}

.oh-dashboard-d3-network-svg {
    touch-action: none;
    cursor: grab;
}

.oh-dashboard-d3-network-svg:active {
    cursor: grabbing;
}

.d3-network-viewport {
    transform-origin: center center;
}

.oh-dashboard-d3-toolbar {
    position: absolute;
    right: 10px;
    bottom: 10px;
    z-index: 5;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px;
    border: 1px solid #bfdbfe;
    border-radius: 999px;
    background: rgba(255, 255, 255, .92);
    box-shadow: 0 10px 24px rgba(15, 23, 42, .12);
    backdrop-filter: blur(8px);
}

.oh-dashboard-d3-toolbar button {
    border: 1px solid #bfdbfe;
    border-radius: 999px;
    background: #fff;
    color: #0f3d7a;
    min-width: 32px;
    height: 28px;
    padding: 0 9px;
    font-size: 11px;
    font-weight: 950;
    line-height: 1;
    cursor: pointer;
}

.oh-dashboard-d3-toolbar button:hover {
    background: #eff6ff;
    border-color: #60a5fa;
}

.oh-dashboard-d3-toolbar button.is-primary {
    background: #0f3d7a;
    border-color: #0f3d7a;
    color: #fff;
}

@media (max-width: 1200px) {
    #onehealth-dashboard-virus-network.oh-dashboard-relation-chart,
    .oh-dashboard-relation-chart.network-chart {
        height: var(--network-chart-height, 620px);
        min-height: 620px;
    }
}

/* Stage 10: chart-style zoom controls and safe plot bounds for both D3 charts */
.oh-dashboard-relation-chart {
    position: relative;
}

.oh-dashboard-relation-chart.chord-chart,
#onehealth-dashboard-host-virus-chord.oh-dashboard-relation-chart {
    height: var(--chord-chart-height, 560px);
    min-height: 560px;
}

.oh-dashboard-d3-chord-svg {
    touch-action: none;
    cursor: grab;
}

.oh-dashboard-d3-chord-svg:active {
    cursor: grabbing;
}

.d3-chord-viewport,
.d3-network-viewport {
    transform-origin: center center;
}

.d3-chord-label.pathogen-label {
    font-size: 9.6px;
}

.d3-chord-label.host-label {
    font-size: 10.8px;
}

.oh-dashboard-d3-toolbar {
    top: 10px;
    right: 10px;
    bottom: auto;
    gap: 4px;
    padding: 4px;
    border-radius: 12px;
    background: rgba(255, 255, 255, .94);
}

.oh-dashboard-d3-toolbar button {
    min-width: 30px;
    width: auto;
    height: 28px;
    padding: 0 8px;
    border-radius: 9px;
    font-size: 12px;
}

.oh-dashboard-d3-toolbar button.is-primary {
    min-width: 34px;
}

@media (max-width: 1200px) {
    .oh-dashboard-relation-chart.chord-chart,
    #onehealth-dashboard-host-virus-chord.oh-dashboard-relation-chart {
        height: var(--chord-chart-height, 620px);
        min-height: 620px;
    }
}

/* Stage 16: hide chart option controls while checking the default layout. */
.oh-dashboard-d3-toolbar {
    display: none !important;
}

.oh-dashboard-relation-chart.chord-chart,
#onehealth-dashboard-host-virus-chord.oh-dashboard-relation-chart,
#onehealth-dashboard-virus-network.oh-dashboard-relation-chart,
.oh-dashboard-relation-chart.network-chart {
    height: 100% !important;
    min-height: 0 !important;
}
