body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    margin: 0;
    padding: 20px;
    background-color: #f5f5f5;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: relative;
}

h1 {
    text-align: center;
    color: #2c3e50;
    margin-bottom: 20px;
}

h2 {
    color: #34495e;
    margin: 20px 0;
}

/* Прогресс-бары */
.progress-bars {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255, 255, 255, 0.95);
    padding: 10px 0;
    margin: -20px -20px 20px -20px;
    border-radius: 10px 10px 0 0;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.progress-bar-container {
    padding: 0 20px;
}

.progress-bar-container + .progress-bar-container {
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    padding-top: 10px;
}

.progress-bar {
    background: #e0e0e0;
    height: 6px;
    border-radius: 3px;
    margin: 0 20px;
    position: relative;
    overflow: hidden;
}

.progress-fill {
    background: #3498db;
    height: 100%;
    border-radius: 3px;
    width: 0%;
    transition: width 0.3s ease-in-out;
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        rgba(255,255,255,0) 0%,
        rgba(255,255,255,0.3) 50%,
        rgba(255,255,255,0) 100%
    );
    animation: shine 1.5s infinite;
}

@keyframes shine {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.progress-info {
    text-align: center;
    margin-top: 8px;
    padding: 0 20px;
}

.progress-text {
    font-size: 14px;
    color: #2c3e50;
    font-weight: 500;
}

.progress-details {
    font-size: 12px;
    color: #7f8c8d;
    margin-top: 2px;
}

/* Блок ввода URL */
.input-block {
    margin-bottom: 30px;
}

.url-input {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

input[type="url"], input[type="text"] {
    flex: 1;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 16px;
    transition: border-color 0.3s;
}

input[type="url"]:focus, input[type="text"]:focus {
    border-color: #3498db;
    outline: none;
}

/* Кнопки */
button {
    padding: 12px 25px;
    border: none;
    border-radius: 6px;
    background-color: #3498db;
    color: white;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
}

button:hover {
    background-color: #2980b9;
}

.primary-button {
    background-color: #2ecc71;
    font-weight: 500;
    font-size: 16px;
}

.primary-button:hover {
    background-color: #27ae60;
}

/* Кнопка создания базы знаний */
.knowledge-base-button {
    background-color: #8e44ad;
    font-weight: 500;
    font-size: 16px;
    padding: 10px 20px;
}

.knowledge-base-button:hover {
    background-color: #703688;
}

.cancel-button {
    background-color: #f39c12;
    font-weight: 500;
    font-size: 16px;
}

.cancel-button:hover {
    background-color: #e67e22;
}

/* Специальная кнопка для редактора промптов */
.special-button {
    background-color: #9b59b6;
    font-weight: 500;
}

.special-button:hover {
    background-color: #8e44ad;
}

/* Кнопка скачивания */
.download-button {
    background-color: #f39c12;
}

.download-button:hover {
    background-color: #d35400;
}

/* Панель управления */
.control-panel {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid #e0e0e0;
}

.action-buttons {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.copy-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.button-group {
    display: flex;
    flex: 1;
    min-width: 300px;
    gap: 8px;
    align-items: center;
    padding: 5px 10px;
    background: white;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
}

.button-group-label {
    font-size: 13px;
    font-weight: 600;
    color: #555;
    margin-right: 10px;
    white-space: nowrap;
}

.button-group button {
    flex: 0 0 auto;
    font-size: 13px;
    padding: 6px 12px;
}

.copy-buttons button {
    background-color: #95a5a6;
}

.copy-buttons button:hover {
    background-color: #7f8c8d;
}

/* Редактор промптов */
.prompt-editor-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.3s ease-in-out;
    overflow-y: auto;
}

.prompt-editor-container > div {
    background-color: white;
    width: calc(100% - 40px);
    max-width: 1000px;
    max-height: 90vh;
    border-radius: 12px;
    box-shadow: 0 5px 30px rgba(0, 0, 0, 0.3);
    overflow-y: auto;
    animation: slideIn 0.3s ease-in-out;
}

.prompt-editor-header {
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
    position: relative;
}

.prompt-editor-description {
    color: #666;
    margin-bottom: 10px;
}

.close-button {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    color: #777;
    font-size: 24px;
    cursor: pointer;
    padding: 5px;
}

.close-button:hover {
    color: #c0392b;
    background: none;
}

.prompt-editor {
    padding: 20px;
    border-bottom: 1px solid #eee;
}

.prompt-editor:last-child {
    border-bottom: none;
}

.prompt-editor h3 {
    margin-top: 0;
    color: #2c3e50;
}

.prompt-editor textarea {
    width: 100%;
    min-height: 200px;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-family: 'Consolas', 'Monaco', monospace;
    margin-bottom: 10px;
    resize: vertical;
    font-size: 14px;
}

.prompt-editor textarea:focus {
    border-color: #3498db;
    outline: none;
    box-shadow: 0 0 5px rgba(52, 152, 219, 0.5);
}

.prompt-editor .button-row {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.prompt-apply {
    background-color: #f39c12;
}

.prompt-apply:hover {
    background-color: #d35400;
}

#prompt-editors-content {
    max-height: calc(90vh - 100px);
    overflow-y: auto;
    padding: 0 20px 20px 20px;
}

/* Блок выбора страниц */
.selection-block {
    margin: 20px 0;
    padding: 20px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
}

.quick-filters {
    margin-bottom: 20px;
}

.category-filters {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.category-filters button {
    background-color: #95a5a6;
}

.category-filters button.active {
    background-color: #2ecc71;
}

/* Дерево страниц */
.pages-tree-container {
    margin-bottom: 15px;
}

#pagesSearchBox {
    margin-bottom: 10px;
}

#pagesSearch {
    width: 100%;
}

/* Дерево страниц */
.pages-tree-container {
    margin-bottom: 15px;
}

#pagesSearchBox {
    margin-bottom: 10px;
}

