/* CSS Variables for Theme */
:root {
	/* Light theme colors */
	--bg-primary: #f5f5f5;
	--bg-secondary: #ffffff;
	--bg-tertiary: #f8fafc;
	--text-primary: #333;
	--text-secondary: #1e293b;
	--text-muted: #64748b;
	--border-color: #e2e8f0;
	--border-subtle: #cbd5e1;
	--input-bg: #ffffff;
	--panel-bg: #ffffff;
	--card-bg: #ffffff;
	--card-hover: #f1f5f9;
	--gradient-start: #b6cdff;
	--gradient-end: #3770ec;
	--accent-primary: #2563eb;
	--accent-hover: #1d4ed8;
	--accent-light: #93c5fd;
	--highlight-gradient-start: #84fab0;
	--highlight-gradient-end: #8fd3f4;
	--success-bg: rgba(34, 197, 94, 0.3);
	--success-border: rgba(34, 197, 94, 0.6);
	--success-text: #16a34a;
	--error-bg: rgba(239, 68, 68, 0.3);
	--error-border: rgba(239, 68, 68, 0.6);
	--error-text: #dc2626;
	--text-on-gradient: white;
	--scrollbar-track: #f1f1f1;
	--scrollbar-thumb: #c1c1c1;
	--scrollbar-thumb-hover: #a1a1a1;
}

/* Dark theme colors */
.dark-theme {
	--bg-primary: #0f172a;
	--bg-secondary: #1e293b;
	--bg-tertiary: #334155;
	--text-primary: #e2e8f0;
	--text-secondary: #f1f5f9;
	--text-muted: #94a3b8;
	--border-color: #334155;
	--border-subtle: #475569;
	--input-bg: #2e4c7d;
	--panel-bg: #1e293b;
	--card-bg: #1e293b;
	--card-hover: #334155;
	--gradient-start: #134eac;
	--gradient-end: #001d4b;
	--accent-primary: #3b82f6;
	--accent-hover: #2563eb;
	--accent-light: #60a5fa;
	--highlight-gradient-start: #10b981;
	--highlight-gradient-end: #06b6d4;
	--success-bg: rgba(34, 197, 94, 0.2);
	--success-border: rgba(34, 197, 94, 0.4);
	--success-text: #22c55e;
	--error-bg: rgba(239, 68, 68, 0.2);
	--error-border: rgba(239, 68, 68, 0.4);
	--error-text: #ef4444;
	--text-on-gradient: white;
	--scrollbar-track: #1e293b;
	--scrollbar-thumb: #475569;
	--scrollbar-thumb-hover: #64748b;
}

* {
	font-family: 'Twemoji Country Flags', sans-serif;
	margin: 0;
	padding: 0;
	box-sizing: border-box;
}

body {
	font-family:
		-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu,
		sans-serif;
	background: linear-gradient(
		135deg,
		var(--gradient-start) 0%,
		var(--gradient-end) 100%
	);
	background-attachment: fixed;
	color: var(--text-primary);
	line-height: 1.6;
	transition:
		background-color 0.3s ease,
		background-image 0.3s ease,
		color 0.3s ease;
}

/* Ensure hidden attribute works */
[hidden] {
	display: none !important;
}

/* Initial centered view */
.initial-view {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 100vh;
	padding: 20px;
	position: relative;
	overflow: hidden;
}

.initial-content {
	width: 100%;
	max-width: 700px;
	text-align: center;
}

.centered-header h1 {
	display: none;
	font-size: 3.5rem;
	font-weight: 800;
	color: white;
	margin-bottom: 12px;
	text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.initial-logo {
	bottom: -0.65rem;
	left: 1.9rem;
	position: relative;
}

.logo {
	width: 70%;
	max-width: 20rem;
	height: auto;
	display: block;
}

.logo-dot {
	fill: var(--input-bg);
}

.header-logo-link,
.header-logo-link:visited,
.header-logo-link:hover {
	color: var(--text-primary);
}

.centered-header .subtitle {
	font-size: 1.1rem;
	color: rgba(255, 255, 255, 0.9);
	margin-bottom: 40px;
}

/* Initial view footer */
.initial-footer {
	margin-top: 40px;
}

.initial-footer a {
	color: rgba(255, 255, 255, 0.8);
	text-decoration: none;
	font-size: 0.9rem;
	transition: color 0.2s;
}

.initial-footer a:hover {
	color: white;
	text-decoration: underline;
}

.centered-form .input-group {
	display: flex;
	gap: 12px;
	background: var(--input-bg);
	transition: background-color 0.3s ease-in-out;
	padding: 8px;
	border-radius: 32px;
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
	flex-direction: column;
}

@media (min-width: 769px) {
	.centered-form .input-group {
		border-radius: 50px;
		flex-direction: row;
	}
}

.centered-form #url-input {
	flex: 1;
	padding: 16px 24px;
	border: none;
	border-radius: 50px;
	font-size: 1rem;
	background: transparent;
	color: var(--text-primary);
}

