/* My RATP - feuille de style (mobile d'abord, mode sombre automatique) */

:root {
	--bg: #eef2f7;
	--surface: #ffffff;
	--surface-2: #f4f7fb;
	--text: #14213d;
	--muted: #5d6b82;
	--line: #dde4ee;
	--brand: #14213d;
	--brand-2: #1f3a68;
	--accent: #00a88f;
	--accent-soft: #e0f6f2;
	--blue: #2563eb;
	--warn: #d97706;
	--warn-soft: #fff5e6;
	--danger: #c0392b;
	--danger-soft: #fdeeee;
	--radius: 18px;
	--shadow: 0 6px 24px rgba(20, 33, 61, 0.08);
	color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
	:root {
		--bg: #0c1220;
		--surface: #151d2e;
		--surface-2: #1c2638;
		--text: #e8edf6;
		--muted: #9aa7bd;
		--line: #273248;
		--accent-soft: #0f3a35;
		--warn-soft: #3a2a10;
		--danger-soft: #3b1717;
		--shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
	}
}

* {
	box-sizing: border-box;
}

html,
body {
	margin: 0;
	background: var(--bg);
	color: var(--text);
	font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	-webkit-tap-highlight-color: transparent;
}

[hidden] {
	display: none !important;
}

button,
input {
	font: inherit;
	color: inherit;
}

button {
	cursor: pointer;
}

h1,
h2,
h3,
p {
	margin: 0;
}

.muted {
	color: var(--muted);
}

/* ------------------------------------------------------------------ */
/* En-tête                                                            */
/* ------------------------------------------------------------------ */

.topbar {
	position: sticky;
	top: 0;
	z-index: 1000;
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
	background: linear-gradient(135deg, var(--brand), var(--brand-2));
	color: #fff;
}

.brand {
	display: flex;
	align-items: center;
	gap: 10px;
}

.brand h1 {
	font-size: 1.15rem;
	letter-spacing: 0.01em;
}

.brand p {
	font-size: 0.75rem;
	opacity: 0.75;
	text-transform: uppercase;
	letter-spacing: 0.12em;
}

.ghost-button {
	padding: 7px 12px;
	border: 1px solid rgba(255, 255, 255, 0.4);
	border-radius: 999px;
	background: transparent;
	color: #fff;
	font-size: 0.85rem;
}

/* ------------------------------------------------------------------ */
/* Mise en page                                                       */
/* ------------------------------------------------------------------ */

.layout {
	width: 100%;
	max-width: 640px;
	margin: 0 auto;
	padding: 14px 14px calc(28px + env(safe-area-inset-bottom));
}

/* Mobile : un seul panneau visible à la fois. */
.result-panel {
	display: none;
}

body.show-results .search-panel {
	display: none;
}

body.show-results .result-panel {
	display: block;
}

.empty-state {
	display: none;
}

.card,
.journey {
	margin-bottom: 12px;
	padding: 14px;
	border: 1px solid var(--line);
	border-radius: var(--radius);
	background: var(--surface);
	box-shadow: var(--shadow);
}

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

.card-header h3 {
	font-size: 0.95rem;
}

.section-title {
	margin: 18px 4px 10px;
	font-size: 1.05rem;
}

label {
	display: block;
	margin-bottom: 6px;
	font-weight: 650;
	font-size: 0.9rem;
}

/* ------------------------------------------------------------------ */
/* Départ                                                             */
/* ------------------------------------------------------------------ */

.origin-status {
	display: flex;
	align-items: center;
	gap: 12px;
}

.origin-status small {
	display: block;
	color: var(--muted);
}

.origin-form {
	margin-top: 12px;
}

.dot {
	flex: none;
	width: 12px;
	height: 12px;
	border-radius: 50%;
}

.dot-pending {
	background: var(--blue);
	animation: pulse 1.4s infinite;
}

.dot-ok {
	background: var(--accent);
	box-shadow: 0 0 0 5px var(--accent-soft);
}

.dot-error {
	background: var(--danger);
}

@keyframes pulse {
	0% {
		box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.45);
	}
	100% {
		box-shadow: 0 0 0 12px rgba(37, 99, 235, 0);
	}
}

/* ------------------------------------------------------------------ */
/* Boutons destination et champs                                      */
/* ------------------------------------------------------------------ */

.destinations {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 12px;
	margin-bottom: 12px;
}

.destination {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-height: 112px;
	border: 0;
	border-radius: 22px;
	color: #fff;
	font-size: 1.05rem;
	font-weight: 700;
	box-shadow: var(--shadow);
	transition: transform 0.1s ease;
}

.destination:active {
	transform: scale(0.97);
}

