/**
 * B&J Verhuur — mobile left-drawer CATEGORY DRILLDOWN.
 *
 * Mounted inside Elementor's .dialog-widget-content at <=1023px,
 * so the popup focus trap stays active while navigating categories.
 * The approved desktop mega-menu, header widgets and taxonomy data are
 * unaffected. One screen/one level; one vertical scroller in the drawer.
 */
.bj-mobile-drilldown[hidden] {
	display: none !important;
}

@media (max-width: 1023px) {
	html.bj-mobile-drilldown-active,
	html.bj-mobile-drilldown-active body {
		overflow: hidden !important;
	}

	/* Show a forward chevron only on the existing Elementor Assortiment link. */
	[id^="elementor-popup-modal-"] :is(a, button)[data-bj-mobile-categories-mounted="1"],
	.elementor-popup-modal :is(a, button)[data-bj-mobile-categories-mounted="1"] {
		position: relative !important;
		padding-right: 52px !important;
	}

	[id^="elementor-popup-modal-"] :is(a, button)[data-bj-mobile-categories-mounted="1"]::after,
	.elementor-popup-modal :is(a, button)[data-bj-mobile-categories-mounted="1"]::after {
		content: '' !important;
		position: absolute !important;
		display: block !important;
		width: 9px;
		height: 9px;
		right: 28px;
		top: 50%;
		border-right: 2px solid currentColor !important;
		border-top: 2px solid currentColor !important;
		transform: translateY(-50%) rotate(45deg) !important;
		pointer-events: none;
	}

	.bj-mobile-drilldown {
		box-sizing: border-box !important;
		position: fixed !important;
		inset: 0 !important;
		width: 100vw !important;
		height: 100vh !important;
		height: 100dvh !important;
		max-height: none !important;
		/* The native [hidden] attribute must win until Assortiment is clicked.
		   A previous display:block !important here overrode [hidden] at
		   equal specificity, exposing an uninitialized EMPTY panel as soon
		   as Elementor's hamburger popup opened. */
		overflow: hidden !important;
		/* Above other Elementor menu widgets but within its focus trap. */
		z-index: 2147483000 !important;
		isolation: isolate;
		pointer-events: auto !important;
		font-family: inherit;
	}

	.bj-mobile-drilldown,
	.bj-mobile-drilldown * {
		box-sizing: border-box !important;
	}

	.bj-mobile-drilldown__backdrop {
		position: absolute;
		inset: 0;
		background: rgba(6, 54, 73, .44);
	}

	/* Like the reference interaction, but entirely B&J's own palette. */
	.bj-mobile-drilldown__drawer {
		position: absolute;
		left: 0;
		top: 0;
		bottom: 0;
		width: min(88vw, 360px);
		max-width: 100vw;
		height: 100%;
		display: flex !important;
		flex-direction: column;
		min-height: 0;
		overflow: hidden;
		background: #ffffff;
		color: #063649;
		box-shadow: 5px 0 30px rgba(6, 54, 73, .18);
		animation: bj-mobile-drilldown-enter .22s ease-out both;
	}

	.bj-mobile-drilldown__header {
		min-height: 54px;
		flex: 0 0 auto;
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: 8px;
		background: #07506e;
		color: #ffffff;
		padding: 0 12px;
	}

	.bj-mobile-drilldown__back,
	.bj-mobile-drilldown__close,
	.bj-mobile-drilldown__back,
	.bj-mobile-drilldown__close {
		border: 0 !important;
		box-shadow: none !important;
		background: transparent !important;
		color: #ffffff !important;
		min-height: 44px !important;
		min-width: 44px !important;
		margin: 0 !important;
		padding: 6px 10px !important;
		font: inherit !important;
		font-size: 15px !important;
		font-weight: 600 !important;
		text-transform: none !important;
		line-height: 1.4 !important;
		cursor: pointer;
	}

	.bj-mobile-drilldown__back {
		width: auto !important;
		text-align: left !important;
	}

	.bj-mobile-drilldown__close {
		font-size: 27px !important;
		font-weight: 400 !important;
	}

	.bj-mobile-drilldown__title {
		margin: 0 !important;
		padding: 18px 22px 14px !important;
		flex: 0 0 auto;
		color: #063649 !important;
		background: #f8f8f6;
		font-size: 21px !important;
		font-weight: 650 !important;
		line-height: 1.3 !important;
	}

	/* The ONLY scrolling content region. No nested accordion scrollboxes. */
	.bj-mobile-drilldown__body {
		flex: 1 1 auto;
		min-height: 0;
		width: 100%;
		padding: 0 !important;
		margin: 0 !important;
		overflow-x: hidden;
		overflow-y: auto;
		overscroll-behavior: contain;
		-webkit-overflow-scrolling: touch;
		scrollbar-width: thin;
		scrollbar-color: #b4c6cc #ffffff;
	}

	.bj-mobile-drilldown__all {
		display: block !important;
		width: 100% !important;
		padding: 14px 20px !important;
		margin: 0 !important;
		min-height: 50px !important;
		border: 0 !important;
		border-bottom: 1px solid #e5e3de !important;
		color: #007aa6 !important;
		background: #f8f8f6 !important;
		text-align: left !important;
		font-size: 14px !important;
		font-weight: 600 !important;
		line-height: 1.45 !important;
		text-decoration: underline !important;
		text-underline-offset: 3px !important;
	}

	.bj-mobile-drilldown__list {
		list-style: none !important;
		display: block !important;
		margin: 0 !important;
		padding: 0 !important;
		position: static !important;
		width: 100% !important;
		visibility: visible !important;
	}

	.bj-mobile-drilldown__item {
		list-style: none !important;
		display: block !important;
		margin: 0 !important;
		padding: 0 !important;
		width: 100% !important;
		border-bottom: 1px solid #e5e3de !important;
	}

	.bj-mobile-drilldown__row {
		position: relative !important;
		display: flex !important;
		align-items: center !important;
		justify-content: space-between !important;
		width: 100% !important;
		min-width: 0 !important;
		min-height: 48px !important;
		padding: 12px 22px !important;
		margin: 0 !important;
		background: #ffffff !important;
		border: 0 !important;
		border-radius: 0 !important;
		box-shadow: none !important;
		color: #063649 !important;
		text-align: left !important;
		text-decoration: none !important;
		font-family: inherit !important;
		font-size: 16px !important;
		font-weight: 400 !important;
		line-height: 1.45 !important;
		text-transform: none !important;
		letter-spacing: normal !important;
		white-space: normal !important;
		cursor: pointer;
	}

	.bj-mobile-drilldown__row:hover,
	.bj-mobile-drilldown__row:hover {
		background: #f1fafd !important;
		color: #007aa6 !important;
	}

	.bj-mobile-drilldown__chevron {
		flex: 0 0 8px;
		width: 8px;
		height: 8px;
		margin-left: 12px;
		border-top: 1.8px solid currentColor;
		border-right: 1.8px solid currentColor;
		transform: rotate(45deg);
	}

	.bj-mobile-drilldown :is(button, a):focus-visible {
		outline: 2px solid #007aa6 !important;
		outline-offset: -3px !important;
	}

	.bj-mobile-drilldown__header :is(button):focus-visible {
		outline-color: #ffffff !important;
	}
}

/* If the user rotates to desktop width, the desktop mega-menu is unchanged. */
@media (min-width: 1024px) {
	.bj-mobile-drilldown {
		display: none !important;
	}
}

/* Motion is decorative; the navigation remains usable without animation. */
@keyframes bj-mobile-drilldown-enter {
	from { transform: translateX(-100%); }
	to { transform: translateX(0); }
}
@media (prefers-reduced-motion: reduce) {
	.bj-mobile-drilldown__drawer {
		animation: none !important;
	}
}

/* Final safety guard: this overlay is INSIDE Elementor dialog content.
   Do not reveal until the visitor actually clicks Assortiment. */
.dialog-widget-content > .bj-mobile-drilldown[hidden] {
	display: none !important;
}
