:root {
    --main-green: #28ac23;
    --line-color: #ddd;
    /* Кодированный SVG (цвет #444444) */
    --svg-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23444444' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 18l6-6-6-6'%3E%3C/path%3E%3C/svg%3E");
    /* Зеленый SVG для hover-эффекта */
    --svg-arrow-hover: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2328ac23' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 18l6-6-6-6'%3E%3C/path%3E%3C/svg%3E");
}


/* Контейнер всей карты */
.sitemap-tree > ul {
    display: flex;
    flex-direction: column; /* Все блоки один под другим */
    gap: 20px; /* Расстояние между основными разделами */
    padding: 0;
    list-style: none;
    width: 100%; /* Занимает всю ширину контейнера */
}

.sitemap-tree > ul > .sitemap-item {
    width: 100%;
    flex: none; /* Отключаем гибкость flex-элементов */
}

/* Настраиваем вложенные списки (со 2-го уровня и глубже) */
.sitemap-tree ul ul {
    list-style: none;
    padding-left: 20px;
    margin-left: 10px; /* Отступ для линии */
    position: relative;
    /* Жирная пунктирная линия */
}

/* Стили для элементов */
.sitemap-item {
    position: relative;
}

/* Иконка-стрелочка перед текстом */
.item-content {
    display: flex;
    /* Выравнивание по верхнему краю, чтобы маркер не уплывал в центр при двух строках */
    align-items: flex-start; 
    position: relative;
    line-height: 1.4; /* Фиксируем высоту строки для предсказуемости */
}

/* Настройка SVG маркера */
.item-content::before {
    content: "";
    display: inline-block;
    /* Фиксируем размеры, чтобы они не менялись */
    width: 14px;
    height: 14px;
    min-width: 14px; /* Запрещаем сжатие по горизонтали */
    min-height: 14px; /* Запрещаем сжатие по вертикали */
    flex-shrink: 0;   /* ГАРАНТИЯ того, что маркер не уменьшится */
    
    margin-right: 8px;
    /* Центрируем маркер относительно первой строки текста */
    margin-top: auto;
    margin-bottom: auto; 
    
    background-image: var(--svg-arrow);
    background-size: contain;
    background-repeat: no-repeat;
    background-position: 50% 50%;
    transition: background-image 0.2s;
}

.item-content a {
    text-decoration: none;
    color: #333;
    font-size: 16px;
    padding-left: 5px;
    transition: all 0.2s ease;
}

/* 2. ПЕРВЫЙ УРОВЕНЬ (Заголовки разделов) */
/* Используем максимально точный путь, чтобы перебить все остальные стили */
.sitemap-tree > ul > .sitemap-item > .item-content a {
    font-size: 22px;
    font-weight: 800;
    /* Принудительно зеленый */
    text-transform: uppercase;
    width: 100%;
    padding-left: 0;
    pointer-events: auto; /* Позволяем клики, если это не disabled */
}

/* 3. ИСКЛЮЧЕНИЕ ДЛЯ НЕКЛИКАБЕЛЬНЫХ ПУНКТОВ */
/* Это правило должно быть ниже или сильнее, чтобы сделать заголовок черным, если там # */
.item-content a.disabled-link {
    color: #333 !important; /* Перекрашиваем в черный, если ссылка # */
    pointer-events: none !important;
    text-decoration: none !important;
}

/* 4. ПОВЕДЕНИЕ ПРИ НАВЕДЕНИИ (HOVER) */
/* Для всех активных ссылок */
.item-content a:not(.disabled-link):hover {
    color: var(--main-green) !important;
}

/* Для обычных ссылок (не главных заголовков) добавляем смещение */
.sitemap-tree ul ul .item-content a:not(.disabled-link):hover {
    transform: translateX(4px);
}


/* Убираем стрелочку у самых главных заголовков */
.sitemap-tree > ul > .sitemap-item > .item-content::before {
    display: none;
}



