/* Custom Table of Contents Styles */

.custom-toc-wrapper {
    background: #ffffff;
    border: none;
    border-radius: 0px;
    margin: 20px 0;
    position: sticky;
    top: 20px;
    z-index: 100;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

/* Avada Builder Compatibility */
.fusion-body .custom-toc-wrapper {
    position: sticky;
}

.fusion-fullwidth .custom-toc-wrapper {
    max-width: 100%;
}

/* Adjust top position for Avada sticky header */
.fusion-is-sticky .custom-toc-wrapper {
    top: 100px;
}

/* TLDR Content Section */
.tldr-content-section {
    background: #f9f9f9;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
    padding: 20px;
    margin: 20px 0;
}

.tldr-content-section h2 {
    margin-top: 0;
    font-size: 16px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #333;
}

.tldr-text {
    font-size: 14px;
    line-height: 1.6;
    color: #555;
}

.tldr-text p {
    margin: 0 0 10px 0;
}

.tldr-text p:last-child {
    margin-bottom: 0;
}

.toc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
	border-radius: 0px;
}

.toc-toggle {
    background: none;
    border: none;
    font-family: 'Pitch';
    font-size: 15px;
    font-weight: 900;
    letter-spacing: 0.1px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0;
    color: #282827;
    transition: color 0.2s;
}

.toc-toggle:hover {
    color: #000;
}

.toc-icon {
    width: 15px;
    display: inline-flex;
}

.toc-like-btn {
    background: none;
	border: none;
    border-left: 1px solid #DEDEDE;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 0px;
	padding-left: 15px;
    border-radius: 0px;
    transition: background-color 0.2s;
    color: #000 !important;
}

.toc-like-btn:hover {
    background-color: #f5f5f5;
}

.toc-like-btn.liked {
    color: #000 !important;
}

.toc-like-btn .like-icon {
    color: #000 !important;
    width: 15px;
    display: inline-flex;
}

.like-icon {
    font-size: 18px;
    color: #000 !important;
}

.toc-like-btn.liked .like-icon {
    width: 15px;
    display: inline-flex;
}

.like-count {
    font-family: 'Source Serif 4 SemiBold';
    font-size: 15px;
    font-weight: 700;
    color: #000 !important;
}

.toc-like-btn.like-animation {
    animation: likeScale 0.3s ease;
}

@keyframes likeScale {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

.toc-content {
    max-height: 400px;
    overflow-y: auto;
    padding: 0;
}

.toc-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background-color: #fff;
	border-top: 7px solid #F7F7F7;
    border-bottom: 1px solid #DEDEDE;
	font-family: "Source Serif 4 SemiBold";
    font-size: 14px;
    letter-spacing: 0.5px;
    color: #282827;
}

.toc-close {
    background: none;
    border: none;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    color: #999;
    transition: color 0.2s;
    display: inline-flex;
}

.toc-close:hover {
    color: #333;
}

.toc-list {
    list-style: none;
    margin: 0;
    padding: 0; //testing dws
}

.toc-list li {
    border-bottom: 1px solid #DEDEDE;
}

.toc-list li:last-child {
    border-bottom: none;
}

.toc-link {
    display: block;
    padding: 12px 16px;
    color: #282827;
    text-decoration: none;
	font-family: "Source Serif 4";
    font-size: 14px;
    line-height: 1.5;
    transition: background-color 0.2s, padding-left 0.2s;
}

.toc-link:hover {
    background-color: #fff;
	color: #282827;
	text-decoration: underline;
}

.toc-link.active {
    background-color: #ECECEB;
	color: #282827;
	text-decoration: underline;
}

/* Scrollbar styling for TOC content */
.toc-content::-webkit-scrollbar {
    width: 6px;
}

.toc-content::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.toc-content::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.toc-content::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* Mobile Styles - MAXIMUM SPECIFICITY */
@media screen and (max-width: 768px) {
    /* Force all properties with !important */
    body .custom-toc-wrapper,
    html body .custom-toc-wrapper,
    .fusion-body .custom-toc-wrapper,
    div.custom-toc-wrapper,
    #custom-toc-5002.custom-toc-wrapper {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        top: auto !important;
        margin: 0 !important;
        border-radius: 0px !important;
        border: none !important;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1) !important;
        z-index: 99999 !important;
        transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1) !important;
        background-color: #ffffff !important;
        background: #ffffff !important;
        opacity: 1 !important;
        width: 100% !important;
    }

    body #custom-toc-5002.custom-toc-wrapper.ctm-cls-ads-exist {
    bottom: 30px !important;
    }
    body #custom-toc-5002.custom-toc-wrapper.ctm-cls-ads-exist.toc-hidden {
        bottom: 0px !important;
    }
    
    /* Force solid background on all child elements */
    body .custom-toc-wrapper *,
    html body .custom-toc-wrapper *,
    .custom-toc-wrapper div,
    .custom-toc-wrapper button,
    .custom-toc-wrapper ul {
        background-color: transparent;
    }
    
    body .custom-toc-wrapper .toc-header,
    html body .custom-toc-wrapper .toc-header,
    .custom-toc-wrapper .toc-header {
        padding: 14px 16px !important;
        background-color: #ffffff !important;
        background: #ffffff !important;
        opacity: 1 !important;
    }
    
    body .custom-toc-wrapper .toc-content,
    html body .custom-toc-wrapper .toc-content,
    .custom-toc-wrapper .toc-content {
        max-height: 50vh !important;
        background-color: #ffffff !important;
        background: #ffffff !important;
        opacity: 1 !important;
    }
    
    body .custom-toc-wrapper .toc-list,
    html body .custom-toc-wrapper .toc-list,
    .custom-toc-wrapper .toc-list {
        background-color: #ffffff !important;
        background: #ffffff !important;
    }
    
    /* Hide state */
    body .custom-toc-wrapper.toc-hidden,
    html body .custom-toc-wrapper.toc-hidden,
    .custom-toc-wrapper.toc-hidden {
        transform: translateY(100%) !important;
    }
    
    /* Show state */
    body .custom-toc-wrapper:not(.toc-hidden),
    html body .custom-toc-wrapper:not(.toc-hidden),
    .custom-toc-wrapper:not(.toc-hidden) {
        transform: translateY(0) !important;
    }
    
    .toc-toggle {
            font-size: 16px !important;
    }
    
    /* Overlay when open */
    body .custom-toc-wrapper.toc-open::before,
    html body .custom-toc-wrapper.toc-open::before,
    .custom-toc-wrapper.toc-open::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: -1;
    }

}

/* Tablet adjustments */
@media screen and (min-width: 769px) and (max-width: 1024px) {
    .custom-toc-wrapper {
        top: 80px;
    }
}

/* Desktop: Larger screens */
@media screen and (min-width: 1200px) {
    .toc-content {
        max-height: 500px;
    }
}

/* Print styles */
@media print {
    .custom-toc-wrapper {
        display: none;
    }
}

/* Accessibility improvements */
.toc-toggle:focus,
.toc-like-btn:focus,
.toc-close:focus,
/*.toc-link:focus {
    outline: 2px solid #4A90E2;
    outline-offset: 2px;
}*/

/* Processing state */
.toc-like-btn.processing {
    /*opacity: 0.6;*/
    /*cursor: not-allowed;*/
     cursor: allowed;
}

/* Empty state */
.toc-list:empty::after {
    content: 'No headings found in this article.';
    display: block;
    padding: 20px 16px;
    text-align: center;
    color: #999;
    font-size: 14px;
    font-style: italic;
}

.toc-section-header .toc-close img {
    width: 12px;
}