.centered-form #url-input::placeholder {
	color: var(--text-muted);
}

.centered-form #url-input:focus {
	outline: none;
}

.centered-form .btn-group {
	display: flex;
	gap: 8px;
	align-items: stretch;
	width: 100%;
}

@media (min-width: 769px) {
	.centered-form .btn-group {
		width: auto;
	}
}

.centered-form #submit-btn {
	padding: 16px 32px;
	background: var(--accent-primary);
	color: white;
	border: none;
	border-radius: 50px;
	font-size: 1rem;
	font-weight: 600;
	cursor: pointer;
	transition: all 0.2s;
	white-space: nowrap;
	flex: 1;
}

.centered-form #submit-btn:hover {
	background: var(--accent-hover);
	transform: scale(1.05);
}

.centered-form #submit-btn:disabled {
	background: var(--accent-light);
	cursor: not-allowed;
	transform: none;
}

.cancel-btn {
	background: var(--error-text);
	color: white;
	border: none;
	border-radius: 50px;
	cursor: pointer;
	transition: all 0.2s;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	padding: 16px;
	min-width: 56px;
}

.cancel-btn:hover {
	filter: brightness(0.85);
	transform: scale(1.05);
}

/* Location tags */
.location-tags {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	justify-content: center;
	margin-top: 30px;
	padding: 20px;
	max-width: 800px;
	margin-left: auto;
	margin-right: auto;
}

.location-tag {
	background: rgba(255, 255, 255, 0.2);
	backdrop-filter: blur(10px);
	border: 2px solid rgba(255, 255, 255, 0.3);
	color: white;
	padding: 12px 20px;
	border-radius: 25px;
	font-size: 0.95rem;
	font-weight: 500;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	transition: all 0.3s ease;
	animation: tagAppear 0.3s ease-out;
}

@keyframes tagAppear {
	from {
		opacity: 0;
		transform: scale(0.8) translateY(-10px);
	}
	to {
		opacity: 1;
		transform: scale(1) translateY(0);
	}
}

.location-tag.pending {
	animation: pulse 1.5s ease-in-out infinite;
}

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

.location-tag.success {
	background: var(--success-bg);
	border-color: var(--success-border);
	animation: successPop 0.4s ease-out;
}

@keyframes successPop {
	0% {
		transform: scale(1);
	}
	50% {
		transform: scale(1.15);
	}
	100% {
		transform: scale(1);
	}
}

.location-tag.failed {
	background: var(--error-bg);
	border-color: var(--error-border);
	opacity: 0.6;
	text-decoration: line-through;
}

.location-tag .emoji {
	font-size: 1.3rem;
}

/* Main view with header and map */
.main-view {
	display: flex;
	flex-direction: column;
	height: 100vh;
	position: relative;
}

/* Purple header */
.map-header {
	padding: 16px 24px;
	z-index: 1000;
}

/* Mobile: stack header content vertically */
.header-content {
	max-width: 1200px;
	margin: 0 auto;
	display: flex;
	flex-direction: column;
	align-items: stretch;
	gap: 12px;
}

.map-header h1 {
	font-size: 1.25rem;
	font-weight: 700;
	color: white;
	margin: 0;
	white-space: nowrap;
	text-align: center;
}

@media (min-width: 769px) {
	.header-content {
		flex-direction: row;
		align-items: center;
		gap: 24px;
	}

	.map-header h1 {
		font-size: 1.5rem;
		text-align: left;
	}
}

.header-content .logo {
	width: 8rem;
	height: auto;
	display: block;
	margin: 0;
}

.header-form {
	flex: 1;
	display: flex;
	max-width: none;
}

@media (min-width: 769px) {
	.header-form {
		max-width: 600px;
	}
}

