* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

html,
body {
    overflow: hidden;
}

#viewer-container {
    position: fixed;
    top: 0;
    left: 0;
    outline: none;
    width: 100%;
    height: 100%;
}

/* Controls Section */
.controls-section {
    position: absolute;
    top: 1rem;
    left: 1rem;
    background: rgba(255, 255, 255, 0.95);
    padding: 1rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 100;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    max-height: 70vh;
    overflow-y: auto;
}

.controls-section h4 {
    margin-bottom: 1rem;
    color: #2c3e50;
    font-size: 1rem;
    border-bottom: 1px solid #ecf0f1;
    padding-bottom: 0.5rem;
}

.checkboxes div {
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.checkboxes input[type="checkbox"] {
    margin: 0;
}

.checkboxes label {
    font-size: 0.9rem;
    color: #2c3e50;
}

/* Properties Panel Styles */
.properties-panel {
    position: fixed;
    top: 20px;
    right: 20px;
    
    /* Increased default width for better graph visibility */
    width: 600px; 
    min-width: 400px;
    max-width: 90vw;
    max-height: 80vh;
    
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    
    /* HIDDEN BY DEFAULT */
    display: none;
    
    border: 1px solid #e1e8ed;
    
    /* Enable resizing */
    resize: both;
    overflow: auto;
    
    /* Layout direction (active only when display becomes flex) */
    flex-direction: column;
}

/* Visible State - Triggered by JS */
.properties-panel.visible {
    display: flex;
}

.properties-header {
    background: #2c3e50;
    color: white;
    padding: 1rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.properties-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.close-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.properties-content {
    padding: 1.25rem;
    overflow-y: auto;
    flex-grow: 1;
}

.properties-section {
    margin-bottom: 1.5rem;
}

.properties-section:last-child {
    margin-bottom: 0;
}

.properties-section h4 {
    margin: 0 0 1rem 0;
    color: #2c3e50;
    font-size: 0.95rem;
    font-weight: 600;
    border-bottom: 2px solid #3498db;
    padding-bottom: 0.5rem;
}

.properties-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.property-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 0.75rem 0;
    border-bottom: 1px solid #f8f9fa;
}

.property-item:last-child {
    border-bottom: none;
}

.property-item label {
    font-weight: 600;
    color: #5d6d7e;
    min-width: 120px;
    margin-right: 1rem;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.property-item span {
    flex: 1;
    text-align: right;
    word-break: break-word;
    color: #2c3e50;
    font-size: 0.85rem;
    line-height: 1.4;
}

.property-set {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.property-set:last-child {
    margin-bottom: 0;
}

.property-set-header {
    font-weight: 700;
    color: #2d3748;
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
    border-bottom: 2px solid #edf2f7;
    padding-bottom: 0.5rem;
}

.property-set-content {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.empty-message {
    color: #a0aec0;
    font-style: italic;
    text-align: center;
    padding: 2rem;
    font-size: 0.85rem;
}

/* Chart Scroll Wrapper */
.chart-scroll-wrapper {
    width: 100%;
    overflow-x: auto; /* Enables horizontal scrolling */
    margin-top: 10px;
    border: 1px solid #f1f1f1;
    border-radius: 4px;
    background-color: #fff;
}

.chart-canvas-container {
    height: 400px;
    /* Forces chart to be wide, enabling scroll in parent wrapper */
    min-width: 2000px; 
    position: relative;
}

/* Scrollbar styling */
.properties-content::-webkit-scrollbar,
.chart-scroll-wrapper::-webkit-scrollbar {
    width: 6px;
    height: 8px; /* Height for horizontal scrollbar */
}

.properties-content::-webkit-scrollbar-track,
.chart-scroll-wrapper::-webkit-scrollbar-track {
    background: #f7fafc;
    border-radius: 3px;
}

.properties-content::-webkit-scrollbar-thumb,
.chart-scroll-wrapper::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 3px;
}

.properties-content::-webkit-scrollbar-thumb:hover,
.chart-scroll-wrapper::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

.controls-section::-webkit-scrollbar {
    width: 4px;
}

.controls-section::-webkit-scrollbar-track {
    background: #f7fafc;
    border-radius: 2px;
}

.controls-section::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 2px;
}

.controls-section::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

/* Loading State */
.loading {
    opacity: 0.7;
    pointer-events: none;
}

/* Responsive Design */
@media (max-width: 768px) {
    .controls-section {
        top: auto;
        bottom: 1rem;
        left: 1rem;
        right: 1rem;
        max-height: 30vh;
    }
    
    .properties-panel {
        left: 1rem;
        right: 1rem;
        width: auto;
        max-height: 60vh;
    }
}