:root {
	/* Darker Green Theme */
	--primary: #059669;
	--primary-hover: #047857;
	--primary-dark: #065f46;
	--icon-color: #059669; /* Icons always green */
	--bg-primary: #ffffff;
	--bg-secondary: #f9fafb;
	--text-primary: #111827;
	--text-secondary: #6b7280;
	--border: #e5e7eb;
	--shadow: rgba(0, 0, 0, 0.1);
	--map-bg: #fbf8f3;
	--bg-page: var(--map-bg);
}

[data-theme='dark'] {
	--primary: #059669;
	--primary-hover: #10b981;
	--primary-dark: #047857;
	--icon-color: #059669; /* Icons stay green in dark mode */
	--bg-primary: #111827;
	--bg-secondary: #1f2937;
	--text-primary: #f9fafb;
	--text-secondary: #9ca3af;
	--border: #374151;
	--shadow: rgba(0, 0, 0, 0.3);
	--map-bg: #0e0e0e;
	--bg-page: var(--map-bg);
}

* {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
}

body,
html {
	width: 100%;
	height: 100%;
	height: 100dvh;
	height: var(--vh, 100dvh); /* Use JS fixed height if available */
	margin: 0;
	padding: 0;
	/* Force background color to avoid gray defaults */
	background-color: var(--map-bg) !important;
	background: var(--map-bg) !important;
	overflow: hidden;
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	-webkit-font-smoothing: antialiased;
	font-family:
		-apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', sans-serif;
	color: var(--text-primary);
	color: var(--text-primary);
	background: var(--map-bg); /* Match map bg */
	background-color: var(--map-bg);
	transition:
		background 0.3s,
		color 0.3s;
	overscroll-behavior: none; /* Prevent bounce efect showing gray background */
	touch-action: none; /* Disable default touch actions like scrolling */
	-webkit-user-select: none;
	user-select: none;
}

#map {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	width: 100%;
	height: 100%;
	height: var(--vh, 100dvh); /* Force match body height */
	z-index: 1;
	background: var(--map-bg);
}

/* Hide Geolocate Button but keep functionality */
.maplibregl-ctrl-geolocate {
	display: none !important;
}

/* Ensure markers don't get messed up */
.maplibregl-marker {
	position: absolute;
	top: 0;
	left: 0;
	will-change: transform;
}

/* Center Marker - Higher position and bigger lift */
.center-marker {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -110%); /* Higher base position */
	z-index: 10;
	pointer-events: none;
	filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.25));
	transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.center-marker.dragging {
	transform: translate(-50%, -140%); /* Much higher when dragging */
}

/* Pollution Markers */
/* Pollution Marker Container - Positioning Only */
.pollution-marker {
	width: 16px;
	height: 16px;
	cursor: pointer;
	position: absolute;
	top: 0;
	left: 0;
	z-index: 10;
	/* NO transform or animation here! MapLibre controls transform */
}

/* Inner Circle - Visuals and Animation */
.pollution-marker-inner {
	width: 100%;
	height: 100%;
	border-radius: 50%;
	border: 2px solid white;
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
	animation: pulse 2s ease-in-out infinite;
}

.pollution-marker.level-1 .pollution-marker-inner {
	background: #059669;
}
.pollution-marker.level-2 .pollution-marker-inner {
	background: #fbbf24;
}
.pollution-marker.level-3 .pollution-marker-inner {
	background: #ef4444;
}

/* Map Vignettes */
.top-vignette,
.bottom-vignette {
	position: fixed;
	left: 0;
	right: 0;
	width: 100%;
	z-index: 5; /* Above map, below buttons */
	pointer-events: none;
	transition: background 0.4s;
}

.top-vignette {
	top: 0;
	height: 120px;
	background: linear-gradient(to bottom, var(--map-bg) 0%, transparent 100%);
}

.bottom-vignette {
	bottom: 0;
	height: 160px;
	background: linear-gradient(to top, var(--map-bg) 0%, transparent 100%);
}

/* Marker sizing based on zoom */
.pollution-marker {
	transition:
		width 0.3s ease,
		height 0.3s ease;
}

.map-zoom-out .pollution-marker {
	width: 10px !important;
	height: 10px !important;
	border-width: 1.5px;
}

.map-zoom-out .pollution-marker-inner {
	border-width: 1.5px;
	animation: none; /* Stop pulsing when small */
	box-shadow: none;
}

/* Pulse Animation - Breathing Glow */
.pollution-marker-inner {
	width: 100%;
	height: 100%;
	border-radius: 50%;
	border: 2px solid white;
	/* Base shadow */
	box-shadow: 0 0 0 0 rgba(0, 0, 0, 0.2);
	animation: breathing-glow 2s infinite ease-in-out;
}

/* Remove radar pseudo-elements */
.pollution-marker-inner::before,
.pollution-marker-inner::after {
	display: none;
}

@keyframes breathing-glow {
	0% {
		transform: scale(1);
		box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.4);
	}
	50% {
		transform: scale(1.1);
		box-shadow: 0 0 0 6px rgba(255, 255, 255, 0);
	}
	100% {
		transform: scale(1);
		box-shadow: 0 0 0 0 rgba(255, 255, 255, 0);
	}
}

/* Stop animation when zoomed out */
.map-zoom-out .pollution-marker-inner::before,
.map-zoom-out .pollution-marker-inner::after {
	animation: none;
	display: none;
}