.header-input-group {
	display: flex;
	gap: 8px;
	background: rgba(255, 255, 255, 0.2);
	padding: 6px;
	border-radius: 50px;
	flex: 1;
	backdrop-filter: blur(10px);
}

@media (min-width: 769px) {
	.header-input-group {
		background: var(--input-bg);
	}
}

.header-form #url-input-header {
	flex: 1;
	padding: 10px 18px;
	border: none;
	border-radius: 50px;
	font-size: 0.95rem;
	background: transparent;
	color: var(--text-primary);
	min-width: 0;
}

.header-form #url-input-header::placeholder {
	color: var(--text-muted);
}

.header-form #url-input-header:focus {
	outline: none;
}

.header-form #submit-btn-header {
	padding: 10px 20px;
	background: var(--accent-primary);
	color: white;
	border: none;
	border-radius: 50px;
	font-size: 0.95rem;
	font-weight: 600;
	cursor: pointer;
	transition: all 0.2s;
	white-space: nowrap;
	flex-shrink: 0;
}

.header-form #submit-btn-header:hover {
	background: var(--accent-hover);
	transform: scale(1.02);
}

/* Content area - contains article panel and map */
.content-area {
	flex: 1;
	position: relative;
	overflow: hidden;
}

.about-container {
	max-width: 700px;
	margin: 0 auto;
}

.about-header {
	text-align: center;
	margin-top: 40px;
}

.about-header h1 {
	font-size: 2.5rem;
	font-weight: 800;
	color: white;
	margin-bottom: 8px;
	text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.about-header .back-link {
	color: rgba(255, 255, 255, 0.9);
	text-decoration: none;
	font-size: 0.95rem;
}

.about-header .back-link:hover {
	text-decoration: underline;
}

.about-card {
	background: var(--card-bg);
	border-radius: 32px;
	padding: 32px;
	margin-bottom: 24px;
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
}

.about-card h2 {
	font-size: 1.5rem;
	font-weight: 700;
	color: var(--text-secondary);
	margin-bottom: 16px;
	padding-bottom: 12px;
	border-bottom: 2px solid var(--border-color);
}

.about-card p {
	color: var(--text-muted);
	line-height: 1.8;
	margin-bottom: 16px;
}

.about-card p:last-child {
	margin-bottom: 0;
}

.about-card ul {
	color: var(--text-muted);
	line-height: 1.8;
	margin: 16px 0;
	padding-left: 24px;
}

.about-card li {
	margin-bottom: 8px;
}

.about-card a {
	color: var(--accent-primary);
	text-decoration: none;
}

.about-card a:hover {
	text-decoration: underline;
}

.about-card h3 {
	font-size: 1.1rem;
	font-weight: 600;
	color: var(--text-secondary);
	margin-top: 24px;
	margin-bottom: 12px;
}

.about-card h3:first-of-type {
	margin-top: 0;
}

/* Fullscreen map container */
.map-container-full {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	width: 100%;
	height: 100%;
	z-index: 1;
}

#map {
	width: 100%;
	height: 100%;
}

/* Fullscreen globe container */
.globe-container-full {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	width: 100%;
	height: 100%;
	z-index: 1;
}

#main-globe {
	width: 100%;
	height: 100%;
	--globe-land-fill: #444;
	--globe-land-stroke: #000;
	--globe-land-stroke-width: 0.5;
	--globe-land-opacity: 0.2;
}

/* Homepage globe - hidden on mobile, shown on desktop */
.homepage-globe-container {
	position: absolute;
	top: 40vh;
	left: 0;
	right: 0;
	height: 90vw;
	pointer-events: none;
	z-index: 0;
	overflow: hidden;
	opacity: 0.3;
	display: none;
}

@media (min-width: 769px) {
	.homepage-globe-container {
		display: block;
	}
}

#homepage-globe {
	width: 100%;
	height: 100%;
	--globe-land-fill: #000000;
	--globe-land-stroke: #333333;
	--globe-land-stroke-width: 0.5;
	--globe-land-opacity: 0.4;
}

.initial-content {
	position: relative;
	z-index: 1;
}

/* Toggle view button */
.toggle-view-btn {
	background: rgba(255, 255, 255, 0.15);
	backdrop-filter: blur(10px);
	border: 1px solid rgba(255, 255, 255, 0.2);
	color: white;
	padding: 8px 16px;
	border-radius: 8px;
	cursor: pointer;
	transition: all 0.2s ease;
	display: flex;
	align-items: center;
	gap: 6px;
	font-size: 0.9rem;
	font-weight: 500;
}

