/**
 * Table of Contents Component
 * Automatic table of contents generated from page headings
 * Clean white card design with custom numbered badges
 *
 * @package Bonusovekody
 * @since 2.0.0
 */

/* ============================================
 * CONTAINER & CARD STYLE
 * ============================================ */

.toc-container {
    border: 1px solid #E8E8E8;
    border-radius: var(--radius-md);
    padding: var(--space-7);
    margin: 0 0 var(--space-7) 0;
}

.toc {
	position: relative;
}

.toc--collapsed {
	max-height: 312px;
	overflow: hidden;
}

.toc--expanded {
	max-height: none;
	overflow: visible;
}

.toc--collapsed::after {
	content: "";
	position: absolute;
	bottom: 0;
	left: 0;
	width: 100%;
	height: 60px;
	background: linear-gradient(to bottom, rgba(255, 255, 255, 0), rgba(255, 255, 255, 1));
	pointer-events: none;
}

.toc--expanded::after {
	display: none;
}

/* ============================================
 * TITLE
 * ============================================ */

.entry-content .toc__title {
    font-size: var(--font-size-h3);
    line-height: var(--line-height-h3);
    font-weight: var(--font-weight-bold);
    margin: 0 0 var(--space-6) 0;
    padding: 0;
    background: transparent;
    border: none;
}

/* ============================================
 * LIST STYLING WITH CUSTOM NUMBERED BADGES
 * ============================================ */

.entry-content .toc__list, #main-content .toc__list {
	list-style: none;
	padding-left: var(--space-8);
	margin: 0;
	counter-reset: toc-counter;
}

#main-content .toc__list-item {
	position: relative;
	line-height: var(--line-height-base);
	counter-increment: toc-counter;
	padding: 6px 0;
	margin-bottom: 0 !important;
}

#main-content .toc__list-item::before {
	content: counter(toc-counter);
	position: absolute;
	left: -2.4rem;
	top: 5px;
	display: inline-grid;
	place-items: center;
	width: var(--space-6);
	height: var(--space-6);
	background: #EAF2FD;
	color: #1A1A1A;
	border-radius: 50%;
	font-size: var(--font-size-small);
	font-weight: var(--font-weight-semibold);
}

/* Nested Lists (Sub-items) */
.toc__list .toc__list {
	margin-top: var(--space-3) !important;
	padding-left: calc(var(--space-6) + 1rem);
	counter-reset: toc-counter;
	pointer-events: none !important;
}

/* Restore pointer events for nested list items */
.toc__list .toc__list .toc__list-item {
	pointer-events: auto !important;
}

.toc__list .toc__list .toc__list-item * {
	pointer-events: auto !important;
}

/* ============================================
 * LINKS
 * ============================================ */

.toc__list > li:hover:not(:has(.toc__list-item:hover)) > .toc__link {
	text-decoration: underline;
}

/* ============================================
 * SHOW MORE BUTTON
 * ============================================ */

.toc__toggle-btn {
	width: 100%;
	margin-top: var(--space-6);
}

/* ============================================
 * RESPONSIVE - MOBILE
 * ============================================ */

@media only screen and (max-width: 768px) {
	.toc-container {
		padding: 20px;
		margin: 24px 0;
	}

	.toc__title {
		font-size: 20px;
		margin-bottom: 20px;
	}

	.toc__link {
		font-size: 15px;
	}

	.toc__list {
		gap: 10px;
	}

	.toc__toggle-btn {
		padding: 10px;
		font-size: 15px;
	}
}
