:root {
	--jeux-header-height: 78px;
	--jeux-header-height-tablet: 60px;

	--us-header-height: 70px;
	--us-header-height-tablet: 70px;

	--toc-height: 44px;
}

.slide-opened .bw-toc,
.nav-visible .bw-toc {
	display: none;
}

/*  Jeux adjustments  */

.bw-toc-active:has(.main-navigation + .bw-toc) .bw-wrapper {
	padding: calc(var(--jeux-header-height) + var(--toc-height)) 0 0;
}

.bw-toc-active:has(.main-navigation + .bw-toc) .bw-toc {
	position: fixed;
	top: var(--jeux-header-height);
	left: 0;
	width: 100%;
	z-index: 998;
}

.bw-toc-active:has(.main-navigation + .bw-toc) .bw-toc .bw-toc__container {
	padding: 0 48px;
}

@media (max-width: 1023px) {
	.bw-toc-active:has(.main-navigation + .bw-toc) .bw-wrapper {
		padding: calc(var(--jeux-header-height-tablet) + var(--toc-height)) 0 0;
	}

	.bw-toc-active:has(.main-navigation + .bw-toc) .bw-toc {
		top: var(--jeux-header-height-tablet);
	}

	.bw-toc-active:has(.main-navigation + .bw-toc) .bw-toc .bw-toc__container {
		padding: 0 20px;
	}
}

/*  US Sites adjustments */

.bw-header-fixed .bw-header {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	z-index: 9999;
}

.bw-header-fixed .bw-main {
	padding-top: var(--us-header-height);
}

.bw-toc-active:has(.bw-header) .bw-toc {
	position: fixed;
	top: var(--us-header-height);
	left: 0;
	width: 100%;
	z-index: 9998;
}

.bw-toc-active:has(.bw-header) .bw-main {
	padding: calc(var(--us-header-height) + var(--toc-height)) 0 0;
}

/*  US - admin bar  */
.bw-header-fixed.admin-bar .bw-header,
.bw-toc-active.admin-bar:has(.bw-header) .bw-header {
	top: var(--us-header-height) + 32px;
}

.bw-toc-active.admin-bar:has(.bw-header) .bw-toc {
	top: calc(var(--us-header-height) + 32px);
}

@media (max-width: 782px) {
	/*  US - admin bar  */
	.bw-header-fixed.admin-bar .bw-header,
	.bw-toc-active.admin-bar:has(.bw-header) .bw-header {
		top: var(--us-header-height) + 46px;
	}

	.bw-toc-active.admin-bar:has(.bw-header) .bw-toc {
		top: calc(var(--us-header-height) + 46px);
	}
}

/* Table of Contents */
.bw-toc {
	width: 100%;
	background: var(--bw-toc-background);
	box-shadow: 0 2px 6px 0 rgba(0, 0, 0, 0.16);
	transition: opacity 0.3s ease, visibility 0.3s ease;
	overflow: hidden;
	margin-top: 0;
	margin-bottom: 0;
	height: var(--toc-height);
}

/* Container */
.bw-toc .bw-toc__container {
	position: relative;
	display: flex;
	align-items: center;
}

/* Swiper Container */
.bw-toc .bw-toc__swiper {
	flex: 1;
	overflow-x: auto;
	overflow-y: hidden;
	position: relative;
	scroll-behavior: smooth;
	/* Hide scrollbar */
	scrollbar-width: none; /* Firefox */
	-ms-overflow-style: none; /* IE/Edge */
	padding: 0 20px;
}

@media (max-width: 767px) {
	.bw-toc .bw-toc__swiper {
		padding: 0;
	}
}

.bw-toc__swiper::-webkit-scrollbar {
	display: none; /* Webkit browsers */
}

.bw-toc__wrapper {
	display: flex;
	align-items: center;
	width: max-content; /* Allow content to extend beyond container */
	gap: 15px;
}

/* Slides */
.bw-toc__slide {
	flex-shrink: 0;
	position: relative;
	display: block;
}

/* Navigation Links */
.bw-toc .bw-toc__link {
	display: block;
	padding: 10px 10px 8px;
	text-decoration: none;
	color: var(--bw-toc-item-color);
	font-weight: 500;
	font-size: 16px;
	border-radius: 0;
	background: var(--bw-toc-background);
	border-bottom: 2px solid var(--bw-toc-background);
	transition: border 0.3s ease, color 0.3s ease;
	white-space: nowrap;
	position: relative;
	cursor: pointer;
	user-select: none;
}

.bw-toc .bw-toc__link.active,
.bw-toc .bw-toc__link:focus,
.bw-toc .bw-toc__link:hover {
	color: var(--bw-toc-item-active-color);
	background: var(--bw-toc-background);
	text-decoration: none;
	transform: none;
	border-bottom: 2px solid var(--bw-toc-item-active-border-color);
}

/* Navigation Arrows */
.bw-toc .bw-toc__nav {
	position: absolute;
	width: 40px;
	height: 100%;
	top: 0;
	z-index: 2;
	border-radius: 0;
	background: #fff;
	background: linear-gradient(
		90deg,
		rgba(255, 255, 255, 0.3) 0%,
		#fff 25%,
		#fff 50%,
		#fff 100%
	);
	border: none;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	color: var(--bw-toc-slider-arrow-color);
	flex-shrink: 0;
	transition: opacity 0.3s ease;
}

.bw-toc .bw-toc__nav--disabled {
	opacity: 0;
}

/* Navigation Arrow Modifiers */
.bw-toc .bw-toc__nav--prev {
	left: 30px;
	background: linear-gradient(
		90deg,
		var(--bw-toc-background) 0%,
		var(--bw-toc-background) 25%,
		var(--bw-toc-background) 50%,
		rgba(255, 255, 255, 0.3) 100%
	);
}

.bw-toc .bw-toc__nav--next {
	right: 30px;
}

/* Responsive Design */
@media (max-width: 1023px) {
	.bw-toc .bw-toc__nav--prev {
		left: 3px;
	}

	.bw-toc .bw-toc__nav--next {
		right: 3px;
	}
}

@media (max-width: 480px) {
}

/* Specific styles for custom theme integration */
.bw-toc.bw-toc--direct,
.bw-toc.bw-toc--helper {
	margin-bottom: 20px;
}

/* Integration before .bw-main */
.bw-main + .bw-toc {
	order: -1; /* If using flexbox */
}

/* Fallback positioning when header is not found */
.bw-toc.bw-toc--fallback {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	z-index: 9999;
	background: rgba(255, 255, 255, 0.98);
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* Hide on very small screens if needed */
@media (max-width: 320px) {
	.bw-toc {
		display: none;
	}
}

/* Loading state */
.bw-toc.bw-toc--loading {
	opacity: 0.7;
}

.bw-toc.bw-toc--loading .bw-toc__link {
	pointer-events: none;
}

/* Smooth transitions for active state changes */
.bw-toc__link {
	transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* TOC is now inside navigation, no need for body padding adjustments */
/* Smooth transitions */
.bw-toc {
	transition: opacity 0.2s ease-out, visibility 0.2s ease-out;
}
