/* Navigation Fluidity Fix */
.top-navigation {
    padding: 1rem;
    background: var(--card-background);
    border-bottom: 2px solid var(--border-color);
    position: sticky;
    top: var(--header-height, 70px);
    z-index: 998;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.top-navigation .toc-grid {
    grid-template-columns: repeat(6, 1fr);
    gap: 0.5rem;
}

.top-navigation .toc-item {
    padding: 0.5rem 0.25rem;
    gap: 0.25rem;
    box-shadow: none;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.top-navigation .toc-item:hover {
    transform: translateY(-2px);
}

.top-navigation .toc-item i {
    font-size: 1.2rem;
}

.top-navigation .toc-item span {
    font-size: 0.7rem;
    line-height: 1.1;
}

/* Smooth scroll offset */
html {
    scroll-padding-top: calc(var(--header-height, 70px) + 60px);
}

/* Section scroll margin */
section[id] {
    scroll-margin-top: calc(var(--header-height, 70px) + 60px);
}

/* Reviews banner adjustment */
.reviews-banner {
    position: relative;
    top: 0;
}

/* Back to top button z-index */
.back-to-top {
    z-index: 997;
}

@media (max-width: 992px) {
    .top-navigation {
        padding: 0.75rem 0.5rem;
    }
    
    .top-navigation .toc-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.4rem;
    }
    
    html {
        scroll-padding-top: calc(var(--header-height, 70px) + 50px);
    }
    
    section[id] {
        scroll-margin-top: calc(var(--header-height, 70px) + 50px);
    }
}

@media (max-width: 768px) {
    .top-navigation {
        padding: 0.6rem 0.4rem;
    }
    
    .top-navigation .toc-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.3rem;
    }
    
    .top-navigation .toc-item {
        padding: 0.4rem 0.2rem;
    }
    
    .top-navigation .toc-item i {
        font-size: 1rem;
    }
    
    .top-navigation .toc-item span {
        font-size: 0.6rem;
    }
    
    html {
        scroll-padding-top: calc(var(--header-height, 70px) + 40px);
    }
    
    section[id] {
        scroll-margin-top: calc(var(--header-height, 70px) + 40px);
    }
}

@media (max-width: 480px) {
    .top-navigation .toc-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .top-navigation .toc-item {
        padding: 0.35rem 0.15rem;
    }
    
    .top-navigation .toc-item i {
        font-size: 0.9rem;
    }
    
    .top-navigation .toc-item span {
        font-size: 0.55rem;
    }
}
