/*
 * Four Level Tab Mega Menu — front-end styles.
 * All rules are scoped to `.fltmm-enabled` trees. No bare element
 * selectors (ul/li/a/.sub-menu) are styled, so normal Elementor menus
 * elsewhere on the page are unaffected.
 *
 * Layout mode is switched per-instance via `.fltmm-mode-desktop` /
 * `.fltmm-mode-mobile` classes applied directly to each `.fltmm-enabled`
 * root item (see mega-menu.js). This is instance-scoped rather than a
 * single <html> class because Elementor Pro's Nav Menu widget renders
 * the SAME WordPress menu twice — once inside `.elementor-nav-menu--main`
 * (desktop, hover) and once inside `.elementor-nav-menu--dropdown`
 * (Elementor's own mobile toggle) — and each tree must be able to render
 * in the correct mode independently of the other.
 */

.fltmm-enabled {
	--fltmm-background: #ffffff;
	--fltmm-color: #222222;
	--fltmm-tab-width: 240px;
	--fltmm-active-background: #f4f4f4;
	--fltmm-active-color: #111111;
	--fltmm-menu-padding: 20px;
	--fltmm-column-gap: 28px;
	--fltmm-row-gap: 22px;
	--fltmm-border-color: #e6e6e6;
	--fltmm-shadow: 0 16px 40px rgba(15, 15, 15, 0.14);
	--fltmm-transition-duration: 180ms;
	--fltmm-menu-width: 860px;
	position: relative;
}

.fltmm-enabled,
.fltmm-enabled *,
.fltmm-enabled *::before,
.fltmm-enabled *::after {
	box-sizing: border-box;
}

/* ============================================================ */
/* Elementor Pro Nav Menu widget compatibility resets            */
/*                                                                 */
/* Elementor's own widget-nav-menu(.min|-rtl.min).css applies      */
/* rules that conflict with the mega menu's layout:                */
/*  - `.elementor-nav-menu a, .elementor-nav-menu li{position:      */
/*    relative}` breaks the absolute-positioned Level-3/4 content   */
/*    panel's containing block — fixed below.                       */
/*  - `.elementor-nav-menu a{display:flex}` + forced padding        */
/*    fights our block/grid layout for tab, group and link items.   */
/*  - `.elementor-nav-menu ul{display:none}` plus Elementor's own    */
/*    hover/toggle script may also set inline styles on the very    */
/*    <ul> elements this plugin re-uses.                            */
/*  - Elementor injects its own `.sub-arrow` icons and hover         */
/*    "pointer" underline/background effects, which visually        */
/*    collide with our own submenu toggle and active-tab styling.   */
/*                                                                    */
/* Everything here is scoped strictly to `.fltmm-enabled` trees, so  */
/* normal Elementor menus elsewhere on the site are never affected.  */
/* !important is used deliberately per the documented Elementor-      */
/* conflict exception, and to guarantee our state classes win over    */
/* any inline style Elementor's own widget script may set.            */
/* ============================================================ */

.fltmm-enabled .sub-arrow {
	display: none !important;
}

.fltmm-enabled .fltmm-mega-menu a {
	display: block !important;
	align-items: normal !important;
	flex-grow: 0 !important;
}

.fltmm-enabled .fltmm-mega-menu ul ul a,
.fltmm-enabled .fltmm-mega-menu ul ul ul a,
.fltmm-enabled .fltmm-mega-menu ul ul ul ul a {
	border-inline-start: 0 !important;
}

.fltmm-enabled .fltmm-mega-menu .elementor-item:after,
.fltmm-enabled .fltmm-mega-menu .elementor-item:before {
	display: none !important;
	content: none !important;
}

.fltmm-enabled .fltmm-mega-menu a.current,
.fltmm-enabled .fltmm-mega-menu .elementor-item-active,
.fltmm-enabled .fltmm-mega-menu .elementor-item.highlighted {
	background-color: transparent !important;
	color: inherit !important;
}

/* Restores `.fltmm-mega-inner` as the true containing block for the
   absolutely positioned Level-3 content panel — see comment above. */
.fltmm-enabled.fltmm-mode-desktop .fltmm-tab-navigation > .fltmm-tab {
	position: static !important;
}

.fltmm-enabled .fltmm-submenu-toggle {
	display: none;
	appearance: none;
	background: transparent;
	border: 0;
	padding: 6px;
	margin: 0;
	color: inherit;
	cursor: pointer;
	line-height: 0;
}

.fltmm-enabled .fltmm-submenu-toggle svg {
	transition: transform var(--fltmm-transition-duration) ease;
}