.destination-home {
	background: linear-gradient(145deg, #00a88f, #008572);
}

.destination-work {
	background: linear-gradient(145deg, #2d4f8a, #14213d);
}

.destination-icon svg {
	width: 34px;
	height: 34px;
	fill: currentColor;
}

.field {
	display: flex;
	gap: 8px;
}

.field input {
	flex: 1;
	min-width: 0;
	padding: 12px 14px;
	border: 1px solid var(--line);
	border-radius: 12px;
	background: var(--surface-2);
	outline: none;
}

.field input:focus {
	border-color: var(--blue);
	box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
}

.icon-button {
	flex: none;
	width: 44px;
	height: 44px;
	border: 1px solid var(--line);
	border-radius: 12px;
	background: var(--surface-2);
	font-size: 1.2rem;
}

.icon-button.spinning {
	animation: spin 0.8s linear infinite;
}

.link-button {
	border: 0;
	background: none;
	color: var(--blue);
	font-size: 0.85rem;
}

.suggestions {
	margin: 6px 0 0;
	padding: 0;
	list-style: none;
	border-radius: 12px;
	overflow: hidden;
}

.suggestion {
	display: flex;
	gap: 10px;
	align-items: flex-start;
	padding: 10px 12px;
	border-bottom: 1px solid var(--line);
	background: var(--surface-2);
	cursor: pointer;
}

.suggestion.active,
.suggestion:hover {
	background: var(--accent-soft);
}

.suggestion small {
	display: block;
	color: var(--muted);
	font-size: 0.8rem;
}

.suggestion-empty {
	padding: 10px 12px;
	color: var(--muted);
	font-size: 0.9rem;
}

.chips {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.chip {
	max-width: 100%;
	padding: 8px 12px;
	overflow: hidden;
	border: 1px solid var(--line);
	border-radius: 999px;
	background: var(--surface-2);
	font-size: 0.88rem;
	white-space: nowrap;
	text-overflow: ellipsis;
}

/* ------------------------------------------------------------------ */
/* Résultats                                                          */
/* ------------------------------------------------------------------ */

.result-header {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-bottom: 12px;
}

.result-header > div {
	flex: 1;
	min-width: 0;
}

.result-header small {
	color: var(--muted);
	font-size: 0.75rem;
	text-transform: uppercase;
	letter-spacing: 0.1em;
}

.result-header h2 {
	overflow: hidden;
	font-size: 1.2rem;
	white-space: nowrap;
	text-overflow: ellipsis;
}

.back-button {
	flex: none;
	width: 40px;
	height: 40px;
	border: 0;
	border-radius: 50%;
	background: var(--surface);
	box-shadow: var(--shadow);
}

.back-button svg {
	width: 22px;
	height: 22px;
	fill: currentColor;
}

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

.spinner {
	width: 22px;
	height: 22px;
	border: 3px solid var(--line);
	border-top-color: var(--accent);
	border-radius: 50%;
	animation: spin 0.8s linear infinite;
}

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

.error {
	border-color: var(--danger);
	background: var(--danger-soft);
	color: var(--danger);
	font-weight: 600;
}

/* Trajet recommandé */

.hero {
	border: 2px solid var(--accent);
}

.hero-none {
	border-color: var(--warn);
}

.hero-status {
	display: inline-block;
	margin-bottom: 10px;
	padding: 4px 10px;
	border-radius: 999px;
	background: var(--accent-soft);
	color: var(--accent);
	font-size: 0.78rem;
	font-weight: 800;
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

.hero-none .hero-status {
	background: var(--warn-soft);
	color: var(--warn);
}

.hero-main {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 10px;
	margin-bottom: 12px;
}

.leave,
.arrive {
	display: flex;
	flex-direction: column;
	padding: 10px 12px;
	border-radius: 14px;
	background: var(--surface-2);
}

.leave {
	background: var(--accent-soft);
}

.leave small,
.arrive small {
	color: var(--muted);
	font-size: 0.75rem;
	text-transform: uppercase;
	letter-spacing: 0.08em;
}

.leave strong,
.arrive strong {
	font-size: 1.45rem;
	line-height: 1.2;
	white-space: nowrap;
}

.leave strong {
	color: var(--accent);
}

.leave span,
.arrive span {
	font-size: 0.82rem;
}

.hero-lines,
.alt-lines {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 4px;
}

.hero-lines {
	margin-bottom: 10px;
}

.chain-sep {
	color: var(--muted);
	font-weight: 700;
}

.first-leg {
	display: grid;
	gap: 4px;
	padding: 10px 12px;
	border-left: 4px solid var(--accent);
	border-radius: 0 12px 12px 0;
	background: var(--surface-2);
	font-size: 0.93rem;
}

.first-line {
	display: flex;
	align-items: center;
	gap: 8px;
}

.direction {
	font-weight: 650;
}

.margin-ok {
	color: var(--accent);
	font-weight: 700;
}

.realtime {
	padding: 1px 6px;
	border-radius: 6px;
	background: var(--accent-soft);
	color: var(--accent);
	font-size: 0.72rem;
	font-weight: 700;
}

.hint {
	margin-top: 10px;
	color: var(--muted);
	font-size: 0.78rem;
}

/* Badges de ligne */

.line-badge {
	display: inline-flex;
	align-items: center;
	gap: 3px;
	white-space: nowrap;
	vertical-align: middle;
}

.mode-tag {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 22px;
	height: 22px;
	padding: 0 4px;
	border: 2px solid var(--text);
	border-radius: 50%;
	font-size: 0.66rem;
	font-weight: 800;
}

.mode-rer,
.mode-train,
.mode-bus,
.mode-other {
	border-radius: 6px;
}

.line-code {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 24px;
	height: 24px;
	padding: 0 6px;
	border-radius: 6px;
	font-size: 0.85rem;
	font-weight: 800;
}

.mode-metro + .line-code,
.mode-tram + .line-code {
	border-radius: 50%;
}

.walk-only {
	font-weight: 650;
}

/* Détail (frise) */

.details {
	margin-top: 10px;
}

.details summary {
	color: var(--blue);
	font-size: 0.9rem;
	font-weight: 600;
	cursor: pointer;
}

.timeline {
	margin: 10px 0 0;
	padding: 0;
	list-style: none;
}

.step {
	display: grid;
	grid-template-columns: 74px 1fr;
	gap: 8px;
	padding: 8px 0;
	border-top: 1px solid var(--line);
	font-size: 0.9rem;
}

.step-icon {
	display: flex;
	justify-content: center;
}

.step-transit > div {
	padding-left: 10px;
	border-left: 4px solid var(--line-color, var(--line));
}

.step-direction {
	font-weight: 650;
}

.tag {
	display: inline-block;
	padding: 1px 7px;
	border-radius: 6px;
	background: var(--surface-2);
	font-size: 0.75rem;
	font-weight: 700;
}

.tag-delay,
.tag-medium,
.tag-low {
	background: var(--warn-soft);
	color: var(--warn);
}

.tag-high {
	background: var(--danger-soft);
	color: var(--danger);
}

/* Départs écartés */

.tight-notice {
	display: flex;
	gap: 10px;
	margin-bottom: 12px;
	padding: 10px 12px;
	border: 1px solid var(--warn);
	border-radius: 14px;
	background: var(--warn-soft);
	font-size: 0.88rem;
}

.tight-notice ul {
	margin: 4px 0 0;
	padding: 0;
	list-style: none;
}

.tight-notice li {
	margin-top: 4px;
}

/* Carte */

.map-wrapper {
	margin-bottom: 12px;
	overflow: hidden;
	border: 1px solid var(--line);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
}

#map {
	height: 220px;
	background: var(--surface-2);
}

.stop-marker {
	background: none;
	border: 0;
}

.stop-marker .line-badge {
	padding: 3px;
	border-radius: 8px;
	background: #fff;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
	transform: translate(-50%, -50%);
}

.stop-marker .mode-tag {
	border-color: #14213d;
	color: #14213d;
}

/* Perturbations */

.traffic-ok {
	color: var(--accent);
	font-weight: 650;
	font-size: 0.92rem;
}

#disruptionsCard h3 {
	margin-bottom: 8px;
	font-size: 1rem;
}

.disruptions {
	display: grid;
	gap: 8px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.disruption {
	padding: 10px 12px;
	border-left: 4px solid var(--warn);
	border-radius: 0 12px 12px 0;
	background: var(--warn-soft);
	font-size: 0.9rem;
}

.disruption.level-high {
	border-left-color: var(--danger);
	background: var(--danger-soft);
}

.disruption-head {
	margin-bottom: 4px;
}

.disruption summary {
	margin-top: 4px;
	color: var(--blue);
	cursor: pointer;
}

.disruption p {
	margin-top: 6px;
	white-space: normal;
}

/* Alternatives */

.alt-main {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
}

.alt-arrival {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
}

.alt-arrival strong {
	font-size: 1.3rem;
}

.alt-arrival span {
	font-size: 0.8rem;
}

.alt-meta {
	margin-top: 4px;
	color: var(--muted);
	font-size: 0.88rem;
}

.alt-meta .countdown {
	color: var(--text);
}

.updated-at {
	margin-top: 16px;
	color: var(--muted);
	font-size: 0.78rem;
	text-align: center;
}

/* ------------------------------------------------------------------ */
/* PC / grand écran : deux colonnes                                   */
/* ------------------------------------------------------------------ */

@media (min-width: 900px) {
	.layout {
		display: grid;
		grid-template-columns: 380px 1fr;
		gap: 24px;
		max-width: 1180px;
		padding: 24px;
	}

	.search-panel,
	body.show-results .search-panel {
		display: block;
		position: sticky;
		top: 84px;
		align-self: start;
	}

	.result-panel {
		display: block;
	}

	.empty-state {
		display: flex;
		align-items: center;
		justify-content: center;
		min-height: 320px;
		padding: 32px;
		border: 2px dashed var(--line);
		border-radius: var(--radius);
		color: var(--muted);
		text-align: center;
	}

	.back-button {
		display: none;
	}

	#map {
		height: 340px;
	}
}
