html, body {
	margin: 0;
	padding: 0;
	height: 100%;
	font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Noto Sans", "Apple Color Emoji", "Segoe UI Emoji";
	overflow-x: hidden;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

/* Smooth custom scrollbar */
::-webkit-scrollbar {
	width: 10px;
	height: 10px;
}

::-webkit-scrollbar-track {
	background: rgba(0, 0, 0, 0.05);
}

::-webkit-scrollbar-thumb {
	background: rgba(0, 0, 0, 0.2);
	border-radius: 5px;
	border: 2px solid transparent;
	background-clip: content-box;
}

::-webkit-scrollbar-thumb:hover {
	background: rgba(0, 0, 0, 0.35);
	background-clip: content-box;
}

/* Loading Overlay */
.loading-overlay {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: linear-gradient(135deg, #8B1538 0%, #5C0F26 100%);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 9999;
	opacity: 1;
	transition: opacity 0.5s ease-out;
}

.loading-overlay.hidden {
	opacity: 0;
	pointer-events: none;
}

.loading-spinner {
	text-align: center;
	color: white;
}

.spinner {
	width: 60px;
	height: 60px;
	margin: 0 auto 20px;
	border: 4px solid rgba(255, 255, 255, 0.3);
	border-top-color: white;
	border-radius: 50%;
	animation: spin 1s linear infinite;
}

@keyframes spin {
	to { transform: rotate(360deg); }
}

.loading-spinner p {
	font-size: 16px;
	font-weight: 500;
	letter-spacing: 0.5px;
	animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
	0%, 100% { opacity: 1; }
	50% { opacity: 0.5; }
}

/* Top Navigation Bar */
.top-navbar {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	height: 60px;
	background: linear-gradient(135deg, #8B1538 0%, #5C0F26 100%);
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
	z-index: 1000;
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 0 20px;
	color: white;
	direction: ltr !important;
}

.navbar-left,
.navbar-right {
	display: flex;
	align-items: center;
	gap: 12px;
	width: 200px;
	flex-shrink: 0;
}

.navbar-left {
	justify-content: flex-start;
}

.navbar-right {
	justify-content: flex-end;
}

.navbar-center {
	flex: 1;
	display: flex;
	justify-content: center;
	align-items: center;
}

.navbar-title {
	margin: 0;
	font-size: 20px;
	font-weight: 600;
	color: white;
	text-align: center;
	letter-spacing: 0.5px;
}

.navbar-btn {
	display: flex;
	align-items: center;
	justify-content: flex-start;
	gap: 8px;
	background: rgba(255, 255, 255, 0.15);
	border: 1px solid rgba(255, 255, 255, 0.3);
	color: white;
	padding: 8px 16px;
	border-radius: 8px;
	cursor: pointer;
	font-size: 14px;
	font-weight: 500;
	transition: all 0.2s ease;
	backdrop-filter: blur(10px);
	width: 130px;
	white-space: nowrap;
}

.navbar-btn:hover {
	background: rgba(255, 255, 255, 0.25);
	border-color: rgba(255, 255, 255, 0.5);
	transform: translateY(-1px);
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.navbar-btn:active {
	transform: translateY(0);
}

.navbar-btn svg {
	flex-shrink: 0;
	width: 20px;
	height: 20px;
}

.navbar-btn span {
	flex: 1;
	text-align: left;
	overflow: hidden;
	text-overflow: ellipsis;
}

.lang-btn {
	width: 110px;
	justify-content: center;
}

.lang-btn span {
	text-align: center;
}

#map {
	position: absolute;
	top: 60px;
	bottom: 0;
	left: 0;
	right: 0;
	overflow: hidden;
}

#sidebar-wrapper, .sidebar-wrapper {
	position: absolute;
	top: 60px;
	left: 0;
	bottom: 0;
	z-index: 12;
	pointer-events: none;
}

#sidebar {
	position: absolute;
	top: 0;
	left: 0 !important;
	right: auto !important;
	bottom: 0;
	z-index: 10;
	background: rgba(255, 255, 255, 0.96);
	padding: 12px 12px 16px;
	border-right: 1px solid rgba(0,0,0,0.1);
	box-shadow: 0 2px 8px rgba(0,0,0,0.08);
	min-width: 260px;
	width: 320px;
	max-width: 40vw;
	overflow-y: auto;
	overflow-x: hidden;
	transition: transform 0.3s ease-in-out;
	pointer-events: auto;
	direction: ltr;
}

#sidebar.collapsed {
	transform: translateX(-100%) !important;
}

