/* Общий фон страницы — светло-серый, как у Википедии */
html, body {
    height: 100%;
    margin: 0;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: #f8f9fa;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    color: #222;
}

/* Шапка — фиксированная, поверх всего */
header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: #2c3e50;
    color: white;
    padding: 10px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

header h1 {
    margin: 0;
    font-size: 22px;
}

header nav a {
    color: #ecf0f1;
    text-decoration: none;
    margin-left: 20px;
    font-weight: 500;
}

header nav a:hover {
    color: #3498db;
}

/* Поиск в шапке — как единый блок */
header form {
    display: flex;
    align-items: center;
    background: white;
    border-radius: 4px;
    overflow: hidden;
}

header form input {
    padding: 5px 12px;
    border: none;
    outline: none;
    width: 180px;
    font-size: 14px;
}

header form button {
    padding: 5px 15px;
    background: #3498db;
    color: white;
    border: none;
    cursor: pointer;
    font-size: 14px;
}

header form button:hover {
    background: #2980b9;
}

/* Белая область для контента — с ограниченной шириной и отступами */
.container {
    max-width: 1100px;
    width: 100%;
    margin: 80px auto 0 auto;
    padding: 20px 40px 20px 40px;   /* нижний отступ минимальный */
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    box-sizing: border-box;
}

/* Боковое меню — прилегает к левому краю, но не перекрывает шапку */
#sidebar {
    position: fixed;
    top: 70px;  /* ниже шапки */
    left: 0;
    width: 260px;
    height: calc(100% - 70px);
    background: #ffffff;
    box-shadow: 2px 0 8px rgba(0,0,0,0.1);
    padding: 20px;
    overflow-y: auto;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 999;
    border-right: 1px solid #ddd;
}

#sidebar.open {
    transform: translateX(0%);
}

#sidebar h3 {
    margin-top: 10;
    color: #2c3e50;
    border-bottom: 1px solid #ddd;
    padding-bottom: 4px;
    font-size: 16px;
}

#sidebar ul {
    list-style: none;
    padding: 0;
}

#sidebar ul li {
    margin: 8px 0;
    font-size: 14px;          /* уменьшаем размер шрифта пунктов */
    margin: 2px 0;            /* уменьшаем расстояние между пунктами */
    padding: 0;
}

#sidebar ul li a {
    color: #2c3e50;
    text-decoration: none;
    font-size: 14px;          /* и для ссылок тоже */
    padding: 2px 0;
}

#sidebar ul li a:hover {
    color: #3498db;
    text-decoration: underline;
}

/* Контент внутри белой области */
main h2 {
    color: #2c3e50;
    font-size: 26px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

main p {
    font-size: 16px;
    line-height: 1.6;
}

main a {
    color: #3498db;
    text-decoration: none;
}

main a:hover {
    text-decoration: underline;
}

/* Список записей */
ul {
    padding-left: 0;
    list-style: none;
}

ul li {
    margin-bottom: 20px;
    padding-bottom: 15px;
    /*border-bottom: 1px solid #f0f0f0;*/
}

ul li a {
    font-size: 18px;
    font-weight: 500;
}

ul li p {
    margin: 5px 0 0 0;
    color: #555;
}

/* Подвал — прибит к низу, с линией и отступом */
footer {
    text-align: center;
    color: #6c757d;
    padding: 15px 0 5px 0;
    font-size: 13px;
    border-top: 1px solid #dee2e6;  /* линия внутри белого блока */
    margin-top: 30px;               /* отступ от контента до футера */
    width: 100%;
}

footer a {
    color: #3498db;
    text-decoration: none;
    margin: 0 10px;
}

footer a:hover {
    text-decoration: underline;
}

/* Сдвиг строки поиска влево для выравнивания с контентом */
header form {
    margin-right: 185px;
}

@media (max-width: 768px) {
    header form {
        margin-right: 20px;
    }
}

/* Стили для меню с подразделами */
.sidebar-section ul li.has-children {
    position: relative;
    list-style: none;
}

.sidebar-section .toggle-btn {
    cursor: pointer;
    display: inline-block;
    width: 20px;
    color: #3498db;
    font-size: 14px;
    user-select: none;
}

.sidebar-section .sub-menu {
    padding-left: 20px;
    margin-top: 5px;
}

#sidebar ul ul.sub-menu {
    padding-left: 0px;
}

#sidebar ul ul li {
    border-bottom: none !important;
    font-size: 13px;
}

.category-group {
    display: block;
}

/*---*/

/* Уменьшаем шрифт и расстояние в боковом меню */
#sidebar {
    font-size: 14px;
}

#sidebar h3 {
    font-size: 15px;
    margin-top: 10px;
    margin-bottom: 5px;
}

#sidebar ul li {
    margin: 2px 0;
    padding: 2px 0;
}

#sidebar ul li a {
    font-size: 14px;
    padding: 2px 0;
}

#sidebar ul ul li {
    padding-left: 15px; /* дополнительный отступ для подразделов */
}

#sidebar .toggle-btn {
    font-size: 12px;
    margin-right: 4px;
}

#sidebar .toggle-icon {
    font-size: 12px;
    margin-left: 6px;
}

/*----*/
/* Закреплённое боковое меню */
#sidebar.pinned {
    transform: translateX(0%) !important;
}

/* Логотип в шапке — автоматический размер */
.site-logo {
    height: 2em;          /* высота относительно текущего размера шрифта */
    width: auto;          /* ширина подстраивается пропорционально */
    vertical-align: middle;
    margin-right: 10px;
}