:root {
  --green-plaque: #0f3d2e;
  --green-plaque-dark: #0a2b20;
  --green-velib: #5ba829;
  --green-velib-bright: #79c94a;
  --amber: #d98e2b;
  --blue-me: #3f7fd9;
  --grey-empty: #8a9691;
  --cream: #f5f1e8;
  --map-bg: #f3f1ea;
  --ink: #182420;
  --line: rgba(245, 241, 232, 0.16);
  --radius-s: 6px;
  --radius-m: 10px;
  --font-display: "Archivo Expanded", sans-serif;
  --font-body: "Archivo", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--map-bg);
}

#app {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ---------------- Sidebar : plaque de rue parisienne ---------------- */

#sidebar {
  width: 380px;
  min-width: 380px;
  background: var(--green-plaque);
  background-image: linear-gradient(160deg, var(--green-plaque) 0%, var(--green-plaque-dark) 100%);
  color: var(--cream);
  display: flex;
  flex-direction: column;
  padding: 22px 20px 16px;
  overflow-y: auto;
  border-right: 3px solid var(--green-plaque-dark);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 18px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--line);
}
.brand-mark { color: var(--green-velib-bright); flex-shrink: 0; }
.brand h1 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 19px;
  letter-spacing: 0.02em;
  margin: 0 0 2px;
  text-transform: uppercase;
}
.brand .tagline {
  margin: 0;
  font-size: 11.5px;
  color: rgba(245, 241, 232, 0.65);
  line-height: 1.35;
}

.panel { margin-bottom: 18px; }
.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 8px;
}
.panel-head h2 {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 0;
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.eyebrow {
  font-family: var(--font-display);
  font-size: 11px;
  color: var(--green-velib-bright);
  border: 1px solid var(--green-velib-bright);
  border-radius: 3px;
  padding: 1px 5px;
}
.nearby-count {
  font-size: 11px;
  color: rgba(245,241,232,0.55);
}

.hint {
  font-size: 12px;
  line-height: 1.5;
  color: rgba(245, 241, 232, 0.6);
  margin: 8px 0 0;
}

/* Bouton principal */
.btn-primary {
  width: 100%;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  background: var(--green-velib);
  color: #0a2b20;
  border: none;
  border-radius: var(--radius-m);
  padding: 13px;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}
.btn-primary:hover:not(:disabled) { background: var(--green-velib-bright); }
.btn-primary:active:not(:disabled) { transform: scale(0.99); }
.btn-primary:disabled { background: rgba(245,241,232,0.15); color: rgba(245,241,232,0.4); cursor: not-allowed; }

/* Recherche d'adresse */
.address-search { position: relative; margin-top: 12px; }
.address-input {
  width: 100%;
  background: rgba(245,241,232,0.08);
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  color: var(--cream);
  font-family: var(--font-body);
  font-size: 13px;
  padding: 9px 10px;
}
.address-input::placeholder { color: rgba(245,241,232,0.4); }
.address-input:focus { outline: none; border-color: var(--green-velib-bright); }
#address-suggestions {
  position: absolute;
  left: 0; right: 0; top: calc(100% + 4px);
  background: #fff;
  color: var(--ink);
  border-radius: var(--radius-s);
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  z-index: 900;
  overflow: hidden;
  font-size: 12.5px;
}
.suggestion-item { padding: 9px 11px; cursor: pointer; border-bottom: 1px solid #eee; }
.suggestion-item:last-child { border-bottom: none; }
.suggestion-item:hover { background: var(--map-bg); }

/* Réglages */
.slider-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  margin-bottom: 8px;
}
.slider-value { font-family: var(--font-display); font-weight: 700; color: var(--green-velib-bright); }
input[type="range"] {
  width: 100%;
  accent-color: var(--green-velib-bright);
}

/* Liste des stations proches */
.nearby-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }

.nearby-empty {
  font-size: 12px;
  color: rgba(245,241,232,0.45);
  padding: 10px;
  border: 1px dashed var(--line);
  border-radius: var(--radius-m);
  text-align: center;
}

.station-row {
  background: rgba(245, 241, 232, 0.06);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  padding: 9px 11px;
  cursor: pointer;
  transition: background 0.12s ease;
}
.station-row:hover { background: rgba(245, 241, 232, 0.12); }

