.mw-treeview-wrapper {
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
	max-width: 100%;
	background: #fff;
	display: flex;
	flex-direction: column;
	gap: 20px;
	box-sizing: border-box;
}

.mw-treeview-search-container {
	margin-bottom: 0;
	position: sticky;
	top: 0;
	background: #fff;
	z-index: 100;
	padding-bottom: 12px;
}

.mw-treeview-search {
	width: 100%;
	padding: 12px 16px;
	border: 2px solid #e0e0e0;
	border-radius: 8px;
	font-size: 14px;
	transition: all 0.2s ease;
	font-weight: 500;
	color: #333;
}

.mw-treeview-search:hover {
	border-color: #b0b0b0;
}

.mw-treeview-search:focus {
	outline: none;
	border-color: #0073aa;
	box-shadow: 0 0 0 4px rgba(0, 115, 170, 0.08);
	background-color: #f8fbff;
}

.mw-treeview-search::placeholder {
	color: #999;
}

.mw-treeview-tree {
	border: 1px solid #e5e5e5;
	border-radius: 8px;
	max-height: 450px;
	overflow-y: auto;
	padding: 12px;
	background-color: #fafafa;
}

.mw-treeview-list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.mw-treeview-list .mw-treeview-list {
	margin-left: 32px;
	padding-left: 0;
	margin-top: 4px;
	border-left: 2px solid #e0e0e0;
	padding-left: 12px;
}

.mw-treeview-item {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 8px 10px;
	user-select: none;
	line-height: 1.5;
	border-radius: 6px;
	transition: background-color 0.15s ease;
}

.mw-treeview-item:hover {
	background-color: #efefef;
}

.mw-treeview-toggle {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 24px;
	min-width: 24px;
	height: 24px;
	cursor: pointer;
	color: #555;
	font-size: 14px;
	border-radius: 4px;
	transition: all 0.2s ease;
	flex-shrink: 0;
	background-color: transparent;
	border: none;
	padding: 0;
}

.mw-treeview-toggle:hover {
	background-color: #e0e0e0;
	color: #333;
}

.mw-treeview-checkbox {
	margin: 0;
	cursor: pointer;
	flex-shrink: 0;
	width: 20px;
	height: 20px;
	accent-color: #0073aa;
	transition: all 0.15s ease;
}

.mw-treeview-checkbox:hover {
	transform: scale(1.05);
}

.mw-treeview-checkbox:indeterminate {
	accent-color: #f39c12;
}

.mw-treeview-checkbox:indeterminate::after {
	content: '';
	position: absolute;
	width: 10px;
	height: 2px;
	background-color: #f39c12;
}

.mw-treeview-label {
	cursor: pointer;
	flex-grow: 1;
	word-break: break-word;
	font-size: 14px;
	color: #333;
	font-weight: 500;
	transition: color 0.15s ease;
}

.mw-treeview-label:hover {
	color: #0073aa;
}

.mw-treeview-children {
	display: none;
}

.mw-treeview-expanded > .mw-treeview-children {
	display: block;
}