.toggle-view-btn:hover {
	background: rgba(255, 255, 255, 0.25);
	transform: translateY(-1px);
}

.toggle-view-btn .view-icon {
	font-size: 1.1rem;
}

.toggle-view-btn .view-label {
	display: none;
}

@media (min-width: 640px) {
	.toggle-view-btn .view-label {
		display: inline;
	}
}

/* Toggle article button in header */
.toggle-article-btn {
	padding: 10px 16px;
	background: rgba(255, 255, 255, 0.2);
	color: white;
	border: 1px solid rgba(255, 255, 255, 0.3);
	border-radius: 8px;
	font-size: 0.9rem;
	font-weight: 500;
	cursor: pointer;
	white-space: nowrap;
	transition: all 0.2s;
}

.toggle-article-btn:hover {
	background: rgba(255, 255, 255, 0.3);
}

/* Shared utility class for fixed icon buttons */
.icon-btn {
	position: fixed;
	width: 36px;
	height: 36px;
	border-radius: 8px;
	background: rgba(255, 255, 255, 0.2);
	border: 1px solid rgba(255, 255, 255, 0.3);
	color: white;
	padding: 8px;
	cursor: pointer;
	transition: all 0.2s;
	display: flex;
	align-items: center;
	justify-content: center;
	text-decoration: none;
}

.icon-btn:hover {
	background: rgba(255, 255, 255, 0.3);
	transform: scale(1.05);
}

.icon-btn svg {
	display: block;
	width: 20px;
	height: 20px;
}

/* Header about link - styled as button at top-right */
.header-about-link {
	top: 20px;
	right: 68px; /* 20px (margin) + 36px (theme button width) + 12px (gap) */
	z-index: 1001;
}

