html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    overflow: hidden;
    background: #f9f9f9;
    font-family: sans-serif;
}

.page-container {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Header and controls take only as much vertical space as they need */
header, #controls {
    flex: 0 0 auto;
}

/* Responsive wrapping for controls */
#controls {
    padding: 10px;
    background: #ddd;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    transition: background 0.3s;
}

#controls.input-mode {
    background: #ccc;
}

#controls.collapsed {
    display: none;
}

#controls select,
#controls button,
#controls input {
    font-size: 14px;
    padding: 4px;
}

.viz-control-group {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 2px 8px;
    background: rgba(255,255,255,0.45);
    border-radius: 6px;
}

.viz-control-group label,
.viz-control-group span {
    font-size: 13px;
    white-space: nowrap;
}

.viz-control-group input[type="range"] {
    width: 140px;
    padding: 0;
}

/* Optional: make controls stack on small screens */
@media (max-width: 600px) {
    #controls {
        flex-direction: column;
        align-items: stretch;
    }
    #controls label,
    #controls select,
    #controls button,
    #controls input {
        width: 100%;
        box-sizing: border-box;
    }
}

/* The tree container now fills the remaining vertical space */
#tree-container {
    flex: 1 1 auto;
    position: relative;
    overflow: auto;
    background: #fff;
}

/* Keep other CSS as before */
#zoom-instructions {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(0,0,0,0.5);
    color: #fff;
    font-size: 12px;
    padding: 5px;
    border-radius: 3px;
}

.link {
    fill: none;
    stroke: #888;
    stroke-width: 2px;
}

.window-link {
    fill: none;
    stroke: #555;
    stroke-width: 1.5px;
    stroke-dasharray: 3,3;
}

.node rect {
    cursor: pointer;
    stroke: #fff;
    stroke-width: 1px;
    rx: 8px;
    ry: 8px;
}

.node text {
    font: 16px sans-serif;
    fill: #fff;
    text-anchor: middle;
    dominant-baseline: central;
}

.info-window {
    font-size: 18px;
    font-family: sans-serif;
    background: #f0f0f0;
    border: 1px solid #999;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
}

.info-window-header {
    background: #003399;
    color: #fff;
    padding: 12px 14px;
    font-weight: bold;
    cursor: move;
    flex: 0 0 auto;
}

.info-window-content {
    padding: 14px;
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
    cursor: auto;
    white-space: normal;
    word-wrap: break-word;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-gutter: stable;
    -webkit-overflow-scrolling: touch;
}

.info-window-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.info-window-toolbar label {
    font-size: 14px;
    font-weight: 600;
}

.info-window-toolbar select {
    font-size: 14px;
    padding: 4px 6px;
}

.info-window-section-title {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 6px;
}

.info-window-role-entry {
    margin-bottom: 10px;
}

.info-window-role-line {
    line-height: 1.35;
}

.info-window-role-line-detail {
    padding-left: 14px;
}

/* For Webkit browsers (Chrome, Edge, Safari) */
.info-window-content::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

.info-window-content::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.08);
}

.info-window-content::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.5);
    border-radius: 4px;
}

.info-window-footer {
    padding: 10px 14px;
    background: #ddd;
    text-align: right;
    flex-shrink: 0;
}

.info-window-link a {
    color: #003399;
    text-decoration: underline;
}

.info-window-close-btn {
    float: right;
    background: #c33;
    color: #fff;
    border: none;
    border-radius: 3px;
    padding: 2px 5px;
    cursor: pointer;
}

.resize-handle {
    position: absolute;
    width: 16px;
    height: 16px;
    background: #333;
    bottom: 0;
    right: 0;
    cursor: nwse-resize;
}

/* Added styles for search results */
#search-results {
    background: #eee;
    padding: 10px;
    display: none;
    min-height: 100px;
    max-height: 300px;
    overflow: auto;
    box-sizing: border-box;
}

#search-results table {
    width: 100%;
    border-collapse: collapse;
}

#search-results th, #search-results td {
    border: 1px solid #999;
    padding: 4px;
    font-size: 12px;
    cursor: pointer;
}

#search-results .highlight {
    background: #ff0;
}

#loading-container {
    width: 100%;
    height: 30px;             /* Adjust height as needed */
    background: #ddd;
    overflow: hidden;
    margin-bottom: 10px;      /* optional spacing below the loading bar */
}

#loading-bar {
    width: 0%;
    height: 100%;
    background: #4285f4;
    transition: width 0.2s ease;
}
