/* ==========================================================================
   Smart TOC Pro - Frontend Styles
   Version: 2.2.1
   Author: Small SEO Engine
   ========================================================================== */

/**
 * TABLE OF CONTENTS
 * 
 * 1.  Reading Progress Bar
 * 2.  Back to Top Button
 * 3.  Reading Time Badge
 * 4.  Title Wrap
 * 5.  Heading Numbers
 * 6.  Search/Filter Styles
 * 7.  Collapsible Sections
 * 8.  Base TOC Styles
 * 9.  Header & Toggle
 * 10. TOC List Styles
 * 11. Active Link Highlighting
 * 12. Sticky TOC
 * 13. Responsive Styles
 * 14. Mobile Floating Button & Modal
 * 15. Theme Presets (Light, Dark, Minimal, Glassmorphism, Gradient)
 * 16. Widget-specific Styles
 * 17. Floating TOC Button & Panel
 * 18. Floating Panel Styles
 * 19. Animations & Transitions
 */

/* ==========================================================================
   1. Reading Progress Bar
   ========================================================================== */

.smart-toc-progress-bar {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 4px;
	background: rgba(0, 0, 0, 0.1);
	z-index: 99999;
}

.smart-toc-progress-fill {
	height: 100%;
	width: 0%;
	background: linear-gradient(90deg, #0073aa 0%, #00a0d2 100%);
	transition: width 0.1s ease-out;
	border-radius: 0 2px 2px 0;
}

/* ==========================================================================
   2. Back to Top Button
   ========================================================================== */

/* Back to Top - Base Styles */
.smart-toc-back-to-top {
	--btt-bg-color: var(--smart-toc-theme-color, #0073aa);
	--btt-icon-color: #ffffff;
	position: fixed;
	bottom: 30px;
	right: 30px;
	width: 48px;
	height: 48px;
	background: var(--btt-bg-color);
	color: var(--btt-icon-color);
	border: none;
	border-radius: 50%;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
	opacity: 0;
	visibility: hidden;
	transform: translateY(20px);
	transition: all 0.3s ease;
	z-index: 9998;
	padding: 0;
}

/* Shape Variants */
.smart-toc-back-to-top.smart-toc-btt-circle {
	border-radius: 50%;
}

.smart-toc-back-to-top.smart-toc-btt-rounded {
	border-radius: 12px;
}

.smart-toc-back-to-top.smart-toc-btt-pill {
	width: auto;
	padding: 0 16px;
	border-radius: 24px;
}

/* Progress Ring */
.smart-toc-back-to-top .progress-ring {
	position: absolute;
	top: -4px;
	left: -4px;
	width: 56px;
	height: 56px;
	transform: rotate(-90deg);
	pointer-events: none;
}

.smart-toc-btt-rounded .progress-ring,
.smart-toc-btt-pill .progress-ring {
	display: none;
}

.smart-toc-back-to-top .progress-ring-bg {
	fill: none;
	stroke: rgba(0, 0, 0, 0.08);
	stroke-width: 3;
}

.smart-toc-back-to-top .progress-ring-fill {
	fill: none;
	stroke: var(--btt-bg-color);
	stroke-width: 3;
	stroke-linecap: round;
	stroke-dasharray: 163;
	stroke-dashoffset: 163;
	transition: stroke-dashoffset 0.1s ease;
	filter: brightness(1.2);
}

/* Visible State */
.smart-toc-back-to-top.visible {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
}

/* Hover State */
.smart-toc-back-to-top:hover {
	transform: translateY(-3px);
	box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
	filter: brightness(1.1);
}

.smart-toc-back-to-top:active {
	transform: translateY(-1px);
	filter: brightness(0.95);
}

/* Icon Styles */
.smart-toc-back-to-top .btt-icon {
	width: 20px;
	height: 20px;
	position: relative;
	z-index: 1;
	color: var(--btt-icon-color);
	fill: var(--btt-icon-color);
}

.smart-toc-back-to-top .btt-icon path,
.smart-toc-back-to-top .btt-icon circle {
	fill: var(--btt-icon-color);
}

.smart-toc-back-to-top .btt-icon path[stroke] {
	stroke: var(--btt-icon-color);
	fill: none;
}

/* ==========================================================================
   2b. Lazy Load Placeholder
   ========================================================================== */

.smart-toc-lazy:not(.smart-toc-ready) {
	opacity: 0.7;
	position: relative;
}

.smart-toc-lazy:not(.smart-toc-ready)::after {
	content: '';
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: linear-gradient(
		90deg,
		transparent 0%,
		rgba(255, 255, 255, 0.4) 50%,
		transparent 100%
	);
	animation: smartTocLazyShimmer 1.5s infinite;
	pointer-events: none;
}

@keyframes smartTocLazyShimmer {
	0% {
		transform: translateX(-100%);
	}
	100% {
		transform: translateX(100%);
	}
}

.smart-toc-lazy.smart-toc-ready {
	opacity: 1;
	transition: opacity 0.3s ease;
}

.smart-toc-lazy.smart-toc-ready::after {
	display: none;
}

/* Reading Time */
.smart-toc-reading-time {
	display: inline-block;
	font-size: 0.75rem;
	color: #666;
	background: #f0f0f0;
	padding: 4px 12px;
	border-radius: 12px;
	margin-left: 8px;
	font-weight: 500;
	white-space: nowrap;
}

/* Title wrap for reading time */
.smart-toc-title-wrap {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 16px;
}

/* Heading Numbers */
.smart-toc-list .toc-number {
	color: #999;
	font-weight: 500;
	margin-right: 6px;
	font-size: 0.9em;
	display: inline;
	white-space: nowrap;
}

.smart-toc-list.smart-toc-numbered .toc-item > a.active .toc-number {
	color: rgba(255, 255, 255, 0.8);
}

/* ==========================================================================
   Search/Filter Styles
   ========================================================================== */

.smart-toc-search {
	position: relative;
	margin-bottom: 12px;
	padding: 0 2px;
}

.smart-toc-search-input {
	width: 100%;
	padding: 8px 32px 8px 36px;
	border: 1.5px solid #e0e0e0;
	border-radius: 20px;
	font-size: 0.9rem;
	outline: none;
	transition: border-color 0.2s, box-shadow 0.2s;
	background: #fafafa;
}

.smart-toc-search-input:focus {
	border-color: #0073aa;
	box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.15);
	background: #fff;
}

.smart-toc-search-input::placeholder {
	color: #999;
}

.smart-toc-search-icon {
	position: absolute;
	left: 12px;
	top: 50%;
	transform: translateY(-50%);
	color: #999;
	pointer-events: none;
}

.smart-toc-search-clear {
	position: absolute;
	right: 8px;
	top: 50%;
	transform: translateY(-50%);
	background: #ddd;
	border: none;
	color: #666;
	width: 20px;
	height: 20px;
	border-radius: 50%;
	cursor: pointer;
	font-size: 14px;
	line-height: 1;
	display: none;
	align-items: center;
	justify-content: center;
	transition: background 0.2s;
}

.smart-toc-search-clear:hover {
	background: #ccc;
	color: #333;
}

.smart-toc-no-results {
	text-align: center;
	padding: 15px;
	color: #999;
	font-size: 0.9rem;
	font-style: italic;
}

/* ==========================================================================
   Copy Anchor Link
   ========================================================================== */

.smart-toc-copy-link {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 24px;
	height: 24px;
	margin-left: 6px;
	padding: 0;
	background: transparent;
	border: none;
	border-radius: 4px;
	color: #999;
	cursor: pointer;
	opacity: 0;
	visibility: hidden;
	transition: all 0.2s ease;
	vertical-align: middle;
	flex-shrink: 0;
}

.smart-toc-copy-link svg {
	width: 14px;
	height: 14px;
}

.smart-toc .toc-item > a:hover + .smart-toc-copy-link,
.smart-toc .toc-item:hover > .smart-toc-copy-link,
.smart-toc-copy-link:hover,
.smart-toc-copy-link:focus {
	opacity: 1;
	visibility: visible;
}

.smart-toc-copy-link:hover {
	background: rgba(0, 115, 170, 0.1);
	color: #0073aa;
}

.smart-toc-copy-link:focus {
	outline: 2px solid #0073aa;
	outline-offset: 1px;
}

.smart-toc-copy-link.copied {
	color: #46b450;
}

.smart-toc-copy-link.copied:hover {
	background: rgba(70, 180, 80, 0.1);
}

/* Copy link tooltip */
.smart-toc-copy-tooltip {
	position: absolute;
	bottom: 100%;
	left: 50%;
	transform: translateX(-50%);
	padding: 4px 8px;
	background: #333;
	color: #fff;
	font-size: 11px;
	font-weight: 500;
	border-radius: 4px;
	white-space: nowrap;
	opacity: 0;
	visibility: hidden;
	transition: all 0.2s ease;
	pointer-events: none;
	margin-bottom: 4px;
	z-index: 10;
}

.smart-toc-copy-tooltip::after {
	content: '';
	position: absolute;
	top: 100%;
	left: 50%;
	transform: translateX(-50%);
	border: 4px solid transparent;
	border-top-color: #333;
}

.smart-toc-copy-link:hover .smart-toc-copy-tooltip,
.smart-toc-copy-link:focus .smart-toc-copy-tooltip,
.smart-toc-copy-link.copied .smart-toc-copy-tooltip {
	opacity: 1;
	visibility: visible;
}

/* Wrapper for link + copy button */
.smart-toc .toc-item-content {
	display: flex;
	align-items: center;
}

.smart-toc .toc-item-content > a {
	flex: 1;
	min-width: 0;
}

/* Dark theme copy link */
.smart-toc.smart-toc-theme-dark .smart-toc-copy-link {
	color: #777;
}

.smart-toc.smart-toc-theme-dark .smart-toc-copy-link:hover {
	background: rgba(255, 255, 255, 0.1);
	color: #fff;
}

/* Gradient theme copy link */
.smart-toc.smart-toc-theme-gradient .smart-toc-copy-link {
	color: rgba(255, 255, 255, 0.5);
}

.smart-toc.smart-toc-theme-gradient .smart-toc-copy-link:hover {
	background: rgba(255, 255, 255, 0.15);
	color: rgba(255, 255, 255, 0.9);
}

/* ==========================================================================
   Keyboard Navigation Styles
   ========================================================================== */

.smart-toc.keyboard-focused {
	outline: 2px solid #0073aa;
	outline-offset: 2px;
}

.smart-toc .toc-item > a:focus {
	outline: 2px solid #0073aa;
	outline-offset: 2px;
	background: #e6f0fa;
}

/* ==========================================================================
   Theme Presets
   ========================================================================== */

/* Default Theme - explicit styles */
.smart-toc.smart-toc-theme-default {
	background: #fff !important;
	border: 1.5px solid #e0e0e0 !important;
	box-shadow: 0 2px 12px rgba(0,0,0,0.06) !important;
}

.smart-toc.smart-toc-theme-default .smart-toc-title {
	color: #222 !important;
}

.smart-toc.smart-toc-theme-default .toc-item > a {
	color: #0073aa !important;
}

.smart-toc.smart-toc-theme-default .toc-item > a:hover {
	color: #005580 !important;
	background: #e6f0fa !important;
}

.smart-toc.smart-toc-theme-default .toc-item > a.active {
	color: #005580 !important;
	background: linear-gradient(90deg, #e6f0fa 0%, #f5f8fa 100%) !important;
	border-left-color: #0073aa !important;
}

/* Light Theme */
.smart-toc.smart-toc-theme-light {
	background: #ffffff !important;
	border: 1px solid #f0f0f0 !important;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04) !important;
}

.smart-toc.smart-toc-theme-light .smart-toc-title {
	color: #333 !important;
}

.smart-toc.smart-toc-theme-light .toc-item > a {
	color: #555 !important;
}

.smart-toc.smart-toc-theme-light .toc-item > a:hover {
	color: #0073aa !important;
	background: #f8f9fa !important;
}

.smart-toc.smart-toc-theme-light .toc-item > a.active {
	color: #0073aa !important;
	background: #f0f4f7 !important;
	border-left-color: #0073aa !important;
}

/* Dark Theme */
.smart-toc.smart-toc-theme-dark {
	background: #1e1e1e !important;
	border: 1px solid #333 !important;
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3) !important;
}

.smart-toc.smart-toc-theme-dark .smart-toc-title {
	color: #fff !important;
}

.smart-toc.smart-toc-theme-dark .toc-item > a {
	color: #ccc !important;
}

.smart-toc.smart-toc-theme-dark .toc-item > a:hover {
	color: #fff !important;
	background: #333 !important;
}

.smart-toc.smart-toc-theme-dark .toc-item > a.active {
	color: #fff !important;
	background: rgba(255, 255, 255, 0.1) !important;
	border-left-color: #fff !important;
}

.smart-toc.smart-toc-theme-dark .smart-toc-toggle {
	background: #333 !important;
	color: #fff !important;
}

.smart-toc.smart-toc-theme-dark .smart-toc-reading-time {
	background: #333 !important;
	color: #aaa !important;
}

.smart-toc.smart-toc-theme-dark .smart-toc-search-input {
	background: #2a2a2a !important;
	border-color: #444 !important;
	color: #fff !important;
}

.smart-toc.smart-toc-theme-dark .smart-toc-search-input::placeholder {
	color: #777;
}

.smart-toc.smart-toc-theme-dark .smart-toc-list ul {
	border-left-color: #444 !important;
}

.smart-toc.smart-toc-theme-dark .smart-toc-active-indicator {
	color: #fff !important;
	background: rgba(255, 255, 255, 0.15) !important;
}

/* Gradient Theme - Active indicator with white text */
.smart-toc.smart-toc-theme-gradient .smart-toc-active-indicator {
	color: #fff !important;
	background: rgba(255, 255, 255, 0.2) !important;
}

/* Minimal Theme */
.smart-toc.smart-toc-theme-minimal {
	background: #fafafa !important;
	border: none !important;
	box-shadow: none !important;
	padding: 15px 0 !important;
	border-left: 3px solid #e0e0e0 !important;
	border-radius: 0 !important;
	padding-left: 20px !important;
}

.smart-toc.smart-toc-theme-minimal .smart-toc-title {
	font-size: 0.85rem !important;
	text-transform: uppercase !important;
	letter-spacing: 0.1em !important;
	color: #999 !important;
	font-weight: 600 !important;
}

.smart-toc.smart-toc-theme-minimal .toc-item > a {
	color: #666 !important;
	font-size: 0.95rem !important;
}

.smart-toc.smart-toc-theme-minimal .toc-item > a:hover {
	color: #333 !important;
	background: transparent !important;
}

.smart-toc.smart-toc-theme-minimal .toc-item > a.active {
	color: #222 !important;
	background: transparent !important;
	border-left-color: #333 !important;
	font-weight: 600 !important;
}

.smart-toc.smart-toc-theme-minimal .smart-toc-list ul {
	border-left: none !important;
	margin-left: 12px !important;
}

/* Glassmorphism Theme */
.smart-toc.smart-toc-theme-glassmorphism {
	background: rgba(255, 255, 255, 0.7) !important;
	backdrop-filter: blur(10px) !important;
	-webkit-backdrop-filter: blur(10px) !important;
	border: 1px solid rgba(255, 255, 255, 0.3) !important;
	box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1) !important;
}