#pagesSearch {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

#pagesTree {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 10px;
    margin: 15px 0;
}

.jstree-default .jstree-category > .jstree-anchor {
    font-weight: bold;
    color: #2c3e50;
}

.jstree-default .jstree-leaf > .jstree-anchor {
    color: #333;
}

.jstree-default .jstree-hovered {
    background-color: #f1f9f3;
}

.jstree-default .jstree-clicked {
    background-color: #e1f5fe;
}

/* Кнопка действия */
.action-button {
    width: 100%;
    padding: 15px;
    background-color: #2ecc71;
    margin: 20px 0;
    font-size: 16px;
}

.action-button:hover {
    background-color: #27ae60;
}

/* Табы результатов */
.results-tabs {
    display: flex;
    gap: 10px;
    margin: 20px 0;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 10px;
}

.tab-btn {
    padding: 8px 16px;
    border: none;
    background: none;
    color: #666;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
}

.tab-btn.active {
    color: #3498db;
    border-bottom: 2px solid #3498db;
    margin-bottom: -12px;
}

/* Контент табов */
.tab-content {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
}

.tab-content.active {
    display: block;
}

/* Результаты парсинга */
.parsing-results, .processed-result {
    background: #f9f9f9;
    padding: 15px;
    border-radius: 6px;
    margin: 15px 0;
    white-space: pre-wrap;
    font-family: monospace;
}

.knowledge-base-content {
    background: #fff;
    padding: 20px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    margin: 15px 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

/* Анимации */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.selection-block, .results-block {
    animation: fadeIn 0.3s ease-in-out;
}

.tab-content.active {
    animation: slideIn 0.3s ease-out;
}

/* Адаптивность */
@media (max-width: 768px) {
    .url-input, .copy-buttons {
        flex-direction: column;
    }
    
    .category-filters {
        flex-direction: column;
    }
    
    button {
        width: 100%;
    }

    .results-tabs {
        flex-wrap: wrap;
    }
}

/* Стили для дерева категорий */
.tree-container {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 10px;
    margin-bottom: 15px;
}

/* Стили для кнопок выбора в категориях */
.node-selection-buttons {
    position: absolute;
    display: inline-flex;
    gap: 3px;
    z-index: 100;
    margin-left: 8px;
}

.node-selection-buttons button {
    padding: 1px 6px;
    font-size: 10px;
    font-weight: normal;
    color: #333;
    background-color: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.node-selection-buttons button:hover {
    background-color: #e8e8e8;
    border-color: #ccc;
}

.node-selection-buttons .select-node-all {
    background-color: #e3f2fd;
    border-color: #90caf9;
    color: #1976d2;
}

.node-selection-buttons .select-node-all:hover {
    background-color: #bbdefb;
    border-color: #64b5f6;
}

.node-selection-buttons .deselect-node-all {
    background-color: #f5f5f5;
    border-color: #ddd;
    color: #666;
}

.node-selection-buttons .deselect-node-all:hover {
    background-color: #eeeeee;
    border-color: #bbb;
}

/* Стиль для выделения категорий, которые можно выбрать */
.selectable-category > .jstree-anchor {
    position: relative;
}

/* Увеличиваем минимальную высоту для строк с кнопками */
.jstree-node {
    min-height: 24px !important;
}

/* Дополнительные стили для кнопок в дереве */
.tree-select-btn, .tree-deselect-btn {
    font-size: 0.7rem;
    padding: 1px 6px;
    border-radius: 3px;
    cursor: pointer;
    white-space: nowrap;
    border: 1px solid #ccc;
    background: #f8f8f8;
    color: #333;
    transition: all 0.2s ease;
}

.tree-select-btn:hover {
    background: #4CAF50;
    color: white;
    border-color: #4CAF50;
}

.tree-deselect-btn:hover {
    background: #F44336;
    color: white;
    border-color: #F44336;
}

/* Подсветка категорий с доступным для парсинга содержимым */
.selectable-category > .jstree-anchor {
    font-weight: bold !important;
    color: #2196F3 !important;
}

/* Улучшение внешнего вида дерева */
.jstree-default .jstree-anchor {
    line-height: 24px;
    height: 24px;
}

.jstree-default .jstree-icon {
    color: #555;
}

/* Делаем больше отступ справа у элементов дерева, 
   чтобы уместить кнопки выбора */
.jstree-node {
    margin-right: 180px;
}

/* Улучшаем видимость выбранных элементов */
.jstree-default .jstree-clicked {
    background: #e3f2fd !important;
    box-shadow: inset 0 0 1px #2196F3 !important;
}