/* Top Buttons - Icons always green with extra top spacing */
.profile-btn,
.rating-btn {
	position: absolute;
	/* Add 44px for Telegram header + safe area */
	top: calc(44px + env(safe-area-inset-top) + 12px);
	z-index: 100;
	width: 44px;
	height: 44px;
	border-radius: 9999px;
	background: var(--bg-primary);
	border: none;
	box-shadow: 0 2px 8px var(--shadow);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all 0.2s;
	backdrop-filter: blur(10px);
	color: var(--icon-color);
}

.profile-btn {
	left: 12px;
}
.rating-btn {
	right: 12px;
}

.profile-btn:active,
.rating-btn:active {
	transform: scale(0.95);
}

/* Geolocation Button - Always green icon */
.geolocate-btn {
	position: absolute;
	right: 16px;
	top: 50%;
	transform: translateY(-50%);
	z-index: 20;
	width: 44px;
	height: 44px;
	border-radius: 9999px;
	background: var(--bg-primary);
	border: none;
	box-shadow: 0 2px 8px var(--shadow);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all 0.2s;
	color: var(--icon-color);
}

.geolocate-btn:active {
	transform: translateY(-50%) scale(0.95);
}

/* Visibility Toggle Button */
.toggle-pollutions-btn {
	position: absolute;
	right: 16px;
	top: calc(50% + 56px); /* Positioned below geolocate btn */
	transform: translateY(-50%);
	z-index: 20;
	width: 44px;
	height: 44px;
	border-radius: 9999px;
	background: var(--bg-primary);
	border: none;
	box-shadow: 0 2px 8px var(--shadow);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all 0.2s;
	color: var(--icon-color);
}

.toggle-pollutions-btn:active {
	transform: translateY(-50%) scale(0.95);
}

.toggle-pollutions-btn.hidden-state {
	color: var(--text-secondary);
	opacity: 0.7;
}

/* Add Button */
.add-btn {
	position: absolute;
	bottom: 32px;
	left: 50%;
	transform: translateX(-50%);
	z-index: 20;
	width: 56px;
	height: 56px;
	background: var(--primary);
	color: white;
	border: none;
	border-radius: 9999px;
	box-shadow: 0 4px 12px rgba(5, 150, 105, 0.4);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all 0.2s;
}

.add-btn:active {
	transform: translateX(-50%) scale(0.95);
}

/* Onboarding Screen */
.onboarding {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: var(--bg-primary); /* Default opaque */
	z-index: 200;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: flex-start;
	padding: 24px;
	padding-top: calc(44px + env(safe-area-inset-top) + 20px);
	opacity: 1;
	visibility: visible;
	transition: all 0.4s;
}

[data-theme='dark'] .onboarding {
	background: #111827; /* Opaque dark */
}

[data-theme='light'] .onboarding {
	background: #ffffff; /* Opaque light */
}

.onboarding.hidden {
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
}

.onboarding-content {
	background: transparent;
	border-radius: 0;
	padding: 0;
	max-width: 100%;
	width: 100%;
	max-height: 100%;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	box-shadow: none;
	animation: fadeInUp 0.6s ease;
}