.smart-toc.smart-toc-theme-glassmorphism .smart-toc-title {
	color: #222 !important;
}

.smart-toc.smart-toc-theme-glassmorphism .toc-item > a {
	color: #444 !important;
}

.smart-toc.smart-toc-theme-glassmorphism .toc-item > a:hover {
	color: #0073aa !important;
	background: rgba(0, 115, 170, 0.1) !important;
}

.smart-toc.smart-toc-theme-glassmorphism .toc-item > a.active {
	color: #005580 !important;
	background: rgba(0, 115, 170, 0.15) !important;
	border-left-color: #0073aa !important;
}

.smart-toc.smart-toc-theme-glassmorphism .smart-toc-toggle {
	background: rgba(255, 255, 255, 0.5) !important;
	color: #333 !important;
}

.smart-toc.smart-toc-theme-glassmorphism .smart-toc-search-input {
	background: rgba(255, 255, 255, 0.5) !important;
	border-color: rgba(255, 255, 255, 0.3) !important;
	color: #333 !important;
}

/* Gradient Theme */
.smart-toc.smart-toc-theme-gradient {
	background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
	border: none !important;
	box-shadow: 0 8px 30px rgba(102, 126, 234, 0.4) !important;
}

.smart-toc.smart-toc-theme-gradient .smart-toc-title {
	color: #fff !important;
}

.smart-toc.smart-toc-theme-gradient .toc-item > a {
	color: rgba(255, 255, 255, 0.85) !important;
}

.smart-toc.smart-toc-theme-gradient .toc-item > a:hover {
	color: #fff !important;
	background: rgba(255, 255, 255, 0.15) !important;
}

.smart-toc.smart-toc-theme-gradient .toc-item > a.active {
	background: rgba(255, 255, 255, 0.25) !important;
	color: #fff !important;
	box-shadow: none !important;
	border-left-color: rgba(255, 255, 255, 0.5) !important;
}

.smart-toc.smart-toc-theme-gradient .smart-toc-toggle {
	background: rgba(255, 255, 255, 0.2) !important;
	color: #fff !important;
}

.smart-toc.smart-toc-theme-gradient .smart-toc-reading-time {
	background: rgba(255, 255, 255, 0.2) !important;
	color: #fff !important;
}

.smart-toc.smart-toc-theme-gradient .smart-toc-search-input {
	background: rgba(255, 255, 255, 0.2) !important;
	border-color: rgba(255, 255, 255, 0.3) !important;
	color: #fff !important;
}

.smart-toc.smart-toc-theme-gradient .smart-toc-search-input::placeholder {
	color: rgba(255, 255, 255, 0.6);
}

.smart-toc.smart-toc-theme-gradient .smart-toc-search-icon {
	color: rgba(255, 255, 255, 0.7) !important;
}

.smart-toc.smart-toc-theme-gradient .smart-toc-list ul {
	border-left-color: rgba(255, 255, 255, 0.2) !important;
}

.smart-toc.smart-toc-theme-gradient .toc-number {
	color: rgba(255, 255, 255, 0.6) !important;
}

/* ==========================================================================
   Base TOC Styles
   ========================================================================== */

