/* ── Reset & tokens ─────────────────────────────── */
*,
*::before,
*::after {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
}

:root {
	--bg: #0a0f1e;
	--bg2: #0f1628;
	--surface: rgba(255, 255, 255, 0.055);
	--surface-hover: rgba(255, 255, 255, 0.09);
	--border: rgba(255, 255, 255, 0.1);
	--accent: #3b82f6;
	--accent2: #06b6d4;
	--accent-grad: linear-gradient(135deg, #3b82f6, #06b6d4);
	--green: #22c55e;
	--orange: #f97316;
	--red: #ef4444;
	--text: #e2e8f0;
	--text-muted: #64748b;
	--text-soft: #94a3b8;
	--radius-sm: 10px;
	--radius: 16px;
	--radius-lg: 22px;
	--blur: blur(20px) saturate(1.5);
	color-scheme: dark;
}

html {
	scroll-behavior: smooth;
}

body {
	background: var(--bg);
	color: var(--text);
	font-family: "Inter", system-ui, -apple-system, sans-serif;
	font-size: 15px;
	line-height: 1.5;
	min-height: 100dvh;
	background-image:
		radial-gradient(
			ellipse 80% 50% at 20% -10%,
			rgba(59, 130, 246, 0.12) 0%,
			transparent 60%
		),
		radial-gradient(
			ellipse 60% 40% at 80% 110%,
			rgba(6, 182, 212, 0.08) 0%,
			transparent 60%
		);
}

a {
	color: var(--accent2);
	text-decoration: none;
}
a:hover {
	text-decoration: underline;
}

/* ── Glass utility ──────────────────────────────── */
.glass {
	background: var(--surface);
	backdrop-filter: var(--blur);
	-webkit-backdrop-filter: var(--blur);
	border: 1px solid var(--border);
	border-radius: var(--radius);
}

.hidden {
	display: none;
}

/* ── Header ─────────────────────────────────────── */
.app-header {
	position: sticky;
	top: 0;
	z-index: 1000;
	background: rgba(10, 15, 30, 0.7);
	backdrop-filter: blur(16px);
	-webkit-backdrop-filter: blur(16px);
	border-bottom: 1px solid var(--border);
	padding: 0 16px;
}

.header-inner {
	max-width: 680px;
	margin: 0 auto;
	height: 52px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
}

a.logo {
	display: flex;
	align-items: center;
	gap: 8px;
	text-decoration: none;
	color: inherit;
	flex-shrink: 0;
}
.logo-icon {
	font-size: 1.3rem;
}
.logo-text {
	font-size: 1.05rem;
	color: var(--text-soft);
	letter-spacing: -0.3px;
}
.logo-text strong {
	color: var(--text);
	font-weight: 700;
}

.data-source {
	font-size: 0.75rem;
	color: var(--text-muted);
	white-space: nowrap;
}

/* ── Header nav ─────────────────────────────────── */
.header-nav {
	display: flex;
	align-items: center;
	gap: 4px;
	flex: 1;
	justify-content: center;
}

.nav-link {
	font-size: 0.82rem;
	font-weight: 500;
	color: var(--text-soft);
	text-decoration: none;
	padding: 5px 10px;
	border-radius: 7px;
	transition:
		background 0.15s,
		color 0.15s;
	white-space: nowrap;
}
.nav-link:hover {
	background: rgba(255, 255, 255, 0.07);
	color: var(--text);
}
.nav-link--active {
	color: var(--accent);
}
.nav-link--subtle {
	font-size: 0.76rem;
	opacity: 0.7;
}
.nav-link--subtle:hover {
	opacity: 1;
}

/* ── Header actions ─────────────────────────────── */
.header-actions {
	display: flex;
	align-items: center;
	gap: 12px;
	flex-shrink: 0;
}

.btn-share {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	border-radius: 9px;
	background: rgba(255, 255, 255, 0.07);
	border: 1px solid var(--border);
	color: var(--text-soft);
	cursor: pointer;
	transition:
		background 0.15s,
		color 0.15s;
}
.btn-share:hover {
	background: rgba(255, 255, 255, 0.12);
	color: var(--text);
}
.btn-share:active {
	background: rgba(59, 130, 246, 0.2);
}

/* ── Main layout ────────────────────────────────── */
main {
	max-width: 680px;
	margin: 0 auto;
	padding: 16px 12px 80px;
	display: flex;
	flex-direction: column;
	gap: 14px;
}

/* ── Controls panel ─────────────────────────────── */
.controls-panel {
	display: flex;
	flex-direction: column;
	gap: 12px;
	padding: 16px;
}

.controls-row {
	display: flex;
	gap: 10px;
	align-items: flex-end;
}

.field-group {
	display: flex;
	flex-direction: column;
	gap: 5px;
	flex: 1;
}
.field-group.flex-grow {
	flex: 1;
	min-width: 0;
}

.field-group label {
	font-size: 0.72rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: var(--text-muted);
}

select,
input[type="number"],
input[type="text"] {
	width: 100%;
	background: rgba(255, 255, 255, 0.07);
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	color: var(--text);
	padding: 10px 12px;
	font-size: 0.92rem;
	outline: none;
	transition: border-color 0.15s;
	-webkit-appearance: none;
	appearance: none;
}

select:focus,
input:focus {
	border-color: var(--accent);
	background: rgba(59, 130, 246, 0.08);
}

select {
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2364748b' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14L2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 12px center;
	padding-right: 32px;
}

/* ── Radius custom ──────────────────────────────── */
.radius-wrapper {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.radius-custom-wrap {
	display: flex;
	align-items: center;
	gap: 6px;
}
.radius-custom-wrap input[type="number"] {
	width: 80px;
	-moz-appearance: textfield;
}
.radius-custom-wrap input[type="number"]::-webkit-inner-spin-button,
.radius-custom-wrap input[type="number"]::-webkit-outer-spin-button {
	-webkit-appearance: none;
}
.radius-unit {
	font-size: 0.8rem;
	color: var(--text-muted);
}

/* ── Bouton géoloc ──────────────────────────────── */
.btn-icon {
	width: 42px;
	height: 42px;
	min-width: 42px;
	border-radius: var(--radius-sm);
	background: rgba(255, 255, 255, 0.07);
	border: 1px solid var(--border);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--text-soft);
	transition: background 0.15s;
	align-self: flex-end;
}
.btn-icon:active {
	background: rgba(59, 130, 246, 0.2);
}
.btn-icon.active {
	color: var(--accent2);
	border-color: var(--accent2);
	background: rgba(6, 182, 212, 0.1);
}
.btn-icon.loading {
	animation: pulse 1s ease infinite;
}
@keyframes pulse {
	0%,
	100% {
		opacity: 1;
	}
	50% {
		opacity: 0.4;
	}
}

/* ── Bouton principal ───────────────────────────── */
.btn-primary {
	width: 100%;
	padding: 13px;
	background: var(--accent-grad);
	border: none;
	border-radius: var(--radius-sm);
	color: #fff;
	font-size: 0.95rem;
	font-weight: 700;
	letter-spacing: 0.02em;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	transition:
		opacity 0.15s,
		transform 0.1s;
}
.btn-primary:active {
	opacity: 0.85;
	transform: scale(0.99);
}
.btn-primary:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

/* ── Spinner ────────────────────────────────────── */
.spinner {
	width: 16px;
	height: 16px;
	border: 2px solid rgba(255, 255, 255, 0.3);
	border-top-color: #fff;
	border-radius: 50%;
	animation: spin 0.6s linear infinite;
}
@keyframes spin {
	to {
		transform: rotate(360deg);
	}
}

/* ── Status message ─────────────────────────────── */
.status-msg {
	padding: 12px 16px;
	border-radius: var(--radius-sm);
	font-size: 0.88rem;
	text-align: center;
}
.status-msg.error {
	background: rgba(239, 68, 68, 0.12);
	border: 1px solid rgba(239, 68, 68, 0.3);
	color: #fca5a5;
}
.status-msg.info {
	background: rgba(59, 130, 246, 0.1);
	border: 1px solid rgba(59, 130, 246, 0.25);
	color: #93c5fd;
}

/* ── Map ────────────────────────────────────────── */
.map-section {
	border-radius: var(--radius);
	overflow: hidden;
}
#map {
	height: 42dvh;
	width: 100%;
}

