@import url('https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,400;0,500;0,700;0,900;1,400&display=swap');

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --header-offset: 158px;
}

body {
    background: #f5f5f5 url('../images/bg.jpg') no-repeat center center fixed;
    background-size: cover;
    font-family: 'Roboto', sans-serif;
    min-height: 100vh;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
}

/* ===================================
   ШАПКА САЙТА (HEADER)
=================================== */
.site-header {
    width: 100%;
    background-color: #352388;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    border-bottom: 12px solid #352388;
    overflow: visible;
    transition: border-bottom-width 0.25s ease;
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 15px;
    transition: padding 0.25s ease;
}

.site-header.is-header-compact {
    border-bottom-width: 6px;
}

.site-header.is-header-compact .header-container {
    padding-top: 4px;
    padding-bottom: 4px;
}

.site-header.is-header-compact .logo-img {
    height: 52px;
}

.site-header.is-header-compact .main-menu a {
    padding-top: 4px;
    padding-bottom: 4px;
}

/* Универсальный отступ для всех внутренних страниц под фиксированную шапку */
.page-content {
    flex: 1 0 auto;
    padding-top: var(--header-offset);
    padding-bottom: 40px;
    min-height: calc(100vh - var(--header-offset));
    transition: padding-top 0.25s ease;
}

/* Логотип + текст под ним */
.logo-block {
    padding-bottom: 4px;
}

.logo-link {
    display: block;
    text-decoration: none;
}

.logo-visual {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.logo-img {
    height: 82px;
    width: auto;
    display: block;
    margin: 0 auto;
    transition: height 0.25s ease;
}

.logo-badge {
    display: block;
    width: fit-content;
    max-width: 100%;
    box-sizing: border-box;
    padding: 1px 5px;
    background-color: #8bbc08;
    color: #ffffff;
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.25px;
    text-transform: uppercase;
    text-align: center;
    line-height: 1.05;
    white-space: nowrap;
}

/* Правая секция */
.header-right {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
    flex-grow: 1;
    margin-left: 24px;
    gap: 16px;
    overflow: visible;
    min-width: 0;
}

.search-block {
    flex-shrink: 0;
    padding: 0;
}

.search-input {
    width: 200px;
    padding: 5px 12px 5px 30px;
    border-radius: 12px;
    border: 1px solid #ccc;
    font-size: 13px;
    outline: none;
    background: #ffffff url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="%20888" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="8"/><line x1="21" y1="21" x2="16.65" y2="16.65"/></svg>') no-repeat 10px center;
}

/* Скошенная панель (фон через ::before — иначе clip-path обрезает dropdown) */
.nav-skew-panel {
    position: relative;
    flex: 1;
    min-width: 0;
    padding-left: 28px;
    overflow: visible;
}

.nav-skew-panel::before {
    display: none;
}

.nav-skew-panel .main-menu {
    position: relative;
    z-index: 1;
}

.main-menu {
    list-style: none;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 28px 32px;
    height: 100%;
    margin: 0;
    padding: 0;
}

.main-menu li {
    position: relative;
    display: flex;
    align-items: center;
    height: 100%;
}

.main-menu li:not(:last-child)::after {
    display: none;
}

.main-menu a {
    text-decoration: none;
    color: #ffffff;
    font-weight: 400;
    font-size: 16px;
    text-transform: none;
    letter-spacing: 0;
    padding: 10px 0;
    transition: color 0.2s ease, padding 0.25s ease;
    white-space: nowrap;
}

.main-menu a:hover,
.main-menu a.active {
    color: #8bbc08;
}

/* Снимаем дополнительную жирность браузера с кнопок-плашек */
.stripe-btn {
    font-weight: normal !important;
}

/* ===================================
   ФУТЕР САЙТА (FOOTER)
=================================== */
.site-footer {
    width: 100%;
    position: relative;
    z-index: 900;
    flex-shrink: 0;
    margin-top: auto;
}

.footer-bar {
    background-color: #352388;
    border-top: 3px solid #8bbc08;
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.25);
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    min-height: 118px;
}

.footer-brand {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    flex-shrink: 0;
}

.footer-logo {
    height: 68px;
    width: auto;
    display: block;
}

.footer-tagline {
    margin: 0;
    color: #ffffff;
    font-size: 14px;
    font-style: italic;
    line-height: 1.35;
    letter-spacing: 0.2px;
}

