/* 浮动抽屉菜单 — 前台样式 */
.wbfdm {
	position: fixed;
	z-index: 99999;
	font-family: inherit;
	font-size: 14px;
	line-height: 1.6;
	-webkit-text-size-adjust: 100%;
}

.wbfdm-side-left  { left: 0; }
.wbfdm-side-right { right: 0; }

.wbfdm-pos-top    { top: 24px; }
.wbfdm-pos-bottom { bottom: 24px; }
.wbfdm-pos-center { top: 50%; transform: translateY( -50% ); }

/* 触发按钮 */
.wbfdm-toggle {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 2px;
	width: 68px;
	min-height: 68px;
	padding: 8px 4px;
	border: 0;
	cursor: pointer;
	background: var( --wbfdm-btn-bg, #20232a );
	color: var( --wbfdm-btn-color, #ffffff );
	box-shadow: 0 6px 18px rgba( 0, 0, 0, .22 );
	font-family: inherit;
	font-size: 12px;
	line-height: 1.2;
	transition: filter .2s ease, box-shadow .2s ease;
}

.wbfdm-toggle:hover,
.wbfdm.is-open .wbfdm-toggle {
	filter: brightness( 1.1 );
	box-shadow: 0 8px 24px rgba( 0, 0, 0, .28 );
}

.wbfdm-toggle .dashicons {
	width: var( --wbfdm-btn-icon-size, 22px );
	height: var( --wbfdm-btn-icon-size, 22px );
	font-size: var( --wbfdm-btn-icon-size, 22px );
	line-height: var( --wbfdm-btn-icon-size, 22px );
}

.wbfdm-toggle-text {
	max-width: 60px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.wbfdm-side-left .wbfdm-toggle  { border-radius: 0 14px 14px 0; }
.wbfdm-side-right .wbfdm-toggle { border-radius: 14px 0 0 14px; }

/* 抽屉主体 */
.wbfdm-drawer {
	--wbfdm-dx: -14px;
	--wbfdm-dy: 0px;
	position: absolute;
	width: var( --wbfdm-drawer-w, 320px );
	max-width: calc( 100vw - 84px );
	max-height: 70vh;
	max-height: min( 70vh, 600px );
	overflow-y: auto;
	padding: var( --wbfdm-drawer-padding, 14px );
	background: var( --wbfdm-drawer-bg, #ffffff );
	color: var( --wbfdm-drawer-color, #333333 );
	border-radius: var( --wbfdm-drawer-radius, 12px );
	box-shadow: 0 14px 42px rgba( 0, 0, 0, .22 );
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transform: translate( var( --wbfdm-dx ), var( --wbfdm-dy ) );
	transition: opacity .25s ease, transform .25s ease, visibility .25s ease;
}

.wbfdm-side-right .wbfdm-drawer { --wbfdm-dx: 14px; }
.wbfdm-pos-center .wbfdm-drawer { --wbfdm-dy: -50%; }

/* 与按钮无缝衔接，避免鼠标移到抽屉时经过空隙导致闪退 */
.wbfdm-side-left .wbfdm-drawer  { left: 100%; }
.wbfdm-side-right .wbfdm-drawer { right: 100%; }

.wbfdm-pos-top .wbfdm-drawer    { top: -4px; }
.wbfdm-pos-bottom .wbfdm-drawer { bottom: -4px; }
.wbfdm-pos-center .wbfdm-drawer { top: 50%; }

.wbfdm:hover .wbfdm-drawer,
.wbfdm.is-open .wbfdm-drawer,
.wbfdm-drawer:hover {
	opacity: 1;
	visibility: visible;
	pointer-events: auto;
	transform: translate( 0, var( --wbfdm-dy ) );
}

/* 抽屉顶部关闭按钮（手机端点击收起） */
.wbfdm-drawer-bar {
	display: flex;
	justify-content: flex-end;
	margin: -4px -4px 6px 0;
}

.wbfdm-close {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 28px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba( 127, 127, 127, .14 );
	color: inherit;
	cursor: pointer;
	font-family: inherit;
	font-size: 18px;
	line-height: 1;
}

.wbfdm-close:hover { background: rgba( 127, 127, 127, .28 ); }

/* 点击关闭后，抑制 hover 展开，直到鼠标离开整个组件 */
.wbfdm.is-closed .wbfdm-drawer {
	opacity: 0 !important;
	visibility: hidden !important;
	pointer-events: none !important;
	transform: translate( var( --wbfdm-dx, -14px ), var( --wbfdm-dy, 0px ) ) !important;
}

/* 抽屉内的菜单项 */
.wbfdm-entry {
	padding: 12px;
	margin-bottom: 10px;
	background: rgba( 127, 127, 127, .06 );
	border: 1px solid rgba( 127, 127, 127, .14 );
	border-radius: 10px;
}

.wbfdm-entry:last-child { margin-bottom: 0; }

.wbfdm-entry-top {
	display: flex;
	align-items: center;
	gap: 10px;
}

.wbfdm-entry-icon {
	display: inline-flex;
	flex: 0 0 38px;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	border-radius: 50%;
	color: #fff;
	overflow: hidden;
}

.wbfdm-entry-icon .dashicons {
	width: 20px;
	height: 20px;
	font-size: 20px;
	line-height: 20px;
	color: #fff;
}

.wbfdm-entry-icon img {
	width: 24px;
	height: 24px;
	object-fit: contain;
}

.wbfdm-entry-title {
	margin: 0;
	font-size: 15px;
	font-weight: 700;
	line-height: 1.4;
}

.wbfdm-entry-content {
	margin-top: 8px;
	font-size: 13px;
	line-height: 1.7;
	word-wrap: break-word;
}

.wbfdm-entry-content p { margin: 0 0 6px; }
.wbfdm-entry-content p:last-child { margin-bottom: 0; }
.wbfdm-entry-content img { max-width: 100%; height: auto; border-radius: 6px; }
.wbfdm-entry-content a { color: inherit; text-decoration: underline; }

.wbfdm-entry-link {
	display: inline-block;
	margin-top: 8px;
	font-size: 12px;
	font-weight: 600;
	text-decoration: none;
	border-bottom: 1px solid currentColor;
}

.wbfdm-empty { margin: 0; text-align: center; opacity: .7; }

@media ( max-width: 600px ) {
	.wbfdm-toggle { width: 58px; min-height: 58px; }
	.wbfdm-drawer { max-width: calc( 100vw - 70px ); }
}

@media ( prefers-reduced-motion: reduce ) {
	.wbfdm-drawer,
	.wbfdm-toggle { transition: none; }
}