@keyframes fadeInUp {
	from {
		opacity: 0;
		transform: translateY(20px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

.onboarding-title {
	font-size: 32px;
	font-weight: 700;
	text-align: center;
	margin-bottom: 12px;
	color: var(--text-primary);
}

.onboarding-subtitle {
	font-size: 16px;
	text-align: center;
	color: var(--text-secondary);
	margin-bottom: 40px;
}

.onboarding-icon {
	width: 100px;
	height: 100px;
	margin: 0 auto 32px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--primary);
	border-radius: 50%;
}

/* Sidebar */
.sidebar {
	position: fixed;
	top: 0;
	left: 0;
	width: 300px;
	height: 100%;
	background: var(--bg-primary);
	box-shadow: 4px 0 24px var(--shadow);
	z-index: 600;
	transform: translateX(-110%);
	opacity: 0;
	pointer-events: auto !important;
	transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
	overflow-y: auto;
	backdrop-filter: blur(12px);
	will-change: transform, opacity;
}

/* Air Widget Spinner Animation */
.air-spinner {
	animation: spinAir 1s linear infinite;
}

@keyframes spinAir {
	from {
		transform: rotate(0deg);
	}
	to {
		transform: rotate(360deg);
	}
}

.sidebar.active {
	transform: translateX(0);
	opacity: 1;
}

.sidebar-header {
	padding: 16px 20px;
	padding-top: calc(32px + env(safe-area-inset-top) + 12px);
	border-bottom: 1px solid var(--border);
	display: flex;
	align-items: center;
	justify-content: space-between;
	position: relative;
}

.profile-main {
	display: flex;
	align-items: center;
	gap: 12px;
}

.profile-avatar {
	width: 48px;
	height: 48px;
	background: var(--primary);
	color: white;
	border-radius: 14px; /* More modern than 50% */
	display: flex;
	align-items: center;
	justify-content: center;
	font-weight: 700;
	font-size: 18px;
	box-shadow: 0 4px 12px rgba(5, 150, 105, 0.2);
}

.user-info {
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.user-name {
	font-size: 17px;
	font-weight: 600;
	color: var(--text-primary);
}

.user-id {
	font-size: 13px;
	color: #374151; /* Darker gray for better visibility in light mode */
	font-weight: 700;
	letter-spacing: 0.5px;
}

[data-theme='dark'] .user-id {
	color: var(--text-secondary); /* Original gray for dark mode */
}

.sidebar-close {
	display: none; /* Removed */
}

.theme-icon-btn {
	background: transparent;
	border: none;
	width: 40px;
	height: 40px;
	border-radius: 12px;
	color: var(--text-primary);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all 0.2s;
	-webkit-tap-highlight-color: transparent;
	outline: none;
}

.theme-icon-btn:active {
	transform: scale(0.9) rotate(15deg);
}

.sidebar-content {
	padding: 16px 20px;
	display: flex;
	flex-direction: column;
	gap: 12px; /* Tight gaps */
}

/* Sidebar Sections */
.sidebar-section {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.theme-toggle {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 10px 14px;
	background: var(--bg-secondary);
	border-radius: 16px;
}

.theme-info {
	display: flex;
	align-items: center;
	gap: 10px;
	font-size: 14px;
	font-weight: 500;
	color: var(--text-primary);
}

.stats-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 12px;
}

.stat-item {
	background: var(--bg-secondary);
	padding: 12px;
	border-radius: 16px;
	display: flex;
	flex-direction: column;
	gap: 8px;
	transition: transform 0.2s;
}

.photo-item.contain {
	background-size: cover;
	background-repeat: no-repeat;
	background-position: center;
	background-color: var(--bg-primary);
}

.stat-icon {
	width: 32px;
	height: 32px;
	border-radius: 10px;
	display: flex;
	align-items: center;
	justify-content: center;
}

.stat-icon.rating {
	background: rgba(245, 158, 11, 0.25) !important; /* Brighter amber tint */
	color: #f59e0b !important; /* Pure Amber/Gold color */
}
.stat-icon.rating svg {
	color: #f59e0b !important;
}

.stat-icon.cleaned {
	background: rgba(59, 130, 246, 0.1);
	color: #3b82f6;
}

.stat-info {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

/* Language Picker (Accordion Style) */
.language-picker {
	background: var(--bg-secondary);
	border-radius: 14px;
	overflow: hidden;
	border: 1px solid var(--border);
	transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
	margin-bottom: 8px;
}

.language-current {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 12px 16px;
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
}

.language-current-info {
	display: flex;
	align-items: center;
	gap: 10px;
}

.language-current .lang-name {
	font-size: 14px;
	color: var(--text-primary);
}

.language-options {
	max-height: 0;
	overflow: hidden;
	transition: max-height 0.3s ease-out;
	border-top: 0px solid var(--border);
}

.language-picker.active .language-options {
	max-height: 200px;
	border-top-width: 1px;
}

.language-picker.active .chevron-icon {
	transform: rotate(180deg);
}

.lang-picker-item {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 12px 16px;
	cursor: pointer;
	font-size: 14px;
	font-weight: 500;
	color: var(--text-primary);
	transition: background 0.2s;
}

.lang-picker-item:active {
	background: rgba(16, 185, 129, 0.1);
}

.lang-picker-item.active {
	color: var(--primary);
	font-weight: 700;
	background: rgba(16, 185, 129, 0.05);
}

.chevron-icon {
	width: 16px;
	height: 16px;
	color: var(--text-secondary);
	transition: transform 0.3s;
}

.stat-value {
	font-size: 16px;
	font-weight: 750;
	color: var(--text-primary);
}

.stat-label {
	font-size: 11px;
	color: var(--text-secondary);
	text-transform: uppercase;
	letter-spacing: 0.5px;
	margin-top: 2px;
}

/* Action Menu */
.action-menu {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.menu-item {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 11px 16px; /* Tightened */
	border-radius: 14px;
	color: var(--text-primary);
	font-size: 14px; /* Slightly smaller */
	font-weight: 500;
	transition: background 0.2s;
	cursor: pointer;
}

.menu-item:active {
	background: var(--bg-secondary);
}

.menu-item svg {
	color: var(--text-secondary);
}

.sidebar-footer {
	margin-top: auto;
	padding: 12px 0;
	text-align: center;
	font-size: 10px;
	color: var(--text-secondary);
	opacity: 0.8;
}

#sidebar-userid {
	color: var(--text-primary);
	font-weight: 600;
	opacity: 0.7;
}

/* Theme Toggle */
.toggle-switch {
	position: relative;
	width: 48px;
	height: 28px;
	background: var(--border);
	border-radius: 14px;
	cursor: pointer;
	transition: background 0.3s;
}

.toggle-switch.active {
	background: var(--primary);
}

.toggle-slider {
	position: absolute;
	top: 2px;
	left: 2px;
	width: 24px;
	height: 24px;
	background: white;
	border-radius: 50%;
	transition: transform 0.3s;
}

.toggle-switch.active .toggle-slider {
	transform: translateX(20px);
}

/* Bottom Sheet */
.bottom-sheet {
	position: fixed;
	bottom: 0;
	left: 0;
	right: 0;
	background: var(--bg-primary);
	border-top-left-radius: 20px;
	border-top-right-radius: 20px;
	box-shadow: 0 -2px 25px rgba(0, 0, 0, 0.2);
	z-index: 500;
	transform: translateY(100%);
	transition: transform 0.5s cubic-bezier(0.32, 0.72, 0, 1);
	max-height: 85vh;
	overflow: hidden; /* Prevent handle from scrolling */
	display: flex;
	flex-direction: column;
	will-change: transform, height;
	backface-visibility: hidden;
}

.detail-sheet {
	z-index: 600; /* Over main bottom-sheet (500) */
}

.fade-in {
	animation: fadeInOpacity 0.3s ease-in;
}

@keyframes fadeInOpacity {
	0% {
		opacity: 0;
		transform: translateY(5px);
	}
	100% {
		opacity: 1;
		transform: translateY(0);
	}
}

.bottom-sheet.active {
	transform: translateY(0);
}

.bottom-sheet.dragging {
	transition: none !important;
}

.sheet-handle {
	width: 100%;
	height: 48px; /* Increased height for even more breathing room */
	display: flex;
	align-items: center;
	justify-content: center;
	touch-action: none;
	cursor: grab;
	position: sticky;
	top: 0;
	background: var(--bg-primary);
	z-index: 100;
	flex-shrink: 0; /* Don't collapse handle */
}

.sheet-handle::after {
	content: '';
	width: 36px;
	height: 4px;
	background: var(--border);
	border-radius: 2px;
}

/* Skeleton List Items */
.skeleton-list-item,
.skeleton-history-item {
	height: 60px;
	background: var(--bg-secondary);
	border-radius: 12px;
	margin-bottom: 8px;
	position: relative;
	overflow: hidden;
}

.skeleton-history-item {
	height: 64px;
}

.sheet-content {
	padding: 12px 20px 32px;
	flex: 1;
	overflow-y: auto;
	display: flex;
	flex-direction: column;
	min-height: 0; /* Important for flex-scroll */
	-webkit-overflow-scrolling: touch;
}

/* Skeleton List Items */
.skeleton-list-item {
	height: 64px;
	background: var(--bg-secondary);
	border-radius: 12px;
	margin-bottom: 8px;
	display: flex;
	align-items: center;
	padding: 12px;
	gap: 12px;
}

.sheet-page-anim {
	animation: sheet-page-in 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes sheet-page-in {
	from {
		opacity: 0;
		transform: translateY(20px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}
/* Overlay */
.overlay {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	bottom: 0;
	background: rgba(17, 24, 39, 0.8); /* Darker backdrop */
	z-index: 450;
	opacity: 0;
	visibility: hidden;
	transition: all 0.3s;
}

.overlay.active {
	opacity: 1;
	visibility: visible;
}

/* Form Elements */
.form-group {
	margin-bottom: 16px;
}

.form-label {
	display: block;
	font-size: 13px;
	font-weight: 600;
	color: var(--text-secondary);
	margin-bottom: 8px;
	text-transform: uppercase;
	letter-spacing: 0.5px;
}

.form-input,
.form-textarea {
	width: 100%;
	padding: 14px 16px;
	border: 1.5px solid var(--border);
	border-radius: 16px;
	font-size: 16px;
	font-family: inherit;
	background: var(--bg-primary); /* Variable defined in :root */
	color: var(--text-primary);
	transition: all 0.2s ease;
	appearance: none;
	-webkit-appearance: none;
}

.form-input:focus,
.form-textarea:focus {
	outline: none;
	border-color: var(--primary);
	box-shadow: 0 0 0 4px rgba(5, 150, 105, 0.15);
}

/* Phone Input Group (Fixed +998) */
.phone-input-group {
	display: flex;
	align-items: center;
	width: 100%;
	padding: 0 16px;
	border: 1.5px solid var(--border);
	border-radius: 16px;
	background: var(--bg-primary);
	transition: all 0.2s ease;
}

.phone-input-group:focus-within {
	border-color: var(--primary);
	box-shadow: 0 0 0 4px rgba(5, 150, 105, 0.15);
}

.phone-prefix {
	font-size: 16px;
	color: var(--text-primary);
	font-weight: 600;
	margin-right: 4px;
	user-select: none; /* Can't select/delete */
}

.form-input.phone-field {
	flex: 1;
	border: none !important;
	box-shadow: none !important;
	padding: 14px 0; /* Vertical padding matches regular input */
	background: transparent;
	padding-left: 4px;
}

/* Level Selector */
.level-selector {
	display: flex;
	gap: 8px;
}

.level-btn {
	flex: 1;
	padding: 12px;
	border: 1px solid var(--border);
	background: var(--bg-primary);
	border-radius: 12px;
	font-weight: 600;
	font-size: 14px;
	cursor: pointer;
	transition: all 0.2s;
	color: var(--text-primary);
}

.level-btn.active.level-1 {
	background: #059669;
	border-color: #059669;
	color: white;
}

.level-btn.active.level-2 {
	background: #fbbf24;
	border-color: #fbbf24;
	color: white;
}

.level-btn.active.level-3 {
	background: #ef4444;
	border-color: #ef4444;
	border-color: #ef4444;
	color: white;
}

/* Tag Selector */
.tag-selector {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.tag-btn {
	padding: 8px 14px;
	border: 1px solid var(--border);
	background: var(--bg-primary);
	border-radius: 20px;
	font-size: 13px;
	font-weight: 500;
	cursor: pointer;
	transition: all 0.2s;
	color: var(--text-primary);
}

.tag-btn.active {
	background: var(--primary);
	border-color: var(--primary);
	color: white;
}
.btn {
	padding: 10px 18px;
	border: none;
	border-radius: 12px;
	font-weight: 600;
	font-size: 14px;
	cursor: pointer;
	transition: all 0.2s;
	display: inline-flex;
	align-items: center;
	gap: 6px;
}

.btn-primary {
	background: var(--primary);
	color: white;
}

.btn-primary:hover {
	background: var(--primary-hover);
	transform: translateY(-1px);
}

.btn-primary:active {
	background: var(--primary-dark);
}

.btn-icon {
	position: fixed;
	width: 44px;
	height: 44px;
	border-radius: 50%;
	background: var(--bg-primary);
	border: 2px solid var(--border);
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	box-shadow: 0 2px 8px var(--shadow);
	transition: all 0.2s;
	z-index: 100; /* Match other button z-index */
	pointer-events: auto; /* Explicit click capture */
}

.btn-secondary {
	background: var(--bg-secondary);
	color: var(--text-primary);
}

/* Photo Upload */
.file-upload {
	border: 2px dashed var(--border);
	border-radius: 12px;
	padding: 24px;
	text-align: center;
	cursor: pointer;
	transition: all 0.2s;
	background: var(--bg-secondary);
}

.file-upload:hover {
	border-color: var(--primary);
}

.file-upload input {
	display: none;
}

/* Photo Grid */
.photo-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
	gap: 12px;
	margin: 16px 0;
	justify-content: center;
}

.photo-item {
	aspect-ratio: 1;
	border-radius: 12px;
	overflow: hidden;
	background: var(--bg-secondary);
}

.photo-item img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* Stats */
.stat-card {
	background: var(--bg-secondary);
	padding: 16px;
	border-radius: 12px;
	margin-bottom: 12px;
}

.stat-value {
	font-size: 28px;
	font-weight: 700;
	color: var(--primary);
}

.stat-label {
	font-size: 13px;
	color: var(--text-secondary);
	margin-top: 4px;
}

/* User Info */
.user-info {
	margin-bottom: 20px;
}

.user-name {
	font-size: 20px;
	font-weight: 600;
	margin-bottom: 4px;
}

.user-id {
	font-size: 14px;
	color: rgba(255, 255, 255, 0.8);
}

/* Photo Viewer */
.photo-viewer {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(0, 0, 0, 0.95);
	z-index: 10000; /* Max z-index */
	display: flex;
	justify-content: center;
	align-items: center;
	opacity: 0;
	visibility: hidden;
	transition: all 0.2s;
	backdrop-filter: blur(5px);
}

.photo-viewer.active {
	opacity: 1;
	visibility: visible;
}

.viewer-img {
	max-width: 100%;
	max-height: 90%;
	object-fit: contain;
	box-shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
}

.close-viewer {
	position: absolute;
	top: calc(44px + env(safe-area-inset-top) + 12px);
	right: 12px;
	width: 44px;
	height: 44px;
	background: rgba(255, 255, 255, 0.2);
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	z-index: 10001;
	color: white;
	font-size: 24px;
}

/* Loading Skeleton */
.photo-item.loading {
	background: var(--bg-secondary);
	display: flex;
	align-items: center;
	justify-content: center;
	border: 1px solid var(--border);
	position: relative;
	overflow: hidden;
}

.photo-item.loading::after {
	content: '';
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: linear-gradient(
		90deg,
		transparent,
		rgba(255, 255, 255, 0.05),
		transparent
	);
	animation: skeleton-shimmer 1.5s infinite;
}

@keyframes skeleton-shimmer {
	0% {
		transform: translateX(-100%);
	}
	100% {
		transform: translateX(100%);
	}
}

.spinner {
	width: 24px;
	height: 24px;
	border: 2px solid rgba(255, 255, 255, 0.1);
	border-left-color: var(--primary);
	border-radius: 50%;
	animation: spin 0.8s linear infinite;
	opacity: 0.5;
}

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

/* Debug styles moved to index.html for maximum reliability and priority */
/* Reports List Styles */
.reports-list {
	display: flex;
	flex-direction: column;
	gap: 16px;
	padding-bottom: 24px;
}

.report-card {
	background: var(--bg-secondary);
	border-radius: 16px;
	padding: 12px;
	display: flex;
	gap: 12px;
	align-items: center;
	border: 1px solid var(--border);
}

.report-thumb {
	width: 60px;
	height: 60px;
	border-radius: 12px;
	background-size: cover;
	background-position: center;
	background-color: var(--border);
	flex-shrink: 0;
}

.report-info {
	flex: 1;
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.report-date {
	font-size: 12px;
	color: var(--text-secondary);
}

.report-desc {
	font-size: 14px;
	font-weight: 500;
	color: var(--text-primary);
	display: -webkit-box;
	-webkit-line-clamp: 1;
	line-clamp: 1;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.status-badge {
	font-size: 11px;
	font-weight: 600;
	padding: 4px 8px;
	border-radius: 8px;
	text-transform: uppercase;
}

.status-badge.active {
	background: rgba(251, 191, 36, 0.1);
	color: #d97706;
}

.status-badge.cleaned {
	background: rgba(16, 185, 129, 0.1);
	color: #059669;
}

/* History List Styles */
.history-list {
	display: flex;
	flex-direction: column;
	gap: 12px;
	padding-bottom: 24px;
}

.history-item {
	background: var(--bg-secondary);
	border-radius: 16px;
	padding: 14px 16px;
	display: flex;
	justify-content: space-between;
	align-items: center;
	border: 1px solid var(--border);
}

.history-left {
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.history-title {
	font-size: 14px;
	font-weight: 600;
	color: var(--text-primary);
}

.history-date {
	font-size: 12px;
	color: var(--text-secondary);
}

.history-amount {
	font-size: 17px;
	font-weight: 700;
	color: #059669; /* Green for earnings */
}

/* Info Section Styles */
.info-sheet {
	padding: 0 4px 24px 4px;
	color: var(--text-primary);
}

.info-header-img {
	width: 100%;
	height: 160px;
	background: linear-gradient(135deg, #10b981 0%, #059669 100%);
	border-radius: 20px;
	margin-bottom: 20px;
	display: flex;
	align-items: center;
	justify-content: center;
	color: white;
	font-size: 64px;
	box-shadow: 0 8px 24px rgba(16, 185, 129, 0.2);
}

.info-card {
	background: var(--bg-secondary);
	border-radius: 20px;
	padding: 20px;
	margin-bottom: 16px;
	border: 1px solid var(--border);
}

.info-tag {
	display: inline-block;
	padding: 4px 12px;
	background: rgba(16, 185, 129, 0.1);
	color: #10b981;
	border-radius: 100px;
	font-size: 12px;
	font-weight: 700;
	margin-bottom: 12px;
	text-transform: uppercase;
	letter-spacing: 0.5px;
}

.info-title {
	font-size: 22px;
	font-weight: 800;
	margin-bottom: 12px;
	line-height: 1.2;
}

.info-text {
	font-size: 15px;
	line-height: 1.6;
	color: var(--text-secondary);
	margin-bottom: 16px;
}

.info-list {
	list-style: none;
	padding: 0;
	margin: 0;
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.info-list-item {
	display: flex;
	gap: 12px;
	align-items: flex-start;
}

.info-list-icon {
	width: 24px;
	height: 24px;
	background: #10b981;
	color: white;
	border-radius: 8px;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 14px;
	flex-shrink: 0;
	margin-top: 2px;
}

.info-contact-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	background: #22c55e;
	color: white;
	padding: 16px;
	border-radius: 16px;
	text-decoration: none;
	font-weight: 700;
	font-size: 16px;
	transition: transform 0.2s;
	margin-top: 10px;
}

.info-contact-btn:active {
	transform: scale(0.97);
}

/* Exchange Section Styles */
.exchange-list {
	display: flex;
	flex-direction: column;
	gap: 12px;
	padding-bottom: 24px;
}

.exchange-card {
	background: var(--bg-secondary);
	border-radius: 20px;
	padding: 16px;
	display: flex;
	justify-content: space-between;
	align-items: center;
	border: 1px solid var(--border);
	transition:
		transform 0.2s,
		border-color 0.2s;
}

.exchange-card:active {
	transform: scale(0.98);
	border-color: #10b981;
}

.exchange-info {
	display: flex;
	flex-direction: column;
	gap: 4px;
	flex: 1;
}

.exchange-types {
	font-size: 11px;
	font-weight: 700;
	color: #10b981;
	text-transform: uppercase;
	letter-spacing: 0.5px;
}

.exchange-desc {
	font-size: 15px;
	font-weight: 600;
	color: var(--text-primary);
	display: -webkit-box;
	-webkit-line-clamp: 1;
	line-clamp: 1;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.exchange-meta {
	font-size: 12px;
	color: var(--text-secondary);
	display: flex;
	align-items: center;
	gap: 8px;
}

.exchange-reward-badge {
	background: #10b981;
	color: white;
	padding: 6px 12px;
	border-radius: 12px;
	font-weight: 800;
	font-size: 14px;
	box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
}

/* Safety Guide Styles */
.safety-level-card {
	background: var(--bg-secondary);
	border-radius: 20px;
	padding: 20px;
	margin-bottom: 16px;
	border: 1px solid var(--border);
	transition: transform 0.2s;
}

.safety-level-header {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-bottom: 10px;
	font-size: 16px;
}

.safety-level-dot {
	width: 12px;
	height: 12px;
	border-radius: 50%;
}

.safety-level-desc {
	font-size: 14px;
	color: var(--text-secondary);
	line-height: 1.5;
	margin-bottom: 12px;
}

.safety-level-tools {
	font-size: 13px;
	background: var(--bg-primary);
	padding: 10px 14px;
	border-radius: 12px;
	border: 1px solid var(--border);
}

/* Level Specific Colors */
.safety-level-card.level-1 .safety-level-dot {
	background: #10b981;
	box-shadow: 0 0 10px rgba(16, 185, 129, 0.4);
}
.safety-level-card.level-2 .safety-level-dot {
	background: #f59e0b;
	box-shadow: 0 0 10px rgba(245, 158, 11, 0.4);
}
.safety-level-card.level-3 .safety-level-dot {
	background: #ef4444;
	box-shadow: 0 0 10px rgba(239, 68, 68, 0.4);
}
/* Air Quality Widget (Circular - Top Right Stack) */
.air-widget {
	position: absolute;
	right: 12px; /* Aligned with Balance Button */
	top: calc(
		44px + env(safe-area-inset-top) + 12px + 44px + 12px
	); /* Directly below Balance Button */
	z-index: 20; /* Matching other map controls like add-btn */
	width: 44px;
	height: 44px;
	border-radius: 9999px;
	background: var(--bg-primary);
	box-shadow: 0 2px 8px var(--shadow);
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	pointer-events: auto; /* Ensure clicks are captured */
	transition: all 0.2s;
	border: 2px solid transparent; /* Prepare for status border */
}

.air-widget:active {
	transform: scale(0.95);
}

.air-value {
	font-size: 13px; /* Slightly smaller to fit circle */
	font-weight: 800;
	color: var(--text-primary);
}

/* Status Colors (Border & Text) */
.air-good {
	border-color: #10b981 !important;
}
.air-moderate {
	border-color: #f59e0b !important;
}
.air-bad {
	border-color: #ef4444 !important;
}

.air-good .air-value {
	color: #10b981;
}
.air-moderate .air-value {
	color: #f59e0b;
}
.air-bad .air-value {
	color: #ef4444;
}

/* Global Blocking Overlay (Location Denial) */
.global-overlay {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 9000;
	background: rgba(17, 24, 39, 0.4); /* Dark translucent */
	backdrop-filter: blur(20px) saturate(180%);
	-webkit-backdrop-filter: blur(20px) saturate(180%);
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px;
	transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.global-overlay.hidden {
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transform: scale(1.1);
}

.overlay-content {
	background: var(--bg-primary);
	width: 100%;
	max-width: 340px;
	padding: 40px 24px;
	border-radius: 32px;
	text-align: center;
	position: relative;
	overflow: hidden;
	border: 1px solid var(--border);
	box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
}

.overlay-glow {
	position: absolute;
	top: -50%;
	left: -50%;
	width: 200%;
	height: 200%;
	background: radial-gradient(
		circle at center,
		rgba(5, 150, 105, 0.15) 0%,
		transparent 50%
	);
	pointer-events: none;
}

.overlay-icon {
	width: 80px;
	height: 80px;
	background: var(--primary);
	color: white;
	border-radius: 24px;
	display: flex;
	align-items: center;
	justify-content: center;
	margin: 0 auto 24px;
	box-shadow: 0 10px 25px rgba(5, 150, 105, 0.4);
	transform: rotate(-5deg);
}

.overlay-title {
	font-size: 24px;
	font-weight: 800;
	color: var(--text-primary);
	margin-bottom: 12px;
}

.overlay-text {
	font-size: 15px;
	line-height: 1.6;
	color: var(--text-secondary);
	margin-bottom: 32px;
}

.btn-overlay {
	width: 100%;
	padding: 16px;
	background: var(--primary);
	color: white;
	border: none;
	border-radius: 16px;
	font-size: 16px;
	font-weight: 700;
	cursor: pointer;
	box-shadow: 0 8px 20px rgba(5, 150, 105, 0.3);
	transition: all 0.2s;
}

.btn-overlay:active {
	transform: scale(0.96);
	background: var(--primary-dark);
}

#offline-overlay {
	z-index: 2100000 !important;
}

/* Map Loading Overlay - Pure Shimmer */
.map-loading-overlay {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: var(--map-bg);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 1000;
	overflow: hidden;
	transition:
		opacity 1s cubic-bezier(0.4, 0, 0.2, 1),
		visibility 1s;
}

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

/* Premium Shimmer Wave Animation */
.shimmer-wave {
	position: absolute;
	top: 0;
	left: -150%;
	width: 300%;
	height: 100%;
	background: linear-gradient(
		to right,
		transparent 0%,
		rgba(255, 255, 255, 0.05) 45%,
		rgba(255, 255, 255, 0.1) 50%,
		rgba(255, 255, 255, 0.05) 55%,
		transparent 100%
	);
	animation: shimmer 2s infinite linear;
}

[data-theme='light'] .shimmer-wave {
	background: linear-gradient(
		to right,
		transparent 0%,
		rgba(0, 0, 0, 0.03) 45%,
		rgba(0, 0, 0, 0.06) 50%,
		rgba(0, 0, 0, 0.03) 55%,
		transparent 100%
	);
}

@keyframes shimmer {
	0% {
		transform: translateX(-50%);
	}
	100% {
		transform: translateX(50%);
	}
}

/* Ghost Marker (Temporary feedback for cleaned items) */
.pollution-marker.ghost {
	pointer-events: none;
	z-index: 5000 !important;
}

.pollution-marker.ghost .pollution-marker-inner {
	background: var(--primary) !important;
	box-shadow: 0 0 35px var(--primary);
	border: 3px solid white;
	animation: ghost-fade-inner 5s forwards cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes ghost-fade-inner {
	0% {
		transform: scale(0.5);
		opacity: 0;
	}
	15% {
		transform: scale(1.8);
		opacity: 0.9;
	}
	30% {
		transform: scale(1);
		opacity: 0.8;
	}
	80% {
		transform: scale(1);
		opacity: 0.8;
	}
	100% {
		transform: scale(0.6);
		opacity: 0;
	}
}

.loader-container {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 16px;
}

.premium-spinner {
	width: 48px;
	height: 48px;
	border: 4px solid var(--border);
	border-top: 4px solid var(--primary);
	border-radius: 50%;
	animation: spin 1s linear infinite;
	box-shadow: 0 0 15px rgba(16, 185, 129, 0.2);
}

.loading-text {
	font-size: 14px;
	font-weight: 600;
	color: var(--text-secondary);
	letter-spacing: 0.5px;
}

@keyframes spin {
	0% {
		transform: rotate(0deg);
	}
	100% {
		transform: rotate(360deg);
	}
}

/* Interactive Tour Styles */
.tour-overlay {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: rgba(0, 0, 0, 0.4);
	z-index: 10000;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.3s;
	backdrop-filter: blur(2px);
}
.tour-overlay.active {
	opacity: 1;
	pointer-events: auto;
}
.tour-spotlight {
	position: fixed;
	z-index: 10001;
	border-radius: 12px;
	box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.4);
	pointer-events: auto; /* Changed from none to block clicks to target */
	transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
	border: 2px solid var(--primary);
}
/* Ensure nothing else is clickable when tour is active */
body.tour-active {
	pointer-events: none;
}
body.tour-active #tour-overlay,
body.tour-active #tour-tooltip,
body.tour-active .tour-spotlight {
	pointer-events: auto;
}
.tour-tooltip {
	position: fixed;
	z-index: 10002;
	width: 300px; /* Increased from 280px */
	left: 50%;
	top: 50%;
	transform: translate(-50%, -50%);
	background: var(--bg-card);
	border: 1px solid var(--border);
	border-radius: 20px;
	padding: 24px;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
	opacity: 0;
	pointer-events: none;
	transition:
		opacity 0.3s,
		transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
	color: var(--text-main);
}
.tour-tooltip.active {
	opacity: 1;
	pointer-events: auto;
}
.tour-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 12px;
}
#tour-title {
	font-weight: 800;
	font-size: 18px;
	color: var(--primary);
}
.tour-close {
	background: none;
	border: none;
	font-size: 24px;
	color: var(--text-muted);
	cursor: pointer;
	padding: 0;
	line-height: 1;
}
.tour-body {
	font-size: 15px;
	line-height: 1.5;
	margin-bottom: 20px;
	color: var(--text-main);
}
.tour-footer {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 10px;
	margin-top: 4px;
}
.tour-dots {
	display: flex;
	gap: 4px;
	flex-shrink: 0;
}
.tour-dot {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: var(--border);
	transition: all 0.2s;
}
.tour-dot.active {
	background: var(--primary);
	transform: scale(1.3);
}
.tour-btns {
	display: flex;
	gap: 4px; /* Reduced gap */
	flex: 1;
	min-width: 0;
	justify-content: flex-end;
}
.btn-tour-solid,
.btn-tour-outline {
	white-space: nowrap;
	flex: 0 0 auto; /* Do not shrink */
	min-width: 0;
}
.btn-tour-solid {
	background: var(--primary);
	color: white;
	border: none;
	padding: 8px 16px;
	border-radius: 10px;
	font-weight: 700;
	font-size: 13px;
	cursor: pointer;
}
.btn-tour-outline {
	background: transparent;
	border: 1px solid var(--border);
	color: var(--text-main);
	padding: 8px 16px;
	border-radius: 10px;
	font-weight: 700;
	font-size: 13px;
	cursor: pointer;
}

/* --- STABILITY FIXES v2.2 --- */

/* Fix Bottom Sheet Jitter */
.sheet-content {
	width: 100%;
	position: relative;
	display: flex;
	flex-direction: column;
}

/* Empty State Styling (Global) */
.empty-state {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: 60px 20px;
	text-align: center;
	flex: 1;
	min-height: 300px; /* Force panel to stay a bit taller even if empty */
}

.empty-icon {
	font-size: 56px;
	margin-bottom: 20px;
	filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.1));
	animation: floatIcon 3s ease-in-out infinite;
}

@keyframes floatIcon {
	0%,
	100% {
		transform: translateY(0);
	}
	50% {
		transform: translateY(-10px);
	}
}

.empty-title {
	font-size: 18px;
	font-weight: 700;
	color: var(--text-primary);
	margin-bottom: 8px;
}

.empty-text {
	font-size: 14px;
	color: var(--text-secondary);
	max-width: 260px;
	line-height: 1.5;
	margin: 0 auto;
}

/* Ensure sheets that are NOT empty also fill space nicely */
.reports-list,
.history-list,
.exchange-list {
	flex: 1;
}

/* Improve loader visibility */
.loader-small {
	width: 24px;
	height: 24px;
	border: 3px solid var(--border);
	border-top-color: var(--primary);
	border-radius: 50%;
	animation: spin 0.8s linear infinite;
}

/* Overlays (Global) */
.overlay,
.tour-overlay,
.photo-viewer,
.onboarding,
.global-overlay {
	transition:
		opacity 0.3s ease,
		visibility 0.3s ease;
	will-change: opacity, visibility;
}

/* Ensure they are hidden correctly without display:none if possible, 
   but main.js might toggle active class which sets opacity/vis */
.overlay:not(.active),
.tour-overlay:not(.active),
.photo-viewer:not(.active) {
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
}

.overlay.active,
.tour-overlay.active,
.photo-viewer.active {
	opacity: 1;
	visibility: visible;
	pointer-events: auto;
}

/* Button Press Effects */
button,
.btn,
.menu-item,
.action-btn {
	transition:
		transform 0.1s ease,
		background-color 0.2s ease;
}
button:active,
.btn:active,
.menu-item:active,
.action-btn:active {
	transform: scale(0.96);
}

/* --- SKELETON LOADING v2.2 --- */
.skeleton {
	background: linear-gradient(
		90deg,
		var(--bg-secondary) 25%,
		var(--border) 50%,
		var(--bg-secondary) 75%
	);
	background-size: 200% 100%;
	animation: skeleton-loading 1.5s infinite;
	border-radius: 8px;
	width: 100%;
}

@keyframes skeleton-loading {
	0% {
		background-position: 200% 0;
	}
	100% {
		background-position: -200% 0;
	}
}

.skeleton-text {
	height: 16px;
	margin-bottom: 8px;
}
.skeleton-title {
	height: 24px;
	width: 60%;
	margin-bottom: 12px;
}
.skeleton-card {
	background: var(--bg-secondary);
	border: 1px solid var(--border);
	border-radius: 16px;
	padding: 16px;
	margin-bottom: 12px;
	display: flex;
	flex-direction: column;
	gap: 8px;
}
/* Fixed Height Containers to prevent jump */
.sheet-min-height {
	flex: 1;
	display: flex;
	flex-direction: column;
}