.smart-toc .smart-toc-title {
	font-size: var(--toc-title-size, 1.25rem);
	font-weight: 700;
	color: #222;
	letter-spacing: 0.01em;
}
.smart-toc .toc-item {
	margin: 0 0 2px 0;
	padding: 0;
	list-style: none;
	position: relative;
	display: flex;
	align-items: center;
}
.smart-toc .toc-item > a {
	color: #0073aa;
	text-decoration: none;
	padding: 4px 10px;
	display: inline-block;
	border-radius: 4px;
	transition: background 0.15s, color 0.15s;
}
.smart-toc .toc-item > a:hover {
	background: #e6f0fa;
	color: #005580;
	padding: 4px 10px;
}
.smart-toc .toc-item.has-children > .toc-section-toggle {
	background: transparent;
	border: none;
	color: #888;
	font-size: 1.1em;
	margin-right: 4px;
	cursor: pointer;
	vertical-align: middle;
	transition: color 0.15s;
}
.smart-toc .toc-item.has-children > .toc-section-toggle:hover {
	color: #0073aa;
}
.smart-toc .toc-item.has-children > .toc-section-toggle:focus {
	outline: 2px solid #0073aa;
}
.smart-toc .toc-level-2 { margin-left: 0; }
.smart-toc .toc-level-3 { margin-left: 12px; }
.smart-toc .toc-level-4 { margin-left: 24px; }
.smart-toc .toc-level-5 { margin-left: 36px; }
.smart-toc .toc-level-6 { margin-left: 48px; }
.smart-toc .smart-toc-list ul {
	margin: 0 0 0 16px;
	padding: 0;
}
.smart-toc .smart-toc-list li {
	margin: 0;
	padding: 0;
}
.smart-toc .smart-toc-list li:last-child {
	margin-bottom: 0;
}
.smart-toc .smart-toc-list a:focus {
	outline: 2px solid #0073aa;
	outline-offset: 1px;
}
.smart-toc .smart-toc-header {
	user-select: none;
}
.smart-toc .smart-toc-toggle[aria-expanded="true"] svg {
	transform: rotate(180deg);
	transition: transform 0.2s;
}
.smart-toc .smart-toc-toggle[aria-expanded="false"] svg {
	transform: rotate(0deg);
	transition: transform 0.2s;
}
.smart-toc .smart-toc-list ul {
	border-left: 1.5px dashed #e0e0e0;
	margin-left: 18px;
	padding-left: 10px;
}
.smart-toc .smart-toc-list ul ul {
	border-left: none;
}
.smart-toc {
	background: #fff;
	border: 1.5px solid #e0e0e0;
	border-radius: 10px;
	box-shadow: 0 2px 12px rgba(0,0,0,0.06);
	padding: 20px 22px 18px 22px;
	margin-bottom: 28px;
	font-family: 'Segoe UI', Arial, sans-serif;
}
.smart-toc .smart-toc-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 12px;
}
.smart-toc .smart-toc-title {
	font-size: var(--toc-title-size, 1.25rem);
	font-weight: 700;
	color: #222;
}
.smart-toc .smart-toc-toggle {
	background: #f3f3f3;
	color: #0073aa;
	border: none;
	padding: 6px;
	cursor: pointer;
	font-size: 16px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	border-radius: 50%;
}
.smart-toc .smart-toc-toggle:hover {
	background: #e6f0fa;
	color: #005580;
}
.smart-toc .smart-toc-toggle:focus {
	outline: 2px solid #0073aa;
}
.smart-toc .smart-toc-toggle svg {
	display: block;
	max-width: 100%;
	height: 20px;
	width: 20px;
	color: inherit;
}

.smart-toc .smart-toc-toggle svg path {
	stroke: currentColor;
}
.smart-toc .smart-toc-list {
	margin: 0;
	padding-left: 22px;
	font-size: 1rem;
}
.smart-toc.collapsed .smart-toc-list {
	display: none;
}

/* Active heading indicator (shown when collapsed) */
.smart-toc-active-indicator {
	display: none;
	font-size: 13px;
	color: #666;
	font-weight: 500;
	padding: 4px 10px;
	background: rgba(0, 115, 170, 0.1);
	border-radius: 12px;
	max-width: 200px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	margin-left: auto;
	margin-right: 10px;
	flex-shrink: 1;
	min-width: 0;
}
.smart-toc.collapsed .smart-toc-active-indicator:not(:empty) {
	display: block;
}
.smart-toc.collapsed .smart-toc-header {
	display: flex;
	align-items: center;
}
.smart-toc.collapsed .smart-toc-title-wrap {
	flex-shrink: 0;
}

