:root {
	--accent-color-rgb: 15, 23, 42;
}

/* Base Theme-aware Backgrounds & Elements */
body.theme-light {
	--bg-surface: #f1f5f9;
	--modal-bg: #ffffff;
	--modal-header-bg: #ffffff;
	--modal-footer-bg: #f8fafc;
	--modal-border: rgba(0, 0, 0, 0.05);
}

body.theme-dark {
	--bg-surface: #1e293b;
	--modal-bg: #111111;
	--modal-header-bg: #111111;
	--modal-footer-bg: #1a1a1a;
	--modal-border: rgba(255, 255, 255, 0.1);
}

.bg-accent {
	background-color: var(--text-color) !important;
	color: var(--bg-color) !important;
}

.text-accent {
	color: var(--text-color) !important;
}

.border-accent {
	border-color: var(--text-color) !important;
}

.bg-accent-light {
	background-color: var(--bg-hover) !important;
}

/* UI Components */
.ui-surface {
	background-color: var(--bg-hover) !important;
	border-radius: 12px;
}

.ui-pill-container {
	background-color: var(--bg-input);
	padding: 4px;
	border-radius: 12px;
	display: flex;
	gap: 4px;
	border: 1px solid var(--border-color);
}

.ui-pill {
	flex: 1;
	padding: 8px 12px;
	font-size: 11px;
	font-weight: 700;
	border-radius: 8px;
	transition: all 0.2s;
	background: transparent;
	color: var(--text-dim);
	border: none;
	cursor: pointer;
}

.ui-pill:hover {
	color: var(--text-color);
}

.ui-pill.active {
	background-color: var(--text-color);
	color: var(--bg-color) !important;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Preset Buttons Area */
.preset-btn {
	background: var(--bg-input);
	border: 1px solid var(--border-color);
	color: var(--text-color);
	transition: all 0.2s;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	border-radius: 16px;
}

.preset-btn span {
	color: var(--text-color);
}

.preset-btn:hover {
	border-color: var(--text-dim);
	background: var(--bg-hover);
}

.preset-btn.active {
	background-color: var(--text-color) !important;
	border-color: var(--text-color) !important;
}

.preset-btn.active span {
	color: var(--bg-color) !important;
	opacity: 1 !important;
}

/* Slider Styles */
input[type="range"] {
	-webkit-appearance: none;
	appearance: none;
	width: 100%;
	height: 4px;
	background: var(--border-color);
	border-radius: 2px;
	outline: none;
	margin: 10px 0;
}

input[type="range"]::-webkit-slider-thumb {
	-webkit-appearance: none;
	appearance: none;
	width: 20px;
	height: 20px;
	background: var(--text-color);
	cursor: pointer;
	border-radius: 50%;
	border: 4px solid var(--bg-color);
	box-shadow: 0 0 0 1px var(--text-color);
	transition: transform 0.1s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
	transform: scale(1.15);
}

input[type="range"]::-moz-range-thumb {
	width: 20px;
	height: 20px;
	background: var(--text-color);
	cursor: pointer;
	border-radius: 50%;
	border: 4px solid var(--bg-color);
	box-shadow: 0 0 0 1px var(--text-color);
}

/* Search Results Styling */
#search-results {
	background: var(--bg-color) !important;
	border: 1px solid var(--border-color) !important;
	color: var(--text-color) !important;
}

.search-item {
	padding: 12px 16px;
	cursor: pointer;
	border-bottom: 1px solid var(--border-subtle);
	font-size: 14px;
	transition: all 0.2s;
	border-radius: 8px;
	margin-bottom: 2px;
}

.search-item:last-child {
	border-bottom: none;
	margin-bottom: 0;
}

.search-item:hover {
	background: var(--text-color) !important;
	color: var(--bg-color) !important;
	transform: translateX(4px);
}

/* Mobile Layout */
.leaflet-container {
	background: transparent !important;
}

#poster-container {
	transition: background-color 0.3s ease;
}

.no-scrollbar::-webkit-scrollbar {
	display: none;
}

.no-scrollbar {
	-ms-overflow-style: none;
	scrollbar-width: none;
}

@keyframes pulse-ring {
	0% {
		transform: scale(.33);
	}

	80%,
	100% {
		opacity: 0;
	}
}

.search-pulse {
	position: absolute;
	width: 20px;
	height: 20px;
	background-color: var(--text-color);
	border-radius: 9999px;
}