.footer-brand .copyright {
    color: #a0a5b5;
    font-size: 13px;
    margin: 0;
    letter-spacing: 0.3px;
}

.footer-sitemap-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    border: 2px solid #8bbc08;
    color: #8bbc08;
    font-family: inherit;
    font-size: 12px;
    font-weight: normal;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    padding: 7px 18px 7px 22px;
    cursor: pointer;
    clip-path: polygon(10px 0, 100% 0, calc(100% - 10px) 100%, 0 100%);
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.footer-sitemap-toggle:hover,
.site-footer.is-sitemap-open .footer-sitemap-toggle {
    background-color: #8bbc08;
    color: #352388;
}

.footer-sitemap-toggle-icon {
    font-size: 10px;
    line-height: 1;
    transition: transform 0.3s ease;
}

.site-footer.is-sitemap-open .footer-sitemap-toggle-icon {
    transform: rotate(180deg);
}

.footer-sitemap-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 12, 18, 0.55);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 998;
    pointer-events: none;
}

.footer-sitemap-overlay.is-visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.footer-sitemap-panel {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    background: linear-gradient(180deg, #4530a5 0%, #352388 100%);
    border-top: 3px solid #8bbc08;
    box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.45);
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height 0.4s ease, opacity 0.3s ease;
}

.site-footer.is-sitemap-open .footer-sitemap-panel {
    max-height: min(62vh, 520px);
    opacity: 1;
    overflow-y: auto;
}

.footer-sitemap-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px 24px;
}

.footer-sitemap-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 0 14px;
    border-bottom: 1px solid rgba(139, 188, 8, 0.18);
    margin-bottom: 22px;
}

.footer-sitemap-title {
    font-size: 15px;
    font-weight: normal;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #ffffff;
    margin: 0;
    position: relative;
    padding-left: 16px;
}

.footer-sitemap-title::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 18px;
    background: #8bbc08;
    clip-path: polygon(0 0, 100% 15%, 100% 85%, 0 100%);
}

.footer-sitemap-close {
    width: 34px;
    height: 34px;
    border: 1px solid rgba(160, 165, 181, 0.35);
    border-radius: 4px;
    background: transparent;
    color: #a0a5b5;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    transition: color 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

.footer-sitemap-close:hover {
    color: #ffffff;
    border-color: #8bbc08;
    background: rgba(139, 188, 8, 0.08);
}

.footer-sitemap-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 28px 36px;
}

.footer-sitemap-col {
    position: relative;
    padding: 14px 0 14px 18px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 0 6px 6px 0;
    transition: background-color 0.2s ease;
}

