* {
  box-sizing: border-box;
}

:root {
  --blue: #0078d7;
  --blue-dark: #005bb5;
  --blue-darker: #003f8a;
  --green: #1a8f4c;
  --text: #333;
  --muted: #666;
  --bg: #f4f4f9;
  --card: #fff;
  --top-bar: 60px;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}
body {
  display: flex;
  flex-direction: column;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Barre horizontale en haut */
.top-bar {
  position: sticky;
  top: 0;
  z-index: 1000;
  min-height: var(--top-bar);
  background: var(--blue);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 30px;
  padding: 10px 20px;
}
.top-bar h1 {
  color: #fff;
  margin: 0;
  font-size: 20px;
  white-space: nowrap;
}
.route-inputs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.route-inputs input {
  width: 220px;
  padding: 8px 10px;
  border: none;
  border-radius: 4px;
  font-size: 15px;
}
.route-inputs input:focus-visible,
.route-inputs button:focus-visible,
select:focus-visible {
  outline: 3px solid #ffd54f;
  outline-offset: 1px;
}
.route-inputs button {
  background: var(--blue-dark);
  color: #fff;
  border: none;
  padding: 9px 16px;
  border-radius: 4px;
  font-size: 15px;
  cursor: pointer;
}
.route-inputs button:hover {
  background: var(--blue-darker);
}
.route-inputs button:disabled {
  opacity: 0.7;
  cursor: progress;
}

/* Volet à gauche, carte à droite */
.layout {
  display: grid;
  grid-template-columns: 330px 1fr;
  flex: 1;
  min-height: 0;
}
.side-panel {
  overflow-y: auto;
  padding: 15px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
  z-index: 1;
}
#map {
  height: 100%;
  min-height: 320px;
}

.card {
  background: var(--card);
  border-radius: 10px;
  padding: 14px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.card h2 {
  margin: 0 0 10px;
  font-size: 16px;
  color: var(--blue);
}
select {
  width: 100%;
  padding: 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 14px;
  background: #fff;
}

.vehicle-photo {
  display: block;
  width: 100%;
  height: 130px;
  margin-top: 10px;
  object-fit: contain;
  background: #f9f9ff;
  border-radius: 8px;
}

.facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 12px;
  margin: 10px 0 0;
}
.facts div {
  min-width: 0;
}
.facts dt {
  font-size: 12px;
  color: var(--muted);
}
.facts dd {
  margin: 2px 0 0;
  font-size: 14px;
  font-weight: 600;
}
.facts-large dd {
  font-size: 18px;
}

.route-title {
  margin: 0;
  font-weight: 600;
}

.stops {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.stops button {
  width: 100%;
  text-align: left;
  border: 1px solid #e3e6ee;
  border-radius: 8px;
  background: #f9f9ff;
  padding: 8px 10px;
  font: inherit;
  font-size: 13px;
  color: inherit;
  cursor: pointer;
}
.stops button:hover {
  border-color: var(--blue);
}
.stops strong {
  display: block;
  font-size: 14px;
}
.stops .missing {
  color: #a15c00;
}

.message {
  margin: 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: #fdecea;
  color: #8a1c14;
  font-size: 14px;
}
.message.info {
  background: #e8f1fb;
  color: var(--blue-darker);
}

.hint,
.about {
  margin: 12px 0 0;
  font-size: 12px;
  color: var(--muted);
}
.about {
  margin-top: auto;
}
.about a {
  color: var(--blue-dark);
}

/* Marqueurs des bornes */
.station-marker {
  background: var(--green);
  border: 2px solid #fff;
  border-radius: 50%;
  color: #fff;
  font: 700 12px/20px system-ui, sans-serif;
  text-align: center;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

/* Téléphone : la page défile, la carte passe entre le formulaire et le volet */
@media (max-width: 760px) {
  .top-bar {
    padding: 10px 12px;
  }
  .route-inputs {
    width: 100%;
  }
  .route-inputs input {
    flex: 1 1 140px;
    width: auto;
  }
  body {
    height: auto;
  }
  .layout {
    display: flex;
    flex-direction: column-reverse;
  }
  #map {
    height: 55vh;
  }
  .side-panel {
    overflow: visible;
    box-shadow: none;
  }
}
