/**
 * Cactus Store Category Menu — Flatsome desktop + mobile.
 */

/* ── Desktop dropdown panel ── */
.header-nav .cscm-store-root > .cscm-category-panel,
.header-nav .cscm-store-root > .nav-dropdown.cscm-category-panel,
.cscm-store-root > .cscm-category-panel,
.cscm-store-root > .sub-menu.cscm-category-panel {
	max-height: min(70vh, 520px);
	overflow-x: hidden;
	overflow-y: auto;
	min-width: 280px;
	-webkit-overflow-scrolling: touch;
	background: #fff;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
	border: 1px solid rgba(0, 0, 0, 0.06);
	padding: 0.25em 0;
}

/* Hide Flatsome auto-toggles on our category items (we use .cscm-toggle) */
.cscm-category-panel .cscm-cat-item > button.toggle:not(.cscm-toggle) {
	display: none !important;
}

/* ── Mobile sidebar: panel visibility ── */
.nav-sidebar .cscm-store-root:not(.active) > .cscm-category-panel,
#main-menu .nav-sidebar .cscm-store-root:not(.active) > .cscm-category-panel,
.mobile-sidebar .cscm-store-root:not(.active) > .cscm-category-panel {
	display: none !important;
}

.nav-sidebar .cscm-category-panel,
#main-menu .nav-sidebar .cscm-category-panel,
.mobile-sidebar .cscm-category-panel {
	position: static !important;
	left: auto !important;
	top: auto !important;
	transform: none !important;
	opacity: 1 !important;
	visibility: visible !important;
	box-shadow: none !important;
	background: transparent !important;
	width: 100% !important;
	min-width: 0 !important;
	max-height: none !important;
	padding: 0;
}

.nav-sidebar .cscm-store-root.active > .cscm-category-panel,
#main-menu .nav-sidebar .cscm-store-root.active > .cscm-category-panel,
.mobile-sidebar .cscm-store-root.active > .cscm-category-panel {
	display: block !important;
}

/* Hide store chevron on desktop (hover dropdown) */
@media (min-width: 850px) {
	.cscm-store-root > button.toggle {
		display: none !important;
	}

	.header-nav .cscm-store-root > a.nav-top-link {
		position: relative;
	}

	.header-nav .cscm-store-root > a.nav-top-link::before,
	.header-nav .cscm-store-root > a.nav-top-link::after {
		content: none !important;
		display: none !important;
	}

	.header-nav .cscm-store-root > a .cscm-store-chevron {
		display: inline-block;
		width: 6px;
		height: 6px;
		margin-left: 0.45em;
		border-right: 2px solid currentColor;
		border-bottom: 2px solid currentColor;
		transform: rotate(45deg) translateY(-1px);
		opacity: 0.55;
		vertical-align: middle;
		transition: opacity 0.15s ease, transform 0.15s ease;
	}

	.header-nav .cscm-store-root:hover > a .cscm-store-chevron,
	.header-nav .cscm-store-root.current-dropdown > a .cscm-store-chevron,
	.header-nav .cscm-store-root:focus-within > a .cscm-store-chevron {
		opacity: 0.9;
		transform: rotate(45deg) translateY(0);
	}
}

/* ── Store root toggle (mobile) ── */
@media (max-width: 849px) {
	.cscm-store-root {
		position: relative;
	}

	.cscm-store-root > button.toggle {
		display: block !important;
		position: absolute;
		top: 0;
		right: 0;
		width: 3em;
		min-width: 44px;
		min-height: 44px;
		opacity: 0.85;
		z-index: 3;
		cursor: pointer;
		background: transparent;
		border: 0;
	}

	.cscm-store-root.active > button.toggle i {
		transform: rotate(180deg);
		display: inline-block;
		transition: transform 0.2s ease;
	}

	.cscm-store-root > a {
		padding-right: 3em !important;
	}
}

/* ── Category row layout (link + chevron always on same line) ── */
.cscm-category-panel .cscm-cat-item {
	list-style: none;
	margin: 0;
	padding: 0;
}

.cscm-category-panel .cscm-cat-item > .cscm-row {
	display: flex;
	align-items: stretch;
	position: relative;
	min-height: 2.75em;
}

/* Same row/link structure for leaf + parent — identical left indent */
.cscm-category-panel .cscm-cat-item > .cscm-row > a {
	flex: 1;
	display: block;
	padding: 0.65em 1em;
	line-height: 1.35;
	white-space: normal;
	text-decoration: none;
}

.cscm-category-panel .cscm-has-children > .cscm-row > a {
	padding-right: 0.5em;
}

/* Legacy markup fallback (cached pages before v1.0.7) */
.cscm-category-panel .cscm-cat-item > a {
	display: block;
	padding: 0.65em 1em;
	line-height: 1.35;
	white-space: normal;
	text-decoration: none;
}

/* Chevron button */
.cscm-category-panel .cscm-toggle {
	flex: 0 0 2.75em;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 2.75em;
	min-height: 44px;
	margin: 0;
	padding: 0;
	border: 0;
	background: transparent;
	color: inherit;
	cursor: pointer;
	opacity: 0.55;
	transition: opacity 0.15s ease;
}

.cscm-category-panel .cscm-toggle:hover,
.cscm-category-panel .cscm-toggle:focus {
	opacity: 1;
	outline: none;
}

