/*
 * Eigen mega menu voor Bakker IJlst (charliens-theme).
 * "Kies een Categorie"-knop met flyout: categorielijst links, subcategorieen
 * rechts (met sub-subs eronder). Bakker-blauw #014b9a.
 * Laadt alleen voor ingelogde gebruikers.
 */

/* Layout-fix: het thema zet float:right en justify-content:flex-end op de
   header-nav. Deze CSS laadt alleen ingelogd, dus dit raakt de uitgelogde
   weergave niet. */
header#mainbar nav {
	float: none !important;
	justify-content: flex-start !important;
}

/* Submenu-links in de blauwe menubalk (goedgekeurde aanpassing). */
header#mainbar nav ul li ul li a {
	font-size: 16px;
	padding: 5px 10px;
}

.bakker-mega {
	--bm-main: #014b9a;
	--bm-dark: #013a78;
	--bm-tri: #1b3699;
	--bm-border: #e6e9f0;
	--bm-muted: #8a8f9c;
	--bm-ink: #22252b;
	--bm-bg: #f6f9fd;
	position: relative;
	font-family: inherit;
	z-index: 600;
}

.bakker-mega * {
	box-sizing: border-box;
}

/* Tekstkleuren forceren: het thema kleurt menu-links wit met ID-selectors. */
.bakker-mega .bakker-mega__catname,
.bakker-mega .bakker-mega__catlink,
.bakker-mega .bakker-mega__sublink,
.bakker-mega .bakker-mega__paneltitle,
.bakker-mega .bakker-mega__subitem a,
.bakker-mega .bakker-mega__grandlist a {
	color: var(--bm-ink) !important;
	text-decoration: none !important;
}

.bakker-mega .bakker-mega__grandlist a {
	color: #6b7280 !important;
}

/* ---------------------------------------------------------------------
 * Trigger-knop "Kies een Categorie"
 * ------------------------------------------------------------------- */
.bakker-mega__trigger {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	padding: 13px 20px;
	border: none;
	border-radius: 10px;
	background: var(--bm-main);
	color: #fff;
	font-family: inherit;
	font-size: 15px;
	font-weight: 700;
	cursor: pointer;
	white-space: nowrap;
	transition: background 0.15s ease;
}

.bakker-mega__trigger:hover,
.bakker-mega.is-open .bakker-mega__trigger {
	background: var(--bm-dark);
}

.bakker-mega__trigger-icon {
	display: inline-flex;
}

.bakker-mega__trigger-icon svg {
	width: 20px;
	height: 20px;
}

.bakker-mega__trigger-chev {
	width: 16px;
	height: 16px;
	transition: transform 0.2s ease;
}

.bakker-mega.is-open .bakker-mega__trigger-chev {
	transform: rotate(180deg);
}

/* ---------------------------------------------------------------------
 * Flyout: twee kolommen (categorielijst links, panelen rechts)
 * ------------------------------------------------------------------- */
.bakker-mega__wrap {
	position: fixed;
	top: 120px;
	left: 0;
	right: 0;
	width: 100%;
	background: #fff;
	border-top: 1px solid var(--bm-border);
	border-bottom: 1px solid var(--bm-border);
	box-shadow: 0 30px 70px rgba(15, 23, 42, 0.22);
	opacity: 0;
	visibility: hidden;
	transform: translateY(10px);
	transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
	overflow: hidden;
	display: flex;
	min-height: 420px;
	z-index: 2147483000;
}

.bakker-mega__inner {
	display: flex;
	width: 100%;
	min-height: 420px;
}

.bakker-mega.is-open .bakker-mega__wrap {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
}

/* Linkerkolom: categorielijst */
.bakker-mega__cats {
	list-style: none;
	margin: 0;
	padding: 16px 14px;
	display: flex;
	flex-direction: column;
	gap: 3px;
	width: 340px;
	flex: 0 0 340px;
	background: var(--bm-bg);
	border-right: 1px solid var(--bm-border);
}

.bakker-mega__cat {
	position: static;
}

.bakker-mega__catlink {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 12px 14px;
	border-radius: 11px;
	font-size: 14.5px;
	font-weight: 600;
	transition: background 0.13s ease, color 0.13s ease, box-shadow 0.13s ease;
}

.bakker-mega__cat.is-hover .bakker-mega__catlink,
.bakker-mega__catlink:hover {
	background: var(--bm-main);
	box-shadow: 0 6px 16px rgba(1, 75, 154, 0.28);
}