.leaflet-tile-pane {
	filter: brightness(0.85) saturate(0.9);
}
.leaflet-popup-content-wrapper {
	background: #1a2236;
	color: var(--text);
	border: 1px solid var(--border);
	border-radius: 10px;
	box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}
.leaflet-popup-tip {
	background: #1a2236;
}

/* ── Results ────────────────────────────────────── */
.results-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 0 4px 8px;
}
.results-count {
	font-weight: 600;
	font-size: 0.9rem;
}
.results-hint {
	font-size: 0.75rem;
	color: var(--text-muted);
}

/* ── Station card ───────────────────────────────── */
.station-card {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 14px 16px;
	margin-bottom: 8px;
	gap: 12px;
	cursor: pointer;
	outline: none;
	transition:
		background 0.15s,
		box-shadow 0.15s,
		border-color 0.15s;
}
.station-card:hover {
	background: var(--surface-hover);
}
.station-card:focus {
	box-shadow: 0 0 0 2px var(--accent);
}
.station-card.card-active {
	background: rgba(59, 130, 246, 0.1);
	border-color: rgba(59, 130, 246, 0.45);
	box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.3);
}

.station-info {
	flex: 1;
	min-width: 0;
}
.station-name {
	font-weight: 600;
	font-size: 0.92rem;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.station-ville {
	font-size: 0.78rem;
	color: var(--text-muted);
	margin-top: 1px;
}
.station-meta {
	font-size: 0.78rem;
	color: var(--text-soft);
	margin-top: 2px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.station-dist {
	color: var(--accent2);
	font-weight: 500;
}

.station-right {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 8px;
	flex-shrink: 0;
}

.price-block {
	display: flex;
	align-items: baseline;
	gap: 2px;
	justify-content: flex-end;
}

.price-badge {
	font-size: 1.25rem;
	font-weight: 800;
	color: var(--accent);
	letter-spacing: -0.5px;
	line-height: 1;
}
.price-unit {
	font-size: 0.7rem;
	color: var(--text-muted);
	font-weight: 400;
}

/* Couleur prix relatif — spécificité (0,2,0), après .price-badge (0,1,0) */
.price-badge.price-good {
	color: var(--green);
}
.price-badge.price-ok {
	color: var(--accent2);
}
.price-badge.price-bad {
	color: var(--orange);
}

/* ── Nav buttons ────────────────────────────────── */
.nav-buttons {
	display: flex;
	gap: 5px;
}
.nav-btn {
	padding: 5px 9px;
	border-radius: 7px;
	font-size: 0.7rem;
	font-weight: 600;
	text-decoration: none;
	border: 1px solid var(--border);
	color: var(--text-soft);
	background: rgba(255, 255, 255, 0.05);
	white-space: nowrap;
	transition: background 0.12s;
}
.nav-btn:hover {
	background: rgba(255, 255, 255, 0.1);
	text-decoration: none;
}

/* ── Tags ───────────────────────────────────────── */
.tags-row {
	display: flex;
	gap: 5px;
	margin-top: 5px;
	overflow-x: auto;
	scrollbar-width: none;
	-ms-overflow-style: none;
	-webkit-overflow-scrolling: touch;
	padding-bottom: 2px;
}
.tags-row::-webkit-scrollbar {
	display: none;
}

.tag {
	display: inline-flex;
	align-items: center;
	white-space: nowrap;
	flex-shrink: 0;
	font-size: 0.68rem;
	font-weight: 600;
	border-radius: 5px;
	padding: 2px 7px;
	border: 1px solid var(--border);
	background: rgba(255, 255, 255, 0.05);
	color: var(--text-soft);
}
.tag-best {
	background: rgba(6, 182, 212, 0.12);
	color: var(--accent2);
	border-color: rgba(6, 182, 212, 0.3);
}
.tag-rupture {
	background: rgba(239, 68, 68, 0.12);
	color: #fca5a5;
	border-color: rgba(239, 68, 68, 0.3);
}
.tag-dist {
	background: rgba(59, 130, 246, 0.1);
	color: #93c5fd;
	border-color: rgba(59, 130, 246, 0.25);
}
.tag-date {
	background: rgba(255, 255, 255, 0.05);
	color: var(--text-muted);
}

/* ── Badge best price ───────────────────────────── */
.badge-best {
	display: inline-block;
	font-size: 0.65rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	background: rgba(6, 182, 212, 0.15);
	color: var(--accent2);
	border: 1px solid rgba(6, 182, 212, 0.3);
	border-radius: 5px;
	padding: 1px 6px;
	vertical-align: middle;
	margin-left: 6px;
}

/* ── Location field ─────────────────────────────── */
.location-field {
	display: flex;
	gap: 8px;
	align-items: flex-start;
}
.autocomplete-wrapper {
	flex: 1;
	position: relative;
}
.autocomplete-wrapper input {
	width: 100%;
}

.autocomplete-list {
	position: absolute;
	top: calc(100% + 4px);
	left: 0;
	right: 0;
	background: #111827;
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	list-style: none;
	z-index: 200;
	overflow: hidden;
	box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}
.autocomplete-list li {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 10px 14px;
	cursor: pointer;
	gap: 8px;
	transition: background 0.1s;
}
.autocomplete-list li:hover,
.autocomplete-list li:focus {
	background: rgba(59, 130, 246, 0.15);
	outline: none;
}
.ac-name {
	font-size: 0.9rem;
}
.ac-post {
	font-size: 0.78rem;
	color: var(--text-muted);
	flex-shrink: 0;
}

/* ── Geoloc tag ─────────────────────────────────── */
.geoloc-tag {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-top: 6px;
	padding: 6px 12px;
	background: rgba(59, 130, 246, 0.12);
	border: 1px solid rgba(59, 130, 246, 0.3);
	border-radius: 8px;
	font-size: 0.82rem;
	color: #93c5fd;
}
.geoloc-tag button {
	background: none;
	border: none;
	color: #93c5fd;
	cursor: pointer;
	font-size: 0.85rem;
	padding: 0 2px;
	line-height: 1;
}

/* ── Toast ──────────────────────────────────────── */
.share-toast {
	position: fixed;
	bottom: 24px;
	left: 50%;
	transform: translateX(-50%) translateY(12px);
	background: #1e293b;
	border: 1px solid var(--border);
	color: var(--text);
	font-size: 0.85rem;
	font-weight: 500;
	padding: 10px 20px;
	border-radius: 20px;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
	opacity: 0;
	transition:
		opacity 0.2s,
		transform 0.2s;
	z-index: 9999;
	pointer-events: none;
	white-space: nowrap;
}
.share-toast.visible {
	opacity: 1;
	transform: translateX(-50%) translateY(0);
}

/* ── Data date ──────────────────────────────────── */
.data-date {
	color: var(--text-muted);
	font-size: 0.76rem;
}

/* ── Footer ─────────────────────────────────────── */
.app-footer {
	text-align: center;
	padding: 20px 16px 32px;
	font-size: 0.75rem;
	color: var(--text-muted);
}
.footer-links {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 6px 16px;
	margin-bottom: 8px;
}
.footer-links a {
	font-size: 0.8rem;
	color: var(--text-muted);
	text-decoration: none;
	transition: color 0.15s;
}
.footer-links a:hover {
	color: var(--text-soft);
}
.footer-data {
	font-size: 0.75rem;
	color: var(--text-muted);
	margin: 4px 0 0;
}

/* ── Pages statiques ────────────────────────────── */
.page-content {
	max-width: 780px;
	margin: 0 auto;
	padding: 24px 16px 48px;
}
.page-hero {
	text-align: center;
	padding: 40px 16px 28px;
}
.page-hero-icon {
	font-size: 3rem;
	margin-bottom: 12px;
}
.page-hero h1 {
	font-size: clamp(1.5rem, 4vw, 2.2rem);
	font-weight: 700;
	color: var(--text);
	margin: 0 0 10px;
}
.page-subtitle {
	font-size: 0.95rem;
	color: var(--text-muted);
	margin: 0;
}

.page-body {
	padding: 28px 32px;
	display: flex;
	flex-direction: column;
	gap: 32px;
}
.page-section h2 {
	font-size: 1.05rem;
	font-weight: 700;
	color: var(--text);
	margin: 0 0 12px;
}
.page-section p {
	font-size: 0.9rem;
	color: var(--text-soft);
	line-height: 1.65;
	margin: 0 0 10px;
}
.page-section p:last-child {
	margin-bottom: 0;
}
.page-section a {
	color: var(--accent);
	text-decoration: none;
}
.page-section a:hover {
	text-decoration: underline;
}
.page-section code {
	background: rgba(255, 255, 255, 0.07);
	padding: 1px 5px;
	border-radius: 4px;
	font-size: 0.85em;
}

.page-list {
	list-style: none;
	padding: 0;
	margin: 10px 0 0;
	display: flex;
	flex-direction: column;
	gap: 7px;
}
.page-list li {
	font-size: 0.88rem;
	color: var(--text-soft);
	padding: 6px 10px;
	background: rgba(255, 255, 255, 0.03);
	border-radius: 7px;
	border: 1px solid var(--border);
}

/* ── CTA buttons ────────────────────────────────── */
.cta-row {
	display: flex;
	gap: 10px;
	flex-wrap: wrap;
	margin-top: 16px;
}
.btn-cta {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 10px 18px;
	border-radius: 10px;
	font-size: 0.88rem;
	font-weight: 600;
	text-decoration: none;
	transition:
		opacity 0.15s,
		transform 0.1s;
}
.btn-cta:hover {
	opacity: 0.85;
	transform: translateY(-1px);
}

/* Qualifié avec `a.` pour gagner sur .page-section a (0,2,1) */
a.btn-cta--primary,
button.btn-cta--primary {
	background: var(--accent);
	color: #fff;
}
a.btn-cta--secondary,
button.btn-cta--secondary {
	background: rgba(255, 255, 255, 0.07);
	color: var(--text-soft);
	border: 1px solid var(--border);
}

/* ── Contact email btn ──────────────────────────── */
.contact-email-btn {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	margin-top: 10px;
	padding: 12px 20px;
	background: rgba(59, 130, 246, 0.1);
	border: 1px solid rgba(59, 130, 246, 0.3);
	border-radius: 10px;
	color: #93c5fd;
	font-size: 0.95rem;
	font-weight: 600;
	text-decoration: none;
	transition: background 0.15s;
}
.contact-email-btn:hover {
	background: rgba(59, 130, 246, 0.18);
	text-decoration: none;
}

/* ── Responsive ─────────────────────────────────── */
@media (max-width: 600px) {
	.page-body {
		padding: 20px 18px;
	}
}

@media (max-width: 500px) {
	.header-nav {
		gap: 0;
	}
	.nav-link {
		padding: 5px 7px;
		font-size: 0.75rem;
	}
	.nav-link--subtle {
		display: none;
	}
}

@media (max-width: 420px) {
	#map {
		height: 36dvh;
	}
	.price-badge {
		font-size: 1.1rem;
	}
	.controls-row {
		flex-wrap: wrap;
	}
	.field-group.flex-grow {
		min-width: calc(50% - 5px);
	}
}

/* iOS safe area */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
	main {
		padding-bottom: calc(80px + env(safe-area-inset-bottom));
	}
}

