.leaflet-right {
    left: 0;
}
.legend {
    left: 0;
    right: initial;
    bottom: 0px;
}
select#thematicSelect {
	padding: 5px;
	border-radius: 5px;
	border: 1px #dbd1d180 solid;
}

.section-label {
	display: flex;
	justify-content: space-around;
	align-items: center;
	flex-direction: column;
}

.button_tmp {
	width: 45% !important;
	float: left;
	margin: 5px !important;
	justify-content: space-between;
}

#radiusSlider {
	-webkit-appearance: none;
	height: 4px;
	background: #ddd;
	border-radius: 5px;
	outline: none;
}

#radiusSlider::-webkit-slider-thumb {
	-webkit-appearance: none;
	width: 15px;
	height: 15px;
	background: #da251d;
	border-radius: 50%;
	cursor: pointer;
}

.toolbox-section {
	padding: 10px;
	border: 1px solid #eeeeee;
	border-radius: 6px;
}

.btn-pin-popup {
	background: none;
	border: none;
	cursor: pointer;
	font-size: 16px;
	padding: 0 5px;
	line-height: 1;
	transition: transform 0.2s;
}

.btn-pin-popup.is-pinned {
	filter: drop-shadow(0 0 2px #da251d);
	transform: scale(1.2);
}

.popup-header-container {
	display: flex;
	justify-content: space-between;
	align-items: center;
	border-bottom: 1px solid #eee;
	padding-bottom: 5px;
	margin-bottom: 10px;
	cursor: move;
}

.icon-btn {
	width: 50px;
	border: 1px solid #f00;
	height: 50px;
	background: #fff;
	padding: 5px;
	cursor: pointer;
	transition: transform 0.1s, filter 0.2s;
}

.icon-btn:active {
	transform: scale(0.9);
	filter: brightness(1.2);
}

.map-layer-btn {
	pointer-events: auto !important;
}

.map-layer-btn img {
	pointer-events: none;
	user-select: none;
}

.filter-panel {
	display: none;
	margin-top: 8px;
	padding: 8px;
	background: #fff;
	border: 1px solid #eee;
	border-radius: 8px;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
	font-size: 13px;
}

.filter-panel.show {
	display: block;
}

.filter-row {
	display: flex;
	align-items: center;
	gap: 6px;
	flex-wrap: wrap;
	margin-bottom: 6px;
}

.filter-row > label {
	font-weight: 600;
	margin-right: 6px;
}

.filter-panel input[type="number"] {
	width: 92px;
}

.filter-actions {
	display: flex;
	align-items: center;
	gap: 8px;
	justify-content: space-between;
}

.filter-count {
	opacity: 0.7;
	font-size: 12px;
	margin-left: auto;
}

.leaflet-control.toolbox {
	position: relative;
	display: flex;
	background: transparent;
	border: none;
	z-index: 1500;
	align-items: flex-end;
}

.leaflet-popup-content {
	min-width: 360px;
}

.badge {
	display: inline-block;
	padding: 6px 10px;
	border-radius: 10px;
	border: 1px solid #e3e3e3;
	background: #f9f9f9;
	margin-right: 6px;
	margin-bottom: 6px;
}

.badge b {
	display: block;
	font-size: 16px;
	margin-top: 2px;
}

.section-title {
	margin: 8px 0 4px;
	font-weight: bold;
}

.leaflet-popup {
	transition: none !important;
}

.label-xa {
	font-size: 12px;
	font-weight: 600;
	margin-top: -36px !important;
	color: #222;
	text-shadow: 1px 1px 2px #fff;
	pointer-events: none;
	white-space: nowrap;
}

.leaflet-top.leaflet-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    bottom: 46px;
    right:15px;
}
.leaflet-control-layers.leaflet-control {
    margin: 0px !important;
    display: none;
}

.toolbox-header {
	display: flex;
	flex-direction: column;
	gap: 6px;
	align-items: flex-end;
}

#toggleToolboxBtn,#reloadPageBtn {
	font-size: 20px;
	border: 1px solid #888;
	border-radius: 6px;
	background: #fff;
	cursor: pointer;
	width: 50px;
	height: 50px;
	transition: 0.2s;
}

#toggleToolboxBtn:hover,#reloadPageBtn:hover {
	background: #f0f0f0;
}

#toggleToolboxBtn:hover {
	background: #f0f0f0;
}

.toolbox-content {
	position: fixed !important;
	bottom: 85px;
	left: 50%;
	transform: translateX(-50%);
	width: 280px;
	max-height: 70vh;
	display: none;
	flex-direction: column;
	overflow: hidden;
	background: white;
	border-radius: 15px;
	box-shadow: 0 10px 30px rgba(0,0,0,0.3);
	border: 1px solid #ddd;
	z-index: 3000 !important;
	animation: slideUp 0.3s ease-out;
	pointer-events: auto;
}

.toolbox-content button {
	width: 100%;
	margin: 4px 0;
	padding: 10px;
	font-size: 14px;
	font-weight: 500;
	text-align: left;
	border: 1px solid #eee;
	border-radius: 8px;
	background: #fff;
	color: #333;
	cursor: pointer;
	transition: all 0.2s;
	display: flex;
	align-items: center;
	gap: 10px;
}

.toolbox-content button:active {
	background: #f0f0f0 !important;
	transform: scale(0.98);
}

#toggleCameraBtn {
	background: #f0f4ff !important;
	color: #2563eb !important;
	border-color: #dbeafe !important;
}

.txtcsv_thangtv {
	display: flex;
	gap: 6px;
	width: 100%;
}

.txtcsv_thangtv button.txtcsv {
	flex: 1;
	text-align: center !important;
	padding: 8px !important;
}

