/**
 * Mega menu — used by both the [creanova_mega_menu] shortcode
 * (renders a <div data-wcd-megamenu>) and the nav-menu integration
 * (adds a caret + panel inside an existing theme <li class="wcd-megamenu-item">).
 * Both share the same caret / panel markup, so one set of rules covers both.
 *
 * Desktop: hover/click-triggered dropdown, categories laid out in a
 * responsive CSS grid (auto-fills as many columns as fit).
 * Mobile: full-width, single scrollable column below the trigger.
 */

.wcd-megamenu,
.wcd-megamenu-item {
	position: relative;
	display: inline-block;
}

/* If the shortcode's own trigger link needs to inherit surrounding nav
   font styles, this keeps it visually consistent without imposing much. */
.wcd-megamenu-trigger-link {
	font: inherit;
	font-weight: 600;
	color: inherit;
	text-decoration: none;
}

/* ── Caret toggle (separate from the real link, so the link always
   navigates normally and the caret is the only click/tap target) ────── */

.wcd-megamenu-caret {
	display: inline-block;
	width: 8px;
	height: 8px;
	margin-left: 6px;
	margin-bottom: 2px;
	border-right: 2px solid currentColor;
	border-bottom: 2px solid currentColor;
	transform: rotate(45deg);
	transition: transform .15s ease;
	cursor: pointer;
	vertical-align: middle;
}

.wcd-megamenu.is-open .wcd-megamenu-caret,
.wcd-megamenu-item.is-open .wcd-megamenu-caret {
	transform: rotate(-135deg);
	margin-bottom: -2px;
}

/* ── Panel ───────────────────────────────────────────────────────────── */

.wcd-megamenu-panel {
	display: none;
	position: absolute;
	top: 100%;
	left: 50%;
	transform: translateX(-50%);
	z-index: 200;
	margin-top: 12px;
	background: #fff;
	border: 1px solid #e5e7eb;
	border-radius: 12px;
	box-shadow: 0 12px 32px rgba(17, 24, 39, .12);
	padding: 24px;
	width: min(1100px, 92vw);
	max-height: 70vh;
	overflow-y: auto;
	/* Reset in case the theme's own menu styles add list markers, margins etc. */
	list-style: none;
	margin-left: 0;
}

.wcd-megamenu.is-open .wcd-megamenu-panel,
.wcd-megamenu-item.is-open .wcd-megamenu-panel {
	display: block;
}

.wcd-megamenu-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
	gap: 20px 24px;
}

.wcd-megamenu-col {
	min-width: 0;
}

.wcd-megamenu-heading {
	display: block;
	font-weight: 700;
	font-size: 14px;
	color: #111827;
	text-decoration: none;
	margin-bottom: 8px;
	padding-bottom: 6px;
	border-bottom: 2px solid #c6e94e;
}

.wcd-megamenu-heading:hover {
	color: #4b5563;
}

.wcd-megamenu-col ul {
	list-style: none;
	margin: 0;
	padding: 0;
}

.wcd-megamenu-col li {
	margin: 0;
}

.wcd-megamenu-col a {
	display: block;
	padding: 4px 0;
	font-size: 13px;
	color: #4b5563;
	text-decoration: none;
	line-height: 1.4;
}

.wcd-megamenu-col a:hover {
	color: #111827;
	text-decoration: underline;
}

/* ── Mobile: full-width, single column ──────────────────────────────── */

@media ( max-width: 900px ) {
	.wcd-megamenu-panel {
		position: fixed;
		left: 0;
		right: 0;
		top: auto;
		transform: none;
		width: 100%;
		max-width: 100%;
		max-height: calc(100vh - 60px);
		border-radius: 0;
		margin-top: 0;
	}

	.wcd-megamenu-grid {
		grid-template-columns: 1fr;
		gap: 4px;
	}

	.wcd-megamenu-col {
		border-bottom: 1px solid #f3f4f6;
		padding-bottom: 8px;
		margin-bottom: 8px;
	}
}