/* Mobile Toggle Style */
@media (max-width: 767px) {
	.sidebar-open .tool-sidebar {
		left: 0;
	}

	.sidebar-open .top-bar,
	.sidebar-open #mobile-toggle {
		display: none !important;
	}

	.sidebar-open #sidebar-overlay {
		display: block !important;
		opacity: 1 !important;
	}

	/* Prevent body scroll when sidebar is open */
	body.sidebar-open {
		overflow: hidden !important;
	}

	/* Consolidated Sidebar Logic */
	.tool-sidebar {
		position: fixed;
		left: -100%;
		top: 0;
		bottom: 0;
		z-index: 9999;
		width: 85%;
		max-width: 350px;
		border-radius: 0 20px 20px 0;
		transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
		box-shadow: 20px 0 50px rgba(0, 0, 0, 0.2);
		background: var(--bg-color) !important;
		display: flex;
		flex-direction: column;
		height: 100dvh !important;
		width: 85% !important;
		overflow: hidden;
	}

	.sidebar-open .tool-sidebar {
		left: 0;
	}

	.tool-sidebar>div.overflow-y-auto {
		flex: 1;
		min-height: 0;
		overflow-y: auto !important;
		-webkit-overflow-scrolling: touch;
		padding-bottom: safe-area-inset-bottom;
		padding-bottom: 2rem;
	}
}

.search-pulse::before {
	content: '';
	position: absolute;
	width: 300%;
	height: 300%;
	left: -100%;
	top: -100%;
	border-radius: 9999px;
	background-color: var(--text-color);
	opacity: 0.5;
	animation: pulse-ring 1.25s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
}

/* Modal Enhancements */
#presets-modal {
	position: fixed;
	inset: 0;
	z-index: 1000;
	display: none;
	align-items: center;
	justify-content: center;
}

#presets-modal.show {
	display: flex;
}

.modal-content-card {
	background: var(--modal-bg);
	border: 1px solid var(--modal-border);
	border-radius: 24px;
	width: 90%;
	max-width: 800px;
	max-height: 90vh;
	display: flex;
	flex-direction: column;
	overflow: hidden;
	position: relative;
	z-index: 1001;
	box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
	color: var(--text-color);
}

.modal-preset-btn {
	background: var(--bg-input);
	border: 1px solid var(--border-color);
	color: var(--text-color);
	padding: 1.25rem;
	border-radius: 16px;
	text-align: left;
	transition: all 0.2s;
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.modal-preset-btn:hover {
	background: var(--bg-hover);
	border-color: var(--text-dim);
}

.modal-preset-btn.active {
	background: var(--text-color);
	border-color: var(--text-color);
}

.modal-preset-btn.active span {
	color: var(--bg-color) !important;
}

#modal-overlay {
	background: rgba(0, 0, 0, 0.8);
	backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px);
}

#close-modal:hover {
	background: var(--bg-hover);
}

.accent-button {
	background: var(--text-color);
	color: var(--bg-color);
	font-weight: 700;
	padding: 1rem;
	border-radius: 16px;
	width: 100%;
	transition: all 0.2s;
	border: none;
	cursor: pointer;
}

.accent-button:hover {
	opacity: 0.9;
	transform: translateY(-1px);
}

.accent-button:active {
	transform: scale(0.98);
}

#display-coords {
	color: inherit;
}

#zoom-value {
	background: var(--bg-input);
	color: var(--text-color);
	border: 1px solid var(--border-color);
}

/* Custom Dropdown Arrow */
select.input-field {
	appearance: none;
	-webkit-appearance: none;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 0.75rem center;
	background-size: 1rem;
	padding-right: 2.5rem;
}

body.theme-dark select.input-field,
.theme-dark select.input-field {
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") !important;
}

/* Custom Checkbox Aesthetics */
input[type="checkbox"] {
	appearance: none;
	-webkit-appearance: none;
	width: 18px;
	height: 18px;
	border: 1.5px solid var(--border-color);
	border-radius: 6px;
	background: var(--bg-input);
	cursor: pointer;
	position: relative;
	transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

input[type="checkbox"]:hover {
	border-color: var(--text-dim);
	background: var(--bg-hover);
}

input[type="checkbox"]:checked {
	background: var(--text-color);
	border-color: var(--text-color);
}

input[type="checkbox"]:checked::after {
	content: '';
	width: 9px;
	height: 5px;
	border-left: 2px solid var(--bg-color);
	border-bottom: 2px solid var(--bg-color);
	transform: rotate(-45deg) translateY(-1px);
	display: block;
}

input[type="checkbox"]:focus {
	outline: none;
	box-shadow: 0 0 0 2px var(--bg-color), 0 0 0 4px var(--border-color);
}