.toolbox-content button img {
	max-width: 100%;
	height: auto;
	display: block;
	margin: 0 auto;
}

.toolbox-content button:hover {
	background: #eaeaea;
}

.toolbox-content button.off {
	opacity: 0.5;
}

.zoom-btns {
	display: flex;
	justify-content: space-between;
	width: 100%;
}

.zoom-btns button {
	width: 40px;
	text-align: center;
}

.txtcsv {
	width: 48% !important;
}

.map-layer-btn {
	font-size: 18px;
	margin: 0 2px;
	cursor: pointer;
	border: 1px solid #ab0808 !important;
	border-radius: 4px;
	background: #fff !important;
	transition: all 0.2s;
}

.map-layer-btn:hover {
	background: #f0f0f0;
	transform: scale(1.1);
}

.btn-ai-voice {
	flex: 1.2 !important;
	border: 2px solid var(--red-flag) !important;
}

.toolbox-header .icon-btn:active, .toolbox-header button:active {
	transform: scale(0.9);
	filter: brightness(0.9);
}

.toolbox-content.open {
	display: flex;
}

.toolbox-header-inner {
	background: #f8f9fa;
	padding: 10px 15px;
	display: flex;
	justify-content: space-between;
	align-items: center;
	border-bottom: 1px solid #eee;
	font-weight: bold;
	color: #da251d;
}

#closeToolbox {
	font-size: 24px;
	cursor: pointer;
	color: #999;
}

#closeToolbox:hover {
	color: red;
}

.toolbox-body {
	padding: 10px;
	overflow-y: auto;
}

.toolbox-body button:hover {
	background: #fff5f5;
	border-color: #da251d;
}

.btn-highlight {
	background: #f0f7ff !important;
	color: #2563eb !important;
	font-weight: bold;
	border: 1px solid #2563eb !important;
}

.txtcsv_row {
	display: flex;
	gap: 8px;
	margin-bottom: 8px;
}

select#thematicSelect {
	padding: 5px;
}

.txtcsv_row button {
	flex: 1;
	justify-content: center;
}

@keyframes slideUpMobile {
	from {
		opacity: 0;
		transform: translate(-50%, 20px);
	}

	to {
		opacity: 1;
		transform: translate(-50%, 0);
	}
}

@keyframes slideUp {
	from {
		opacity: 0;
		transform: translate(-50%, 20px);
	}

	to {
		opacity: 1;
		transform: translate(-50%, 0);
	}
}

@media (max-width: 767.99px) {
	#mapLayersMenu {
		bottom: 60px !important;
		flex-direction: row !important;
		right: -45px !important;
	}
	.leaflet-top.leaflet-right {
    bottom: 5px;
}

	.button_tmp {
		width: 100% !important;
	}

	.leaflet-control.toolbox {
		margin: 0 !important;
		float: none !important;
		width: 100%;
		display: flex;
		justify-content: center;
		pointer-events: none;
	}

	#toolboxContent.toolbox-content {
		position: fixed !important;
		left: 50% !important;
		top: auto !important;
		bottom: 80px !important;
		transform: translateX(-50%) !important;
		width: 92% !important;
		max-width: 340px !important;
		max-height: calc(100vh - 160px) !important;
		overflow-y: auto !important;
		background: white;
		border-radius: 12px;
		box-shadow: 0 -5px 25px rgba(0,0,0,0.2);
		z-index: 1001;
		pointer-events: auto;
		display: none;
	}

	#toolboxContent.toolbox-content.open {
		display: block;
		animation: slideUpMobile 0.3s ease-out;
	}

	.toolbox-body {
		display: grid;
		grid-template-columns: 1fr 1fr;
		gap: 6px;
		padding: 12px;
	}

	.toolbox-body button {
		padding: 8px 4px;
		font-size: 12px;
		height: 40px;
		margin: 0;
	}

	.toolbox-header-inner {
		padding: 10px;
		font-size: 14px;
	}

	.toolbox-content {
		width: 85vw;
		bottom: 80px;
		max-height: 70vh;
		overflow-y: auto;
	}

	.leaflet-control.toolbox {
		position: fixed !important;
		bottom: 10px !important;
		left: 50% !important;
		transform: translateX(-50%) !important;
		width: 96vw !important;
		background: rgba(255, 255, 255, 0.9);
		padding: 6px !important;
		border-radius: 12px;
		box-shadow: 0 4px 15px rgba(0,0,0,0.2);
		display: flex !important;
		justify-content: center !important;
		z-index: 2000;
	}

	.toolbox-header {
		display: flex !important;
		flex-direction: row !important;
		width: 100% !important;
		gap: 4px !important;
		justify-content: center !important;
		align-items: center !important;
	}

	.toolbox-header .icon-btn, .toolbox-header button {
		flex: 1 !important;
		min-width: 0 !important;
		max-width: 50px !important;
		aspect-ratio: 1 / 1 !important;
		width: auto !important;
		height: auto !important;
		padding: 5px !important;
		background: #fff !important;
		border: 1px solid #ddd !important;
		border-radius: 8px !important;
		display: flex !important;
		align-items: center !important;
		justify-content: center !important;
		box-sizing: border-box !important;
	}

	.toolbox-header img.icon-btn {
		object-fit: contain !important;
	}

	#toggleToolboxBtn, #reloadPageBtn {
		font-size: 18px !important;
		line-height: 1 !important;
	}

	#toolboxContent.toolbox-content {
		position: fixed;
		left: 50%;
		top: auto;
		bottom: 90px;
		transform: translateX(-50%);
		width: 90%;
		max-width: 350px;
		max-height: 60vh;
		overflow-y: auto;
		background: #ffffff;
		border-radius: 15px;
		box-shadow: 0 -5px 20px rgba(0,0,0,0.2);
	}
}