/* Article panel — mobile-first: full-screen overlay, hidden by default */
.article-panel {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	width: 100%;
	background: var(--panel-bg);
	display: none;
	flex-direction: column;
	overflow: hidden;
	z-index: 10;
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

/* Desktop: positioned floating panel */
@media (min-width: 769px) {
	.article-panel {
		left: 1rem;
		top: 1rem;
		bottom: 1rem;
		right: auto;
		width: 33.33%;
		max-width: 500px;
		border: 1px solid var(--border-color);
		border-radius: 1rem;
		display: flex;
		transition:
			transform 0.3s ease,
			opacity 0.3s ease;
	}

	.article-panel.hidden {
		transform: translateX(calc(-100% - 1rem));
		opacity: 0;
		pointer-events: none;
	}
}

/* Show article panel by default on large desktops (1400px+) */
@media (min-width: 1400px) {
	.article-panel {
		display: flex !important;
	}

	.toggle-article-btn {
		display: none !important;
	}
}

.article-panel-header {
	padding: 12px 16px;
	border-bottom: 1px solid var(--border-color);
	display: flex;
	flex-direction: column;
	gap: 8px;
	background: var(--bg-tertiary);
}

@media (min-width: 769px) {
	.article-panel-header {
		padding: 16px 20px;
	}
}

.article-header-top {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
}

.article-source-info {
	display: flex;
	align-items: center;
	gap: 8px;
	flex: 1;
	min-width: 0;
}

.article-favicon {
	width: 16px;
	height: 16px;
	object-fit: contain;
	flex-shrink: 0;
}

.article-hostname {
	font-size: 0.875rem;
	color: var(--text-muted);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.article-source-link {
	color: var(--accent-primary);
	font-size: 0.8rem;
	text-decoration: none;
	display: inline-block;
	margin-bottom: 4px;
}

@media (min-width: 769px) {
	.article-source-link {
		font-size: 0.85rem;
	}
}

.article-source-link:hover {
	text-decoration: underline;
}

.article-panel-header h3 {
	font-size: 0.95rem;
	font-weight: 600;
	margin: 0;
	color: var(--text-secondary);
	word-wrap: break-word;
	overflow-wrap: break-word;
}

@media (min-width: 769px) {
	.article-panel-header h3 {
		font-size: 1rem;
	}
}

.close-article-btn {
	background: none;
	border: none;
	font-size: 1.5rem;
	color: var(--text-muted);
	cursor: pointer;
	padding: 0 4px;
	line-height: 1;
	transition: color 0.2s;
}

.close-article-btn:hover {
	color: var(--text-secondary);
}

.article-panel-content {
	flex: 1;
	overflow-y: auto;
	padding: 0;
	font-size: 0.95rem;
	line-height: 1.8;
	color: var(--text-primary);
}

.article-og-image {
	width: 100%;
	max-height: 300px;
	object-fit: cover;
	display: block;
	margin-bottom: 20px;
}

.article-text {
	padding: 0 20px 20px 20px;
	white-space: pre-wrap;
	word-wrap: break-word;
}

.location-highlight {
	background: linear-gradient(
		120deg,
		var(--highlight-gradient-start) 0%,
		var(--highlight-gradient-end) 100%
	);
	background-size: 100% 40%;
	background-position: 0 85%;
	background-repeat: no-repeat;
	padding: 2px 4px;
	border-radius: 3px;
	cursor: pointer;
	transition: all 0.2s ease;
	font-weight: 500;
	color: var(--text-secondary);
}

.location-highlight:hover {
	background-size: 100% 100%;
	background-position: 0 0;
	color: var(--text-primary);
	text-decoration: underline;
}

/* Locations sidebar — mobile-first: full-screen overlay, hidden by default */
.locations-sidebar {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	width: 100%;
	background: var(--panel-bg);
	display: none;
	flex-direction: column;
	overflow: hidden;
	z-index: 10;
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

/* Desktop: positioned floating panel */
@media (min-width: 769px) {
	.locations-sidebar {
		right: 1rem;
		top: 1rem;
		bottom: 1rem;
		left: auto;
		width: 320px;
		border: 1px solid var(--border-color);
		border-radius: 1rem;
		display: flex;
		transition:
			transform 0.3s ease,
			opacity 0.3s ease;
	}

	.locations-sidebar.hidden {
		transform: translateX(calc(100% + 1rem));
		opacity: 0;
		pointer-events: none;
	}
}

.sidebar-header {
	padding: 16px 20px;
	border-bottom: 1px solid var(--border-color);
	background: var(--bg-tertiary);
	display: flex;
	align-items: center;
	justify-content: space-between;
}

.sidebar-header h3 {
	font-size: 1rem;
	font-weight: 600;
	margin: 0;
	color: var(--text-secondary);
}

.close-sidebar-btn {
	background: none;
	border: none;
	font-size: 1.5rem;
	color: var(--text-muted);
	cursor: pointer;
	padding: 0;
	width: 30px;
	height: 30px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 4px;
	transition: all 0.2s;
}

.close-sidebar-btn:hover {
	background: var(--card-hover);
	color: var(--text-primary);
}

/* Shared FAB (Floating Action Button) utility class */
.fab-btn {
	position: fixed;
	background: var(--accent-primary);
	border: none;
	width: 56px;
	height: 56px;
	border-radius: 50%;
	font-size: 1.5rem;
	cursor: pointer;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
	transition: all 0.2s;
	z-index: 999;
	display: flex;
	align-items: center;
	justify-content: center;
}

.fab-btn:hover {
	background: var(--accent-hover);
	transform: scale(1.05);
}

/* Reopen sidebar button */
.reopen-sidebar-btn {
	/* Mobile: bottom-center */
	bottom: 5rem;
	left: 50%;
	transform: translateX(-50%);
}

.reopen-sidebar-btn:hover {
	transform: translateX(-50%) scale(1.05);
}

/* Desktop: bottom-right, slides in from the right */
@keyframes fab-slide-in-right {
	from {
		transform: translateX(80px);
		opacity: 0;
	}
	to {
		transform: none;
		opacity: 1;
	}
}

@media (min-width: 769px) {
	.reopen-sidebar-btn {
		bottom: 2rem;
		right: 2rem;
		left: auto;
		transform: none;
	}

	.reopen-sidebar-btn:hover {
		transform: scale(1.05);
	}

	.reopen-sidebar-btn:not([hidden]) {
		animation: fab-slide-in-right 0.25s ease 0.2s backwards;
	}

	.leaflet-top.leaflet-left {
		top: 0.5rem;
		left: calc(
			min(33%, 500px) + 2rem
		); /* Account for article panel width + margin */
		transition: left 0.3s ease;
	}

	#main-view:has(.article-panel.hidden) .leaflet-top.leaflet-left {
		left: 1rem; /* Move controls to left edge when article panel is hidden */
	}
}

/* Reopen article button - hidden on mobile (accessible via tab bar) */
.reopen-article-btn {
	display: none;
}

/* Desktop: bottom-left, slides in from the left */
@keyframes fab-slide-in-left {
	from {
		transform: translateX(-80px);
		opacity: 0;
	}
	to {
		transform: none;
		opacity: 1;
	}
}

@media (min-width: 769px) {
	.reopen-article-btn {
		bottom: 2rem;
		left: 2rem;
		display: flex;
	}

	.reopen-article-btn:not([hidden]) {
		animation: fab-slide-in-left 0.25s ease 0.2s backwards;
	}
}

.sidebar-content {
	flex: 1;
	overflow-y: auto;
	padding: 12px;
}

.sidebar-content ul {
	list-style: none;
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.sidebar-content li {
	background: var(--card-bg);
	border: 1px solid var(--border-color);
	color: var(--text-secondary);
	padding: 12px 14px;
	border-radius: 8px;
	font-size: 0.9rem;
	cursor: pointer;
	transition: all 0.2s;
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.sidebar-content li:hover {
	background: var(--card-hover);
	border-color: var(--accent-primary);
}

/* Mobile tab bar - shown on mobile, hidden on desktop */
.mobile-tab-bar {
	display: flex;
	position: fixed;
	bottom: 0;
	left: 0;
	right: 0;
	background: var(--panel-bg);
	border-top: 1px solid var(--border-color);
	box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
	z-index: 1000;
	padding: 8px 0;
	padding-bottom: max(8px, env(safe-area-inset-bottom));
}

@media (min-width: 769px) {
	/* Hide desktop toggle button and about link on mobile */
	.toggle-article-btn,
	.header-about-link {
		display: flex !important;
	}

	/* Hide mobile tab bar on desktop */
	.mobile-tab-bar {
		display: none;
	}
}

.tab-btn {
	flex: 1;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 4px;
	background: none;
	border: none;
	padding: 8px;
	color: var(--text-muted);
	cursor: pointer;
	transition: color 0.2s;
}

.tab-btn.active {
	color: var(--accent-primary);
}

.tab-icon {
	font-size: 1.25rem;
}

.tab-label {
	font-size: 0.7rem;
	font-weight: 500;
}

/* Location header - contains flag, name, and type on one line */
.location-header {
	display: flex;
	align-items: center;
	gap: 8px;
	min-width: 0; /* Allow flex children to shrink below content size */
}

.location-emoji {
	font-size: 1.2rem;
	flex-shrink: 0; /* Prevent emoji from shrinking */
}

.location-name {
	flex: 1; /* Take up available space */
	min-width: 0; /* Allow text truncation */
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	font-weight: 600;
}

.location-type {
	flex-shrink: 0; /* Prevent badge from shrinking */
	font-size: 0.5rem;
	line-height: 0.7rem;
	font-weight: 500;
	background: var(--border-color);
	padding: 0.2rem 0.3rem;
	border-radius: 0.3rem;
	text-transform: uppercase;
	letter-spacing: 0.02em;
}

.location-context {
	font-size: 0.8rem;
	color: var(--text-muted);
	font-style: italic;
	line-height: 1.4;
	margin-top: 2px;
}

.locations-list li.pending {
	background: var(--bg-tertiary);
	border-color: var(--border-subtle);
	opacity: 0.7;
}

.locations-list li.pending .location-name {
	color: var(--text-muted);
}

.locations-list li.failed {
	background: var(--error-bg);
	border-color: var(--error-border);
	opacity: 0.6;
}

.locations-list li.failed .location-name {
	color: var(--text-muted);
	text-decoration: line-through;
}

/* Article Content */
.article-content {
	flex: 1;
	overflow-y: auto;
}

#article-title {
	font-size: 1.25rem;
	font-weight: 600;
	margin-bottom: 16px;
	color: var(--text-secondary);
}

#article-text {
	font-size: 0.95rem;
	color: var(--text-primary);
	max-height: 400px;
	overflow-y: auto;
	padding-right: 8px;
}

#article-text p {
	margin-bottom: 12px;
}

/* Map Container */
.map-container {
	flex: 1;
	position: relative;
}

#map {
	width: 100%;
	height: 100%;
}

