/* float-toc.css - Componente condiviso: TOC flottante mobile */

.float-toc-btn {
    position: fixed;
    bottom: 76px;
    right: 24px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--white);
    border: 1px solid var(--gray-200);
    box-shadow: var(--shadow-md);
    cursor: pointer;
    display: grid;
    place-items: center;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.3s, transform 0.3s, border-color 0.3s;
    z-index: 90;
}

.float-toc-btn.visible {
    opacity: 1;
    transform: translateY(0);
}

.float-toc-btn svg {
    width: 18px;
    height: 18px;
    stroke: var(--gray-500);
    fill: none;
}

.float-toc-btn:hover {
    border-color: var(--page-accent);
}

.float-toc-btn:hover svg {
    stroke: var(--page-accent-dark);
}

.float-toc-panel {
    position: fixed;
    bottom: 128px;
    right: 24px;
    background: var(--white);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--gray-200);
    padding: 16px 0;
    min-width: 220px;
    z-index: 91;
    opacity: 0;
    transform: translateY(8px) scale(0.96);
    pointer-events: none;
    transition: opacity 0.2s cubic-bezier(.4, 0, .15, 1),
                transform 0.2s cubic-bezier(.4, 0, .15, 1);
}

.float-toc-panel.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.float-toc-panel a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--gray-500);
    text-decoration: none;
    transition: background-color 0.15s, color 0.15s;
}

.float-toc-panel a:hover {
    background: var(--gray-50);
    color: var(--gray-800);
}

.float-toc-panel a.active {
    color: var(--page-accent-dark);
    font-weight: 600;
}

.float-toc-panel a .toc-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--gray-200);
    flex-shrink: 0;
    transition: background 0.15s;
}

.float-toc-panel a.active .toc-dot {
    background: var(--page-accent);
}

/* ── Responsive ── */
@media (max-width: 768px) {
    /* Senza mobile-bar: sopra btt (76+40+8 = 124px) */
    .float-toc-btn {
        bottom: 124px;
        right: 16px;
        width: 40px;
        height: 40px;
    }

    .float-toc-panel {
        bottom: 172px;
        right: 16px;
        max-height: calc(100vh - 200px);
        overflow-y: auto;
        min-width: 190px;
    }

    /* Con mobile-bar: btt nascosto (back-to-top.css), il TOC prende il suo slot
       sopra la mobile-bar (~115px) */
    .has-mobile-bar .float-toc-btn {
        bottom: 160px;
    }

    .has-mobile-bar .float-toc-panel {
        bottom: 208px;
        max-height: calc(100vh - 240px);
    }

    .float-toc-panel a {
        padding: 8px 16px;
        font-size: 0.75rem;
    }
}