.mw-treeview-selected {
	margin-top: 0;
	padding: 16px;
	background: linear-gradient(135deg, #f5f8fb 0%, #ffffff 100%);
	border: 2px solid #e3f2fd;
	border-radius: 8px;
	transition: all 0.2s ease;
}

.mw-treeview-selected:hover {
	border-color: #0073aa;
	background: linear-gradient(135deg, #f8fbfd 0%, #ffffff 100%);
}

.mw-treeview-selected > label {
	display: block;
	font-weight: 700;
	margin-bottom: 12px;
	font-size: 13px;
	color: #333;
	text-transform: uppercase;
	letter-spacing: 0.5px;
}

.mw-treeview-selected-items {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	min-height: 28px;
	align-items: center;
}

.mw-treeview-tag {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	background: linear-gradient(135deg, #0073aa 0%, #005a8a 100%);
	color: white;
	padding: 6px 12px;
	border-radius: 20px;
	font-size: 13px;
	white-space: nowrap;
	box-shadow: 0 2px 8px rgba(0, 115, 170, 0.2);
	transition: all 0.2s ease;
	font-weight: 500;
}

.mw-treeview-tag:hover {
	transform: translateY(-2px);
	box-shadow: 0 4px 12px rgba(0, 115, 170, 0.3);
}

.mw-treeview-tag-text {
	overflow: hidden;
	text-overflow: ellipsis;
	max-width: 220px;
}

.mw-treeview-tag-remove {
	background: none;
	border: none;
	color: white;
	cursor: pointer;
	font-size: 18px;
	padding: 0;
	line-height: 1;
	width: 18px;
	height: 18px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	transition: all 0.15s ease;
	flex-shrink: 0;
	opacity: 0.8;
}

.mw-treeview-tag-remove:hover {
	opacity: 1;
	background-color: rgba(0, 0, 0, 0.2);
	transform: scale(1.1);
}

.mw-treeview-tag-remove:focus {
	outline: 2px solid rgba(255, 255, 255, 0.5);
	outline-offset: 1px;
}

.mw-treeview-hidden-input {
	display: none;
}

/* Scrollbar styling */
.mw-treeview-tree::-webkit-scrollbar {
	width: 8px;
}

.mw-treeview-tree::-webkit-scrollbar-track {
	background: #f5f5f5;
	border-radius: 4px;
}

.mw-treeview-tree::-webkit-scrollbar-thumb {
	background: #bbb;
	border-radius: 4px;
	transition: background 0.2s ease;
}

.mw-treeview-tree::-webkit-scrollbar-thumb:hover {
	background: #888;
}

/* Responsive adjustments */
@media (max-width: 768px) {
	.mw-treeview-wrapper {
		gap: 16px;
	}

	.mw-treeview-search {
		padding: 14px 12px;
		font-size: 16px;
	}

	.mw-treeview-tree {
		max-height: 400px;
		padding: 10px;
	}

	.mw-treeview-item {
		padding: 10px 8px;
		gap: 8px;
	}

	.mw-treeview-checkbox {
		width: 24px;
		height: 24px;
		min-width: 24px;
		flex-shrink: 0;
	}

	.mw-treeview-toggle {
		width: 28px;
		min-width: 28px;
		height: 28px;
		font-size: 16px;
	}

	.mw-treeview-label {
		font-size: 15px;
	}

	.mw-treeview-list .mw-treeview-list {
		margin-left: 24px;
		padding-left: 10px;
	}

	.mw-treeview-selected {
		padding: 14px;
	}

	.mw-treeview-selected > label {
		font-size: 12px;
		margin-bottom: 10px;
	}

	.mw-treeview-tag {
		font-size: 13px;
		padding: 6px 10px;
		gap: 6px;
	}

	.mw-treeview-tag-text {
		max-width: 140px;
	}

	.mw-treeview-tag-remove {
		width: 20px;
		height: 20px;
		font-size: 16px;
	}
}

/* Extra small screens */
@media (max-width: 480px) {
	.mw-treeview-wrapper {
		gap: 14px;
	}

	.mw-treeview-search-container {
		padding-bottom: 10px;
		margin-bottom: 0;
	}

	.mw-treeview-tree {
		max-height: 60vh;
	}

	.mw-treeview-item {
		padding: 8px 6px;
	}

	.mw-treeview-checkbox {
		width: 22px;
		height: 22px;
	}

	.mw-treeview-label {
		font-size: 14px;
	}

	.mw-treeview-list .mw-treeview-list {
		margin-left: 20px;
		padding-left: 8px;
	}

	.mw-treeview-tag-text {
		max-width: 100px;
	}

	.mw-treeview-tag {
		font-size: 12px;
		padding: 5px 8px;
	}
}

/* Empty state */
.mw-treeview-selected-items:empty::after {
	content: 'Keine Elemente ausgewählt';
	color: #999;
	font-size: 13px;
	font-style: italic;
}