.details-open { outline: none; }

#details {
	position: absolute;
	top: 60px;
	right: 0 !important;
	left: auto !important;
	bottom: 0;
	z-index: 11;
	background: rgba(255, 255, 255, 0.98);
	border-left: 1px solid rgba(0,0,0,0.1);
	box-shadow: 0 2px 8px rgba(0,0,0,0.08);
	min-width: 320px;
	width: 400px;
	max-width: 45vw;
	transform: translateX(100%);
	transition: transform 0.2s ease-in-out;
	overflow-y: auto;
	overflow-x: hidden;
	direction: ltr;
}

#details:not(.collapsed) {
	transform: translateX(0%);
}

.details-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	position: sticky;
	top: 0;
	background: inherit;
	padding: 10px 12px;
	border-bottom: 1px solid rgba(0,0,0,0.06);
}

#details h3 {
	margin: 0;
	font-size: 16px;
}

#details-close {
	border: 1px solid rgba(0,0,0,0.15);
	background: #fff;
	border-radius: 6px;
	padding: 4px 8px;
	cursor: pointer;
}

/* Details Panel Content Styling */
#details-content {
	padding: 16px;
}

.details-rows {
	display: flex;
	flex-direction: column;
	gap: 4px;
}

/* Translation Notice */
.translation-notice {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 10px 14px;
	background: linear-gradient(135deg, #fff3cd 0%, #ffe69c 100%);
	border: 1px solid #ffc107;
	border-radius: 6px;
	margin-bottom: 12px;
	font-size: 13px;
	color: #856404;
	box-shadow: 0 2px 4px rgba(255, 193, 7, 0.15);
}

.notice-icon {
	font-size: 16px;
	flex-shrink: 0;
}

.notice-text {
	font-weight: 500;
	line-height: 1.4;
}

.detail-row {
	display: grid;
	grid-template-columns: 140px 1fr;
	gap: 12px;
	padding: 10px 12px;
	background: #f8f9fa;
	border-radius: 6px;
	border-left: 3px solid #8B1538;
	transition: all 0.2s ease;
}

.detail-row:hover {
	background: #e9ecef;
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.detail-row.common-field {
	background: linear-gradient(135deg, #f8f9fa 0%, #fff 100%);
	border-left-color: #2c7fb8;
	border-left-width: 4px;
	font-weight: 500;
}

.detail-label {
	font-size: 13px;
	font-weight: 600;
	color: #495057;
	text-transform: capitalize;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.detail-value {
	font-size: 14px;
	color: #212529;
	word-wrap: break-word;
	line-height: 1.5;
}

/* RTL Support for Details */
[dir="rtl"] .detail-row {
	border-left: none;
	border-right: 3px solid #8B1538;
}

[dir="rtl"] .detail-row.common-field {
	border-right-color: #2c7fb8;
	border-right-width: 4px;
}

#details-content {
	padding: 14px;
	font-size: 14px;
}

#details-content table {
	width: 100%;
	border-collapse: collapse;
}

#details-content th, #details-content td {
	text-align: left;
	padding: 6px 8px;
	border-bottom: 1px solid rgba(0,0,0,0.06);
}

#details-content th {
	width: 42%;
	color: #444;
}

.sidebar-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	margin-bottom: 12px;
}

#sidebar h3 {
	margin: 0 0 8px 0;
	font-size: 16px;
}

#sidebar label {
	display: block;
	margin: 6px 0;
	cursor: pointer;
}

/* Modernize radio/checkbox appearance */
input[type="radio"], input[type="checkbox"] {
	appearance: none;
	-webkit-appearance: none;
	width: 16px;
	height: 16px;
	border: 2px solid #888;
	border-radius: 4px;
	display: inline-block;
	vertical-align: middle;
	margin-right: 6px;
	position: relative;
	outline: none;
	transition: all 0.15s ease-in-out;
}