.station-row-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
}
.station-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.distance-badge {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  color: var(--green-velib-bright);
  flex-shrink: 0;
}

.station-row-meta {
  display: flex;
  gap: 12px;
  margin-top: 4px;
  font-size: 12px;
  color: rgba(245,241,232,0.7);
}

.messages { margin-top: auto; padding-top: 10px; }
.msg {
  font-size: 12px;
  padding: 8px 10px;
  border-radius: var(--radius-s);
  margin-bottom: 6px;
  line-height: 1.4;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}
.msg-error { background: rgba(217, 80, 63, 0.18); border: 1px solid #d9503f; }
.msg-warning { background: rgba(217, 142, 43, 0.18); border: 1px solid var(--amber); }
.msg-close { background: none; border: none; color: inherit; cursor: pointer; font-size: 14px; line-height: 1; opacity: 0.7; flex-shrink: 0; }
.msg-close:hover { opacity: 1; }

/* ---------------- Carte ---------------- */

#map-wrap { position: relative; flex: 1; }
#map { width: 100%; height: 100%; background: var(--map-bg); cursor: crosshair; }

.legend {
  position: absolute;
  bottom: 20px;
  right: 20px;
  z-index: 500;
  background: #fff;
  border-radius: var(--radius-m);
  padding: 12px 14px;
  box-shadow: 0 4px 18px rgba(15, 61, 46, 0.18);
  font-size: 12px;
  min-width: 190px;
}
.legend-title { font-family: var(--font-display); font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; margin: 0 0 8px; color: var(--green-plaque); }
.legend-row { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; }
.legend hr { border: none; border-top: 1px solid #e5e2d8; margin: 8px 0; }

.dot { width: 11px; height: 11px; border-radius: 50%; display: inline-block; border: 1.5px solid rgba(0,0,0,0.15); }
.dot-green { background: var(--green-velib); }
.dot-amber { background: var(--amber); }
.dot-grey { background: var(--grey-empty); }
.dot-me { background: var(--blue-me); }

/* Popups Leaflet stations */
.velib-popup { font-family: var(--font-body); font-size: 12.5px; min-width: 190px; }
.velib-popup h3 { font-family: var(--font-display); font-size: 13px; margin: 0 0 6px; color: var(--green-plaque); }
.velib-popup .row { display: flex; justify-content: space-between; margin-bottom: 3px; }
.velib-popup .closed { color: #d9503f; font-weight: 600; }

/* Marqueurs stations Vélib' */
.station-marker {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}
.station-marker.avail-green { background: var(--green-velib); }
.station-marker.avail-amber { background: var(--amber); }
.station-marker.avail-grey { background: var(--grey-empty); }

/* Marqueur "ma position" avec halo pulsant */
.me-marker { position: relative; width: 22px; height: 22px; }
.me-marker-dot {
  position: absolute; top: 50%; left: 50%; width: 16px; height: 16px;
  margin: -8px 0 0 -8px; border-radius: 50%;
  background: var(--blue-me); border: 3px solid #fff;
  box-shadow: 0 1px 6px rgba(0,0,0,0.4);
}
.me-marker-pulse {
  position: absolute; top: 50%; left: 50%; width: 22px; height: 22px;
  margin: -11px 0 0 -11px; border-radius: 50%;
  background: var(--blue-me);
  opacity: 0.5;
  animation: me-pulse 1.8s ease-out infinite;
}
@keyframes me-pulse {
  0% { transform: scale(0.4); opacity: 0.6; }
  100% { transform: scale(2.2); opacity: 0; }
}

/* Responsive */
@media (max-width: 860px) {
  #app { display: block; position: relative; height: 100vh; }

  #map-wrap { position: absolute; inset: 0; height: 100%; }

  #sidebar {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 600;
    width: 100%;
    min-width: 0;
    max-height: 46vh;
    border-right: none;
    border-top: none;
    border-radius: 18px 18px 0 0;
    box-shadow: 0 -8px 28px rgba(10, 43, 32, 0.45);
    padding-top: 10px;
  }
  #sidebar::before {
    content: "";
    display: block;
    width: 40px; height: 4px;
    margin: 0 auto 14px;
    border-radius: 2px;
    background: rgba(245, 241, 232, 0.35);
  }

  .legend { top: 14px; right: 14px; bottom: auto; left: auto; min-width: 0; }
}
