/* Контейнер для кнопки и окна */
.fhn-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

/* Кнопка-гамбургер */
.fhn-toggle-button {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: #0073aa;
    color: white;
    font-size: 28px;
    font-weight: bold;
    border: none;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    transition: transform 0.2s, background-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.fhn-toggle-button:hover {
    background-color: #005a87;
    transform: scale(1.05);
}

/* Окно навигации */
.fhn-modal {
    position: fixed;
    bottom: 80px;
    right: 20px;
    width: 300px;
    max-width: 90vw;
    max-height: 80vh;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.fhn-modal-open {
    display: flex;
}

/* Заголовок окна */
.fhn-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background-color: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    cursor: move;
    user-select: none;
}

.fhn-modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.fhn-close-button {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #888;
    padding: 0;
    line-height: 1;
}

.fhn-close-button:hover {
    color: #333;
}

/* Контейнер для списка с прокруткой */
.fhn-list-container {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

/* Список заголовков */
.fhn-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.fhn-item {
    margin: 0;
    padding: 0;
}

.fhn-item a {
    display: block;
    padding: 8px 16px;
    text-decoration: none;
    color: #0073aa;
    font-size: 14px;
    transition: background-color 0.2s;
    border-left: 3px solid transparent;
}

.fhn-item a:hover {
    background-color: #f0f0f0;
    color: #005a87;
}

.fhn-item a.fhn-active {
    background-color: #e9f0f5;
    border-left-color: #0073aa;
    font-weight: 500;
}

/* Отступы для уровней заголовков */
.fhn-level-1 a {
    padding-left: 16px;
    font-weight: 600;
}
.fhn-level-2 a {
    padding-left: 32px;
}
.fhn-level-3 a {
    padding-left: 48px;
}
.fhn-level-4 a {
    padding-left: 64px;
}

/* Адаптив: на маленьких экранах окно занимает большую часть экрана */
@media (max-width: 768px) {
    .fhn-modal {
        width: 90%;
        max-height: 70vh;
        right: 5%;
        bottom: 70px;
        left: auto;
    }

    .fhn-toggle-button {
        width: 44px;
        height: 44px;
        font-size: 24px;
    }
}

@media (max-width: 480px) {
    .fhn-modal {
        width: 95%;
        right: 2.5%;
        bottom: 60px;
    }
}