input[type="radio"] {
	border-radius: 50%;
}

input[type="radio"]:checked::after {
	content: "";
	position: absolute;
	left: 50%;
	top: 50%;
	width: 8px;
	height: 8px;
	background: #2c7fb8;
	border-radius: 50%;
	transform: translate(-50%, -50%);
}

input[type="checkbox"]:checked {
	background: #2c7fb8;
	border-color: #2c7fb8;
}

input[type="checkbox"]:checked::after {
	content: "";
	position: absolute;
	left: 4px;
	top: 0px;
	width: 4px;
	height: 8px;
	border: solid #fff;
	border-width: 0 2px 2px 0;
	transform: rotate(45deg);
}

/* Inline icon next to layer labels */
.label-icon {
	display: inline-block;
	width: 16px;
	height: 16px;
	vertical-align: middle;
	margin-right: 6px;
}

.label-icon svg {
	display: block;
	width: 16px;
	height: 16px;
}

.hint {
	font-size: 12px;
	color: #333;
}

.popup { display: none; }

/* Compare swipe mask for NDVI B */



/* --- Filters UI --- */
.filter-group {
	margin: 4px 0 10px 22px;
	padding: 6px 8px;
	border-left: 2px solid rgba(0,0,0,0.08);
	background: rgba(255,255,255,0.6);
}
.filter-enable-row {
	display: flex;
	align-items: center;
	gap: 6px;
	margin-bottom: 6px;
}
.filter-label {
	font-size: 12px;
	color: #333;
	margin: 6px 0 2px;
}
.filter-input-text, .filter-group input[type="number"], .filter-group select, .filter-group input[type="date"], .filter-group input[type="time"] {
	width: 100%;
	box-sizing: border-box;
	padding: 4px 6px;
	border: 1px solid rgba(0,0,0,0.15);
	border-radius: 6px;
}

#ae-opacity::-webkit-slider-thumb {
	-webkit-appearance: none;
	appearance: none;
	width: 18px;
	height: 18px;
	background: #2c7fb8;
	border: 2px solid #fff;
	border-radius: 50%;
	cursor: pointer;
	box-shadow: 0 2px 6px rgba(0,0,0,0.15);
	transition: all 0.15s ease-in-out;
}

#ae-opacity::-webkit-slider-thumb:hover {
	background: #1f5f8f;
	transform: scale(1.1);
	box-shadow: 0 3px 8px rgba(0,0,0,0.25);
}

#ae-opacity::-moz-range-thumb {
	width: 18px;
	height: 18px;
	background: #2c7fb8;
	border: 2px solid #fff;
	border-radius: 50%;
	cursor: pointer;
	box-shadow: 0 2px 6px rgba(0,0,0,0.15);
	transition: all 0.15s ease-in-out;
}

#ae-opacity::-moz-range-thumb:hover {
	background: #1f5f8f;
	transform: scale(1.1);
	box-shadow: 0 3px 8px rgba(0,0,0,0.25);
}

#ae-opacity::-moz-range-track {
	height: 6px;
	background: linear-gradient(to right, #e0e0e0 0%, #2c7fb8 100%);
	border-radius: 3px;
	border: none;
}

#ae-opacity-value {
	font-weight: 500;
	color: #2c7fb8;
	background: rgba(44, 127, 184, 0.08);
	padding: 2px 6px;
	border-radius: 4px;
	font-size: 11px;
	letter-spacing: 0.5px;
}

.layer-desc {
	font-size: 11px;
	color: #666;
	margin: 0 0 8px 22px;
	line-height: 1.4;
	padding-left: 6px;
	border-left: 2px solid #ddd;
}

/* Section Headers */
.section-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	margin-bottom: 8px;
}