.sidebar-block {
    background-color: #efefef; /* Светло-серый фон как на фото */
    border: 1px solid #e0e0e0;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
    padding: 0 5px 15px 5px;
}

/* Заголовок ПОИСК */
.sidebar-title {
    padding: 10px 22px;
    font-size: 1.3rem;
    line-height: 1;
    font-weight: 600;
    word-wrap: normal;
    hyphens: none;
    -webkit-hyphens: none;
    display: -webkit-box;
    overflow: hidden;
    margin: 0 5px;
    border-bottom: 1px solid rgb(192, 192, 192);
}

/* Обертка поля ввода */
.search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    background: transparent;
    transition: border-color 0.3s ease;
}

.search-wrapper:focus-within {
    border-color: #28ac23;
}

/* Поле ввода */
#searchBox {
    width: 100%;
    border: none;
    background: transparent;
    padding: 10px 35px 10px 40px; /* Отступы под иконки */
    font-size: 15px;
    color: #333;
    outline: none;
}

/* Иконка лупы (слева) */
.search-icon {
    position: absolute;
    left: 12px;
    width: 18px;
    height: 18px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' stroke='%23888' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' viewBox='0 0 24 24'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    opacity: 0.6;
}

/* Кнопка очистки (справа) */
.clear-btn {
    position: absolute;
    right: 8px;
    background: none;
    border: none;
    font-size: 24px;
    color: #aaa;
    cursor: pointer;
    display: none; /* Управляется JS */
    line-height: 1;
}

.clear-btn:hover {
    color: #333;
}

.highlight {
    background-color: #e2f5e1;
    font-weight: bold;
    color: #000 !important;
}

.hidden {
    display: none !important;
}

#noResultsMessage {
    display: none;
    padding: 20px;
    color: #666;
    text-align: center;
    background: #f9f9f9;
    border-radius: 4px;
    margin-bottom: 20px;
}

/* Стили для неактивных ссылок (#) */
.item-content a.disabled-link {
    pointer-events: none; /* Ссылка не кликабельна */
    cursor: default;     /* Курсор остается обычной стрелкой */
    color: #333;         /* Цвет текста как у обычного текста */
    text-decoration: none; /* Убираем подчеркивание, если оно было */
    font-weight: 600;
}

/* Дополнительно гарантируем, что hover не сработает через родителя */
.sitemap-item:hover > .item-content a.disabled-link {
    color: #333 !important; 
}

/* Если вы используете SVG-маркеры, можно сделать их полупрозрачными для таких пунктов */
.sitemap-item:has(> .item-content a.disabled-link) > .item-content::before {
    opacity: 0.5;
    background-image: none !important; /* Запрещаем смену на зеленый SVG */
}

/* Стили для информации о результатах поиска */
.search-results-info {
    padding: 15px 22px;
    border-top: 1px solid #e0e0e0;
    background-color: #f8f8f8;
}

.search-results-info p {
    margin: 5px 0;
    font-size: 14px;
    color: #555;
}

.show-all-link {
    color: #28ac23;
    text-decoration: none;
    font-weight: 600;
}

.show-all-link:hover {
    text-decoration: underline;
}

.show-message {
    display: block !important;
}

#searchResultsHeader {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #28ac23;
}

#searchResultsHeader h3 {
    color: #333;
    margin: 0 0 5px 0;
}

#searchResultsHeader p {
    color: #666;
    margin: 0;
    font-size: 14px;
}

.no-more-results {
    color: #888;
    font-style: italic;
    font-size: 13px;
    padding-left: 20px;
    margin: 5px 0;
}

/* Стили для найденных элементов при AJAX-поиске */
.sitemap-item.search-match > .item-content a {
    color: #28ac23 !important;
    font-weight: bold;
}

/* Подсветка найденных элементов */
.item-content a.search-highlight {
    background-color: #e2f5e1;
    padding: 2px 5px;
    border-radius: 3px;
}
