body {
    margin: 0;
    font-family: sans-serif;
    background-color: #f0f0f0;
}

#visualization-container {
    width: 100vw;
    height: 100vh;
}

/* --- Control Panel Styles --- */
#control-panel {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    background-color: rgba(255, 255, 255, 0.9);
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    padding: 10px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    gap: 20px;
    z-index: 10;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.group-label {
    font-weight: bold;
    font-size: 14px;
    margin-right: 5px;
}

#control-panel button {
    padding: 5px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background-color: #fff;
    cursor: pointer;
}

#control-panel button:hover {
    background-color: #f0f0f0;
}

#control-panel input {
    padding: 5px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

#search-count {
    font-size: 12px;
    color: #555;
    min-width: 40px; /* Prevents layout shift */
    text-align: center;
}

/* Mode Toggle Button */
.mode-button {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #f8f9fa;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
    font-weight: 500;
    min-width: 120px;
    justify-content: center;
}

.mode-button:hover {
    background: #e9ecef;
    border-color: #adb5bd;
}

.mode-button.active {
    background: #007bff;
    border-color: #007bff;
    color: white;
}

.mode-button.active:hover {
    background: #0056b3;
    border-color: #0056b3;
}

.mode-button[data-mode="lineage"] .mode-icon::before {
    content: "👥";
}

.mode-button[data-mode="path"] .mode-icon::before {
    content: "🔗";
}

.mode-icon {
    font-size: 16px;
    line-height: 1;
}

.mode-text {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
    .mode-button {
        min-width: 100px;
        padding: 6px 10px;
        font-size: 12px;
    }
    
    .mode-text {
        font-size: 11px;
    }
    
    .mode-icon {
        font-size: 14px;
    }
}

/* Status indicator for path selection mode */
.path-selection-status {
    position: fixed;
    top: 20px;
    right: 20px;
    background: rgba(0, 123, 255, 0.9);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    z-index: 1000;
    display: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.path-selection-status.show {
    display: block;
}

@media (max-width: 768px) {
    .path-selection-status {
        top: 10px;
        right: 10px;
        font-size: 11px;
        padding: 6px 12px;
    }
}

/* --- Visualization Styles --- */

.node circle,
.node image {
    stroke: #fff;
    stroke-width: 1.5px;
}

.node.highlighted circle,
.node.highlighted image {
    stroke: #f00;
    stroke-width: 3px;
}

.link {
    stroke: #999;
    stroke-opacity: 0.6;
}

.label {
    font-size: 12px;
    pointer-events: none; /* Prevents text from interfering with mouse events on nodes */
    text-anchor: middle;
    alignment-baseline: middle;
}

/* Styles for specific link types */
.link.partner {
    stroke-dasharray: 4, 4; /* Creates a dashed line */
    stroke: #888;
}

.link.child {
    stroke-width: 1.5px;
    stroke: #555;
}

/* Lineage highlighting styles */
.node.faded {
    opacity: 0.3;
}

.node.lineage-highlighted {
    opacity: 1;
}

.node.selected circle,
.node.selected image {
    stroke: #007bff;
    stroke-width: 4px;
}

.link.faded {
    opacity: 0.2;
}

.link.lineage-highlighted {
    opacity: 1;
}

/* Path finding styles */
.node.path-selected {
    opacity: 1;
}

.node.path-selected circle,
.node.path-selected image {
    stroke: #28a745;
    stroke-width: 4px;
}

.node.path-highlighted {
    opacity: 1;
}

.node.path-highlighted circle,
.node.path-highlighted image {
    stroke: #ffc107;
    stroke-width: 3px;
}

.link.path-highlighted {
    opacity: 1;
    stroke: #ffc107;
    stroke-width: 3px;
}

/* Family grouping visual indicators */
.node.sibling-node circle {
    stroke: #fff;
    stroke-width: 1.5px;
}

.node.sibling-node image {
    stroke: #fff;
    stroke-width: 1.5px;
}