.bakker-mega__cat.is-hover .bakker-mega__catlink,
.bakker-mega__cat.is-hover .bakker-mega__catname,
.bakker-mega__catlink:hover,
.bakker-mega__catlink:hover .bakker-mega__catname {
	color: #fff !important;
}

.bakker-mega__caticon {
	display: inline-flex;
	width: 30px;
	height: 30px;
	flex: 0 0 auto;
	align-items: center;
	justify-content: center;
	border-radius: 8px;
	background: rgba(1, 75, 154, 0.08);
	color: var(--bm-main);
	transition: background 0.13s ease, color 0.13s ease;
}

.bakker-mega__cat.is-hover .bakker-mega__caticon,
.bakker-mega__catlink:hover .bakker-mega__caticon {
	background: rgba(255, 255, 255, 0.22);
	color: #fff;
}

.bakker-mega__caticon svg {
	width: 18px;
	height: 18px;
}

.bakker-mega__catname {
	flex: 1 1 auto;
}

.bakker-mega__catarrow {
	width: 15px;
	height: 15px;
	flex: 0 0 auto;
	opacity: 0.55;
	transition: opacity 0.13s ease, transform 0.13s ease;
}

.bakker-mega__cat.is-hover .bakker-mega__catarrow,
.bakker-mega__catlink:hover .bakker-mega__catarrow {
	opacity: 1;
	transform: translateX(2px);
}

/* Rechterkolom: panelen */
.bakker-mega__panels {
	flex: 1 1 auto;
	position: relative;
	min-width: 0;
}

.bakker-mega__panel {
	display: none;
	padding: 26px 34px 34px;
}

.bakker-mega__panel.is-active {
	display: block;
}

/* Kop van het paneel */
.bakker-mega__panelhead {
	display: flex;
	align-items: center;
	gap: 14px;
	padding-bottom: 18px;
	margin-bottom: 26px;
	border-bottom: 1px solid var(--bm-border);
}

.bakker-mega__panelicon {
	display: inline-flex;
	width: 48px;
	height: 48px;
	flex: 0 0 auto;
	align-items: center;
	justify-content: center;
	border-radius: 13px;
	background: linear-gradient(135deg, rgba(1, 75, 154, 0.1), rgba(1, 75, 154, 0.04));
	color: var(--bm-main);
}

.bakker-mega__panelicon svg {
	width: 26px;
	height: 26px;
}

.bakker-mega__paneltitlewrap {
	display: flex;
	flex-direction: column;
	gap: 3px;
}

.bakker-mega__paneltitle {
	font-size: 20px;
	font-weight: 800;
	letter-spacing: 0.01em;
	line-height: 1.1;
}

.bakker-mega__panelcount {
	font-size: 12.5px;
	font-weight: 500;
	color: var(--bm-muted) !important;
}

.bakker-mega__panelall {
	margin-left: auto;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 11px 20px;
	border-radius: 10px;
	background: var(--bm-main);
	color: #fff !important;
	font-size: 13.5px;
	font-weight: 700;
	white-space: nowrap;
	box-shadow: 0 4px 14px rgba(1, 75, 154, 0.25);
	transition: background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.bakker-mega__panelall:hover {
	background: var(--bm-dark);
	transform: translateY(-1px);
	box-shadow: 0 6px 18px rgba(1, 75, 154, 0.32);
}

.bakker-mega__panelall svg {
	width: 16px;
	height: 16px;
	transition: transform 0.15s ease;
}

.bakker-mega__panelall:hover svg {
	transform: translateX(3px);
}

/* Subcategorieen als kolomkoppen, sub-subs eronder.
   CSS-kolommen geven een compacte masonry-achtige vulling. */
.bakker-mega__sublist {
	list-style: none;
	margin: 0;
	padding: 0;
	columns: 6;
	column-gap: 34px;
	column-fill: balance;
}

.bakker-mega__subitem {
	break-inside: avoid;
	-webkit-column-break-inside: avoid;
	page-break-inside: avoid;
	display: inline-block;
	width: 100%;
	margin: 0 0 18px;
}

.bakker-mega__sublink {
	display: flex;
	align-items: baseline;
	gap: 7px;
	font-size: 12px;
	font-weight: 800;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--bm-main) !important;
	padding-bottom: 6px;
	margin-bottom: 7px;
	border-bottom: 1px solid var(--bm-border);
	transition: border-color 0.14s ease;
}

.bakker-mega__sublink:hover {
	color: var(--bm-dark) !important;
	border-color: var(--bm-main);
}