/* Mobile tab system — controls panel visibility via data-active-tab attribute.
   Must stay as max-width query because data-active-tab is also set on desktop
   (where panels are controlled by the toggle-panel component instead). */
@media (max-width: 768px) {
	/* Show panels based on active tab */
	.main-view[data-active-tab='article'] .article-panel {
		display: flex !important;
	}

	.main-view[data-active-tab='article'] .map-container-full,
	.main-view[data-active-tab='article'] .globe-container-full,
	.main-view[data-active-tab='article'] .locations-sidebar {
		display: none !important;
	}

	.main-view[data-active-tab='map'] .article-panel,
	.main-view[data-active-tab='map'] .locations-sidebar {
		display: none !important;
	}

	.main-view[data-active-tab='locations'] .locations-sidebar {
		display: flex !important;
		flex-direction: row;
		width: 100% !important;
		height: auto !important;
		position: fixed;
		bottom: 70px;
		left: 0;
		right: 0;
		top: auto;
		border-radius: 0;
		border-left: none;
		border-top: 1px solid var(--border-color);
		margin: 0;
	}

	.main-view[data-active-tab='locations'] .sidebar-header {
		display: none;
	}

	.main-view[data-active-tab='locations'] .sidebar-content {
		overflow-x: auto;
		overflow-y: hidden;
		padding: 16px 0;
		scroll-snap-type: x mandatory;
		scroll-padding: 0 16px;
		-webkit-overflow-scrolling: touch;
	}

	.main-view[data-active-tab='locations'] .sidebar-content ul {
		flex-direction: row;
		gap: 12px;
		padding-left: 16px;
		padding-right: 0;
		margin: 0;
	}

	/* Create end spacing using pseudo-element (more reliable than padding-right) */
	.main-view[data-active-tab='locations'] .sidebar-content ul::after {
		content: '';
		flex-shrink: 0;
		width: 1px;
	}

	.main-view[data-active-tab='locations'] .sidebar-content li {
		width: 75%;
		min-width: 18rem;
		flex-shrink: 0;
		scroll-snap-align: start;
	}

	.main-view[data-active-tab='locations'] .article-panel,
	.main-view[data-active-tab='locations'] .map-container-full,
	.main-view[data-active-tab='locations'] .globe-container-full {
		display: none !important;
	}

	/* Add padding at bottom for tab bar */
	.main-view {
		padding-bottom: 70px;
	}
}

