/* E-Nav mobile widget dock: entry button injected into the theme's right
 * tool rail (#footer-tools) + a slide-in drawer. Hidden on desktop; the theme
 * hides its own widget area below 992px, so the dock covers exactly that gap.
 *
 * The entry button uses the theme's own `.btn-tools` class for its look and an
 * icon class supplied by the settings screen. No theme file is touched.
 */

.e-onenav-dock-mask,
.e-onenav-dock {
	box-sizing: border-box;
}

/* Desktop: mask + drawer never appear. The entry button is injected in every
 * viewport and simply hidden here — deciding in JS at load time is what made
 * the button missing whenever the window was narrowed from a desktop width. */
.e-onenav-dock-mask,
.e-onenav-dock {
	display: none !important;
}

@media (min-width: 992px) {
	.e-onenav-dock-fab {
		display: none !important;
	}
}

/* 内置图标（后台留空时用）。主题的 .btn-tools 一般按 em 定尺寸，
 * 这里按 px 固定，免得跟着字号飘。 */
.e-onenav-dock-fab svg {
	display: block;
	width: 20px;
	height: 20px;
}

@media (max-width: 991.98px) {
	.e-onenav-dock-mask {
		position: fixed;
		inset: 0;
		z-index: 9991;
		display: block !important;
		background: rgba(0, 0, 0, .38);
		opacity: 0;
		transition: opacity .22s ease;
	}

	.e-onenav-dock-mask[hidden] {
		display: none !important;
	}

	.e-onenav-dock-mask.is-open {
		opacity: 1;
	}

	/* Drawer */
	.e-onenav-dock {
		position: fixed;
		top: 0;
		right: 0;
		bottom: 0;
		z-index: 9992;
		display: flex !important;
		flex-direction: column;
		width: min(88vw, 360px);
		background: var(--main-bg-color, #fff);
		box-shadow: -6px 0 24px rgba(0, 0, 0, .18);
		transform: translateX(102%);
		transition: transform .24s ease;
	}

	.e-onenav-dock[hidden] {
		display: none !important;
	}

	.e-onenav-dock.is-open {
		transform: translateX(0);
	}

	.e-onenav-dock-head {
		position: relative;
		z-index: 2; /* stays above any absolutely positioned widget bit */
		flex: 0 0 auto;
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: 10px;
		min-height: 44px;
		padding: 6px 10px;
		border-bottom: 1px solid rgba(0, 0, 0, .07);
		box-sizing: border-box;
	}

	.e-onenav-dock-title {
		flex: 1 1 auto;
		min-width: 0;
		font-size: 14px;
		font-weight: 700;
		line-height: 1.4;
		color: var(--main-color, #333);
	}

	.e-onenav-dock-close {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		width: 32px;
		min-width: 32px;
		height: 32px;
		min-height: 32px;
		margin: 0;
		padding: 0;
		border: 0;
		border-radius: 50%;
		background: rgba(0, 0, 0, .05);
		color: var(--main-color, #666);
		font-family: inherit;
		font-size: 20px;
		font-weight: 400;
		line-height: 1;
		white-space: nowrap;
		cursor: pointer;
		box-sizing: border-box;
		appearance: none;
	}

	.e-onenav-dock-close:focus,
	.e-onenav-dock-close:active {
		outline: 0;
		box-shadow: none;
	}

	.e-onenav-dock-body {
		flex: 1 1 auto;
		min-height: 0;
		overflow-x: hidden;
		overflow-y: auto;
		-webkit-overflow-scrolling: touch;
		padding: 12px 12px calc(24px + env(safe-area-inset-bottom, 0px));
	}

	/* The six widgets keep their own theme card markup; tighten the gutters
	 * only inside the drawer so more fits on a phone. */
	.e-onenav-dock-body .card {
		position: relative; /* own positioning context for 「换一条」/「在线」 badges */
		margin-bottom: 12px;
	}

	.e-onenav-dock-body .card:last-child {
		margin-bottom: 0;
	}

	body.e-onenav-dock-open {
		overflow: hidden;
	}
}

/* Dark mode */
.io-black-mode .e-onenav-dock {
	background: #2c2e2f;
}

.io-black-mode .e-onenav-dock-head {
	border-bottom-color: rgba(255, 255, 255, .08);
}

.io-black-mode .e-onenav-dock-title,
.io-black-mode .e-onenav-dock-close {
	color: #eee;
}

.io-black-mode .e-onenav-dock-close {
	background: rgba(255, 255, 255, .08);
}