/* ── Rank-1 card — après les media queries pour éviter la descending specificity ── */
.station-card.rank-1 {
	border-color: rgba(6, 182, 212, 0.4);
}

.hidden {
	display: none;
}

/* ── Overflow global fix ────────────────────────── */
html,
body {
	overflow-x: hidden;
	max-width: 100vw;
}

/* ── Hamburger button ───────────────────────────── */
.btn-hamburger {
	display: none;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	border-radius: 9px;
	background: rgba(255, 255, 255, 0.07);
	border: 1px solid var(--border);
	color: var(--text-soft);
	cursor: pointer;
	flex-shrink: 0;
	transition: background 0.15s;
}
.btn-hamburger:hover {
	background: rgba(255, 255, 255, 0.12);
}

/* ── Bouton load more ───────────────────────────── */
.btn-load-more {
	width: 100%;
	padding: 12px;
	margin-top: 4px;
	background: rgba(255, 255, 255, 0.05);
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	color: var(--text-soft);
	font-size: 0.88rem;
	font-weight: 600;
	cursor: pointer;
	transition:
		background 0.15s,
		color 0.15s;
}
.btn-load-more:hover {
	background: rgba(255, 255, 255, 0.09);
	color: var(--text);
}

@media (max-width: 620px) {
	.btn-hamburger {
		display: flex;
	}

	/* Nav cachée par défaut, dropdown quand .open */
	.header-nav {
		display: none;
		position: absolute;
		top: 52px;
		left: 0;
		right: 0;
		flex-direction: column;
		background: rgba(10, 15, 30, 0.97);
		backdrop-filter: blur(16px);
		-webkit-backdrop-filter: blur(16px);
		border-bottom: 1px solid var(--border);
		padding: 6px 0 10px;
		z-index: 999;
		gap: 0;
	}
	.header-nav.open {
		display: flex;
	}

	.nav-link {
		padding: 11px 20px;
		font-size: 0.9rem;
		border-radius: 0;
	}
	.nav-link--subtle {
		display: flex;
		opacity: 1;
	}

	/* Masque le lien "données" pour gagner de la place */
	.data-source {
		display: none;
	}
}

/* ── Station card mobile ────────────────────────── */
@media (max-width: 520px) {
	.station-card {
		flex-direction: column;
		align-items: stretch;
		gap: 10px;
	}
	.station-right {
		flex-direction: row;
		justify-content: space-between;
		align-items: center;
		width: 100%;
		gap: 10px;
	}
	.nav-buttons {
		flex-wrap: wrap;
		gap: 4px;
	}
	.nav-btn {
		font-size: 0.68rem;
		padding: 5px 8px;
	}
	.price-badge {
		font-size: 1.15rem;
	}
}