.footer-sitemap-col::before {
    content: '';
    position: absolute;
    left: 0;
    top: 10px;
    bottom: 10px;
    width: 3px;
    background: linear-gradient(180deg, #8bbc08 0%, #2b1b80 100%);
    border-radius: 2px;
}

.footer-sitemap-col:hover {
    background: rgba(139, 188, 8, 0.05);
}

.footer-sitemap-main {
    display: block;
    color: #ffffff;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    text-decoration: none;
    margin-bottom: 0;
    transition: color 0.2s ease;
}

.footer-sitemap-col:has(.footer-sitemap-sub) .footer-sitemap-main {
    margin-bottom: 12px;
}

.footer-sitemap-main:hover {
    color: #8bbc08;
}

.footer-sitemap-sub {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-sitemap-sub li + li {
    margin-top: 6px;
}

.footer-sitemap-sub a {
    color: #a0a5b5;
    font-size: 13px;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: color 0.2s ease, transform 0.2s ease;
}

.footer-sitemap-sub a::before {
    content: '';
    width: 6px;
    height: 6px;
    flex-shrink: 0;
    background: #8bbc08;
    clip-path: polygon(0 0, 100% 50%, 0 100%);
    opacity: 0.7;
}

.footer-sitemap-sub a:hover {
    color: #ffffff;
    transform: translateX(3px);
}

.footer-sitemap-sub-nested {
    list-style: none;
    padding: 0 0 0 14px;
    margin: 6px 0 0;
}

.footer-sitemap-sub-nested li + li {
    margin-top: 4px;
}

.footer-sitemap-sub-nested a {
    color: #8a8f9c;
    font-size: 12px;
}

.footer-sitemap-sub-nested a::before {
    width: 4px;
    height: 4px;
    background: #2b1b80;
    opacity: 0.6;
}

@media (max-width: 768px) {
    .footer-container {
        flex-direction: column;
        gap: 14px;
        padding: 18px 15px;
        min-height: auto;
    }

    .footer-brand {
        align-items: center;
        text-align: center;
    }

    .footer-logo {
        height: 60px;
    }

    .copyright {
        text-align: center;
        font-size: 12px;
    }

    .footer-sitemap-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .site-footer.is-sitemap-open .footer-sitemap-panel {
        max-height: min(70vh, 560px);
    }
}

/* Выпадающее меню */
.main-menu li.has-dropdown {
    position: relative;
}

.main-menu li.has-dropdown > a {
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.main-menu .arrow {
    font-size: 11px;
    line-height: 1;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: #ffffff;
    min-width: 220px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    border-radius: 0 0 6px 6px;
    list-style: none;
    padding: 8px 0;
    margin: 0;
    display: none;
    z-index: 1100;
    border-top: 3px solid #8bbc08;
}

/* Показываем при наведении */
.main-menu li.has-dropdown:hover .dropdown-menu {
    display: block;
}

.dropdown-menu li {
    width: 100%;
    height: auto !important;
}

.dropdown-menu li::after {
    display: none !important; /* Убираем зеленые разделители */
}

.dropdown-menu a {
    display: block;
    padding: 10px 18px !important;
    color: #1a1c23 !important;
    font-size: 14px !important;
    text-transform: none !important;
    font-weight: normal !important;
    white-space: nowrap;
    transition: background 0.2s ease, color 0.2s ease;
}

.dropdown-menu a:hover {
    background-color: #f4f6f8;
    color: #2b1b80 !important;
}

.dropdown-menu li.has-submenu {
    position: relative;
}

.dropdown-menu .submenu-arrow {
    float: right;
    margin-left: 12px;
    opacity: 0.55;
}

.dropdown-submenu {
    position: absolute;
    top: 0;
    left: 100%;
    min-width: 220px;
    background: #ffffff;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    border-radius: 0 6px 6px 0;
    list-style: none;
    padding: 8px 0;
    margin: 0;
    display: none;
    z-index: 1200;
    border-left: 3px solid #8bbc08;
}

.dropdown-menu li.has-submenu:hover > .dropdown-submenu {
    display: block;
}

.dropdown-submenu a {
    white-space: nowrap;
}

@media (max-width: 900px) {
    .dropdown-submenu {
        position: static;
        box-shadow: none;
        border-left: 3px solid #8bbc08;
        border-radius: 0;
        display: none;
        margin: 0 0 4px 12px;
    }

    .dropdown-menu li.has-submenu:hover > .dropdown-submenu,
    .dropdown-menu li.has-submenu.is-open > .dropdown-submenu {
        display: block;
    }
}

/* Виджет дерева страниц в сайдбаре */
.widget-tree {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 25px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    border: 1px solid #eef0f2;
}

.widget-title {
    font-size: 18px;
    font-weight: 700;
    color: #1a1c23;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #8bbc08;
}

/* Списки */
.pages-tree-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.tree-item {
    margin-bottom: 6px;
}

/* Элементы дерева */
.tree-summary, .tree-single {
    display: flex;
    align-items: center;
    padding: 6px 8px;
    border-radius: 5px;
    transition: background 0.2s ease;
    cursor: pointer;
}

.tree-summary:hover, .tree-single:hover {
    background-color: #f4f6f8;
}

/* Кастомная стрелка свертывания */
.tree-summary {
    list-style: none; /* Убираем стандартную дефолтную стрелку */
    position: relative;
}

.tree-summary::-webkit-details-marker {
    display: none; /* Скрываем в Safari/Chrome */
}

.tree-summary::before {
    content: '▶';
    font-size: 9px;
    color: #888;
    margin-right: 8px;
    transition: transform 0.2s ease;
    display: inline-block;
}

.tree-details[open] > .tree-summary::before {
    transform: rotate(90deg); /* Поворачиваем стрелочку при открытии */
    color: #8bbc08;
}

/* Иконки и ссылки */
.tree-icon, .tree-icon-sub {
    font-size: 14px;
    margin-right: 6px;
}

.tree-link {
    color: #333;
    text-decoration: none;
    font-size: 14px;
    flex-grow: 1;
}

.tree-link:hover {
    color: #2b1b80;
}

.tree-link.active {
    font-weight: bold;
    color: #2b1b80;
}

/* Вложенный список (Подразделы) */
.tree-sub {
    padding-left: 22px !important;
    margin-top: 4px !important;
    border-left: 2px dashed #e0e0e0;
    margin-left: 12px !important;
}

.tree-sub li {
    display: flex;
    align-items: center;
    padding: 4px 6px;
}

.tree-empty {
    font-size: 13px;
    color: #999;
    font-style: italic;
}

/* ===================================
   МОБИЛЬНАЯ ШАПКА
=================================== */
.header-menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    padding: 10px;
    border: 2px solid #8bbc08;
    border-radius: 6px;
    background: transparent;
    cursor: pointer;
    flex-shrink: 0;
    position: relative;
    z-index: 1002;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.header-menu-toggle-bar {
    display: block;
    width: 100%;
    height: 2px;
    background: #8bbc08;
    border-radius: 1px;
    transition: transform 0.25s ease, opacity 0.25s ease;
    pointer-events: none;
}

.site-header.is-nav-open .header-menu-toggle-bar:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.site-header.is-nav-open .header-menu-toggle-bar:nth-child(2) {
    opacity: 0;
}

.site-header.is-nav-open .header-menu-toggle-bar:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

.header-nav-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 12, 18, 0.55);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 998;
    pointer-events: none;
}

.header-nav-overlay.is-visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

body.is-nav-open {
    overflow: hidden;
}

@media (max-width: 768px) {
    body {
        background-attachment: scroll;
    }

    .site-header {
        border-bottom-width: 6px;
    }

    .header-container {
        flex-wrap: wrap;
        align-items: center;
        min-height: auto;
        padding: 4px 15px;
        gap: 0;
    }

    .logo-block {
        flex: 1;
        padding-bottom: 0;
    }

    .logo-img {
        height: 67px;
    }

    .site-header.is-header-compact .logo-img {
        height: 44px;
    }

    .site-header.is-header-compact .main-menu a {
        padding-top: 10px;
        padding-bottom: 10px;
    }

    .logo-badge {
        font-size: 8px;
        padding: 1px 4px;
        letter-spacing: 0.15px;
    }

    .header-menu-toggle {
        display: flex;
    }

    .header-right {
        display: none;
        width: 100%;
        margin-left: 0;
        margin-top: 0;
        order: 3;
        flex-direction: column;
        align-items: stretch;
    }

    .site-header.is-nav-open .header-right {
        display: flex;
        flex-direction: column;
        align-items: stretch;
    }

    .search-block {
        padding: 12px 0 8px;
        order: -1;
    }

    .search-input {
        width: 100%;
        font-size: 16px;
        padding: 10px 12px 10px 36px;
    }

    .nav-skew-panel {
        padding: 0;
    }

    .nav-skew-panel::before {
        display: none;
    }

    .main-menu {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
    }

    .main-menu li {
        display: block;
        height: auto;
        width: 100%;
        padding: 0 !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .main-menu li:not(:last-child)::after {
        display: none;
    }

    .main-menu a {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 14px 4px;
        white-space: normal;
        font-size: 15px;
        color: #e8ecf2;
    }

    .main-menu a:hover {
        color: #ffffff;
    }

    .main-menu a.active {
        color: #8bbc08;
    }

    .main-menu li.has-dropdown:hover .dropdown-menu {
        display: none;
    }

    .main-menu li.has-dropdown.is-open > .dropdown-menu {
        display: block;
    }

    .dropdown-menu {
        position: static;
        box-shadow: none;
        border-radius: 0;
        border-top: none;
        border-left: 3px solid #8bbc08;
        padding: 0 0 8px;
        margin: 0 0 0 8px;
        background: transparent;
    }

    .dropdown-menu a {
        white-space: normal;
        padding: 10px 14px !important;
        color: #c5ccd8;
    }

    .dropdown-menu a:hover,
    .dropdown-menu a.active {
        color: #8bbc08;
        background: transparent;
    }

    .dropdown-submenu {
        background: transparent;
    }

    .dropdown-submenu a {
        color: #b0b8c6;
    }

    .dropdown-menu li.has-submenu:hover > .dropdown-submenu {
        display: none;
    }

    .page-content {
        padding-bottom: 32px;
    }

    .page-content:has(.main-stage) {
        padding-top: 0;
        min-height: calc(100vh - var(--header-offset));
    }
}