/**
 * MyGeneratorLab navigation: calculators mega menu + mobile drawer.
 *
 * @since 3.9.1
 */

/* ---------- Mega menu (desktop) ---------- */

.mgl-menu > li.mgl-has-mega {
	position: static;
	display: inline-flex;
	align-items: center;
}

/* Modern dropdown arrow indicator (desktop + mobile). */
.mgl-mega-expand {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 26px;
	height: 26px;
	margin-left: 4px;
	padding: 0;
	background: rgba(255, 255, 255, 0.1);
	border: 0;
	border-radius: 50%;
	color: #fff;
	cursor: pointer;
	transition: background 0.2s ease;
	-webkit-tap-highlight-color: transparent;
}

.mgl-mega-expand:hover {
	background: var(--mgl-accent, #ff6b35);
}

.mgl-mega-expand .mgl-icon {
	width: 14px;
	height: 14px;
	transform: rotate(90deg);
	transition: transform 0.22s ease;
}

.mgl-menu > li.mgl-mega-open > .mgl-mega-expand .mgl-icon {
	transform: rotate(270deg);
}

.mgl-menu > li.mgl-mega-open > .mgl-mega-expand {
	background: var(--mgl-accent, #ff6b35);
}

.mgl-mega {
	position: absolute;
	top: 100%;
	left: 0;
	right: 0;
	background: linear-gradient(180deg, #0c1425 0%, #111c33 100%);
	border-top: 1px solid rgba(255, 255, 255, 0.08);
	box-shadow: 0 32px 64px rgba(0, 0, 0, 0.45);
	opacity: 0;
	visibility: hidden;
	transform: translateY(-12px);
	transition: opacity 0.22s ease, transform 0.22s ease, visibility 0s linear 0.22s;
	z-index: 600;
}

.mgl-menu > li.mgl-mega-open > .mgl-mega,
.mgl-menu > li.mgl-has-mega:focus-within > .mgl-mega {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
	transition: opacity 0.25s ease, transform 0.25s ease;
}

.mgl-mega-inner {
	padding-top: 4px;
	padding-bottom: 4px;
}

.mgl-mega-grid {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 10px 36px;
	padding: 34px 0 14px;
}

.mgl-mega-cat-title {
	margin: 0 0 8px;
}

.mgl-mega .mgl-mega-cat-toggle {
	background: none;
	border: 0;
	padding: 0;
	color: var(--mgl-primary);
	font-family: inherit;
	font-size: 12px;
	font-weight: 800;
	letter-spacing: 0.09em;
	text-transform: uppercase;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	cursor: default;
}

.mgl-mega .mgl-mega-cat-toggle .mgl-icon {
	display: none;
}

.mgl-mega .mgl-mega-links {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
}

.mgl-mega .mgl-mega-links a {
	display: block;
	padding: 7px 0 7px 0;
	border-left: 2px solid transparent;
	color: #c3c9d4;
	font-size: 14px;
	font-weight: 500;
	white-space: normal;
	border-radius: 0;
	transition: color 0.15s ease, padding-left 0.15s ease, border-color 0.15s ease;
}

.mgl-mega .mgl-mega-links a:hover {
	color: #fff;
	text-decoration: none;
	padding-left: 10px;
	border-left-color: var(--mgl-primary);
	background: none;
}

.mgl-mega-footer {
	margin-top: 18px;
	padding: 20px 0 30px;
	border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.mgl-mega .mgl-mega-all {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	background: var(--mgl-primary);
	color: #fff;
	font-weight: 700;
	font-size: 15px;
	padding: 12px 26px;
	border-radius: 999px;
	transition: background 0.15s ease, transform 0.15s ease;
}

.mgl-mega .mgl-mega-all:hover {
	background: var(--mgl-primary-dark);
	color: #fff;
	text-decoration: none;
	transform: translateY(-1px);
}

.mgl-mega .mgl-mega-all .mgl-icon {
	width: 18px;
	height: 18px;
}

/* ---------- Mobile drawer + mega accordion ---------- */

.mgl-nav-backdrop {
	position: fixed;
	inset: 0;
	background: rgba(4, 9, 18, 0.62);
	backdrop-filter: blur(2px);
	-webkit-backdrop-filter: blur(2px);
	z-index: 690;
	opacity: 0;
	transition: opacity 0.3s ease;
}

.mgl-nav-backdrop[hidden] {
	display: none;
}

body.mgl-nav-open {
	overflow: hidden;
}

body.mgl-nav-open .mgl-nav-backdrop {
	opacity: 1;
}

body.mgl-nav-open .mgl-header-actions {
	position: relative;
	z-index: 701;
}

@media (max-width: 768px) {
	/* Slide-in drawer replaces the old absolute dropdown. */
	.mgl-nav {
		display: block;
		position: fixed;
		top: 0;
		right: 0;
		left: auto;
		bottom: 0;
		width: min(400px, 92vw);
		height: 100dvh;
		max-height: none;
		background: linear-gradient(180deg, #0c1425 0%, #0a101f 100%);
		border-top: none;
		box-shadow: -24px 0 56px rgba(0, 0, 0, 0.5);
		transform: translateX(105%);
		visibility: hidden;
		transition: transform 0.34s cubic-bezier(0.32, 0.72, 0.24, 1), visibility 0s linear 0.34s;
		z-index: 700;
		overflow-y: auto;
		overscroll-behavior: contain;
		padding: 84px 0 40px;
	}

	.mgl-nav.open {
		display: block;
		transform: translateX(0);
		visibility: visible;
		transition: transform 0.34s cubic-bezier(0.32, 0.72, 0.24, 1);
	}

	.mgl-menu {
		padding: 0;
		gap: 0;
	}

	.mgl-menu > li {
		border-bottom: 1px solid rgba(255, 255, 255, 0.07);
	}

	.mgl-menu a {
		font-size: 17px;
		font-weight: 700;
		padding: 16px 26px;
		border-bottom: none;
		color: #eef1f6;
	}

	.mgl-menu a:hover {
		background: rgba(255, 255, 255, 0.05);
	}

	/* Mega item becomes a flex row: link + expand button. */
	.mgl-menu > li.mgl-has-mega {
		display: flex;
		flex-wrap: wrap;
		align-items: center;
	}

	.mgl-menu > li.mgl-has-mega > a {
		flex: 1;
		min-width: 0;
	}

	.mgl-mega-expand {
		flex: 0 0 56px;
		width: 56px;
		height: 56px;
		margin-left: 0;
		background: rgba(255, 255, 255, 0.08);
		border-radius: 12px;
	}

	.mgl-mega-expand .mgl-icon {
		width: 20px;
		height: 20px;
		transform: rotate(90deg);
	}

	.mgl-menu > li.mgl-mega-open > .mgl-mega-expand .mgl-icon {
		transform: rotate(270deg);
	}

	/* Mega panel as a static accordion. */
	.mgl-mega {
		position: static;
		flex-basis: 100%;
		display: none;
		opacity: 1;
		visibility: visible;
		transform: none;
		transition: none;
		background: rgba(0, 0, 0, 0.28);
		border-top: 1px solid rgba(255, 255, 255, 0.06);
		box-shadow: none;
	}

	.mgl-menu > li.mgl-mega-open > .mgl-mega {
		display: block;
	}

	.mgl-mega-inner {
		padding-top: 0;
		padding-bottom: 0;
	}

	.mgl-mega-grid {
		grid-template-columns: 1fr;
		gap: 0;
		padding: 6px 0 10px;
	}

	.mgl-mega-col {
		border-bottom: 1px solid rgba(255, 255, 255, 0.06);
	}

	.mgl-mega-col:last-child {
		border-bottom: none;
	}

	.mgl-mega-cat-title {
		margin: 0;
	}

	.mgl-mega .mgl-mega-cat-toggle {
		width: 100%;
		display: flex;
		align-items: center;
		justify-content: space-between;
		padding: 15px 26px;
		color: #fff;
		font-size: 15px;
		font-weight: 700;
		letter-spacing: 0;
		text-transform: none;
		cursor: pointer;
		-webkit-tap-highlight-color: transparent;
	}

	.mgl-mega .mgl-mega-cat-toggle .mgl-icon {
		display: block;
		width: 20px;
		height: 20px;
		color: var(--mgl-primary);
		transition: transform 0.22s ease;
	}

	.mgl-mega-col.mgl-cat-open .mgl-mega-cat-toggle .mgl-icon {
		transform: rotate(90deg);
	}

	.mgl-mega .mgl-mega-links {
		display: none;
		padding: 2px 26px 14px;
	}

	.mgl-mega-col.mgl-cat-open .mgl-mega-links {
		display: block;
	}

	.mgl-mega .mgl-mega-links a {
		padding: 11px 0;
		font-size: 15px;
		border-left: none;
	}

	.mgl-mega .mgl-mega-links a:hover {
		padding-left: 0;
	}

	.mgl-mega-footer {
		margin-top: 6px;
		padding: 18px 26px 22px;
		border-top: 1px solid rgba(255, 255, 255, 0.06);
	}

	.mgl-mega .mgl-mega-all {
		width: 100%;
		justify-content: center;
	}

	/* Category strip becomes tidy scrollable chips. */
	.mgl-category-strip-inner {
		gap: 8px;
		padding: 10px 0;
	}

	.mgl-category-menu {
		gap: 8px;
	}

	.mgl-category-menu a {
		padding: 8px 15px;
		background: #edf0f5;
		border-radius: 999px;
		font-size: 12px;
	}

	.mgl-category-menu a:hover,
	.mgl-category-menu .current-menu-item > a {
		background: var(--mgl-primary-soft);
		color: var(--mgl-primary-dark);
	}
}

@media (min-width: 769px) {
	/* Desktop: category headings are static, accordions disabled. */
	.mgl-mega .mgl-mega-cat-toggle {
		pointer-events: none;
	}
}