.fltmm-enabled .fltmm-submenu-toggle[aria-expanded="true"] svg {
	transform: rotate(180deg);
}

/* ============================================================ */
/* Desktop: Level-1 opener, Level-2 hover tabs, Level-3/4 panel   */
/* ============================================================ */

.fltmm-enabled.fltmm-mode-desktop > .fltmm-mega-menu {
	position: absolute;
	top: 100%;
	inset-inline-start: 0;
	z-index: 9999;
	width: var(--fltmm-menu-width);
	max-width: calc(100vw - 32px);
	background: var(--fltmm-background);
	color: var(--fltmm-color);
	border: 1px solid var(--fltmm-border-color);
	box-shadow: var(--fltmm-shadow);
	opacity: 0;
	visibility: hidden;
	transform: translateY(6px);
	pointer-events: none;
	transition:
		opacity var(--fltmm-transition-duration) ease,
		transform var(--fltmm-transition-duration) ease,
		visibility 0s linear var(--fltmm-transition-duration);
}

.fltmm-enabled.fltmm-mode-desktop.fltmm-open > .fltmm-mega-menu {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
	pointer-events: auto;
	transition:
		opacity var(--fltmm-transition-duration) ease,
		transform var(--fltmm-transition-duration) ease,
		visibility 0s linear 0s;
}

/* Desktop width: Full — spans the viewport without causing horizontal scroll */
.fltmm-enabled.fltmm-mode-desktop.fltmm-width-full > .fltmm-mega-menu {
	position: fixed;
	inset-inline-start: 0;
	width: 100vw;
	max-width: 100vw;
}

/* Desktop width: Custom — fixed & centered to a configured max width */
.fltmm-enabled.fltmm-mode-desktop.fltmm-width-custom > .fltmm-mega-menu {
	position: fixed;
	inset-inline-start: 50%;
	margin-inline-start: calc(var(--fltmm-menu-width) / -2);
	width: var(--fltmm-menu-width);
	max-width: calc(100vw - 32px);
}

.fltmm-enabled.fltmm-mode-desktop .fltmm-mega-inner {
	position: relative;
	padding: var(--fltmm-menu-padding);
	max-width: 1600px;
	margin-inline: auto;
	overflow: hidden;
}

.fltmm-enabled.fltmm-mode-desktop .fltmm-tab-navigation {
	list-style: none;
	margin: 0;
	padding: 0;
	display: block !important;
	width: var(--fltmm-tab-width);
}

.fltmm-enabled.fltmm-mode-desktop .fltmm-tab-navigation > .fltmm-tab {
	display: block;
}

.fltmm-enabled.fltmm-mode-desktop .fltmm-tab-navigation > .fltmm-tab > .fltmm-tab-link {
	display: block !important;
	padding: 10px 14px !important;
	border-radius: 6px;
	text-decoration: none;
	color: inherit;
}

.fltmm-enabled.fltmm-mode-desktop .fltmm-tab-navigation > .fltmm-tab.fltmm-tab-active > .fltmm-tab-link {
	background: var(--fltmm-active-background);
	color: var(--fltmm-active-color);
}

/* The accordion wrapper collapses to nothing on desktop so the inner
   Level-3 <ul> can be positioned as a panel relative to .fltmm-mega-inner. */
.fltmm-enabled.fltmm-mode-desktop .fltmm-tab-navigation .fltmm-accordion-panel,
.fltmm-enabled.fltmm-mode-desktop .fltmm-group .fltmm-accordion-panel {
	display: contents;
}

.fltmm-enabled.fltmm-mode-desktop .fltmm-tab-panel {
	position: absolute;
	top: 0;
	inset-inline-start: var(--fltmm-tab-width);
	inset-inline-end: 0;
	bottom: 0;
	overflow-y: auto;
	display: none !important;
	grid-template-columns: repeat(var(--fltmm-columns, 3), minmax(0, 1fr));
	column-gap: var(--fltmm-column-gap);
	row-gap: var(--fltmm-row-gap);
	list-style: none;
	margin: 0;
	padding-inline-start: var(--fltmm-column-gap);
	padding-inline-end: 4px;
}

.fltmm-enabled.fltmm-mode-desktop .fltmm-tab-panel.fltmm-panel-active {
	display: grid !important;
}

.fltmm-enabled.fltmm-mode-desktop .fltmm-group {
	display: block;
	min-width: 0;
	position: static !important;
}

.fltmm-enabled.fltmm-mode-desktop .fltmm-group-title {
	display: block !important;
	font-weight: 600;
	text-decoration: none;
	color: inherit;
	margin-block-end: 10px;
	padding-block-end: 6px;
	padding-inline: 0 !important;
	border-block-end: 1px solid var(--fltmm-border-color);
}

