/* Table of Contents Block - Frontend Styles */

.discovermax-toc-wrapper {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 1.5rem;
    margin: 1.5rem 0;
    font-family: inherit;
    position: relative;
    overflow: hidden;
}

.discovermax-toc-wrapper::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #007cba, #0073aa);
}

.discovermax-toc-header {
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #dee2e6;
}

.discovermax-toc-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
    display: flex;
    align-items: center;
}

.discovermax-toc-title::before {
    content: '📑';
    margin-right: 0.5rem;
    font-size: 1rem;
}

.discovermax-toc-content {
    margin: 0;
}

.discovermax-toc-list {
    margin: 0;
    padding-left: 1.5rem;
    list-style: none;
    counter-reset: toc-counter;
}

.discovermax-toc-list ol {
    counter-reset: toc-counter;
}

.discovermax-toc-list ol .discovermax-toc-item::before {
    counter-increment: toc-counter;
    content: counter(toc-counter) '. ';
    font-weight: 600;
    color: #007cba;
    margin-right: 0.5rem;
}

.discovermax-toc-list ul .discovermax-toc-item::before {
    content: '▶';
    color: #007cba;
    font-size: 0.8rem;
    margin-right: 0.5rem;
}

.discovermax-toc-item {
    margin: 0.5rem 0;
    line-height: 1.5;
    position: relative;
    padding-left: 1rem;
}

.discovermax-toc-item::before {
    position: absolute;
    left: 0;
    top: 0;
}

.discovermax-toc-h2 {
    font-weight: 600;
}

.discovermax-toc-h3 {
    font-weight: 500;
    margin-left: 1rem;
}

.discovermax-toc-h4 {
    font-weight: 400;
    margin-left: 2rem;
    font-size: 0.9rem;
}

.discovermax-toc-link {
    color: #333;
    text-decoration: none;
    transition: color 0.2s ease;
    display: block;
    padding: 0.25rem 0;
    border-radius: 4px;
    padding-left: 0.5rem;
    margin-left: -0.5rem;
    transition: all 0.2s ease;
}

.discovermax-toc-link:hover {
    color: #007cba;
    background-color: rgba(0, 124, 186, 0.1);
    text-decoration: none;
}

.discovermax-toc-link:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

/* Conflict and empty state styles */
.discovermax-toc-conflict {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 8px;
    padding: 1rem;
    margin: 1rem 0;
}

.discovermax-toc-conflict p {
    margin: 0;
    color: #856404;
}

.discovermax-toc-empty {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 1rem;
    margin: 1rem 0;
    text-align: center;
}

.discovermax-toc-empty p {
    margin: 0;
    color: #6c757d;
    font-style: italic;
}

/* Responsive Design */
@media (max-width: 768px) {
    .discovermax-toc-wrapper {
        padding: 1rem;
        margin: 1rem 0;
    }
    
    .discovermax-toc-title {
        font-size: 1rem;
    }
    
    .discovermax-toc-h3 {
        margin-left: 0.5rem;
    }
    
    .discovermax-toc-h4 {
        margin-left: 1rem;
    }
    
    .discovermax-toc-list {
        padding-left: 1rem;
    }
}

/* Dark mode support - only when site has dark mode class */
.dark-mode .discovermax-toc-wrapper {
    background: #2d3748;
    border-color: #4a5568;
}

.dark-mode .discovermax-toc-title {
    color: #e2e8f0;
}

.dark-mode .discovermax-toc-header {
    border-bottom-color: #4a5568;
}

.dark-mode .discovermax-toc-link {
    color: #e2e8f0;
}

.dark-mode .discovermax-toc-link:hover {
    color: #63b3ed;
    background-color: rgba(99, 179, 237, 0.1);
}

/* Smooth scrolling for anchor links */
html {
    scroll-behavior: smooth;
}

/* Heading anchor offset for fixed headers */
h2[id], h3[id], h4[id] {
    scroll-margin-top: 2rem;
}

/* Animation for TOC appearance */
.discovermax-toc-wrapper {
    animation: tocFadeIn 0.5s ease-in-out;
}

@keyframes tocFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}