/* Main container */
.dash-feature-impact {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    --kde-width: 300px;
    --force-width: 400px;
    --connection-space: 20px;
}

.visualization-grid {
    display: grid;
    grid-template-columns: 
        var(--kde-width) 
        var(--force-width) 
        minmax(20px, 2%) /* Connection space */
        minmax(0, 1fr);
    height: 100%;
    width: 100%;
}

/* Individual section styles */
.kde-section {
    grid-column: 1;
    position: relative;
    overflow: hidden;
}

.force-section {
    grid-column: 2;
    position: relative;
    overflow: hidden;
}

.connection-space {
    grid-column: 3;
    position: relative;
}

.table-section {
    grid-column: 4;
    position: relative;
    overflow: hidden;
    min-width: 0; /* Allows proper grid shrinking */
}

.connections-overlay {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 10;
}

/* Tooltip styles */
.prediction-tooltip {
    position: absolute;
    background: var(--tooltip-bg, white);
    border: 1px solid var(--tooltip-border, #ddd);
    border-radius: 4px;
    padding: 8px 12px;
    pointer-events: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: opacity 0.2s ease;
}

.prediction-tooltip-content {
    font-family: var(--tooltip-font, monospace);
    font-size: var(--tooltip-font-size, 12px);
    color: var(--tooltip-color, #333);
    white-space: pre-line;
    text-align: center;
}

/* Responsive adjustments */
@media (max-width: 1200px) {
    .visualization-grid {
        --kde-width: 250px;
        --force-width: 350px;
    }
}

@media (max-width: 900px) {
    .visualization-grid {
        --kde-width: 200px;
        --force-width: 300px;
    }
}

/* KDE Plot */
.kde-plot {
    width: 100%;
    height: 100%;
}

.grid-line {
    stroke-dasharray: 2,2;
    stroke-opacity: 0.3;
}

.axis-line {
    stroke-width: 1;
}

.tick-line {
    stroke-width: 1;
}

.tick-text {
    font-size: 12px;
    font-family: monospace;
}

.density-area {
    opacity: 0.8;
    transition: opacity 0.2s ease;
}

.density-area:hover {
    opacity: 0.9;
}

.prediction-line {
    stroke-width: 1;
    stroke-dasharray: 4,4;
    opacity: 0.6;
}

.prediction-point {
    stroke-width: 2;
    transition: all 0.2s ease;
}

.prediction-point:hover {
    r: 6;
    cursor: pointer;
}

/* ForcePlot */
.force-plot-container {
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.force-plot-svg {
    width: 100%;
    height: 100%;
}

.segment {
    cursor: pointer;
    transition: all 0.2s ease;
}

.segment:hover {
    filter: brightness(0.95);
}

.segment.highlighted {
    filter: brightness(0.9);
}

.segment-rect {
    stroke: rgba(0, 0, 0, 0.1);
    stroke-width: 1;
    transition: all 0.3s ease;
}

.segment-rect.negative {
    stroke: rgba(255, 0, 0, 0.1);
}

.segment-rect.positive {
    stroke: rgba(0, 0, 255, 0.1);
}

/* Add subtle shadow effect for depth */
.segment-rect {
    filter: drop-shadow(0px 2px 3px rgba(0, 0, 0, 0.1));
}

/* Enhanced hover effects */
.segment:hover .segment-rect {
    filter: drop-shadow(0px 4px 6px rgba(0, 0, 0, 0.15));
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .segment-rect {
        stroke-width: 0.5;
    }
}

/* FeatureTable */
.feature-table-container {
    display: flex;
    flex-direction: column;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
    width: 100%;
    flex: 1 1 auto;
    min-width: 0;
}

.table-header {
    position: sticky;
    top: 0;
    z-index: 10;
}

.header-row {
    display: flex;
    min-width: min-content;
}

.header-cell {
    padding: 12px 16px;
    font-weight: 600;
    font-size: 14px;
    border-bottom: 1px solid #e2e8f0;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.table-body {
    overflow-y: auto;
    overflow-x: auto;
    min-height: 0;
    width: 100%;
    flex-grow: 1;
}

.table-row {
    display: flex;
    min-width: min-content;
    border-bottom: 1px solid #e2e8f0;
    transition: background-color 0.2s;
    cursor: pointer;
}

.table-row:hover {
    background-color: #f8fafc;
}

.table-row.highlighted {
    background-color: #f1f5f9;
}

.table-cell {
    padding: 12px 16px;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.table-cell.id-column {
    font-family: monospace;
}

/* Scrollbar styling */
.table-body::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.table-body::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

.table-body::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.table-body::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* ConnectingLine */
.connecting-line {
    pointer-events: none; /* Prevents interfering with underlying elements */
}

.connection-path {
    fill: none;
    transition: stroke-width 0.2s ease;
}

.label-background {
    stroke: currentColor;
    stroke-width: 1;
}

.label-text {
    font-family: monospace;
    font-size: 14px;
    user-select: none;
}

/* Optional hover effects could be added here */
.connecting-line:hover .connection-path {
    stroke-width: 2;
}