/* TOC (Table of Contents) System Styles */
/* Modern, sade tasarım - Anthropic tarzı */

/* TOC Container - Sade ve modern */
#toc-sidebar {
    /* Temel positioning */
    position: fixed;
    top: 5rem; /* header height */
    right: 1rem;
    width: 12rem; /* w-48 */
    max-height: calc(100vh - 8rem);
    z-index: 30;
    
    /* Görünüm - sadece xl ve üzerinde */
    display: none;
    
    /* Modern stil */
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(229, 231, 235, 0.8);
    border-radius: 0.5rem; /* rounded-lg */
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    
    /* Scrollable */
    overflow-y: auto;
    
    /* Smooth transitions */
    transition: opacity 0.3s ease;
}

/* Dark mode */
.dark #toc-sidebar {
    background: rgba(17, 24, 39, 0.95);
    border-color: rgba(55, 65, 81, 0.8);
}

/* Responsive - sadece XL ekranlarda göster VE TOC varsa */
@media (min-width: 1280px) {
    #toc-sidebar.toc-has-items {
        display: block;
    }
}

/* TOC Header - Sade başlık */
.toc-header {
    padding: 0.75rem 1rem 0.5rem;
    border-bottom: 1px solid rgba(229, 231, 235, 0.6);
    margin-bottom: 0.5rem;
}

.dark .toc-header {
    border-bottom-color: rgba(55, 65, 81, 0.6);
}

.toc-title {
    font-size: 0.875rem; /* text-sm */
    font-weight: 600; /* font-semibold */
    color: #374151; /* gray-700 */
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.dark .toc-title {
    color: #d1d5db; /* gray-300 */
}

.toc-icon {
    width: 1rem;
    height: 1rem;
    opacity: 0.7;
}

/* TOC Navigation */
#toc-nav {
    padding: 0 0.75rem 0.75rem;
    position: relative;
}

/* Progress Line - Sol kenarda ince çizgi */
.toc-progress-bg {
    position: absolute;
    left: 0.5rem;
    top: 0;
    width: 2px;
    height: 100%;
    background: #e5e7eb; /* gray-200 */
    border-radius: 1px;
    opacity: 0.5;
}

.dark .toc-progress-bg {
    background: #4b5563; /* gray-600 */
}

#toc-progress {
    position: absolute;
    left: 0.5rem;
    top: 0;
    width: 2px;
    height: 0%;
    background: #6366f1; /* indigo-500 */
    border-radius: 1px;
    transition: height 0.3s ease;
}

/* Floating indicator kaldırıldı - basit olan daha güzel */

/* TOC Links - Çok sade stil */
.toc-link {
    display: block;
    padding: 0.375rem 0.5rem 0.375rem 1rem; /* py-1.5 px-2 pl-4 */
    margin-bottom: 0.125rem; /* mb-0.5 */
    
    /* Typography */
    font-size: 0.875rem; /* text-sm */
    font-weight: 400; /* font-normal */
    color: #6b7280; /* gray-500 */
    text-decoration: none;
    line-height: 1.25; /* leading-tight */
    
    /* Layout */
    border-radius: 0.25rem; /* rounded */
    position: relative;
    
    /* Smooth transitions */
    transition: all 0.15s ease;
}

/* Link hover */
.toc-link:hover {
    color: #374151; /* gray-700 */
    background: rgba(243, 244, 246, 0.8); /* gray-100/80 */
}

.dark .toc-link {
    color: #9ca3af; /* gray-400 */
}

.dark .toc-link:hover {
    color: #d1d5db; /* gray-300 */
    background: rgba(55, 65, 81, 0.5); /* gray-700/50 */
}

/* Active link - Perfect sol çizgi sistemi */
.toc-link.toc-active {
    color: #1f2937; /* gray-800 */
    font-weight: 500; /* font-medium */
    
    /* Sol kenarda ince çizgi - perfect hali */
    border-left: 2px solid #6366f1; /* indigo-500 */
    padding-left: calc(1rem - 2px); /* border için padding ayarı */
}

.dark .toc-link.toc-active {
    color: #f3f4f6; /* gray-100 */
    border-left-color: #818cf8; /* indigo-400 */
}

/* Scrollbar styling - sadece webkit */
#toc-sidebar::-webkit-scrollbar {
    width: 4px;
}

#toc-sidebar::-webkit-scrollbar-track {
    background: transparent;
}

#toc-sidebar::-webkit-scrollbar-thumb {
    background: rgba(156, 163, 175, 0.5); /* gray-400/50 */
    border-radius: 2px;
}

#toc-sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(156, 163, 175, 0.8); /* gray-400/80 */
}

.dark #toc-sidebar::-webkit-scrollbar-thumb {
    background: rgba(75, 85, 99, 0.5); /* gray-600/50 */
}

.dark #toc-sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(75, 85, 99, 0.8); /* gray-600/80 */
}

/* Animation classes */
.toc-fade-in {
    animation: tocFadeIn 0.3s ease;
}

@keyframes tocFadeIn {
    from {
        opacity: 0;
        transform: translateX(0.5rem);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Link click animation */
.toc-link:active {
    transform: scale(0.98);
    transition: transform 0.1s ease;
}

/* Accessibility improvements - outline kaldırıldı */
.toc-link:focus {
    outline: none; /* Mor çerçeve kaldırıldı */
}

.dark .toc-link:focus {
    outline: none;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .toc-link,
    #toc-progress,
    #toc-sidebar {
        transition: none;
    }
    
    .toc-fade-in {
        animation: none;
    }
}