/* ============================================================
   БОКОВАЯ ПАНЕЛЬ (САЙДБАР)
   ============================================================ */

.book-sidebar {
    width: 320px;
    background-color: #1e1e1e;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Заголовок боковой панели */
.sidebar-header {
    padding: 16px 20px;
    background: linear-gradient(135deg, #2a2a2a 0%, #1e1e1e 100%);
    border-bottom: 2px solid #ff6600;
}

.sidebar-header h3 {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 600;
    color: #ff6600;
    text-align: center;
    letter-spacing: 0.5px;
}

/* Основное дерево */
.sidebar-tree {
    list-style: none;
    padding: 8px 0;
    margin: 0;
}

/* Элемент дерева */
.tree-item {
    list-style: none;
    margin: 2px 0;
}

/* Заголовок элемента */
.tree-item-header {
    display: flex;
    align-items: center;
    padding: 10px 12px 10px 16px;
    border-radius: 6px;
    margin: 0 4px;
    transition: all 0.2s ease;
    cursor: pointer;
}

/* ============================================================
   СТИЛИ ДЛЯ ГЛАВ (ЖЕЛТЫЕ ТОНА)
   ============================================================ */

/* Ховер для заголовков глав */
.tree-item-header:hover .tree-chapter-title {
    color: #f1772e;
}

.tree-item-header:hover:has(.tree-chapter-title) {
    background-color: #ffaa0022;  /* прозрачный желтый фон */
}

/* Иконка разворота/сворачивания */
.toggle-icon {
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 35px;
    height: 35px;
    font-size: 10px;
    margin-right: 8px;
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

/* Цвет иконки для глав */
.tree-chapter-title + .toggle-icon,
.tree-item-header .toggle-icon {
    color: #ffaa66;
}

.toggle-icon:hover {
    color: #ffcc44;
}

/* Название главы (не ссылка) */
.tree-chapter-title {
    flex: 1;
    color: #e0c080;
    font-size: 1.25rem;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.2s ease;
}

/* Активная глава (если внутри неё открыта статья) */
.tree-item.active > .tree-item-header .tree-chapter-title {
    color: #ffaa00;
    font-weight: bold;
    text-shadow: 0 0 4px rgba(255, 170, 0, 0.5);
}

.tree-item.active > .tree-item-header:has(.tree-chapter-title) {
    background: linear-gradient(90deg, #9f6a00 0%, transparent 100%);
    border-left: 4px solid #bf4700;
}

/* ============================================================
   СТИЛИ ДЛЯ СТАТЕЙ (СИНИЕ ТОНА)
   ============================================================ */

/* Ссылка на статью */
.tree-link {
    flex: 1;
    text-decoration: none;
    padding: 4px 0;
    transition: all 0.2s ease;
    display: block;
    font-size: 1.05rem;
}

/* Обычное состояние статьи */
.tree-link {
    color: #27acf8;
}

/* Ховер для статей */
.tree-item-header:hover .tree-link {
    color: #44aaff;
    transform: translateX(4px);
}

.tree-item-header:hover:has(.tree-link) {
    background-color: #0088ff22;  /* прозрачный синий фон */
}

/* Активная статья */
.tree-item.active > .tree-item-header .tree-link {
    color: #002340;
    font-weight: bold;
    text-shadow: 0 0 4px rgba(68, 170, 255, 0.5);
}

.tree-item.active > .tree-item-header:has(.tree-link) {
    background: linear-gradient(90deg, #fad465 0%, transparent 100%);
    border-left: 4px solid #df5300;
}

/* ============================================================
   ОБЩИЕ СТИЛИ
   ============================================================ */

/* Дочерние элементы (вложенные) */
.tree-children {
    list-style: none;
    padding-left: 28px;
    margin: 0;
    overflow: hidden;
    transition: all 0.3s ease;
}

/* Стили для скроллбара боковой панели */
.book-sidebar::-webkit-scrollbar {
    width: 6px;
}

.book-sidebar::-webkit-scrollbar-track {
    background: #2a2a2a;
    border-radius: 3px;
}

.book-sidebar::-webkit-scrollbar-thumb {
    background: #ff6600;
    border-radius: 3px;
}

.book-sidebar::-webkit-scrollbar-thumb:hover {
    background: #ff8833;
}


/* ============================================================
   ДОПОЛНИТЕЛЬНЫЕ ВИЗУАЛЬНЫЕ ЭЛЕМЕНТЫ
   ============================================================ */

/* Разделители между основными элементами */
.tree-item:not(:last-child) {
    border-bottom: 1px solid #2a2a2a;
    margin-bottom: 4px;
}

/* Иконка для статей (можно добавить через псевдоэлемент) */
.tree-item-header:has(.tree-link)::before {
    content: "📄";
    font-size: 0.9rem;
    margin-right: 8px;
    opacity: 0.6;
    transition: opacity 0.2s ease;
}

.tree-item-header:has(.tree-link):hover::before {
    opacity: 1;
}

/* Иконка для глав */
.tree-item-header:has(.tree-chapter-title)::before {
    content: "📁";
    font-size: 0.9rem;
    margin-right: 8px;
    opacity: 0.7;
}

/* Если глава активна (открыта статья внутри) - иконка меняется */
.tree-item.active > .tree-item-header:has(.tree-chapter-title)::before {
    content: "📂";
    opacity: 1;
}

/* Альтернатива - если не хотите иконки, можно добавить отступы и фоновые эффекты */

/* Более насыщенные отступы и структура */
.tree-children {
    border-left: 1px dashed #3a3a3a;
    margin-left: 18px;
    padding-left: 10px;
}

/* Подсветка при наведении на весь пункт меню */
.tree-item-header {
    position: relative;
    transition: all 0.2s ease;
}

.tree-item-header:hover {
    background-color: #2a2a2a;
    transform: translateX(2px);
}

/* Тень для активного элемента */
.tree-item.active > .tree-item-header {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* Нумерация для глав (если хотите) */
.tree-item-header:has(.tree-chapter-title) .toggle-icon {
    position: relative;
}

/* Счетчик статей в главе (опционально) */
.tree-chapter-title {
    position: relative;
}

.tree-chapter-title::after {
    content: attr(data-count);
    font-size: 0.7rem;
    color: #888;
    margin-left: 8px;
}


.tree-item-header:has(.tree-link)::before {
    content: "•";
    font-size: 1.2rem;
    margin-right: 8px;
    color: #88aaff;
}




@media (max-width: 1180px) {

    .programming-menu    {
        display: none;
    }
}

