/* Убираем display: flex с body, если он там был для предыдущего макета */
body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    display: flex;
    height: 100vh;
    overflow: hidden; /* Prevent body scrolling */
}

.sidebar {
    width: 50px;
    background-color: #f0f0f0;
    padding: 10px 5px;
    display: flex;
    flex-direction: column;
    align-items: center;
    border-right: 1px solid #ccc;
    z-index: 100;
}

.sidebar button {
    width: 40px;
    height: 40px;
    margin-bottom: 10px;
    font-size: 20px;
    border: 1px solid #ccc;
    border-radius: 5px;
    background-color: #fff;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
}

.sidebar button:hover {
    background-color: #e9e9e9;
}

.app-container {
    flex-grow: 1; /* Take up remaining space */
    display: flex;
    flex-direction: row;
    height: 100%;
    overflow: hidden;
}

.main-content {
    flex-grow: 1;
    position: relative; /* For positioning overlays like statsPanel */
    height: 100%;
}

.controls {
    min-width: 350px;
    width: 350px; /* Fixed width */
    flex-shrink: 0; /* Prevent from shrinking */
    padding: 15px;
    border-left: 1px solid #ccc;
    overflow-y: auto;    
    height: 100%;        
    box-sizing: border-box;
}

.controls > div {
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px dashed #eee;
}
.controls > div:last-child {
    border-bottom: none;
}


#offsetsPanel { 
    position: absolute;
    top: 10px; 
    left: 10px;
    width: 300px; 
    padding: 8px;
    z-index: 100;
    background-color: rgba(240, 240, 240, 0.85);
    /*font-size: 11px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);*/
}

label {
    display: block;
    margin-bottom: 5px;
}

input[type="file"], input[type="number"] {
    margin-bottom: 10px;
    width: calc(100% - 22px);
    padding: 5px;
    box-sizing: border-box; 
}

/* Стили для новых полей ввода смещений */
.spacing-inputs-container {
    display: flex;          
    align-items: center;    
    margin-bottom: 10px;    
}

.spacing-inputs-container span {
    margin-right: 5px;      
}

.spacing-input {
    width: 70px;            
    padding: 5px;
    box-sizing: border-box;
    margin-right: 10px;     
}

.spacing-input:last-child {
    margin-right: 0;        
}

button {
    padding: 8px 12px;
    margin-top: 5px;
    margin-right: 5px;
    cursor: pointer;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
}
button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}
button:hover:not(:disabled) {
    background-color: #0056b3;
}


#graphContainer {
    width: 100%;
    height: 100%;
    background-color: #ffffff;
    overflow: hidden;    
    position: absolute;
    top: 0;
    left: 0; /* <<<< ИЗМЕНЕНО: граф теперь слева */
    right: 350px; /* <<<< ДОБАВЛЕНО: справа от графа будет панель .controls */
    bottom: 0;
}

.selected-info p {
    font-size: 0.9em;
    margin: 5px 0;
}
.selected-info span {
    font-weight: bold;
}

/* Styles for CSS2D Node Labels */
.node-label {
    font-size: 10px;
    color: #000; /* Default color, will be overridden by JS if node.color is set */
    background-color: rgba(255, 255, 255, 0.75); /* Semi-transparent white background */
    padding: 1px 3px;
    border-radius: 3px;
    user-select: none; /* Prevent text selection on labels */
    pointer-events: none; /* Labels should not interfere with mouse events on the graph */
    /* Position the label slightly above the node center */
    /* This might need adjustment based on your node sizes and desired appearance */
    transform: translateY(-100%); 
}

/* Styles for CSS2D Link Labels */
.link-label {
    font-size: 9px;
    color: #333; /* Темно-серый цвет для текста по умолчанию */
    background-color: rgba(255, 255, 255, 0.7); /* Полупрозрачный белый фон */
    padding: 1px 2px;
    border-radius: 2px;
    user-select: none;
    pointer-events: none; 
    /* text-shadow: -1px -1px 0 #fff, 1px -1px 0 #fff, -1px 1px 0 #fff, 1px 1px 0 #fff; /* Белая обводка для лучшей читаемости */
}

/* Label Controls Panel */
.label-controls-panel {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: rgba(240, 240, 240, 0.85);
    padding: 8px;
    border-radius: 5px;
    z-index: 10; 
    font-size: 12px;
}

.label-controls-panel div {
    /* margin-bottom: 5px; */ /* Больше не нужно для горизонтального расположения */
    display: flex; 
    align-items: center; 
}

.label-controls-panel label {
    margin-left: 5px;
    user-select: none;
}

.label-controls-panel input[type="checkbox"] {
    vertical-align: middle;
}

/* Styles for Edit Label Panel */
#editLabelPanel {
    background-color: #f9f9f9;
    border-radius: 4px;
}

