* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

header {
    padding: 24px 30px 30px 30px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 20px;
}

header svg {
    fill: #aaa;
}

a {
    color: rgb(33, 176, 135);
}

hr {
    opacity: 0.1;
    margin: 0 6px;
}

.container {
    display: flex;
    height: 100vh;
    width: 100vw;
    background: #f8f9fa;
}

.sidebar {
    width: 25%;
    max-width: 500px;
    min-width: 380px;
    border-right: 1px solid #dfe2e5;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.tree-panel {
    flex: 1;
    padding: 20px 30px 30px 30px;
    overflow: auto;
}

.tree-panel h2 {
    margin-bottom: 15px;
    color: #333;
    font-size: 18px;
    font-weight: 600;
}

.viewer-container {
    flex: 1;
    position: relative;
    overflow: hidden;
    background-image: radial-gradient(circle at center, #ced0d0 0, #d7d9d9, #f5f5f5 90%);
}

.viewer-container::after {
    content: '';
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    width: 2px;
    height: 2px;
    background: #f5f5f5;
}

webvis-viewer {
    width: 100%;
    height: 100%;
    display: block;
}

webvis-tree {
    position: absolute;
    top: 0;
    left: 0;
    width: 300px;
    height: 100%;
    background: rgba(248, 249, 250, 0.95);
    backdrop-filter: blur(10px);
    border-right: 1px solid #e9ecef;
    z-index: 20;
    overflow-y: auto;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

webvis-tree:hover {
    transform: translateX(0);
}

webvis-navigation-cube {
    position: absolute;
    top: 50px;
    right: 60px;
    z-index: 10;
    --webvis-navigation-cube-in-front-background-color: rgba(255, 255, 255, 0.761);
    --webvis-navigation-cube-in-front-border-color: rgba(255, 255, 255, 0.2);
    --webvis-navigation-cube-background-color: rgba(214, 214, 214, 0.391);
    --webvis-navigation-cube-border-color: rgb(168, 167, 167);
}

webvis-gizmo {
    position: absolute;
    bottom: 20px;
    right: 20px;
    z-index: 10;
}

/* Tree Overlay Panel */
.tree-overlay {
    position: absolute;
    top: 0px;
    left: 0px;
    width: 320px;
    height: 100%;
    background: #f8f9fa;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    z-index: 30;
    overflow: hidden;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.tree-overlay.hidden {
    transform: translateX(-100%);
    opacity: 0;
    pointer-events: none;
}

.tree-header {
    position: relative;
    height: 111px;
}

.tree-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.tree-toggle {
    position: absolute;
    top: 22px;
    left: 30px;
    background: none;
    border: none;
    font-size: 26px;
    color: #aaa;
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.tree-toggle:hover {
    color: #666;
}

.tree-content {
    height: calc(100% - 60px);
    overflow-y: auto;
    padding: 10px;
}

.tree-content webvis-tree {
    position: static;
    width: 100%;
    height: 100%;
    background: transparent;
    backdrop-filter: none;
    border: none;
    box-shadow: none;
}

/* Open Tree Button (when panel is closed) */
.tree-open-btn {
    position: absolute;
    top: 20px;
    left: 22px;
    width: 45px;
    height: 45px;
    background: transparent;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    z-index: 25;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.2s ease;
    fill: #aaa;
}

.tree-open-btn:hover {
    fill: #666;
    border: none;
}

.tree-open-btn span {
    line-height: 1;
}

/* Controls Panel Styles */
.control-section {
    margin-bottom: 11px;
}

.control-section:last-child {
    margin-bottom: 0;
}

.control-section h3 {
    margin: 0 0 1rem 0;
    font-size: 1rem;
    font-weight: 600;
    color: #333;
}

/* Info Icon Styles */
.info-container {
    position: absolute;
    right: 46px;
    top: 12px;
}

.info-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    color: #6c757d;
    cursor: text;
    transition: color 0.2s ease;
}

.info-icon:hover svg {
    fill: #a5a7ab;
}

.info-icon svg {
    transition: all 0.2s ease;
    fill: #d1d5db;
    width: 100%;
    height: 100%;
}

#clearButton {
    justify-self: end;
    margin-top: 1em;
    margin-right: 6px;
    display: none;
    appearance: none;
    background: none;
    border: none;
    font-size: 26px;
    color: #aaa;
    cursor: pointer;
    padding: 2px 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

#clearButton:hover {
    background: #f0f1f3;
    cursor: pointer;
}

.tooltip {
    position: absolute;
    top: 100%;
    right: -12px;
    margin-top: 6px;
    padding: 12px;
    background: #2c3e50;
    color: white;
    border-radius: 6px;
    font-size: 12px;
    line-height: 1.4;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition:
        opacity 0.2s ease,
        visibility 0.2s ease,
        transform 0.2s ease;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    width: 300px;
}

.tooltip::after {
    content: '';
    position: absolute;
    bottom: 100%;
    right: 16px;
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 6px solid #2c3e50;
}

.tooltip a {
    color: white;
    text-decoration: underline;
}

.tooltip a::before, .tooltip a::after {
    content: '"';
}

.info-container:hover .tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.teaser {
    font-size: 0.85em;
    color: #666;
    margin-bottom: 1em;
    margin-left: 2px;
}

.input-group {
    position: relative;
    display: flex;
    align-items: center;
}

.message-input {
    flex: 1;
    padding: 12px 75px 12px 16px;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    background: #ffffff;
    color: #333;
    transition: all 0.2s ease;
    outline: none;
    text-overflow: ellipsis;
}

.message-input:focus {
    border-color: rgb(40, 221, 170);
    /* box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1); */
}

.message-input::placeholder {
    color: #9ca3af;
}

.send-button {
    position: absolute;
    right: 6px;
    width: 32px;
    height: 32px;
    background: rgb(40, 221, 170);
    border: none;
    border-radius: 6px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: bold;
    transition: all 0.2s ease;
    z-index: 1;
}

.send-button:hover {
    background: rgb(40, 230, 176);
    box-shadow: 0 2px 4px rgba(99, 102, 241, 0.2);
}

.send-button:active {
    transform: translateY(0);
}

.send-button:disabled {
    background: #d1d5db;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.send-button svg.cancel {
    display: none;
}

.send-button svg.arrow {
    transform: rotate(90deg);
}

.send-button svg.circle {
    display: none;
}

.send-button.loading {
    border-radius: 50%;
}

.send-button.loading svg.arrow {
    display: none;
}

.send-button.loading svg.circle {
    display: block;
}

.send-button.loading svg.cancel {
    position: absolute;
    top: -2px;
    left: -2px;
    display: block;
    transition: transform 0.25s ease;
}

.send-button.loading svg.cancel:hover {
    transition: transform 0.1s;
    transform: scale(1.1);
}

.send-button.loading svg.cancel:active {
    transform: scale(0.95);
}

.send-button.loading svg.circle circle {
    transform-origin: 50% 50%;
    animation: spin 2s linear infinite;
}

.selected-nodes {
    visibility: hidden;
    min-height: 18px;
    font-size: 12px;
    color: #999;
    margin: 12px 10px 0px 18px;
}

.selected-nodes ul {
    display: inline-block;
    vertical-align: middle;
}

.selected-nodes li {
    display: inline-block;
    /* padding: 2px 4px; */
    /* border: 1px solid #dddddd91; */
    /* background: #f8f9fa; */
    /* border-radius: 10px; */
    max-width: 100px;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
}

.selected-nodes li::after {
    content: ",";
}

.selected-nodes li:last-child:after {
    content: "";
}

.selected-nodes li:not(:first-child) {
    margin-left: 4px;
}

.details {
    margin-top: 37px;
    margin-left: 6px;
    margin-right: 6px;
    font-size: 0.95em;
    color: #444;
    opacity: 0.5;
    transition: opacity 0.5s ease-out;
}

.details h4 {
    margin-top: 1.5em;
}

.details ul {
    margin-left: 1em;
    padding-top: 0.5em;
}

.details ul li {
    margin-bottom: 0.5em;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* Heatmap Legend Styles */
.heatmap-legend {
    margin-top: 20px;
    padding: 16px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    font-size: 12px;
}

.legend-title {
    font-weight: 600;
    color: #495057;
    margin-bottom: 12px;
    text-align: center;
}

.legend-scale {
    position: relative;
    margin-bottom: 8px;
}

.legend-gradient {
    height: 20px;
    border-radius: 4px;
    background: linear-gradient(to right, 
        rgb(0, 255, 0) 0%,     /* Pure green at value 0 */
        rgb(128, 255, 0) 16.67%, /* Yellow-green */
        rgb(255, 255, 0) 33.33%, /* Yellow */
        rgb(255, 128, 0) 50%,    /* Orange */
        rgb(255, 64, 0) 66.67%,  /* Red-orange */
        rgb(255, 0, 0) 100%      /* Pure red at value 30 */
    );
    border: 1px solid #dee2e6;
    margin-bottom: 4px;
}

.legend-labels {
    display: flex;
    justify-content: space-between;
    color: #6c757d;
    font-size: 11px;
    font-weight: 500;
}

.legend-description {
    display: flex;
    justify-content: space-between;
    color: #868e96;
    font-size: 10px;
    margin-top: 4px;
}

.legend-min,
.legend-max {
    font-style: italic;
}