/* Active link highlighting */
.smart-toc .toc-item > a.active {
	background: linear-gradient(90deg, #0073aa 0%, #0073aa 100%) !important;
	color: #fff !important;
	font-weight: 600;
	padding: 6px 12px 6px 10px !important;
	border-left: 4px solid #005580;
	margin-left: -10px;
	border-radius: 0 6px 6px 0;
	box-shadow: 0 2px 8px rgba(0, 115, 170, 0.3);
	display: inline-block;
	transition: all 0.2s ease;
}

/* Alternative subtle active style */
.smart-toc.smart-toc-subtle .toc-item > a.active {
	background: #e6f0fa !important;
	color: #005580 !important;
	font-weight: 600;
	padding: 4px 10px 4px 8px !important;
	border-left: 3px solid #0073aa;
	margin-left: -8px;
	border-radius: 0 4px 4px 0;
	box-shadow: none;
}

/* ==========================================================================
   Sticky TOC Styles
   ========================================================================== */

.smart-toc.smart-toc-sticky {
	transition: box-shadow 0.3s ease;
	will-change: transform, width, left, right;
}

/* Placeholder to prevent content jump */
.smart-toc-placeholder {
	display: none;
}

/* Base sticky state */
.smart-toc.smart-toc-sticky.is-sticky {
	position: fixed;
	z-index: 9999;
	max-height: calc(100vh - 60px);
	overflow-y: auto;
	box-shadow: 0 4px 25px rgba(0,0,0,0.15);
	background: #fff;
}

/* Left floating position */
.smart-toc.smart-toc-sticky-left.is-sticky {
	left: 20px;
	right: auto;
}

/* Right floating position */
.smart-toc.smart-toc-sticky-right.is-sticky {
	right: 20px;
	left: auto;
}

/* Inline sticky (stays in content flow position) */
.smart-toc.smart-toc-sticky-inline.is-sticky {
	/* Position set by JS based on original location */
}

/* Collapsed state when sticky */
.smart-toc.smart-toc-sticky.is-sticky.collapsed {
	max-height: none;
	overflow-y: visible;
}

/* Scrollbar styling for sticky TOC */
.smart-toc.smart-toc-sticky.is-sticky::-webkit-scrollbar {
	width: 5px;
}

.smart-toc.smart-toc-sticky.is-sticky::-webkit-scrollbar-track {
	background: #f1f1f1;
	border-radius: 3px;
}

.smart-toc.smart-toc-sticky.is-sticky::-webkit-scrollbar-thumb {
	background: #c1c1c1;
	border-radius: 3px;
}

.smart-toc.smart-toc-sticky.is-sticky::-webkit-scrollbar-thumb:hover {
	background: #a1a1a1;
}

/* Firefox scrollbar */
.smart-toc.smart-toc-sticky.is-sticky {
	scrollbar-width: thin;
	scrollbar-color: #c1c1c1 #f1f1f1;
}

/* Smooth scroll behavior */
html {
	scroll-behavior: smooth;
}

/* Print styles - Clean TOC for printed pages */
@media print {
	/* Hide interactive elements */
	.smart-toc-back-to-top,
	.smart-toc-progress-bar,
	.smart-toc-toggle,
	.smart-toc-search,
	.smart-toc-floating-btn,
	.smart-toc-floating-panel,
	.smart-toc-mobile-modal,
	.smart-toc-copy-link,
	.smart-toc-placeholder {
		display: none !important;
	}
	
	/* Show and style the TOC for print */
	.smart-toc {
		position: static !important;
		display: block !important;
		width: 100% !important;
		max-width: none !important;
		margin: 20px 0 !important;
		padding: 15px 20px !important;
		background: #fff !important;
		border: 2px solid #333 !important;
		border-radius: 0 !important;
		box-shadow: none !important;
		page-break-inside: avoid;
	}
	
	/* Clean title styling */
	.smart-toc-title {
		font-size: 14pt !important;
		font-weight: bold !important;
		color: #000 !important;
		border-bottom: 1px solid #333 !important;
		padding-bottom: 8px !important;
		margin-bottom: 12px !important;
	}
	
	/* Ensure list is visible and expanded */
	.smart-toc-list {
		display: block !important;
		max-height: none !important;
		overflow: visible !important;
	}
	
	/* Clean link styling for print */
	.smart-toc-list a {
		color: #000 !important;
		text-decoration: none !important;
		font-size: 11pt !important;
		display: block !important;
		padding: 3px 0 !important;
		background: none !important;
	}
	
	/* Show page numbers hint (URLs) */
	.smart-toc-list a::after {
		content: " [#" attr(href) "]";
		font-size: 9pt;
		color: #666;
	}
	
	/* Nested list indentation */
	.smart-toc-list .toc-list-inner {
		margin-left: 20px !important;
		padding-left: 0 !important;
		border-left: 1px solid #ccc !important;
	}
	
	/* Remove collapsed state */
	.smart-toc.collapsed .smart-toc-list {
		display: block !important;
	}
	
	/* Hide sticky specific styles */
	.smart-toc.is-sticky {
		position: static !important;
	}
	
	/* Reading time for print */
	.smart-toc-reading-time {
		background: none !important;
		border: 1px solid #999 !important;
		color: #333 !important;
	}
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
	.smart-toc,
	.smart-toc * {
		transition: none !important;
	}
	html {
		scroll-behavior: auto;
	}
}

/* ==========================================================================
   Responsive Styles
   ========================================================================== */

/* Large screens - TOC can float beside content */
@media screen and (min-width: 1400px) {
	.smart-toc.smart-toc-sticky-left.is-sticky,
	.smart-toc.smart-toc-sticky-right.is-sticky {
		max-width: 320px;
	}
}

/* Medium-large screens */
@media screen and (max-width: 1399px) and (min-width: 1200px) {
	.smart-toc.smart-toc-sticky-left.is-sticky,
	.smart-toc.smart-toc-sticky-right.is-sticky {
		max-width: 280px;
	}
}

/* Medium screens - reduce floating TOC size */
@media screen and (max-width: 1199px) and (min-width: 992px) {
	.smart-toc.smart-toc-sticky-left.is-sticky,
	.smart-toc.smart-toc-sticky-right.is-sticky {
		max-width: 250px;
		padding: 15px;
	}
	
	.smart-toc.smart-toc-sticky.is-sticky .smart-toc-list {
		font-size: 0.9rem;
	}
}

/* Tablet - disable floating, keep inline sticky only */
@media screen and (max-width: 991px) {
	.smart-toc.smart-toc-sticky-left.is-sticky,
	.smart-toc.smart-toc-sticky-right.is-sticky {
		position: relative !important;
		top: auto !important;
		left: auto !important;
		right: auto !important;
		width: 100% !important;
		max-width: 100% !important;
		max-height: none;
		overflow-y: visible;
		box-shadow: none;
	}
	
	.smart-toc.smart-toc-sticky-inline.is-sticky {
		/* Inline can still work on tablet */
		max-width: 100%;
	}
	
	.smart-toc {
		margin-bottom: 20px;
	}
	
	.smart-toc-placeholder {
		display: none !important;
	}
}

/* Mobile styles */
@media screen and (max-width: 768px) {
	.smart-toc {
		padding: 15px 16px 14px 16px;
		border-radius: 8px;
	}
	
	.smart-toc .smart-toc-title {
		font-size: 1.1rem;
	}
	
	.smart-toc .smart-toc-list {
		padding-left: 16px;
		font-size: 0.9rem;
	}
	
	.smart-toc .smart-toc-toggle {
		width: 32px;
		height: 32px;
	}
	
	.smart-toc .toc-level-3 { margin-left: 8px; }
	.smart-toc .toc-level-4 { margin-left: 16px; }
	.smart-toc .toc-level-5 { margin-left: 24px; }
	.smart-toc .toc-level-6 { margin-left: 32px; }
	
	/* Disable all sticky on mobile */
	.smart-toc.smart-toc-sticky.is-sticky {
		position: relative !important;
		top: auto !important;
		left: auto !important;
		right: auto !important;
		width: 100% !important;
		max-width: 100% !important;
		max-height: none;
		overflow-y: visible;
		box-shadow: none;
	}
	
	/* Mobile back to top */
	.smart-toc-back-to-top {
		bottom: 20px;
		right: 20px;
		width: 44px;
		height: 44px;
	}
	
	.smart-toc-back-to-top .progress-ring {
		width: 52px;
		height: 52px;
		top: -4px;
		left: -4px;
	}
	
	/* Reading time responsive */
	.smart-toc-reading-time {
		font-size: 0.75rem;
		padding: 2px 8px;
	}
}

/* Small mobile */
@media screen and (max-width: 480px) {
	.smart-toc {
		padding: 12px 14px;
		margin-bottom: 16px;
	}
	
	.smart-toc .smart-toc-header {
		margin-bottom: 8px;
	}
	
	.smart-toc .smart-toc-list {
		padding-left: 12px;
		font-size: 0.875rem;
	}
	
	/* Hide reading time on very small screens */
	.smart-toc-title-wrap {
		flex-direction: column;
		align-items: flex-start;
		gap: 4px;
	}
	
	/* Smaller back to top */
	.smart-toc-back-to-top {
		bottom: 15px;
		right: 15px;
		width: 44px;
		height: 44px;
	}
	
	.smart-toc-back-to-top .progress-ring {
		width: 52px;
		height: 52px;
		top: -4px;
		left: -4px;
	}
	
	.smart-toc-back-to-top .progress-ring circle {
		r: 24;
	}
	
	.smart-toc-back-to-top .progress-ring-fill {
		stroke-dasharray: 151;
		stroke-dashoffset: 151;
	}
	
	.smart-toc-back-to-top .btt-icon {
		width: 18px;
		height: 18px;
	}
}

/* ==========================================================================
   Mobile Floating Button & Modal
   ========================================================================== */

/* Mobile Floating Button - Icon Only */
.smart-toc-mobile-btn {
	position: fixed;
	bottom: calc(80px + env(safe-area-inset-bottom, 0px));
	right: 15px;
	width: 48px;
	height: 48px;
	min-width: 48px;
	min-height: 48px;
	background: transparent;
	color: var(--smart-toc-theme-color, #0073aa);
	border: none;
	border-radius: 0;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: none;
	opacity: 0;
	visibility: hidden;
	transform: scale(0.8);
	transition: all 0.3s ease;
	z-index: 9997;
	-webkit-tap-highlight-color: transparent;
	padding: 0;
}

.smart-toc-mobile-btn svg {
	width: 36px;
	height: 36px;
	fill: currentColor;
}

.smart-toc-mobile-btn.visible {
	opacity: 1;
	visibility: visible;
	transform: scale(1);
}

.smart-toc-mobile-btn:active {
	transform: scale(0.9);
	opacity: 0.8;
}

/* Hide mobile button on desktop - it's for mobile only */
@media screen and (min-width: 769px) {
	.smart-toc-mobile-btn,
	.smart-toc-mobile-modal,
	.smart-toc-mobile-outside-close {
		display: none !important;
	}
}

/* Outside Close Button - X icon */
.smart-toc-mobile-outside-close {
	position: fixed;
	bottom: calc(70vh + 8px);
	right: 12px;
	width: 36px;
	height: 36px;
	background: #fff;
	border: 1px solid #ddd;
	border-radius: 50%;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 100001;
	opacity: 0;
	visibility: hidden;
	transform: scale(0.8);
	transition: all 0.3s ease;
	box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
	color: #666;
	padding: 0;
	-webkit-tap-highlight-color: transparent;
}

.smart-toc-mobile-outside-close svg {
	width: 18px;
	height: 18px;
}

.smart-toc-mobile-outside-close.visible {
	opacity: 1;
	visibility: visible;
	transform: scale(1);
}

.smart-toc-mobile-outside-close:hover {
	background: #ff4444;
	border-color: #ff4444;
	color: #fff;
}

.smart-toc-mobile-outside-close:active {
	transform: scale(0.9);
	background: #ff4444;
}

/* Mobile Modal */
.smart-toc-mobile-modal {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: rgba(0, 0, 0, 0);
	z-index: 99999;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.3s ease, visibility 0.3s ease, background 0.3s ease;
	-webkit-overflow-scrolling: touch;
	pointer-events: none;
}

.smart-toc-mobile-modal.active {
	opacity: 1;
	visibility: visible;
	background: rgba(0, 0, 0, 0.4);
	pointer-events: auto;
}

.smart-toc-mobile-modal-content {
	position: absolute;
	bottom: 0;
	left: 0;
	right: 0;
	max-height: 70vh;
	display: flex;
	flex-direction: column;
	background: #fff;
	border-radius: 16px 16px 0 0;
	border-top: 3px solid var(--smart-toc-theme-color, #0073aa);
	transform: translateY(100%);
	transition: transform 0.4s cubic-bezier(0.32, 0.72, 0, 1);
	overflow: hidden;
	box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.05);
	will-change: transform;
}

.smart-toc-mobile-modal.active .smart-toc-mobile-modal-content {
	transform: translateY(0);
}

/* Drag handle indicator */
.smart-toc-mobile-modal-content::before {
	content: '';
	position: absolute;
	top: 8px;
	left: 50%;
	transform: translateX(-50%);
	width: 36px;
	height: 4px;
	background: #d0d0d0;
	border-radius: 2px;
	z-index: 10;
}

/* Mobile Modal Header - with theme color */
.smart-toc-mobile-modal-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 20px 16px 10px;
	border-bottom: 1px solid #e0e0e0;
	position: sticky;
	top: 0;
	background: #fff;
	border-radius: 16px 16px 0 0;
	z-index: 5;
	flex-shrink: 0;
}

.smart-toc-mobile-modal-title {
	font-size: 15px;
	font-weight: 600;
	color: #222 !important;
	margin: 0;
}

/* Collapse/Expand Toggle Button - CSS-only chevron icon */
.smart-toc-mobile-modal-toggle {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 30px;
	height: 30px;
	min-width: 30px;
	background: #f5f5f5 !important;
	border: none;
	border-radius: 6px;
	cursor: pointer;
	color: #333 !important;
	transition: all 0.2s ease;
	-webkit-tap-highlight-color: transparent;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
	user-select: none;
	position: relative;
}

/* CSS chevron icon - up arrow (collapse state) */
.smart-toc-mobile-modal-toggle::before {
	content: '';
	display: block;
	width: 8px;
	height: 8px;
	border-left: 2px solid #333;
	border-bottom: 2px solid #333;
	transform: rotate(135deg);
	transition: transform 0.2s ease;
	margin-top: 2px;
}

/* Down arrow when collapsed (expand state) */
.smart-toc-mobile-modal-toggle[aria-expanded="false"]::before {
	transform: rotate(-45deg);
	margin-top: -2px;
}

.smart-toc-mobile-modal-toggle:hover {
	background: #e8e8e8 !important;
	color: #222 !important;
}

.smart-toc-mobile-modal-toggle:hover::before {
	border-color: #222;
}

.smart-toc-mobile-modal-toggle:active {
	background: #ddd !important;
	transform: scale(0.95);
}

/* Hide old close button */
.smart-toc-mobile-close {
	display: none;
}

.smart-toc-mobile-modal-body {
	padding: 12px 10px 16px;
	padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
	flex: 1 1 auto;
	overflow-y: auto;
	overflow-x: hidden;
	-webkit-overflow-scrolling: touch;
	overscroll-behavior: contain;
}

.smart-toc-mobile-modal-body .smart-toc {
	margin: 0;
	box-shadow: none;
	border: none;
	padding: 0;
}

.smart-toc-mobile-modal-body .smart-toc-in-modal {
	background: transparent !important;
	border: none !important;
	box-shadow: none !important;
}

/* Hide main TOC header in modal (we have modal header) */
.smart-toc-mobile-modal-body .smart-toc-header {
	display: none;
}

/* Mobile modal TOC list styles */
.smart-toc-mobile-modal-body .smart-toc-list {
	padding: 0;
	margin: 0;
}

.smart-toc-mobile-modal-body .toc-item {
	margin: 0;
	position: relative;
	display: flex;
	align-items: center;
}

.smart-toc-mobile-modal-body .toc-item > a {
	display: flex;
	align-items: center;
	padding: 8px 12px;
	color: #222 !important;
	text-decoration: none;
	font-size: 14px;
	border-radius: 8px;
	transition: all 0.2s ease;
	border-left: 3px solid transparent;
	margin-left: 0;
	gap: 8px;
	flex: 1;
	min-width: 0;
}

.smart-toc-mobile-modal-body .toc-item > a:hover,
.smart-toc-mobile-modal-body .toc-item > a:active {
	background: #f5f8fa;
	color: #222 !important;
}

.smart-toc-mobile-modal-body .toc-item > a.active {
	background: linear-gradient(90deg, #e6f0fa 0%, #f5f8fa 100%) !important;
	color: #005580 !important;
	font-weight: 600;
	border-left-color: #0073aa;
	box-shadow: none;
	margin-left: 0;
}

/* Mobile modal nested indentation - matches desktop panel */
.smart-toc-mobile-modal-body .toc-level-2 { padding-left: 0; }
.smart-toc-mobile-modal-body .toc-level-3 { padding-left: 12px; }
.smart-toc-mobile-modal-body .toc-level-4 { padding-left: 24px; }
.smart-toc-mobile-modal-body .toc-level-5 { padding-left: 36px; }
.smart-toc-mobile-modal-body .toc-level-6 { padding-left: 48px; }

.smart-toc-mobile-modal-body ul {
	margin: 0;
	padding: 0;
	list-style: none;
	border-left: none !important;
}

/* Copy link in mobile modal - matches desktop panel */
.smart-toc-mobile-modal-body .smart-toc-copy-link {
	opacity: 0;
	visibility: hidden;
	margin-left: auto;
	flex-shrink: 0;
	width: 24px;
	height: 24px;
	transition: opacity 0.2s ease, visibility 0.2s ease;
}

.smart-toc-mobile-modal-body .toc-item > a:hover + .smart-toc-copy-link,
.smart-toc-mobile-modal-body .toc-item:hover > .smart-toc-copy-link,
.smart-toc-mobile-modal-body .smart-toc-copy-link:hover,
.smart-toc-mobile-modal-body .smart-toc-copy-link:focus {
	opacity: 1;
	visibility: visible;
}

/* Section toggles in mobile modal - matches desktop panel */
.smart-toc-mobile-modal-body .toc-section-toggle {
	background: #f5f5f5;
	border: none;
	color: #666;
	font-size: 13px;
	font-weight: 600;
	width: 20px;
	height: 20px;
	min-width: 20px;
	border-radius: 4px;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	margin-right: 6px;
	vertical-align: middle;
	transition: all 0.2s ease;
	line-height: 1;
}

.smart-toc-mobile-modal-body .toc-section-toggle:hover {
	background: #e0e0e0;
	color: #333;
}

.smart-toc-mobile-modal-body .toc-item.has-children {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-start;
}

.smart-toc-mobile-modal-body .toc-item.has-children > a {
	flex: 1;
}

.smart-toc-mobile-modal-body .toc-item.has-children > ul {
	width: 100%;
	flex-basis: 100%;
}

.smart-toc-mobile-modal-body .smart-toc-list ul {
	border-left: none !important;
	margin-left: 0 !important;
	padding-left: 0 !important;
}

/* Mobile modal scrollbar styling - matches desktop panel */
.smart-toc-mobile-modal-body::-webkit-scrollbar {
	width: 5px;
}

.smart-toc-mobile-modal-body::-webkit-scrollbar-track {
	background: #f5f5f5;
	border-radius: 3px;
}

.smart-toc-mobile-modal-body::-webkit-scrollbar-thumb {
	background: #d0d0d0;
	border-radius: 3px;
}

.smart-toc-mobile-modal-body::-webkit-scrollbar-thumb:hover {
	background: #b0b0b0;
}

/* Firefox scrollbar */
.smart-toc-mobile-modal-body {
	scrollbar-width: thin;
	scrollbar-color: #d0d0d0 #f5f5f5;
}

/* No body scroll lock - allow background scroll */

/* ==========================================================================
   Improved Collapsible Sections
   ========================================================================== */

.smart-toc .toc-section-toggle {
	background: #f5f5f5;
	border: none;
	color: #666;
	font-size: 14px;
	font-weight: 600;
	width: 22px;
	height: 22px;
	min-width: 22px;
	border-radius: 4px;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	margin-right: 6px;
	vertical-align: middle;
	transition: all 0.2s ease;
	line-height: 1;
}

.smart-toc .toc-section-toggle:hover {
	background: #e0e0e0;
	color: #333;
}

.smart-toc .toc-section-toggle:focus {
	outline: 2px solid #0073aa;
	outline-offset: 1px;
}

.smart-toc .toc-item.has-children {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-start;
}

.smart-toc .toc-item.has-children > a {
	flex: 1;
}

.smart-toc .toc-item.has-children > ul {
	width: 100%;
	flex-basis: 100%;
}

/* Section collapsed indicator */
.smart-toc .toc-item.section-collapsed > a {
	opacity: 0.7;
}

/* Dark theme section toggles */
.smart-toc.smart-toc-theme-dark .toc-section-toggle {
	background: #333;
	color: #aaa;
}

.smart-toc.smart-toc-theme-dark .toc-section-toggle:hover {
	background: #444;
	color: #fff;
}

/* Gradient theme section toggles */
.smart-toc.smart-toc-theme-gradient .toc-section-toggle {
	background: rgba(255, 255, 255, 0.2);
	color: rgba(255, 255, 255, 0.8);
}

.smart-toc.smart-toc-theme-gradient .toc-section-toggle:hover {
	background: rgba(255, 255, 255, 0.3);
	color: #fff;
}

/* Dark theme support for mobile modal */
.smart-toc-mobile-modal-body .smart-toc.smart-toc-theme-dark .toc-item > a {
	color: #aaa !important;
}

.smart-toc-mobile-modal-body .smart-toc.smart-toc-theme-dark .toc-item > a:hover,
.smart-toc-mobile-modal-body .smart-toc.smart-toc-theme-dark .toc-item > a:active {
	color: #fff !important;
	background: #333 !important;
}

.smart-toc-mobile-modal-body .smart-toc.smart-toc-theme-dark .toc-item > a.active {
	background: #333 !important;
	color: #fff !important;
	border-left-color: #58a6ff !important;
}

/* Widget-specific styles */
.widget_smart_toc .smart-toc {
	margin: 0;
}

.widget_smart_toc .smart-toc-widget {
	box-shadow: none;
	border: 1px solid #e0e0e0;
}

/* Widget responsive - make header wrap properly in narrow sidebars */
.widget_smart_toc .smart-toc .smart-toc-header {
	flex-wrap: wrap;
	gap: 8px;
}

.widget_smart_toc .smart-toc .smart-toc-title-wrap {
	flex: 1 1 auto;
	min-width: 0;
	flex-wrap: wrap;
	gap: 6px;
}

.widget_smart_toc .smart-toc .smart-toc-title {
	font-size: clamp(0.875rem, 4vw, 1.1rem);
	word-wrap: break-word;
	overflow-wrap: break-word;
	hyphens: auto;
}

.widget_smart_toc .smart-toc .smart-toc-reading-time {
	font-size: 0.7rem;
	padding: 2px 6px;
	flex-shrink: 0;
}

.widget_smart_toc .smart-toc .smart-toc-toggle {
	flex-shrink: 0;
	width: 32px;
	height: 32px;
	padding: 4px;
	color: var(--smart-toc-theme-color, #0073aa);
}

.widget_smart_toc .smart-toc .smart-toc-toggle svg {
	width: 16px;
	height: 16px;
}

/* Widget list responsive */
.widget_smart_toc .smart-toc .smart-toc-list {
	padding-left: 14px;
	font-size: 0.875rem;
}

.widget_smart_toc .smart-toc .smart-toc-list a {
	padding: 4px 6px;
	word-wrap: break-word;
	overflow-wrap: break-word;
	hyphens: auto;
}

.widget_smart_toc .smart-toc .smart-toc-list ul {
	margin-left: 10px;
	padding-left: 8px;
}

/* Widget search box */
.widget_smart_toc .smart-toc .smart-toc-search-input {
	padding: 6px 28px 6px 30px;
	font-size: 0.8rem;
}

.widget_smart_toc .smart-toc .smart-toc-search-icon {
	left: 8px;
	width: 14px;
	height: 14px;
}

.widget_smart_toc .smart-toc .smart-toc-search-clear {
	right: 6px;
	width: 16px;
	height: 16px;
}

/* Narrow sidebar (under 280px) */
@media screen and (max-width: 320px) {
	.widget_smart_toc .smart-toc {
		padding: 10px 12px;
	}
	
	.widget_smart_toc .smart-toc .smart-toc-header {
		flex-direction: column;
		align-items: flex-start;
	}
	
	.widget_smart_toc .smart-toc .smart-toc-title-wrap {
		width: 100%;
		justify-content: space-between;
	}
	
	.widget_smart_toc .smart-toc .smart-toc-toggle {
		position: absolute;
		top: 10px;
		right: 10px;
	}
	
	.widget_smart_toc .smart-toc .smart-toc-list {
		padding-left: 10px;
		font-size: 0.8rem;
	}
}

/* ==========================================================================
   Floating TOC Button & Panel
   ========================================================================== */

.smart-toc-floating {
	position: fixed;
	top: 100px;
	z-index: 99998;
	opacity: 0;
	visibility: hidden;
	transform: translateX(20px);
	transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.smart-toc-floating.visible {
	opacity: 1;
	visibility: visible;
	transform: translateX(0);
}

.smart-toc-floating.dismissed {
	opacity: 0;
	transform: scale(0.8);
	pointer-events: none;
}

/* Position variants */
.smart-toc-floating.floating-left {
	left: 20px;
	transform: translateX(-20px);
}

.smart-toc-floating.floating-left.visible {
	transform: translateX(0);
}

.smart-toc-floating.floating-right {
	right: 20px;
}

/* Floating Button Wrapper */
.smart-toc-floating-btn-wrapper {
	position: relative;
	display: inline-flex;
}

/* Dismiss Button */
.smart-toc-floating-dismiss {
	position: absolute;
	top: -8px;
	right: -8px;
	width: 24px;
	height: 24px;
	background: #fff;
	border: 1px solid #ddd;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	opacity: 0;
	visibility: hidden;
	transform: scale(0.8);
	transition: all 0.2s ease;
	z-index: 2;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
	color: #666;
	padding: 0;
}

.smart-toc-floating-dismiss svg {
	width: 14px;
	height: 14px;
	display: block;
}

.smart-toc-floating-btn-wrapper:hover .smart-toc-floating-dismiss,
.smart-toc-floating-dismiss:focus {
	opacity: 1;
	visibility: visible;
	transform: scale(1);
}

/* Always show dismiss when floating TOC is visible */
.smart-toc-floating.visible .smart-toc-floating-dismiss {
	opacity: 1;
	visibility: visible;
	transform: scale(1);
}

.smart-toc-floating-dismiss:hover {
	background: #ff4444;
	border-color: #ff4444;
	color: #fff;
}

.smart-toc-floating.floating-left .smart-toc-floating-dismiss {
	right: auto;
	left: -8px;
}

/* Floating Button */
.smart-toc-floating-btn {
	display: flex;
	align-items: center;
	gap: 8px;
	background: linear-gradient(135deg, #0073aa 0%, #005580 100%);
	color: #fff;
	border: none;
	padding: 12px 16px;
	border-radius: 50px;
	cursor: pointer;
	font-size: 14px;
	font-weight: 600;
	font-family: 'Segoe UI', Arial, sans-serif;
	box-shadow: 0 4px 20px rgba(0, 115, 170, 0.35);
	transition: all 0.3s ease;
	white-space: nowrap;
}

.smart-toc-floating-btn:hover {
	background: linear-gradient(135deg, #005580 0%, #003855 100%);
	box-shadow: 0 6px 25px rgba(0, 115, 170, 0.45);
	transform: translateY(-2px);
}

.smart-toc-floating-btn:active {
	transform: translateY(0);
	box-shadow: 0 4px 15px rgba(0, 115, 170, 0.3);
}

/* Icon only style */
.smart-toc-floating.style-icon_only .smart-toc-floating-btn {
	padding: 14px;
	border-radius: 50%;
	width: 52px;
	height: 52px;
	justify-content: center;
}

.smart-toc-floating.style-icon_only .smart-toc-floating-btn-text,
.smart-toc-floating.style-icon_only .smart-toc-floating-counter {
	display: none;
}

/* Icon + Counter style */
.smart-toc-floating.style-icon_counter .smart-toc-floating-btn-text {
	display: none;
}

.smart-toc-floating-counter {
	background: rgba(255, 255, 255, 0.25);
	padding: 2px 8px;
	border-radius: 12px;
	font-size: 12px;
	font-weight: 700;
}

.smart-toc-floating.style-icon_text .smart-toc-floating-counter {
	display: none;
}

/* Button Icon */
.smart-toc-floating-btn svg {
	width: 20px;
	height: 20px;
	flex-shrink: 0;
	transition: transform 0.3s ease;
}

.smart-toc-floating.panel-open .smart-toc-floating-btn svg {
	transform: rotate(180deg);
}

/* Floating Panel */
.smart-toc-floating-panel {
	position: absolute;
	top: calc(100% + 12px);
	background: #fff;
	border-radius: 16px;
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.05);
	max-height: 0;
	display: flex;
	flex-direction: column;
	overflow: hidden;
	opacity: 0;
	transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
	width: 320px;
}

.smart-toc-floating.floating-left .smart-toc-floating-panel {
	left: 0;
}

.smart-toc-floating.floating-right .smart-toc-floating-panel {
	right: 0;
}

.smart-toc-floating.panel-open .smart-toc-floating-panel {
	max-height: 60vh;
	opacity: 1;
}

/* Panel Header */
.smart-toc-floating-panel-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 16px 20px 12px;
	border-bottom: 1px solid #f0f0f0;
	position: sticky;
	top: 0;
	background: #fff;
	border-radius: 16px 16px 0 0;
	z-index: 1;
}

.smart-toc-floating-panel-title {
	font-size: 16px;
	font-weight: 700;
	color: #222;
	margin: 0;
}

.smart-toc-floating-panel-close {
	display: inline-flex !important;
	align-items: center !important;
	justify-content: center !important;
	width: 28px !important;
	height: 28px !important;
	min-width: 28px !important;
	min-height: 28px !important;
	border: none !important;
	border-radius: 4px !important;
	cursor: pointer !important;
	background: transparent !important;
	padding: 0 !important;
	margin: 0 !important;
	opacity: 0.7;
	transition: opacity 0.2s ease, background 0.2s ease;
	line-height: 1 !important;
	box-sizing: border-box !important;
	font-size: 24px !important;
	font-weight: 300 !important;
	font-family: Arial, sans-serif !important;
	color: #333;
}

.smart-toc-floating-panel-close:hover {
	opacity: 1;
	background: rgba(0, 0, 0, 0.05);
}

/* Panel Progress Bar */
.smart-toc-floating-progress {
	height: 3px;
	background: #f0f0f0;
	margin: 0;
}

.smart-toc-floating-progress-fill {
	height: 100%;
	width: 0%;
	background: linear-gradient(90deg, #0073aa 0%, #00a0d2 100%);
	transition: width 0.15s ease-out;
	border-radius: 0 3px 3px 0;
}

/* Panel Body */
.smart-toc-floating-panel-body {
	padding: 12px 16px 16px;
	flex: 1 1 auto;
	overflow-x: hidden;
	overflow-y: auto;
	overscroll-behavior: contain;
}

/* Panel TOC List */
.smart-toc-floating-panel-body .smart-toc-list {
	margin: 0;
	padding: 0;
	list-style: none;
}

.smart-toc-floating-panel-body .toc-item {
	margin: 0;
	display: flex;
	align-items: center;
}

.smart-toc-floating-panel-body .toc-item > a {
	display: flex;
	align-items: center;
	padding: 8px 12px;
	color: #444;
	text-decoration: none;
	font-size: 14px;
	border-radius: 8px;
	transition: all 0.2s ease;
	border-left: 3px solid transparent;
	margin-left: 0;
	gap: 8px;
	word-break: break-word;
	overflow-wrap: break-word;
	flex: 1;
	min-width: 0;
}

.smart-toc-floating-panel-body .toc-item > a:hover {
	background: #f5f8fa;
	color: #0073aa;
}

.smart-toc-floating-panel-body .toc-item > a.active {
	background: linear-gradient(90deg, #e6f0fa 0%, #f5f8fa 100%);
	color: #005580;
	font-weight: 600;
	border-left-color: #0073aa;
	box-shadow: none;
	margin-left: 0;
}

/* Nested items */
.smart-toc-floating-panel-body .toc-level-2 { padding-left: 0; }
.smart-toc-floating-panel-body .toc-level-3 { padding-left: 12px; }
.smart-toc-floating-panel-body .toc-level-4 { padding-left: 24px; }
.smart-toc-floating-panel-body .toc-level-5 { padding-left: 36px; }
.smart-toc-floating-panel-body .toc-level-6 { padding-left: 48px; }

.smart-toc-floating-panel-body ul {
	margin: 0;
	padding: 0;
	list-style: none;
	border-left: none !important;
}

/* Show section toggles in floating panel */
.smart-toc-floating-panel-body .toc-section-toggle {
	background: #f5f5f5;
	border: none;
	color: #666;
	font-size: 13px;
	font-weight: 600;
	width: 20px;
	height: 20px;
	min-width: 20px;
	border-radius: 4px;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	margin-right: 6px;
	vertical-align: middle;
	transition: all 0.2s ease;
	line-height: 1;
}

.smart-toc-floating-panel-body .toc-section-toggle:hover {
	background: #e0e0e0;
	color: #333;
}

.smart-toc-floating-panel-body .toc-item.has-children {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-start;
}

.smart-toc-floating-panel-body .toc-item.has-children > a {
	flex: 1;
}

.smart-toc-floating-panel-body .toc-item.has-children > ul {
	width: 100%;
	flex-basis: 100%;
}

/* Remove dashed border from nested lists */
.smart-toc-floating-panel-body .smart-toc-list ul {
	border-left: none !important;
	margin-left: 0 !important;
	padding-left: 0 !important;
}

/* Copy link in floating panel */
.smart-toc-floating-panel-body .smart-toc-copy-link {
	opacity: 0;
	visibility: hidden;
	margin-left: auto;
	flex-shrink: 0;
	width: 24px;
	height: 24px;
	transition: opacity 0.2s ease, visibility 0.2s ease;
}

.smart-toc-floating-panel-body .toc-item > a:hover + .smart-toc-copy-link,
.smart-toc-floating-panel-body .toc-item:hover > .smart-toc-copy-link,
.smart-toc-floating-panel-body .smart-toc-copy-link:hover,
.smart-toc-floating-panel-body .smart-toc-copy-link:focus {
	opacity: 1;
	visibility: visible;
}

/* Panel scrollbar styling */
.smart-toc-floating-panel-body::-webkit-scrollbar {
	width: 5px;
}

.smart-toc-floating-panel-body::-webkit-scrollbar-track {
	background: #f5f5f5;
	border-radius: 3px;
}

.smart-toc-floating-panel-body::-webkit-scrollbar-thumb {
	background: #d0d0d0;
	border-radius: 3px;
}

.smart-toc-floating-panel-body::-webkit-scrollbar-thumb:hover {
	background: #b0b0b0;
}

/* Firefox scrollbar */
.smart-toc-floating-panel-body {
	scrollbar-width: thin;
	scrollbar-color: #d0d0d0 #f5f5f5;
}

/* Hide on mobile/tablet - floating TOC is desktop only */
@media screen and (max-width: 1023px) {
	.smart-toc-floating {
		display: none !important;
	}
}

/* Animation for panel items */
.smart-toc-floating.panel-open .smart-toc-floating-panel-body .toc-item {
	animation: fadeInUp 0.2s ease forwards;
	opacity: 0;
}

.smart-toc-floating.panel-open .smart-toc-floating-panel-body .toc-item:nth-child(1) { animation-delay: 0.05s; }
.smart-toc-floating.panel-open .smart-toc-floating-panel-body .toc-item:nth-child(2) { animation-delay: 0.08s; }
.smart-toc-floating.panel-open .smart-toc-floating-panel-body .toc-item:nth-child(3) { animation-delay: 0.11s; }
.smart-toc-floating.panel-open .smart-toc-floating-panel-body .toc-item:nth-child(4) { animation-delay: 0.14s; }
.smart-toc-floating.panel-open .smart-toc-floating-panel-body .toc-item:nth-child(5) { animation-delay: 0.17s; }
.smart-toc-floating.panel-open .smart-toc-floating-panel-body .toc-item:nth-child(n+6) { animation-delay: 0.2s; }

@keyframes fadeInUp {
	from {
		opacity: 0;
		transform: translateY(10px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
	.smart-toc-floating,
	.smart-toc-floating-panel,
	.smart-toc-floating * {
		transition: none !important;
		animation: none !important;
	}
}

/* ==========================================================================
   19a. Floating Panel Dark Theme
   ========================================================================== */

/* Dark theme for floating panel */
.smart-toc-floating.floating-theme-dark .smart-toc-floating-panel {
	background: #1e1e1e;
	border: 1px solid #333;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.smart-toc-floating.floating-theme-dark .smart-toc-floating-panel-header {
	background: #2a2a2a;
	border-bottom-color: #333;
}

.smart-toc-floating.floating-theme-dark .smart-toc-floating-panel-title {
	color: #fff;
}

.smart-toc-floating.floating-theme-dark .smart-toc-floating-panel-close {
	color: #aaa;
}

.smart-toc-floating.floating-theme-dark .smart-toc-floating-panel-close:hover {
	color: #fff;
	background: #333;
}

.smart-toc-floating.floating-theme-dark .smart-toc-floating-panel-body {
	background: #1e1e1e;
}

.smart-toc-floating.floating-theme-dark .toc-item > a {
	color: #ccc;
}

.smart-toc-floating.floating-theme-dark .toc-item > a:hover {
	color: #fff;
	background: #333;
}

.smart-toc-floating.floating-theme-dark .smart-toc-active-indicator {
	background: rgba(255, 255, 255, 0.1);
	color: #fff;
}

.smart-toc-floating.floating-theme-dark .smart-toc-floating-progress {
	background: rgba(255, 255, 255, 0.1);
}

.smart-toc-floating.floating-theme-dark .smart-toc-floating-progress-bar {
	background: #fff;
}

.smart-toc-floating.floating-theme-dark .smart-toc-floating-btn {
	background: #1e1e1e;
	color: #fff;
	border-color: #333;
}

.smart-toc-floating.floating-theme-dark .smart-toc-floating-btn:hover {
	background: #2a2a2a;
	border-color: #444;
}

.smart-toc-floating.floating-theme-dark .smart-toc-floating-dismiss {
	background: rgba(30, 30, 30, 0.95);
	color: #aaa;
}

.smart-toc-floating.floating-theme-dark .smart-toc-floating-dismiss:hover {
	background: #2a2a2a;
	color: #fff;
}

.smart-toc-floating.floating-theme-dark .smart-toc-copy-link {
	color: #888;
}

.smart-toc-floating.floating-theme-dark .smart-toc-copy-link:hover {
	color: #fff;
}

.smart-toc-floating.floating-theme-dark .smart-toc-floating-counter {
	color: #ccc;
	background: rgba(255, 255, 255, 0.05);
}

/* Scrollbar for dark theme */
.smart-toc-floating.floating-theme-dark .smart-toc-floating-panel-body::-webkit-scrollbar-track {
	background: #1e1e1e;
}

.smart-toc-floating.floating-theme-dark .smart-toc-floating-panel-body::-webkit-scrollbar-thumb {
	background: #444;
}

.smart-toc-floating.floating-theme-dark .smart-toc-floating-panel-body::-webkit-scrollbar-thumb:hover {
	background: #555;
}

.smart-toc-floating.floating-theme-dark .smart-toc-floating-panel-body {
	scrollbar-color: #444 #1e1e1e;
}

/* ==========================================================================
   19b. Mobile Modal Dark Theme
   ========================================================================== */

/* Dark theme for mobile modal */
.smart-toc-mobile-modal.mobile-theme-dark.active {
	background: rgba(0, 0, 0, 0.7);
}

.smart-toc-mobile-modal.mobile-theme-dark .smart-toc-mobile-modal-content {
	background: #1e1e1e;
	box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.1);
}

.smart-toc-mobile-modal.mobile-theme-dark .smart-toc-mobile-modal-content::before {
	background: #444;
}

.smart-toc-mobile-modal.mobile-theme-dark .smart-toc-mobile-modal-header {
	background: #2a2a2a;
	border-bottom-color: #333;
}

.smart-toc-mobile-modal.mobile-theme-dark .smart-toc-mobile-modal-title {
	color: #fff !important;
}

.smart-toc-mobile-modal.mobile-theme-dark .smart-toc-mobile-modal-toggle {
	background: #333 !important;
	color: #fff !important;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.smart-toc-mobile-modal.mobile-theme-dark .smart-toc-mobile-modal-toggle::before {
	border-left-color: #ccc;
	border-bottom-color: #ccc;
}

.smart-toc-mobile-modal.mobile-theme-dark .smart-toc-mobile-modal-toggle:hover {
	background: #3a3a3a !important;
}

.smart-toc-mobile-modal.mobile-theme-dark .smart-toc-mobile-modal-toggle:hover::before {
	border-color: #fff;
}

.smart-toc-mobile-modal.mobile-theme-dark .smart-toc-mobile-modal-toggle:active {
	background: #444 !important;
}

.smart-toc-mobile-modal.mobile-theme-dark .smart-toc-mobile-modal-body {
	background: #1e1e1e !important;
}

.smart-toc-mobile-modal.mobile-theme-dark .toc-item > a {
	color: #ccc !important;
}

.smart-toc-mobile-modal.mobile-theme-dark .toc-item > a:hover,
.smart-toc-mobile-modal.mobile-theme-dark .toc-item > a:active {
	background: #333 !important;
	color: #fff !important;
}

.smart-toc-mobile-modal.mobile-theme-dark .smart-toc-active-indicator {
	background: rgba(255, 255, 255, 0.1) !important;
	color: #fff !important;
}

.smart-toc-mobile-modal.mobile-theme-dark .toc-number {
	color: #888 !important;
}

.smart-toc-mobile-modal.mobile-theme-dark .smart-toc-copy-link {
	color: #888;
}

.smart-toc-mobile-modal.mobile-theme-dark .smart-toc-copy-link:hover {
	color: #fff;
	background: rgba(255, 255, 255, 0.1);
}

.smart-toc-mobile-modal.mobile-theme-dark .smart-toc-copy-link.copied {
	color: #4caf50 !important;
}

/* Scrollbar for dark theme */
.smart-toc-mobile-modal.mobile-theme-dark .smart-toc-mobile-modal-body::-webkit-scrollbar-track {
	background: #1e1e1e;
}

.smart-toc-mobile-modal.mobile-theme-dark .smart-toc-mobile-modal-body::-webkit-scrollbar-thumb {
	background: #444;
}

.smart-toc-mobile-modal.mobile-theme-dark .smart-toc-mobile-modal-body::-webkit-scrollbar-thumb:hover {
	background: #555;
}

.smart-toc-mobile-modal.mobile-theme-dark .smart-toc-mobile-modal-body {
	scrollbar-color: #444 #1e1e1e;
}

/* ==========================================================================
   20. Toggle Icon Styles
   ========================================================================== */

/* Icon rotation for different styles */
.smart-toc-toggle svg {
	transition: transform 0.25s ease;
}

/* Chevron - rotates 180deg when collapsed */
.smart-toc.collapsed .smart-toc-toggle svg {
	transform: rotate(-90deg);
}

/* Arrow icon - rotates 90deg when expanded */
.smart-toc:not(.collapsed) .smart-toc-toggle svg[class*="arrow"] {
	transform: rotate(90deg);
}

/* Plus/Minus icon - changes via CSS */
.smart-toc-icon-plus path:last-child {
	transition: opacity 0.2s ease;
}

.smart-toc:not(.collapsed) .smart-toc-icon-plus path:last-child {
	opacity: 0;
}

/* Caret icon - rotates 90deg when expanded */
.smart-toc:not(.collapsed) .smart-toc-toggle svg path[fill="currentColor"] {
	transform-origin: center;
}

/* ==========================================================================
   21. Auto Dark Mode
   ========================================================================== */

/* Auto dark mode - applied when user system prefers dark */
.smart-toc-auto-dark {
	/* Will be applied via JS when prefers-color-scheme: dark */
}

@media (prefers-color-scheme: dark) {
	.smart-toc.smart-toc-auto-dark {
		background: #1e1e1e;
		border-color: #333;
		box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
	}
	
	.smart-toc.smart-toc-auto-dark .smart-toc-title {
		color: #fff;
	}
	
	.smart-toc.smart-toc-auto-dark .smart-toc-toggle {
		color: #aaa;
	}
	
	.smart-toc.smart-toc-auto-dark .smart-toc-toggle:hover {
		color: #fff;
		background: #333;
	}
	
	.smart-toc.smart-toc-auto-dark .smart-toc-reading-time {
		color: #888;
	}
	
	.smart-toc.smart-toc-auto-dark .smart-toc-list a {
		color: #b0b0b0;
	}
	
	.smart-toc.smart-toc-auto-dark .smart-toc-list a:hover {
		color: #fff;
		background: rgba(255, 255, 255, 0.05);
	}
	
	.smart-toc.smart-toc-auto-dark .smart-toc-list a.active {
		color: #58a6ff;
		background: rgba(88, 166, 255, 0.1);
		border-left-color: #58a6ff;
	}
	
	/* Floating panel dark mode */
	.smart-toc-auto-dark .smart-toc-floating-panel {
		background: #1e1e1e;
		border-color: #333;
	}
	
	.smart-toc-auto-dark .smart-toc-floating-panel-header {
		background: #252525;
		border-bottom-color: #333;
	}
	
	.smart-toc-auto-dark .smart-toc-floating-panel-title {
		color: #fff;
	}
	
	.smart-toc-auto-dark .smart-toc-floating-close {
		color: #888;
	}
	
	.smart-toc-auto-dark .smart-toc-floating-close:hover {
		color: #fff;
	}
	
	.smart-toc-auto-dark .smart-toc-floating-panel-body a {
		color: #b0b0b0;
	}
	
	.smart-toc-auto-dark .smart-toc-floating-panel-body a:hover {
		color: #fff;
		background: rgba(255, 255, 255, 0.05);
	}
	
	.smart-toc-auto-dark .smart-toc-floating-panel-body a.active {
		color: #58a6ff;
		background: rgba(88, 166, 255, 0.1);
	}
}

/* ==========================================================================
   22. RTL (Right-to-Left) Support
   ========================================================================== */

[dir="rtl"] .smart-toc,
.rtl .smart-toc {
	direction: rtl;
	text-align: right;
}

/* TOC Header RTL */
[dir="rtl"] .smart-toc .smart-toc-header,
.rtl .smart-toc .smart-toc-header {
	flex-direction: row-reverse;
}

[dir="rtl"] .smart-toc .smart-toc-title-wrap,
.rtl .smart-toc .smart-toc-title-wrap {
	flex-direction: row-reverse;
}

/* Reading time RTL */
[dir="rtl"] .smart-toc-reading-time,
.rtl .smart-toc-reading-time {
	margin-left: 0;
	margin-right: 8px;
}

/* List indentation RTL */
[dir="rtl"] .smart-toc .smart-toc-list,
.rtl .smart-toc .smart-toc-list {
	padding-left: 0;
	padding-right: 22px;
}

[dir="rtl"] .smart-toc .toc-level-2,
.rtl .smart-toc .toc-level-2 { margin-left: 0; margin-right: 0; }
[dir="rtl"] .smart-toc .toc-level-3,
.rtl .smart-toc .toc-level-3 { margin-left: 0; margin-right: 12px; }
[dir="rtl"] .smart-toc .toc-level-4,
.rtl .smart-toc .toc-level-4 { margin-left: 0; margin-right: 24px; }
[dir="rtl"] .smart-toc .toc-level-5,
.rtl .smart-toc .toc-level-5 { margin-left: 0; margin-right: 36px; }
[dir="rtl"] .smart-toc .toc-level-6,
.rtl .smart-toc .toc-level-6 { margin-left: 0; margin-right: 48px; }

/* Nested list border RTL */
[dir="rtl"] .smart-toc .smart-toc-list ul,
.rtl .smart-toc .smart-toc-list ul {
	border-left: none;
	border-right: 1.5px dashed #e0e0e0;
	margin-left: 0;
	margin-right: 18px;
	padding-left: 0;
	padding-right: 10px;
}

/* Active link RTL */
[dir="rtl"] .smart-toc .toc-item > a.active,
.rtl .smart-toc .toc-item > a.active {
	border-left: none;
	border-right: 4px solid #005580;
	margin-left: 0;
	margin-right: -10px;
	border-radius: 6px 0 0 6px;
	padding: 6px 10px 6px 12px !important;
}

/* Heading numbers RTL */
[dir="rtl"] .smart-toc-list .toc-number,
.rtl .smart-toc-list .toc-number {
	margin-right: 0;
	margin-left: 6px;
}

/* Section toggle button RTL */
[dir="rtl"] .smart-toc .toc-section-toggle,
.rtl .smart-toc .toc-section-toggle {
	margin-right: 0;
	margin-left: 6px;
}

/* Search icon RTL */
[dir="rtl"] .smart-toc-search-icon,
.rtl .smart-toc-search-icon {
	left: auto;
	right: 12px;
}

[dir="rtl"] .smart-toc-search-input,
.rtl .smart-toc-search-input {
	padding: 8px 36px 8px 32px;
}

[dir="rtl"] .smart-toc-search-clear,
.rtl .smart-toc-search-clear {
	right: auto;
	left: 8px;
}

/* Copy link button RTL */
[dir="rtl"] .smart-toc-copy-link,
.rtl .smart-toc-copy-link {
	margin-left: 0;
	margin-right: 6px;
}

/* Active indicator RTL */
[dir="rtl"] .smart-toc-active-indicator,
.rtl .smart-toc-active-indicator {
	margin-left: 10px;
	margin-right: auto;
}

/* Back to top button RTL - auto-flip position */
[dir="rtl"] .smart-toc-back-to-top,
.rtl .smart-toc-back-to-top {
	right: auto;
	left: 30px;
}

@media screen and (max-width: 768px) {
	[dir="rtl"] .smart-toc-back-to-top,
	.rtl .smart-toc-back-to-top {
		left: 20px;
	}
}

@media screen and (max-width: 480px) {
	[dir="rtl"] .smart-toc-back-to-top,
	.rtl .smart-toc-back-to-top {
		left: 15px;
	}
}

/* Sticky TOC RTL */
[dir="rtl"] .smart-toc.smart-toc-sticky-left.is-sticky,
.rtl .smart-toc.smart-toc-sticky-left.is-sticky {
	left: auto;
	right: 20px;
}

[dir="rtl"] .smart-toc.smart-toc-sticky-right.is-sticky,
.rtl .smart-toc.smart-toc-sticky-right.is-sticky {
	right: auto;
	left: 20px;
}

/* Floating TOC RTL */
[dir="rtl"] .smart-toc-floating.floating-left,
.rtl .smart-toc-floating.floating-left {
	left: auto;
	right: 20px;
}

[dir="rtl"] .smart-toc-floating.floating-right,
.rtl .smart-toc-floating.floating-right {
	right: auto;
	left: 20px;
}

[dir="rtl"] .smart-toc-floating.floating-left .smart-toc-floating-panel,
.rtl .smart-toc-floating.floating-left .smart-toc-floating-panel {
	left: auto;
	right: 0;
}

[dir="rtl"] .smart-toc-floating.floating-right .smart-toc-floating-panel,
.rtl .smart-toc-floating.floating-right .smart-toc-floating-panel {
	right: auto;
	left: 0;
}

/* Mobile floating button RTL */
[dir="rtl"] .smart-toc-mobile-btn,
.rtl .smart-toc-mobile-btn {
	right: auto;
	left: 20px;
}

/* Mobile responsive RTL */
@media screen and (max-width: 768px) {
	[dir="rtl"] .smart-toc .smart-toc-list,
	.rtl .smart-toc .smart-toc-list {
		padding-right: 16px;
		padding-left: 0;
	}
	
	[dir="rtl"] .smart-toc .toc-level-3,
	.rtl .smart-toc .toc-level-3 { margin-right: 8px; margin-left: 0; }
	[dir="rtl"] .smart-toc .toc-level-4,
	.rtl .smart-toc .toc-level-4 { margin-right: 16px; margin-left: 0; }
	[dir="rtl"] .smart-toc .toc-level-5,
	.rtl .smart-toc .toc-level-5 { margin-right: 24px; margin-left: 0; }
	[dir="rtl"] .smart-toc .toc-level-6,
	.rtl .smart-toc .toc-level-6 { margin-right: 32px; margin-left: 0; }
	
	[dir="rtl"] .smart-toc-back-to-top,
	.rtl .smart-toc-back-to-top {
		left: 20px;
		right: auto;
	}
}