.section-badge {
	background: linear-gradient(135deg, #8B1538 0%, #5C0F26 100%);
	color: white;
	font-size: 10px;
	font-weight: 700;
	padding: 2px 8px;
	border-radius: 12px;
	min-width: 20px;
	text-align: center;
	letter-spacing: 0.5px;
}

.ai-section {
	background: linear-gradient(90deg, rgba(139, 21, 56, 0.08) 0%, rgba(139, 21, 56, 0) 100%);
	padding: 8px 10px;
	margin: 0 -12px 8px;
	border-left: 3px solid #8B1538;
}

.ai-badge {
	background: linear-gradient(135deg, #8B1538 0%, #5C0F26 100%);
	color: white;
	font-size: 10px;
	font-weight: 700;
	padding: 3px 8px;
	border-radius: 10px;
	letter-spacing: 1px;
	box-shadow: 0 2px 4px rgba(139, 21, 56, 0.3);
}

/* Map Controls */
.map-controls {
	position: absolute;
	bottom: 30px;
	right: 20px;
	z-index: 10;
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.map-control-btn {
	width: 40px;
	height: 40px;
	border: none;
	background: white;
	border-radius: 8px;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
	cursor: pointer;
	font-size: 20px;
	font-weight: 700;
	color: #333;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all 0.2s ease;
	user-select: none;
}

.map-control-btn:hover {
	background: #f8f8f8;
	transform: translateY(-2px);
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.map-control-btn:active {
	transform: translateY(0);
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.map-control-btn:focus {
	outline: 2px solid #2c7fb8;
	outline-offset: 2px;
}

/* Improved hover states for buttons */
#lang-toggle, #details-close {
	transition: all 0.2s ease;
}

#lang-toggle:hover, #details-close:hover {
	background: #f0f0f0;
	transform: scale(1.05);
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

#lang-toggle:active, #details-close:active {
	transform: scale(0.98);
}

/* Focus states for accessibility */
input[type="radio"]:focus, input[type="checkbox"]:focus {
	outline: 2px solid #2c7fb8;
	outline-offset: 2px;
}

button:focus-visible {
	outline: 2px solid #2c7fb8;
	outline-offset: 2px;
}

/* Improved disabled state */
input[type="checkbox"]:disabled,
input[type="radio"]:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

label:has(input:disabled) {
	opacity: 0.6;
	cursor: not-allowed;
}

/* RTL Support for Arabic */
[dir="rtl"] #sidebar {
	/* Removed - sidebar always stays on left */
}

[dir="rtl"] #sidebar.collapsed {
	/* Removed - sidebar always collapses to left */
}

[dir="rtl"] #details {
	/* Removed - details always stays on right */
}

[dir="rtl"] #details:not(.collapsed) {
	/* Removed - details always stays on right */
}

[dir="rtl"] .filter-group {
	border-left: none;
	border-right: 2px solid rgba(0, 0, 0, 0.08);
	margin: 4px 22px 10px 0;
}

[dir="rtl"] .layer-desc {
	border-left: none;
	border-right: 2px solid #ddd;
	margin: 0 22px 8px 0;
	padding-left: 0;
	padding-right: 6px;
}

[dir="rtl"] .ai-section {
	border-left: none;
	border-right: 3px solid #8B1538;
	background: linear-gradient(270deg, rgba(139, 21, 56, 0.08) 0%, rgba(139, 21, 56, 0) 100%);
}

[dir="rtl"] input[type="radio"],
[dir="rtl"] input[type="checkbox"] {
	margin-right: 0;
	margin-left: 6px;
}

[dir="rtl"] .label-icon {
	margin-right: 0;
	margin-left: 6px;
}

/* Responsive Design */
@media (max-width: 768px) {
	.navbar-title {
		font-size: 16px;
	}
	
	.navbar-btn span {
		display: none;
	}
	
	.navbar-btn {
		padding: 8px 12px;
	}
	
	#sidebar {
		min-width: 240px;
		width: 280px;
		max-width: 80vw;
	}
	
	#details {
		min-width: 280px;
		width: 320px;
		max-width: 85vw;
	}
	
	.map-controls {
		bottom: 20px;
		right: 12px;
		gap: 6px;
	}
	
	.map-control-btn {
		width: 36px;
		height: 36px;
		font-size: 18px;
	}
}

/* Print styles */
@media print {
	.top-navbar,
	#sidebar, 
	#details, 
	.map-controls {
		display: none !important;
	}
	
	#map {
		position: relative !important;
		top: 0 !important;
		width: 100% !important;
		height: 100vh !important;
	}
}