.bakker-mega__subcount {
	font-size: 9.5px;
	font-weight: 700;
	color: var(--bm-muted) !important;
	background: #eef1f6;
	border-radius: 20px;
	padding: 2px 7px;
	margin-left: auto;
	line-height: 1;
}

.bakker-mega__grandlist {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 0;
}

.bakker-mega__grandlist li a {
	position: relative;
	display: block;
	font-size: 12.5px;
	font-weight: 400;
	color: #5c6270 !important;
	padding: 3px 0;
	line-height: 1.25;
	transition: color 0.14s ease, padding 0.14s ease;
}

.bakker-mega__grandlist li a::before {
	content: "";
	position: absolute;
	left: 0;
	top: 50%;
	width: 0;
	height: 1.5px;
	background: var(--bm-main);
	transform: translateY(-50%);
	transition: width 0.16s ease;
	border-radius: 2px;
}

.bakker-mega__grandlist li a:hover {
	color: var(--bm-main) !important;
	padding-left: 13px;
}

.bakker-mega__grandlist li a:hover::before {
	width: 9px;
}

/* Subcategorie zonder sub-subs: los, klikbaar item (geen kop-opmaak) */
.bakker-mega__subitem:not(:has(.bakker-mega__grandlist)) .bakker-mega__sublink {
	text-transform: none;
	letter-spacing: 0;
	font-size: 12.5px;
	font-weight: 400;
	color: #5c6270 !important;
	border-bottom: none;
	padding-bottom: 0;
	margin-bottom: 0;
}

.bakker-mega__subitem:not(:has(.bakker-mega__grandlist)) .bakker-mega__sublink:hover {
	color: var(--bm-main) !important;
}

/* ---------------------------------------------------------------------
 * Mobiel: knop opent, drill-down (hoofdcategorieen -> subcategorie-paneel)
 * ------------------------------------------------------------------- */
.bakker-mega__back {
	display: none;
}

@media (max-width: 900px) {
	.bakker-mega {
		width: 100%;
		padding: 0 14px;
		box-sizing: border-box;
	}

	.bakker-mega__trigger {
		width: 100%;
		justify-content: center;
	}

	.bakker-mega__wrap {
		position: static;
		width: 100%;
		max-width: 100%;
		box-shadow: none;
		border-radius: 12px;
		border: 1px solid var(--bm-border);
		opacity: 1;
		visibility: visible;
		transform: none;
		min-height: 0;
		height: 0;
		overflow: hidden;
		transition: none;
		display: block;
		margin-top: 10px;
	}

	.bakker-mega.is-open .bakker-mega__wrap {
		height: auto;
		max-height: 70vh;
		overflow-y: auto;
		-webkit-overflow-scrolling: touch;
	}

	.bakker-mega__inner {
		display: block;
		width: 100%;
		min-height: 0;
	}

	/* Standaard: hoofdcategorieen tonen, panelen verborgen. */
	.bakker-mega__cats {
		width: 100%;
		border-right: none;
		padding: 8px;
	}

	.bakker-mega__catlink {
		padding: 14px 14px;
	}

	.bakker-mega__panels {
		width: 100%;
		display: none;
	}

	/* Drill-down: paneel-weergave actief. */
	.bakker-mega.is-mobile-panel .bakker-mega__cats {
		display: none;
	}

	.bakker-mega.is-mobile-panel .bakker-mega__panels {
		display: block;
	}

	.bakker-mega__panel {
		padding: 0 16px 22px;
	}

	/* Terugknop bovenaan het paneel. */
	.bakker-mega__back {
		display: inline-flex;
		align-items: center;
		gap: 6px;
		width: 100%;
		margin: 0 0 14px;
		padding: 14px 4px;
		background: none;
		border: none;
		border-bottom: 1px solid var(--bm-border);
		color: var(--bm-main);
		font-family: inherit;
		font-size: 14px;
		font-weight: 700;
		cursor: pointer;
	}

	.bakker-mega__back svg {
		width: 18px;
		height: 18px;
	}

	.bakker-mega__panelhead {
		flex-wrap: wrap;
		gap: 10px;
		padding-top: 4px;
	}

	.bakker-mega__panelall {
		margin-left: 0;
		margin-top: 4px;
		width: 100%;
		justify-content: center;
	}

	.bakker-mega__sublist {
		columns: 2;
		column-gap: 20px;
	}
}

@media (max-width: 560px) {
	.bakker-mega__sublist {
		columns: 1;
	}
}
