/**
 * Anchor Navigation Block Styles
 */

/* Floating */
/*.wdb-anchor-navigation {
    position: fixed;
    width: 250px;
    max-width: 25vw;
    background-color: var(--contrast-3, #ffffff);
    border-radius: calc(var(--pv-text-s) + var(--pv-space-3xs) + var(--pv-space-4xs));
    box-shadow: var(--pv-shadow-m, 0 4px 6px rgba(0, 0, 0, 0.1));
    padding: 15px;
    z-index: 9999;
    opacity: 0.7;
    transition: opacity 0.3s;
} */
.wdb-anchor-navigation {
	background-color: var(--contrast-3, #ffffff);
	position: sticky !important;
	top: var(--header--height) !important;
	left: auto !important;
	right: auto !important;
	/*width: 100%;*/
	width: fit-content;
	max-width: 100%;
	transform: none;
	opacity: 1;
	margin: 0 auto var(--pv-space-l) auto;
	padding: var(--pv-space-3xs);
	outline: 1px solid var(--contrast-2, #eee);
	border-radius: var(--btn-radius);
	box-shadow: 0 0 var(--pv-space-2xs) var(--pv-shadow-primary);
	z-index: 9;
}

body.admin-bar .wdb-anchor-navigation {
	top: calc(var(--wp-admin--admin-bar--height, 32px) + var(--pv-space-s) * 3 + var(--pv-text-m)) !important;
}

.wdb-anchor-navigation:hover,
.wdb-anchor-navigation.is-visible { opacity: 1; }

/* Draggable styles */
.wdb-anchor-navigation.wdb-draggable {
	cursor: move;
	user-select: none;
}
.wdb-anchor-navigation.wdb-dragging {
	opacity: 0.8;
	box-shadow: var(--pv-shadow-l, 0 8px 15px rgba(0, 0, 0, 0.2));
	transition: none;
}
.wdb-anchor-nav-handle {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	height: var(--pv-text-2xl, 35px);
	cursor: move;
	border-radius: var(--btn-radius-2) var(--btn-radius-2) 0 0;
	background-color: var(--base-2, #0073aa);
	opacity: 0.7;
	transition: opacity 0.3s;
	display: flex;
	align-items: center;
	justify-content: center;
}
.wdb-anchor-nav-handle h3 {
	margin: 0;
	padding: 0 5px;
	color: var(--contrast-3, #ffffff);
	font-size: var(--pv-text-s, 0.9rem);
	border: none;
	text-align: center;
	font-weight: 500;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	flex-grow: 1;
}
.wdb-anchor-navigation:hover .wdb-anchor-nav-handle { opacity: 1; }
.wdb-anchor-nav-reset, .wdb-anchor-nav-toggle, .wdb-anchor-nav-to-top {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: 20px;
	height: 20px;
	color: var(--contrast-3);
	font-size: 14px;
	line-height: 1;
	padding: 0;
	cursor: pointer;
	opacity: 0.7;
	transition: opacity 0.3s;
	background: none;
	border: none;
	display: flex;
	align-items: center;
	justify-content: center;
}
.wdb-anchor-nav-reset:hover, .wdb-anchor-nav-toggle:hover, .wdb-anchor-nav-to-top:hover { opacity: 1; }
.wdb-anchor-nav-to-top {
	left: 5px;
	font-size: 16px;
}
.wdb-anchor-nav-toggle {
	right: var(--pv-text-xl, 30px);
	font-size: 12px;
}
.wdb-anchor-nav-reset { right: 5px; }

/* Collapsed state */
.wdb-anchor-nav-collapsed {
	height: var(--pv-text-2xl, 35px);
	overflow: hidden;
}
.wdb-anchor-nav-collapsed .wdb-anchor-nav-content { display: none; }
.wdb-anchor-nav-content {
	max-height: 60vh;
	scrollbar-width: thin;
	margin-top: var(--pv-text-2xl, 35px);
}
.wdb-anchor-nav-list {
	list-style: none;
	margin: 0;
	padding: 0;
	line-height: 0;
	overflow: visible;
}
.wdb-anchor-nav-item {
	margin-bottom: 8px;
	font-size: var(--pv-text-s, 0.9rem);
	line-height: 1.2;
}
.wdb-anchor-nav-item a {
	background-color: var(--contrast-3);
	display: block;
	color: var(--base, #333);
	font-weight: normal;
	text-decoration: none;
	border: 1.3px solid var(--base);
	border-radius: var(--btn-radius);
	transition: all 0.3s;
	width: 100%;
	text-align: center;
}
.wdb-anchor-nav-item a:hover,
.wdb-anchor-nav-item.active a {
	background: var(--base);
	color: var(--contrast-3);
}

/* Indentation based on heading level */
/* no levels yet
.wdb-anchor-nav-item.level-1 { font-weight: 600; }
.wdb-anchor-nav-item.level-2 { padding: 0 0.5rem; }
.wdb-anchor-nav-item.level-3 {
    padding: 0 1rem;
    font-size: var(--pv-text-xs, 0.8rem);
}
*/

.wdb-anchor-navigation-editor {
	background-color: #f8f9fa;
	border: 1px dashed #ccc;
	border-radius: var(--btn-radius-2);
	box-shadow: var(--pv-shadow-m, 0 4px 6px rgba(0, 0, 0, 0.1));
	padding: 0.5rem 1rem;
	.content { padding: 1rem; }
}
.wdb-anchor-nav-preview {
	background-color: #fff;
	border-radius: var(--btn-radius-2);
	padding: 1rem;
	margin-top: 1rem;
}

.wdb-anchor-nav-list {
	display: flex;
	justify-content: space-evenly;
	column-gap: 0.5rem;
	flex-wrap: wrap;
}
.wdb-anchor-navigation.stuck {
	border-top-right-radius: 0;
	border-top-left-radius: 0;
}
.wdb-anchor-nav-content {
	margin-top: 0;
	max-height: none;
}
.wdb-anchor-nav-handle { display: none; }
.wdb-anchor-nav-item:last-child { margin-bottom: 0; }
.wdb-anchor-nav-item, .wdb-anchor-nav-item a { display: inline-block; }
.wdb-anchor-nav-item {
	margin: 0;
	padding: 0 !important;
	white-space: nowrap;
	flex-grow: 1;
	/*min-width: 12rem;*/
	max-width: 16rem;
}
.wdb-anchor-nav-list .wdb-anchor-nav-item a.btn {
	padding: var(--pv-space-4xs) var(--pv-space-2xs) var(--pv-space-5xs) !important;
	color: var(--darkgrey);
	background: none;
	width: 100%;
}
.wdb-anchor-nav-list .wdb-anchor-nav-item a.btn:hover {
	background-color: var(--base-2);
	color: var(--contrast-3);
	box-shadow: var(--pv-shadow-m);
}
@media (max-width: 640px) {
	.wdb-anchor-nav-item {
		flex-grow: 0;
		justify-content: center;
		min-width: 0;
	}
}
body.scrolling-up .wdb-anchor-navigation { top: var(--header--height) !important; }
body .wdb-anchor-navigation {
	/*top: 0 !important;*/
	transition: all var(--transition-time);
}

/* Responsive adjustments (only floating) */
/*
@media (max-width: 1200px) {
    .wdb-anchor-navigation { width: 200px; }
}
*/
