/* Основной контейнер */
.constructor-container {
    display: flex;
    height: calc(100vh - 100px);
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    font-family: Arial, sans-serif;
}

/* ЛЕВАЯ КОЛОНКА */
.sidebar {
    width: 320px;
    background: #f7f7f7;
    border-right: 1px solid #ddd;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 15px;
    background: #eaeaea;
    border-bottom: 1px solid #ddd;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.add-node-btn {
    width: 32px;
    height: 32px;
    font-size: 22px;
    cursor: pointer;
    border: none;
    background: #4B70C3;
    color: white;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.add-node-btn:hover {
    background: #3a5aa0;
}

/* ПОЛЕ ПОИСКА */
.sidebar-search {
    padding: 10px;
    background: #fff;
    border-bottom: 1px solid #eee;
}

.sidebar-search input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

.sidebar-search input:focus {
    border-color: #4B70C3;
    outline: none;
}

.node-list {
    flex: 1;
    overflow-y: auto;
}

/* ЭЛЕМЕНТ СПИСКА */
.node-item {
    padding: 10px 15px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.2s;
}

.node-item:hover {
    background: #eef2fa;
}

.node-item.active {
    background: #4B70C3;
    border-bottom-color: #4B70C3;
}

.node-title {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.node-key {
    font-size: 11px;
    color: #888;
    font-family: monospace;
}

.node-item.active .node-title {
    color: #fff;
}

.node-item.active .node-key {
    color: rgba(255, 255, 255, 0.7);
}

/* ПРАВАЯ КОЛОНКА */
.editor-area {
    flex: 1;
    padding: 25px;
    overflow-y: auto;
    background: #fff;
    position: relative;
}

#editor-placeholder {
    display: flex;
    height: 100%;
    align-items: center;
    justify-content: center;
    color: #999;
    font-size: 18px;
}

.editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.editor-header h2 {
    margin: 0;
    font-size: 20px;
    color: #333;
}

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

.form-group label {
    display: block;
    font-weight: bold;
    margin-bottom: 5px;
    font-size: 14px;
    color: #555;
}

input[type="text"],
textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
}

input[type="text"]:focus,
textarea:focus {
    border-color: #4B70C3;
    outline: none;
}

textarea {
    resize: vertical;
    min-height: 100px;
    font-family: inherit;
}

.input-readonly {
    background: #f0f0f0;
    color: #777;
}

/* КНОПКИ РЕДАКТОРА */
#buttons-container {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 10px;
}

.btn-row-card {
    display: flex;
    gap: 8px;
    background: #fff;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 6px;
    margin-bottom: 8px;
    align-items: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.btn-name-input {
    font-weight: bold;
}

.btn-type-select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #f0f4ff;
    cursor: pointer;
}

.btn-value-input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.remove-btn-x {
    width: 24px;
    height: 24px;
    background: #ffebee;
    color: #c62828;
    border: 1px solid #ffcdd2;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.remove-btn-x:hover {
    background: #ffcdd2;
}

.highlight-group input {
    border-color: #4B70C3;
    background: #f4f8ff;
}

/* ТУЛБАР И ЭМОДЗИ */
.toolbar {
    display: flex;
    gap: 5px;
    margin-bottom: 5px;
    position: relative;
}

.tool-btn {
    padding: 6px 12px;
    background: #eee;
    border: 1px solid #ccc;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
}

.tool-btn:hover {
    background: #e0e0e0;
}

/* 🔥 АККУРАТНОЕ ОКНО ЭМОДЗИ С ПРОКРУТКОЙ */
#emoji-picker {
    position: absolute;
    top: 40px;
    left: 0;
    width: 340px;
    max-height: 250px;
    /* Ограничение высоты */
    overflow-y: auto;
    /* Вертикальная прокрутка */
    background: white;
    border: 1px solid #ccc;
    padding: 8px;

    display: grid;
    grid-template-columns: repeat(8, 1fr);
    /* 8 в ряд */
    gap: 4px;

    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    border-radius: 8px;
}

/* Стилизация скроллбара для Chrome/Safari */
#emoji-picker::-webkit-scrollbar {
    width: 6px;
}

#emoji-picker::-webkit-scrollbar-track {
    background: #f1f1f1;
}

#emoji-picker::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

#emoji-picker span {
    cursor: pointer;
    font-size: 22px;
    padding: 4px;
    text-align: center;
    border-radius: 4px;
    transition: transform 0.1s;
}

#emoji-picker span:hover {
    background: #f0f0f0;
    transform: scale(1.2);
}

.hidden {
    display: none !important;
}

/* Кнопки действий */
.btn-success {
    background: #28a745;
    color: white;
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
}

.btn-danger {
    background: #dc3545;
    color: white;
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.btn-secondary {
    background: #6c757d;
    color: white;
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
}