.cdm-wrapper {
	position: relative;
	width: auto;
    display: inline-block;
}

.cdm-nav-container {
	display: block;
}

.cdm-nav {
	display: flex;
	flex-direction: row;
	flex-wrap: wrap;
	gap: 20px;
	align-items: center;
}

.cdm-item-wrapper {
	position: relative;
    display: inline-block;
}

.cdm-mobile-toggle {
	display: none;
	background: none;
	border: none;
	cursor: pointer;
	padding: 10px;
	font-size: 24px;
	color: inherit;
}

.cdm-mobile-toggle svg {
	width: 1em;
	height: 1em;
	fill: currentColor;
}

.cdm-toggle {
	background: none;
	border: none;
	display: flex;
	align-items: center;
	gap: 8px;
	cursor: pointer;
	padding: 10px 15px;
	transition: all 0.3s ease;
	font-family: inherit;
}

.cdm-toggle svg {
	width: 1em;
	height: 1em;
}

.cdm-dropdown-content {
	position: absolute;
	top: 100%;
	left: 0;
	background: #fff;
	box-shadow: 0 10px 30px rgba(0,0,0,0.1);
	border-radius: 12px;
	padding: 24px;
	opacity: 0;
	visibility: hidden;
	transform: translateY(10px);
	transition: all 0.3s ease;
	z-index: 9999; /* Increased z-index to ensure it sits on top of sliders and text */
	min-width: 340px;
    border: 1px solid #f0f0f0;
}

.cdm-item-wrapper:last-child .cdm-dropdown-content {
    left: auto;
    right: 0;
}

.cdm-item-wrapper.is-open .cdm-dropdown-content {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
}

.cdm-items-grid {
	display: grid;
	gap: 12px;
}

.cdm-item {
	display: flex;
	align-items: flex-start;
	gap: 16px;
	text-decoration: none;
	color: inherit;
	padding: 16px;
	border-radius: 8px;
	transition: background 0.2s ease, transform 0.2s ease;
}

.cdm-item:hover {
	background: #fdfdfd;
    box-shadow: 0 4px 12px rgba(0,0,0,0.03);
}

.cdm-item-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: #fff5f5;
    border-radius: 8px;
    color: #8F2D4F; /* Matches site primary color */
    flex-shrink: 0;
}

.cdm-item-icon svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.cdm-item-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.cdm-item-text h4 {
	margin: 0;
	font-size: 16px;
    font-weight: 600;
    color: #333;
}

.cdm-item-text p {
	margin: 0;
	font-size: 13px;
	color: #777;
    line-height: 1.4;
}

.cdm-mobile-overlay {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: rgba(0,0,0,0.5);
	z-index: 9998;
}

/* Mobile Styles */
@media (max-width: 767px) {
	.cdm-mobile-toggle {
		display: flex;
		align-items: center;
		justify-content: center;
	}

	.cdm-nav-container {
		position: fixed;
		top: 0;
		left: -300px; /* Start hidden */
		width: 300px;
		height: 100vh;
		background: #fff;
		z-index: 9999;
		overflow-y: auto;
		transition: left 0.3s ease;
		padding: 20px;
		box-shadow: 2px 0 10px rgba(0,0,0,0.1);
	}

	.cdm-nav-container.is-mobile-open {
		left: 0;
	}

	.cdm-nav {
		flex-direction: column;
		align-items: stretch;
		gap: 0;
	}

	.cdm-item-wrapper {
		display: block;
		width: 100%;
		border-bottom: 1px solid #eee;
	}

	.cdm-item-wrapper:last-child {
		border-bottom: none;
	}

	.cdm-toggle {
		width: 100%;
		justify-content: space-between;
		padding: 15px 0;
	}

	.cdm-dropdown-content {
		position: static;
		box-shadow: none;
		opacity: 1;
		visibility: visible;
		transform: none;
		display: none; /* Controlled by JS */
		padding: 10px 0 20px 20px; /* Indent submenus */
		min-width: auto;
		border: none;
		border-radius: 0;
	}

	.cdm-item-wrapper.is-open .cdm-dropdown-content {
		display: block; /* Show when open */
	}
	
	.cdm-item {
		padding: 10px 0;
	}
}