#editLabelPanel label {
    display: inline;
    margin-bottom: 5px;
}

#editLabelPanel input[type="text"] {
    width: calc(100% - 12px); 
    padding: 5px;
    margin-bottom: 10px;
    box-sizing: border-box;
}

#editLabelPanel button {
    margin-right: 5px;
}

/* Styles for Edit Seam Label Panel */
#editSeamLabelPanel {
    background-color: #f9f9f9;
    border-radius: 4px;
    /* margin-top: 10px; /* Already applied via inline style in HTML for the div */
    /* padding: 10px; /* Already applied via inline style in HTML for the div */
    /* border: 1px solid #ccc; /* Already applied via inline style in HTML for the div */
}

#editSeamLabelPanel label {
    display: block;
    margin-bottom: 5px;
}

#editSeamLabelPanel input[type="text"] {
    width: calc(100% - 12px); 
    padding: 5px;
    margin-bottom: 10px;
    box-sizing: border-box;
}

#editSeamLabelPanel button {
    margin-right: 5px;
}

#viewTopBtn {
    position: absolute;
    top: 70px;
    margin: 0;
    right: 10px; 
    z-index: 10;
}

#statsPanel {
    position: absolute;
    bottom: 10px; 
    left: 10px; /* <<<< ИЗМЕНЕНО: Сдвинута левее, например, справа от label-controls-panel */
    width: auto; 
    background-color: rgba(240, 240, 240, 0.85);
    padding: 8px;
    z-index: 100;
    font-size: 11px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

#statsPanel strong {
    font-size: 12px;
}

#statsPanel span {
    font-weight: bold;
    color: #007bff;
}

/* Style for new pan buttons in stats panel */
.pan-btn {
    padding: 2px 5px;
    font-size: 10px;
    margin-left: 8px;
    vertical-align: middle; /* Align with text */
    cursor: pointer;
    background-color: #6c757d; /* A more neutral color */
    color: white;
    border: none;
    border-radius: 3px;
}

.pan-btn:hover {
    background-color: #5a6268;
}

#infoPanel {
    /*position: absolute;
    top: 10px; 
    left: 10px;*/
    width: 300px;
    height: auto;
    max-height: 90vh;
    overflow-y: scroll;
    background-color: rgba(240, 240, 240, 0.85);
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    padding: 8px;
    z-index: 100;
}

.session-panel {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #ccc;
}

.sync-offsets-container {
    margin: 10px 0;
    text-align: center;
}

/* Styles for Info Panels to allow HTML content */
.info-pre {
    background-color: #f4f4f4;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 10px;
    font-family: monospace;
    white-space: pre-wrap;
    word-wrap: break-word;
    max-height: 300px;
    overflow-y: auto;
    font-size: 1em;
    margin-bottom: 10px;
}

.info-pre p {
    margin: 0 0 5px 0;
}

.info-pre hr {
    border: none;
    border-top: 1px solid #ddd;
    margin: 10px 0;
}

/* Styles for comparison results */
.match-success {
    color: #28a745; /* Bootstrap success green */
    font-weight: bold;
}

.match-fail {
    color: #dc3545; /* Bootstrap danger red */
    font-weight: bold;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    width: 800px;
    max-width: 90%;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.modal-body {
    display: flex;
    justify-content: space-between;
    gap: 20px;
}

.source-selector {
    flex: 1;
    border: 1px solid #ccc;
    padding: 15px;
    border-radius: 5px;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
}

.form-group select {
    width: 100%;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.modal-footer {
    margin-top: 20px;
    text-align: right;
}

.modal-footer button {
    margin-left: 10px;
    padding: 10px 15px;
}

/* Color Legend Styles */
.color-legend {
    position: absolute;
    bottom: 120px;
    left: 10px; /* Position to the right of statsPanel */
    background-color: rgba(240, 240, 240, 0.95);
    padding: 10px;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    z-index: 100;
    font-size: 11px;
    min-width: 200px;
    max-height: 400px;
    overflow-y: auto;
}

.color-legend h4 {
    margin: 0 0 8px 0;
    font-size: 13px;
    font-weight: bold;
    text-align: center;
    color: #333;
}

.color-legend h5 {
    margin: 8px 0 5px 0;
    font-size: 11px;
    font-weight: bold;
    color: #555;
    border-bottom: 1px solid #ccc;
    padding-bottom: 2px;
}

.legend-section {
    margin-bottom: 10px;
}

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

.legend-item {
    display: flex;
    align-items: center;
    margin-bottom: 3px;
    padding: 2px 0;
}

.legend-color {
    width: 12px;
    height: 12px;
    border: 1px solid #333;
    margin-right: 6px;
    flex-shrink: 0;
    border-radius: 2px;
}

.legend-item span {
    font-size: 10px;
    color: #333;
    line-height: 1.2;
}
