/* Lazy Map — feuille de style */
:root {
  --accent: #6d28d9;
  --accent-soft: #ede9fe;
  --ink: #1e293b;
  --muted: #64748b;
  --line: #e2e8f0;
  --bg: #f8fafc;
  --good: #16a34a;
  --bad: #dc2626;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
}

#app {
  display: grid;
  grid-template-columns: 400px 1fr;
  height: 100dvh;
}

#map { height: 100%; }

/* ------------------------------------------------------------- panneau */

#panel {
  overflow-y: auto;
  padding: 20px 22px 16px;
  background: var(--bg);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

#panel header h1 {
  margin: 0 0 6px;
  font-size: 1.5rem;
  letter-spacing: -0.02em;
}

.tagline {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.45;
}

.field label {
  display: block;
  font-weight: 600;
  font-size: 0.85rem;
  margin-bottom: 6px;
}

.hint {
  margin: 2px 0 0;
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.4;
}

/* champs adresse + suggestions */
.combo { position: relative; }

.combo input {
  width: 100%;
  padding: 10px 12px;
  font-size: 0.95rem;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: #fff;
  outline: none;
  transition: border-color 0.15s;
}

.combo input:focus { border-color: var(--accent); }

.suggestions {
  position: absolute;
  z-index: 1100;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  margin: 0;
  padding: 4px;
  list-style: none;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
  max-height: 260px;
  overflow-y: auto;
}

.suggestions li {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 8px 10px;
  border-radius: 7px;
  cursor: pointer;
  font-size: 0.88rem;
}

.suggestions li small { color: var(--muted); font-size: 0.75rem; }
.suggestions li.active { background: var(--accent-soft); }

.swap-row { text-align: center; margin: -6px 0; }

#swap {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 4px 14px;
  font-size: 0.8rem;
  color: var(--muted);
  cursor: pointer;
}

#swap:hover { color: var(--accent); border-color: var(--accent); }

/* choix du vélo */
.bikes { display: flex; gap: 8px; }

.bikes label { flex: 1; cursor: pointer; }

.bikes input { display: none; }

.bikes span {
  display: block;
  text-align: center;
  padding: 9px 4px;
  font-size: 0.8rem;
  line-height: 1.5;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: #fff;
  transition: all 0.15s;
}

.bikes input:checked + span {
  border-color: var(--accent);
  background: var(--accent-soft);
  font-weight: 600;
}

/* curseur paresse */
input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
  margin: 6px 0 2px;
}

.badge {
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 0.75rem;
  font-weight: 600;
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  cursor: pointer;
}

.check input { accent-color: var(--accent); }

/* boutons */
.primary {
  display: block;
  width: 100%;
  text-align: center;
  padding: 12px;
  font-size: 0.95rem;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  text-decoration: none;
  transition: filter 0.15s;
}

.primary:hover { filter: brightness(1.08); }
.primary:disabled { opacity: 0.6; cursor: wait; }

.primary.ghost {
  color: var(--accent);
  background: var(--accent-soft);
}

.status {
  margin: 0;
  font-size: 0.83rem;
  padding: 9px 12px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent);
}

.status.error { background: #fee2e2; color: var(--bad); }

/* résultats */
#results { display: flex; flex-direction: column; gap: 12px; }

#results h2 { margin: 4px 0 0; font-size: 1.02rem; }

.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.stat {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 12px;
}

.stat-label {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.stat strong { font-size: 1.05rem; }

table.compare {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}

table.compare th, table.compare td {
  padding: 7px 9px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}

table.compare tbody tr:last-child th,
table.compare tbody tr:last-child td { border-bottom: none; }

table.compare thead th {
  font-size: 0.75rem;
  color: var(--muted);
  background: var(--bg);
}

table.compare .lazy-col { color: var(--accent); font-weight: 600; }

table.compare em {
  font-style: normal;
  font-size: 0.72rem;
  border-radius: 999px;
  padding: 1px 7px;
  white-space: nowrap;
}

table.compare em.good { background: #dcfce7; color: var(--good); }
table.compare em.bad { background: #fee2e2; color: var(--bad); }

.chart-wrap {
  height: 190px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px;
}

#panel footer {
  margin-top: auto;
  padding-top: 10px;
  font-size: 0.72rem;
  color: var(--muted);
}

#panel footer a { color: var(--muted); }

/* marqueurs */
.pin {
  width: 30px;
  height: 30px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 0.9rem;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.4);
  border: 2px solid #fff;
}

.pin > * { transform: rotate(45deg); }

.pin-a { background: #16a34a; }
.pin-b { background: #dc2626; }

/* mobile */
@media (max-width: 840px) {
  #app {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 52dvh) 1fr;
  }
  #panel { order: 2; border-right: none; border-top: 1px solid var(--line); }
  #map { order: 1; min-height: 48dvh; }
}