.cscm-category-panel .cscm-toggle:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: -2px;
}

.cscm-toggle-icon {
	display: block;
	width: 7px;
	height: 7px;
	border-right: 2px solid currentColor;
	border-bottom: 2px solid currentColor;
	transform: rotate(-45deg);
	transition: transform 0.2s ease;
}

.cscm-cat-item.cscm-expanded > .cscm-row .cscm-toggle-icon {
	transform: rotate(45deg);
}

/* Submenus collapsed by default */
.cscm-cat-item.cscm-has-children:not(.cscm-expanded) > .cscm-sub-menu {
	display: none !important;
}

.cscm-cat-item.cscm-has-children.cscm-expanded > .cscm-sub-menu {
	display: block !important;
}

/* Nested indent + typography */
.cscm-category-panel .cscm-sub-menu {
	list-style: none;
	margin: 0;
	padding: 0 0 0.25em 0;
}

.cscm-category-panel > .cscm-cat-item + .cscm-cat-item > .cscm-row {
	border-top: 1px solid rgba(0, 0, 0, 0.07);
}

.cscm-category-panel .cscm-sub-menu .cscm-cat-item > .cscm-row > a {
	padding-left: 1.5em;
	font-size: 0.92em;
}

.cscm-category-panel .cscm-sub-menu .cscm-sub-menu .cscm-cat-item > .cscm-row > a {
	padding-left: 2.25em;
	font-size: 0.88em;
}

/* Mobile sidebar: match Flatsome nav weight */
@media (max-width: 849px) {
	.cscm-category-panel .cscm-cat-item > .cscm-row > a {
		font-size: 0.95em;
	}

	.cscm-category-panel .cscm-toggle {
		min-height: 44px;
	}
}

/* Desktop dropdown link sizing + two-column flyout */
@media (min-width: 850px) {
	.header-nav .cscm-store-root > .cscm-category-panel,
	.header-nav .cscm-store-root > .nav-dropdown.cscm-category-panel {
		overflow: visible;
		padding: 0;
	}

	.header-nav .cscm-category-panel.cscm-flyout-open {
		min-width: 560px !important;
	}

	/* Left column only — prevents chevrons bleeding into flyout */
	.header-nav .cscm-category-panel > .cscm-cat-item {
		position: relative;
		max-width: 280px;
	}

	.header-nav .cscm-category-panel > .cscm-cat-item > .cscm-row {
		max-width: 280px;
	}

	.header-nav .cscm-category-panel .cscm-cat-item > .cscm-row > a {
		padding-top: 0.5em;
		padding-bottom: 0.5em;
		font-size: 0.9em;
	}

	/* Top-level: hover flyout instead of inline accordion */
	.header-nav .cscm-category-panel > .cscm-cat-item > .cscm-row > .cscm-toggle {
		display: none !important;
	}

	.header-nav .cscm-category-panel > .cscm-cat-item.cscm-has-children > .cscm-row > a {
		padding-right: 1em;
	}

	.header-nav .cscm-category-panel > .cscm-cat-item.cscm-has-children > .cscm-row > a::after {
		content: '';
		position: static;
		display: inline-block;
		width: 6px;
		height: 6px;
		margin-left: 0.35em;
		border-right: 2px solid currentColor;
		border-bottom: 2px solid currentColor;
		transform: rotate(-45deg);
		opacity: 0.45;
		vertical-align: middle;
	}

	.header-nav .cscm-category-panel > .cscm-cat-item.cscm-flyout-active > .cscm-row,
	.header-nav .cscm-category-panel > .cscm-cat-item.cscm-has-children:hover > .cscm-row {
		background: rgba(0, 0, 0, 0.04);
	}

	.header-nav .cscm-category-panel > .cscm-cat-item.cscm-flyout-active > .cscm-row > a,
	.header-nav .cscm-category-panel > .cscm-cat-item.cscm-has-children:hover > .cscm-row > a {
		font-weight: 600;
	}

	.header-nav .cscm-category-panel > .cscm-cat-item > .cscm-sub-menu {
		position: absolute;
		left: 280px;
		top: 0;
		z-index: 2;
		width: 280px;
		min-height: 100%;
		max-height: min(70vh, 520px);
		overflow-x: hidden;
		overflow-y: auto;
		display: none !important;
		margin: 0;
		padding: 0.25em 0;
		background: #fff;
		border-left: 1px solid rgba(0, 0, 0, 0.07);
		box-shadow: inset 1px 0 0 rgba(255, 255, 255, 0.6);
	}

	.header-nav .cscm-category-panel > .cscm-cat-item.cscm-flyout-active > .cscm-sub-menu {
		display: block !important;
	}

	/* Inside flyout: accordion for deeper levels */
	.header-nav .cscm-category-panel > .cscm-cat-item > .cscm-sub-menu > .cscm-cat-item + .cscm-cat-item > .cscm-row {
		border-top: 1px solid rgba(0, 0, 0, 0.07);
	}

	.header-nav .cscm-category-panel > .cscm-cat-item > .cscm-sub-menu .cscm-cat-item > .cscm-row > a {
		padding-left: 1em;
		font-size: 0.9em;
	}

	.header-nav .cscm-category-panel > .cscm-cat-item > .cscm-sub-menu .cscm-sub-menu .cscm-cat-item > .cscm-row > a {
		padding-left: 1.5em;
		font-size: 0.88em;
	}
}
