/* Bao bọc toàn bộ TOC */
#fptoc-wrapper {
    position: fixed;
    top: 50%;
    right: 0;
    transform: translateY(-50%);
    z-index: 99999;
    display: flex;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease;
}

#fptoc-wrapper.has-headings {
    opacity: 1;
    visibility: visible;
}

/* Vùng chứa các vạch ngang */
.fptoc-trigger {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px 5px;
    margin-right: 5px;
    cursor: pointer;
    background: transparent;
}

/* Từng vạch ngang (Mặc định xám nhạt) */
.fptoc-dash {
    width: 18px;
    height: 1px;
    background-color: #b0b0b0;
    margin: 4px 0;
    border-radius: 1px;
    transition: all 0.2s ease;
}

/* Vạch ngang IN ĐẬM khi cuộn tới tiêu đề tương ứng */
.fptoc-dash.active {
    width: 16px;
    height: 2px;
    background-color: #000000; /* Màu đen đậm */
}

/* Hover vào vùng gạch cho cảm giác nút bấm */
.fptoc-trigger:hover .fptoc-dash {
    background-color: #777;
}
.fptoc-trigger:hover .fptoc-dash.active {
    background-color: #000;
}

/* Bảng danh sách mục lục */
.fptoc-menu {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%) translateX(120%);
    background: #ffffff;
    border: 1px solid #e5e5e5;
    box-shadow: -4px 4px 15px rgba(0,0,0,0.08);
    border-radius: 10px 0 0 10px;
    width: max-content;
    max-width: 350px;
    max-height: 80vh;
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* HIỂN THỊ KHI CLICK (Dùng JS thêm class .is-open vào wrapper) */
#fptoc-wrapper.is-open .fptoc-menu {
    transform: translateY(-50%) translateX(0);
    opacity: 1;
    visibility: visible;
}

/* Style cho các mục trong danh sách */
#fptoc-list {
    list-style: none !important;
    margin: 0 !important;
    padding: 10px 0 !important;
    font-family: inherit;
}

#fptoc-list li {
    margin: 0;
    padding: 0;
}

#fptoc-list a {
    text-decoration: none;
    color: #333;
    display: block;
    padding: 10px 20px;
    font-size: 0.95em;
    transition: all 0.2s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    border-left: 3px solid transparent; /* Chuẩn bị cho hiệu ứng active */
}

#fptoc-list a:hover {
    background-color: #f9f9f9;
}

/* HIỆU ỨNG ACTIVE TRONG MỤC LỤC (Nền xám nhạt) */
#fptoc-list li.active a {
    background-color: #f0f0f0; /* Nền xám nhạt theo yêu cầu */
    color: #000;
    font-weight: 600;
}