/**
 * Header dropdown stacking and submenu visibility repair — v1.8.0.
 *
 * Loaded after all normal theme styles. The selectors deliberately cover
 * native and imported Elementor header wrappers.
 */

/* Keep the complete header above Elementor/content sections and allow flyouts. */
html body.amam-marketplace .amam-elementor-header-template,
html body.amam-marketplace .elementor-location-header,
html body.amam-marketplace header#masthead.site-header,
html body.amam-marketplace .site-header[data-amam-owner="theme-header"] {
	position: relative !important;
	z-index: 100000 !important;
	overflow: visible !important;
	isolation: auto !important;
}

/* Elementor can add overflow:hidden to its wrapper/container hierarchy. */
html body.amam-marketplace .amam-elementor-header-template,
html body.amam-marketplace .amam-elementor-header-template > .elementor,
html body.amam-marketplace .amam-elementor-header-template > .elementor > .elementor-element,
html body.amam-marketplace .amam-elementor-header-template .elementor-section-wrap,
html body.amam-marketplace .amam-elementor-header-template .elementor-widget-shortcode,
html body.amam-marketplace .amam-elementor-header-template .elementor-widget-container,
html body.amam-marketplace .elementor-location-header,
html body.amam-marketplace .elementor-location-header > .elementor,
html body.amam-marketplace .elementor-location-header .elementor-section-wrap {
	overflow: visible !important;
}

/* Do not let the navigation row clip dropdowns. */
html body.amam-marketplace .amam-nav-row,
html body.amam-marketplace .amam-nav-row__inner,
html body.amam-marketplace .amam-departments,
html body.amam-marketplace .primary-navigation,
html body.amam-marketplace .primary-navigation > ul {
	overflow: visible !important;
}

/* Departments panel. The former vertical overflow rule clipped the flyout. */
html body.amam-marketplace .amam-departments__menu {
	z-index: 100100 !important;
	max-height: none !important;
	overflow: visible !important;
	clip: auto !important;
}

html body.amam-marketplace .amam-departments__menu > ul,
html body.amam-marketplace .amam-departments__menu li {
	position: relative;
	overflow: visible;
}

html body.amam-marketplace .amam-departments__menu .sub-menu {
	z-index: 100110 !important;
	max-height: min(78vh, 720px);
	overflow-x: hidden;
	overflow-y: auto;
}

/* Third level is kept inside the second-level flyout instead of opening behind it. */
html body.amam-marketplace .amam-departments__menu .sub-menu .sub-menu {
	position: static !important;
	display: none;
	width: 100% !important;
	min-width: 0 !important;
	min-height: 0 !important;
	max-height: none !important;
	margin: 0;
	padding: 0 0 4px 12px;
	overflow: visible !important;
	border: 0 !important;
	border-radius: 0 !important;
	box-shadow: none !important;
	background: #f8fafc;
}

html body.amam-marketplace .amam-departments__menu .sub-menu li:hover > .sub-menu,
html body.amam-marketplace .amam-departments__menu .sub-menu li:focus-within > .sub-menu,
html body.amam-marketplace .amam-departments__menu .sub-menu li.is-submenu-open > .sub-menu {
	display: block;
}

/* Primary navigation dropdowns. */
html body.amam-marketplace .primary-navigation .sub-menu {
	z-index: 100100 !important;
	max-height: none !important;
	overflow: visible !important;
}

html body.amam-marketplace .primary-navigation > ul > li.amam-open-left > .sub-menu {
	right: 0;
	left: auto;
}

/* Keep level-three navigation visible inside the first dropdown. */
html body.amam-marketplace .primary-navigation .sub-menu .sub-menu {
	position: static !important;
	display: none;
	width: 100% !important;
	min-width: 0 !important;
	margin: 2px 0 4px;
	padding: 0 0 0 12px;
	overflow: visible !important;
	border: 0 !important;
	border-radius: 0 !important;
	box-shadow: none !important;
	background: #f8fafc;
}

html body.amam-marketplace .primary-navigation .sub-menu li:hover > .sub-menu,
html body.amam-marketplace .primary-navigation .sub-menu li:focus-within > .sub-menu,
html body.amam-marketplace .primary-navigation .sub-menu li.is-submenu-open > .sub-menu {
	display: block;
}

/* Click/tap submenu controls. */
html body.amam-marketplace li.amam-has-submenu {
	position: relative;
}

html body.amam-marketplace li.amam-has-submenu > a {
	padding-right: 44px;
}

html body.amam-marketplace .amam-submenu-toggle {
	position: absolute;
	top: 50%;
	right: 5px;
	z-index: 3;
	display: inline-grid;
	place-items: center;
	width: 34px;
	height: 34px;
	padding: 0;
	transform: translateY(-50%);
	border: 0;
	border-radius: 6px;
	background: transparent;
	color: currentColor !important;
	box-shadow: none;
}

html body.amam-marketplace .amam-submenu-toggle:hover,
html body.amam-marketplace .amam-submenu-toggle:focus-visible {
	background: rgba(15, 118, 110, .1);
	outline: 2px solid transparent;
}

html body.amam-marketplace .amam-submenu-toggle::before {
	content: "";
	width: 7px;
	height: 7px;
	transform: rotate(45deg);
	border-right: 2px solid currentColor;
	border-bottom: 2px solid currentColor;
	transition: transform .18s ease;
}

html body.amam-marketplace li.is-submenu-open > .amam-submenu-toggle::before {
	transform: rotate(225deg);
}

html body.amam-marketplace .primary-navigation li.is-submenu-open > .sub-menu,
html body.amam-marketplace .amam-departments__menu li.is-submenu-open > .sub-menu {
	display: block !important;
}

/* Mobile drawer: collapse nested links and use the same tap controls. */
html body.amam-marketplace .amam-mobile-navigation li.amam-has-submenu > a {
	padding-right: 54px;
}

html body.amam-marketplace .amam-mobile-navigation .amam-submenu-toggle {
	top: 23px;
	right: 12px;
}

html body.amam-marketplace .amam-mobile-navigation .sub-menu {
	display: none;
	position: static;
	width: 100%;
	min-width: 0;
	max-height: none;
	overflow: visible;
	border: 0;
	box-shadow: none;
}

html body.amam-marketplace .amam-mobile-navigation li.is-submenu-open > .sub-menu {
	display: block !important;
}

/* RTL placement. */
html[dir="rtl"] body.amam-marketplace li.amam-has-submenu > a {
	padding-right: inherit;
	padding-left: 44px;
}

html[dir="rtl"] body.amam-marketplace .amam-submenu-toggle {
	right: auto;
	left: 5px;
}

html[dir="rtl"] body.amam-marketplace .amam-departments__menu .sub-menu {
	right: 100%;
	left: auto;
}

/* Header remains above fixed and transformed Elementor sections. */
html body.amam-marketplace main#primary,
html body.amam-marketplace .site-main,
html body.amam-marketplace .elementor-location-single,
html body.amam-marketplace .elementor-location-archive {
	position: relative;
	z-index: 1;
}

@media (max-width: 991px) {
	html body.amam-marketplace .amam-elementor-header-template,
	html body.amam-marketplace .elementor-location-header,
	html body.amam-marketplace header#masthead.site-header {
		z-index: 100000 !important;
	}

	html body.amam-marketplace .amam-mobile-drawer {
		z-index: 100200 !important;
	}
}