.fltmm-enabled.fltmm-mode-desktop .fltmm-group-list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: block !important;
}

.fltmm-enabled.fltmm-mode-desktop .fltmm-group-list > .menu-item {
	display: block;
}

.fltmm-enabled.fltmm-mode-desktop .fltmm-group-list > .menu-item > a {
	display: block !important;
	padding: 5px 0 !important;
	text-decoration: none;
	color: inherit;
	opacity: 0.85;
}

.fltmm-enabled.fltmm-mode-desktop .fltmm-group-list > .menu-item > a:hover,
.fltmm-enabled.fltmm-mode-desktop .fltmm-group-list > .menu-item > a:focus {
	opacity: 1;
	text-decoration: underline;
}

/* Unexpected 5th+ level: flattened, ordinary nested links, no extra tab/group layer */
.fltmm-enabled.fltmm-mode-desktop .fltmm-subitems {
	list-style: none;
	margin: 4px 0 0;
	padding-inline-start: 14px;
	display: block !important;
}

/* ============================================================ */
/* Mobile / tablet: nested accordion, all levels                 */
/* ============================================================ */

.fltmm-enabled.fltmm-mode-mobile {
	position: static;
}

.fltmm-enabled.fltmm-mode-mobile .fltmm-tab,
.fltmm-enabled.fltmm-mode-mobile .fltmm-group {
	position: relative;
}

.fltmm-enabled.fltmm-mode-mobile > a.fltmm-level1-link,
.fltmm-enabled.fltmm-mode-mobile .fltmm-tab-link,
.fltmm-enabled.fltmm-mode-mobile .fltmm-group-title {
	display: block !important;
	padding-inline-end: 40px !important;
	text-decoration: none;
	color: inherit;
	padding-block: 10px !important;
}

.fltmm-enabled.fltmm-mode-mobile .fltmm-submenu-toggle {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	position: absolute;
	inset-inline-end: 0;
	top: 0;
	width: 40px;
	height: 40px;
}

/* 0fr -> 1fr grid collapse: lightweight, no hardcoded max-height */
.fltmm-enabled.fltmm-mode-mobile .fltmm-mega-menu,
.fltmm-enabled.fltmm-mode-mobile .fltmm-accordion-panel {
	display: grid !important;
	grid-template-rows: 0fr;
	transition: grid-template-rows var(--fltmm-transition-duration) ease;
}

.fltmm-enabled.fltmm-mode-mobile .fltmm-mega-menu.fltmm-accordion-open,
.fltmm-enabled.fltmm-mode-mobile .fltmm-accordion-panel.fltmm-accordion-open {
	grid-template-rows: 1fr;
}

.fltmm-enabled.fltmm-mode-mobile .fltmm-mega-menu > .fltmm-mega-inner,
.fltmm-enabled.fltmm-mode-mobile .fltmm-accordion-panel > ul {
	overflow: hidden;
	min-height: 0;
}

.fltmm-enabled.fltmm-mode-mobile .fltmm-mega-inner {
	padding-inline-start: 14px;
}

.fltmm-enabled.fltmm-mode-mobile .fltmm-tab-navigation,
.fltmm-enabled.fltmm-mode-mobile .fltmm-tab-panel,
.fltmm-enabled.fltmm-mode-mobile .fltmm-group-list,
.fltmm-enabled.fltmm-mode-mobile .fltmm-subitems {
	list-style: none;
	margin: 0;
	padding: 0;
	display: block !important;
}

.fltmm-enabled.fltmm-mode-mobile .fltmm-tab-panel,
.fltmm-enabled.fltmm-mode-mobile .fltmm-group-list,
.fltmm-enabled.fltmm-mode-mobile .fltmm-subitems {
	padding-inline-start: 14px;
}

.fltmm-enabled.fltmm-mode-mobile .fltmm-group-list > .menu-item > a,
.fltmm-enabled.fltmm-mode-mobile .fltmm-subitems > .menu-item > a {
	display: block !important;
	text-decoration: none;
	color: inherit;
	padding-block: 8px !important;
}

/* ============================================================ */
/* Motion preferences                                             */
/* ============================================================ */

@media (prefers-reduced-motion: reduce) {
	.fltmm-enabled .fltmm-mega-menu,
	.fltmm-enabled .fltmm-accordion-panel,
	.fltmm-enabled .fltmm-submenu-toggle svg {
		transition-duration: 0.001ms !important;
	}
}
