.cdm-dropdown-wrapper {
	position: relative;
	display: inline-block;
	width: 240px;
	max-width: 100%;
	font-family: inherit;
	--cdm-transition: 0.2s ease;
}

.cdm-dropdown-wrapper.cdm-full-width {
	display: block;
	width: 100%;
}

/* ---- Toggle button ---- */
.cdm-dropdown-toggle {
	display: flex;
	align-items: center;
	justify-content: space-between;
	width: 100%;
	gap: 10px;
	cursor: pointer;
	background: #ffffff;
	border: 1px solid #e0e0e0;
	border-radius: 8px;
	padding: 10px 16px;
	font-size: 15px;
	line-height: 1.4;
	text-align: left;
	transition: border-color var(--cdm-transition), box-shadow var(--cdm-transition);
	-webkit-tap-highlight-color: transparent;
}

.cdm-dropdown-toggle:hover {
	border-color: #c2c2c2;
}

.cdm-dropdown-wrapper.is-open .cdm-dropdown-toggle {
	border-color: #6366f1;
	box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

.cdm-dropdown-toggle:focus-visible {
	outline: 2px solid #6366f1;
	outline-offset: 2px;
}

.cdm-item-inner {
	display: flex;
	align-items: center;
	gap: 10px;
	min-width: 0;
	flex: 1;
}

.cdm-item-image {
	flex: none;
	display: inline-flex;
	line-height: 0;
}

.cdm-item-image img {
	width: 24px;
	height: 24px;
	object-fit: cover;
	border-radius: 4px;
	display: block;
}

.cdm-item-text {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.cdm-dropdown-arrow {
	flex: none;
	width: 10px;
	height: 10px;
	border-right: 2px solid currentColor;
	border-bottom: 2px solid currentColor;
	transform: rotate(45deg);
	margin-top: -4px;
	opacity: 0.6;
	transition: transform var(--cdm-transition);
}

.cdm-dropdown-wrapper.is-open .cdm-dropdown-arrow {
	transform: rotate(-135deg);
	margin-top: 2px;
}

/* ---- Panel ---- */
.cdm-dropdown-panel {
	position: absolute;
	top: calc(100% + 8px);
	left: 0;
	right: 0;
	z-index: 9999;
	background: #ffffff;
	border-radius: 10px;
	box-shadow: 0 12px 32px rgba(0, 0, 0, 0.14), 0 2px 8px rgba(0, 0, 0, 0.06);
	padding: 6px;
	max-height: 320px;
	overflow-y: auto;
	opacity: 0;
	visibility: hidden;
	transform: translateY(-6px);
	transition: opacity var(--cdm-transition), transform var(--cdm-transition), visibility var(--cdm-transition);
}

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

.cdm-dropdown-item {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 9px 10px;
	border-radius: 6px;
	text-decoration: none !important;
	color: #1a1a1a;
	font-size: 14px;
	transition: background-color var(--cdm-transition);
}

.cdm-dropdown-item:hover,
.cdm-dropdown-item.is-active {
	background-color: #f2f4ff;
}

.cdm-dropdown-item .cdm-item-image img {
	width: 22px;
	height: 22px;
}

/* Scrollbar dalam panel - kemas */
.cdm-dropdown-panel::-webkit-scrollbar {
	width: 6px;
}
.cdm-dropdown-panel::-webkit-scrollbar-thumb {
	background: #d8d8d8;
	border-radius: 6px;
}

/* ---- Mobile friendly ---- */
@media (max-width: 767px) {
	.cdm-dropdown-wrapper {
		width: 100%;
	}

	.cdm-dropdown-toggle {
		padding: 12px 14px;
		font-size: 16px; /* elak zoom auto iOS */
	}

	.cdm-dropdown-panel {
		max-height: 60vh;
	}

	.cdm-dropdown-item {
		padding: 12px 10px;
	}
}
