body {
    margin: 0;
    background-color: #f4f4f9;
    overflow: hidden;
}
.node circle {
    cursor: pointer;
    fill: #fff;
    stroke: steelblue;
    stroke-width: 2.5px;
}
.node text {
    font-size: 15px;
    pointer-events: none;
}
.link {
    fill: none;
    stroke: #ccc;
    stroke-width: 2px;
}
#tooltip {
    position: absolute;
    opacity: 0;
    background-color: #333;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 14px;
    pointer-events: none;
    transition: opacity 0.2s;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    z-index: 1100;
}
#tooltip strong {
    color: lightsteelblue;
}
#context-menu {
    position: absolute;
    background: white;
    border: 1px solid #ccc;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    display: none;
    z-index: 1000;
}
#context-menu ul {
    list-style: none;
    margin: 0;
    padding: 0;
}
#context-menu li {
    padding: 8px 12px;
    cursor: pointer;
}
#context-menu li:hover {
    background: #eee;
}
#context-menu li.disabled {
    color: #999;
    cursor: default;
    background: none;
    pointer-events: none;
}
#search-container {
    margin: 10px;
    display: flex;
    align-items: center;
    position: relative;
    z-index: 1000;
}
#search {
    padding:5px;
    font-size:16px;
    width:300px;
}
#search-btn, #reset-btn {
    width:24px;
    height:24px;
    cursor:pointer;
    margin-left:5px;
}
#legend-container {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 1050;
    background-color: white;
    border: 1px solid #ccc;
    padding: 10px;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);

    /* Neu hinzugefügt: */
    max-height: 80vh; /* höchstens 80% der Fensterhöhe */
    overflow-y: auto; /* Scrollbalken, wenn Inhalt zu lang ist */
}
#legend-toggle {
    cursor: pointer;
    font-weight: bold;
    color: steelblue;
    display: block;
}
#legend-content {
    border-top: 1px solid #eee;
    margin-top: 5px;
    padding-top: 5px;
}
#legend-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
#legend-table td {
    padding: 5px 0;
    vertical-align: middle;
}
.legend-icon-container {
    width: 30px;
    text-align: center;
}
.legend-icon {
    width: 20px;
    height: 20px;
    display: inline-block;
    border-radius: 50%;
    border: 1px solid #333;
}
.legend-path {
    height: 20px;
    width: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.legend-path-line {
    height: 2px;
    width: 100%;
    background-color: #ccc;
}
.legend-path-pref {
    height: 2px;
    width: 100%;
    background-color: none;
    border-top: 2px dashed red;
}

/* --- Mobile Ansicht optimieren --- */
@media (max-width: 600px) {

    #search-container {
        position: static;
        width: calc(100% - 20px);
        margin: 10px auto;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 5px;
    }

    #search {
        flex: 1; /* Suchfeld nimmt den restlichen Platz ein */
        font-size: 16px;
        padding: 6px;
        min-width: 0; /* verhindert, dass das Feld überläuft */
    }

    #search-btn,
    #reset-btn {
        flex: 0 0 32px;
        height: 32px;
        cursor: pointer;
    }

    #legend-container {
        position: static;
        margin: 0 auto 10px auto;
        width: calc(100% - 20px);
        box-sizing: border-box;
    }

    #legend-toggle {
        text-align: center;
        display: block;
    }
}