/* Scrollbar styling */
::-webkit-scrollbar {
	width: 6px;
}

::-webkit-scrollbar-track {
	background: var(--scrollbar-track);
	border-radius: 3px;
}

::-webkit-scrollbar-thumb {
	background: var(--scrollbar-thumb);
	border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
	background: var(--scrollbar-thumb-hover);
}

/* Leaflet popup styling */
.leaflet-popup-content {
	margin: 16px;
	line-height: 1.6;
}

.leaflet-popup-content strong {
	color: var(--accent-primary);
	font-size: 1.1rem;
}

.leaflet-popup-content em {
	display: block;
	margin-top: 8px;
	color: var(--text-muted);
	font-size: 0.9rem;
	line-height: 1.5;
	max-width: 250px;
}

.popup-emoji {
	font-size: 1.5rem;
}

.popup-type {
	font-size: 0.75rem;
	color: var(--text-muted);
}

/* Theme Toggle Button - styled as button at top-right */
.theme-toggle {
	top: 20px;
	right: 20px;
	z-index: 1001;
}

.theme-toggle svg {
	display: block;
}

/* Back button - styled as button at top-right */
.back-button {
	top: 20px;
	right: 68px;
	/* 20px (margin) + 36px (theme button width) + 12px (gap) */
	z-index: 1000;
}

/* Initial About Link - styled as button next to theme toggle */
.initial-about-link {
	top: 20px;
	right: 68px; /* 20px (margin) + 36px (theme button width) + 12px (gap) */
	z-index: 1000;
}

.status {
	margin-top: 0.5rem;
	color: var(--text-on-gradient);
	text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.status-favicon {
	width: 16px;
	height: 16px;
	margin-right: 8px;
	vertical-align: middle;
}

.marker-highlight {
	filter: hue-rotate(120deg) brightness(1.5);
}

/* Recent Lookups */
.recent-lookups {
	width: 100%;
	max-width: 700px;
	text-align: left;
	padding: 0 1rem;
	opacity: 0;
	transform: translateY(-20px);
	animation: slideDownRecentLookups 0.5s ease-out 1s forwards;
	/* Always enable transition for smooth collapse */
	transition:
		opacity 0.3s ease-out,
		transform 0.3s ease-out;
}

@media (min-width: 769px) {
	.recent-lookups {
		padding-left: 2rem;
		padding-right: 0;
	}
}

/* Collapsing state: slide up and fade out */
.recent-lookups.collapsing {
	/* Remove animation and force collapsed state */
	animation: none !important;
	opacity: 0 !important;
	transform: translateY(-20px) !important;
	pointer-events: none;
}

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

.recent-lookups-toggle {
	width: 100%;
	background: transparent;
	border: none;
	padding: 0.4rem 0 0.75rem 0;
	cursor: pointer;
	display: flex;
	align-items: start;
	justify-content: start;
	gap: 0.5rem;
	color: rgba(255, 255, 255, 0.8);
	text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
	font-size: 0.875rem;
	font-weight: 500;
	transition: all 0.2s ease;
	text-transform: lowercase;
}

.recent-lookups-toggle:hover {
	color: white;
}

.recent-lookups-toggle .toggle-icon {
	font-size: 0.75rem;
	transition: transform 0.2s ease;
}

.recent-lookups-toggle.expanded .toggle-icon {
	transform: rotate(180deg);
}

.recent-lookups-list {
	list-style: none;
	padding: 0;
	margin: 0;
	max-height: 500px;
	overflow: hidden;
	transition:
		max-height 0.3s ease-out,
		opacity 0.3s ease-out;
	opacity: 1;
}

.recent-lookups-list.collapsed {
	max-height: 0;
	opacity: 0;
}

.recent-lookup-item {
	background: transparent;
	border: none;
	border-radius: 8px;
	padding: 0.75rem 1rem;
	margin-bottom: 0.5rem;
	cursor: pointer;
	transition: all 0.2s ease;
}

.recent-lookup-item:hover {
	background: rgba(255, 255, 255, 0.1);
}

.recent-lookup-content {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	justify-content: space-between;
}

.recent-lookup-favicon {
	width: 16px;
	height: 16px;
	margin-right: 0.5rem;
	vertical-align: middle;
	object-fit: contain;
}

.recent-lookup-text {
	flex: 1;
	min-width: 0;
}

.recent-lookup-title {
	font-size: 0.9375rem;
	font-weight: 500;
	color: white;
	text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	margin-bottom: 0.25rem;
}

.recent-lookup-meta {
	font-size: 0.8125rem;
	color: rgba(255, 255, 255, 0.7);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.recent-lookup-delete {
	background: transparent;
	border: none;
	color: rgba(255, 255, 255, 0.5);
	font-size: 1.5rem;
	line-height: 1;
	cursor: pointer;
	padding: 0.25rem 0.5rem;
	transition: all 0.2s ease;
	opacity: 0.6; /* Always visible on mobile */
	border-radius: 4px;
	flex-shrink: 0;
}

@media (min-width: 769px) {
	.recent-lookup-delete {
		opacity: 0; /* Hidden on desktop until hover */
	}
}

.recent-lookup-item:hover .recent-lookup-delete {
	opacity: 1;
}

.recent-lookup-delete:hover {
	background: rgba(255, 255, 255, 0.1);
	color: rgba(255, 255, 255, 0.9);
}

.recent-lookup-delete:active {
	transform: scale(0.95);
}

/* Delete data button */
.delete-data-button {
	background: linear-gradient(135deg, #f43f5e 0%, #dc2626 100%);
	color: white;
	border: none;
	padding: 12px 24px;
	border-radius: 8px;
	font-size: 0.95rem;
	font-weight: 600;
	cursor: pointer;
	transition: all 0.2s ease;
	margin: 16px 0;
	box-shadow: 0 2px 8px rgba(244, 63, 94, 0.3);
}

.delete-data-button:hover {
	transform: translateY(-2px);
	box-shadow: 0 4px 12px rgba(244, 63, 94, 0.4);
}

.delete-data-button:active {
	transform: translateY(0);
}

.delete-status {
	font-size: 0.9rem;
	font-weight: 500;
	margin-top: 8px;
}

.delete-status.success {
	color: var(--success-text);
}

.delete-status.error {
	color: var(--error-text);
}
