:root {
  --fond: #f5f6fa;
  --carte: #ffffff;
  --texte: #1a1a2e;
  --texte-sec: #6b7280;
  --bordure: #e5e7eb;
  --accent: #2563eb;
  --rayon: 12px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--texte);
  background: var(--fond);
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

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

/* === Navbar === */
.navbar {
  background: var(--carte);
  border-bottom: 1px solid var(--bordure);
  padding: .75rem 1.25rem;
  position: sticky; top: 0; z-index: 1100;
}
.navbar-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}
.brand {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--texte);
  text-decoration: none;
  flex-shrink: 0;
}
.brand:hover { text-decoration: none; }
.brand-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }

.search {
  flex: 1;
  max-width: 480px;
  position: relative;
}
.search i {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--texte-sec);
}
.search input {
  width: 100%;
  padding: .5rem .75rem .5rem 2.25rem;
  border: 1px solid var(--bordure);
  border-radius: var(--rayon);
  font-size: .9rem;
  background: var(--fond);
  outline: none;
}
.search input:focus {
  border-color: var(--accent);
  background: #fff;
}

/* === Footer === */
.site-footer {
  margin-top: auto;
  padding: 1.5rem 1.25rem;
  border-top: 1px solid var(--bordure);
  text-align: center;
  font-size: .8rem;
  color: var(--texte-sec);
  background: var(--carte);
}
.site-footer .footer-credit { margin-top: .35rem; opacity: .8; }

/* === Home === */
.home {
  max-width: 1000px;
  margin: 0 auto;
  padding: 3rem 1.25rem;
  width: 100%;
}
.hero {
  text-align: center;
  margin-bottom: 3rem;
}
.hero h1 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -.02em;
  margin-bottom: .75rem;
}
.hero .lead {
  font-size: 1.05rem;
  color: var(--texte-sec);
  max-width: 600px;
  margin: 0 auto;
}

.theme-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}
.theme-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--carte);
  border: 1px solid var(--bordure);
  border-left: 4px solid var(--theme-color, var(--accent));
  border-radius: var(--rayon);
  padding: 1.25rem;
  text-decoration: none;
  color: inherit;
  transition: transform .15s ease, box-shadow .15s ease;
}
.theme-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0,0,0,.06);
  text-decoration: none;
}
.theme-icon {
  width: 48px; height: 48px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--theme-color) 12%, transparent);
  color: var(--theme-color);
  font-size: 1.5rem;
  flex-shrink: 0;
}
.theme-body { flex: 1; min-width: 0; }
.theme-label { font-weight: 600; font-size: 1.05rem; }
.theme-tagline { color: var(--texte-sec); font-size: .85rem; margin-top: 2px; }
.theme-count {
  font-size: .75rem;
  color: var(--texte-sec);
  margin-top: .35rem;
  font-variant-numeric: tabular-nums;
}
.theme-arrow { color: var(--texte-sec); flex-shrink: 0; }
.theme-card:hover .theme-arrow { color: var(--theme-color); transform: translateX(2px); }

/* === Theme page (map + sidebar) === */
.page-theme { display: block; }
.theme-page {
  display: grid;
  grid-template-columns: 320px 1fr;
  height: calc(100vh - 56px);
}
.theme-sidebar {
  background: var(--carte);
  border-right: 1px solid var(--bordure);
  overflow-y: auto;
  padding: 1.25rem;
}
.sidebar-head {
  display: flex;
  align-items: flex-start;
  gap: .5rem;
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--bordure);
}
.sidebar-head .back {
  color: var(--texte-sec);
  font-size: 1.2rem;
  text-decoration: none;
  padding-top: 2px;
}
.sidebar-head h1 {
  font-size: 1.25rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.sidebar-head h1 i { color: var(--theme-color); }
.sidebar-head .theme-tagline { color: var(--texte-sec); font-size: .85rem; margin-top: 2px; }

.theme-sidebar h2 {
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--texte-sec);
  margin: 1rem 0 .5rem;
  font-weight: 600;
}

.filter-list { list-style: none; }
.filter-list li { padding: 4px 0; }
.filter-list label {
  display: flex; align-items: center; gap: 8px;
  cursor: pointer; font-size: .9rem;
}
.cat {
  display: inline-block;
  width: 12px; height: 12px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px var(--bordure);
  flex-shrink: 0;
}
.cat-stationnement   { background: #2563eb; }
.cat-aire_jeux       { background: #f59e0b; }
.cat-parc            { background: #10b981; }
.cat-fontaine        { background: #06b6d4; }
.cat-wc              { background: #8b5cf6; }
.cat-defibrillateur  { background: #dc2626; }
.cat-borne_recharge  { background: #14b8a6; }
.cat-tri             { background: #84cc16; }
.cat-parking_velo    { background: #0ea5e9; }
.cat-troncon         { background: #6b7280; }

.lieu-list { list-style: none; max-height: 50vh; overflow-y: auto; }
.lieu-list li { padding: 5px 0; font-size: .85rem; }
.lieu-list li a {
  display: flex; align-items: center; gap: 8px;
  color: var(--texte); text-decoration: none;
}
.lieu-list li a:hover { color: var(--accent); }
.muted { color: var(--texte-sec); font-size: .8rem; }

.theme-map { width: 100%; height: 100%; }

/* === Search === */
.search-page {
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem 1.25rem;
  width: 100%;
}
.search-page h1 { font-size: 1.5rem; margin-bottom: .5rem; }
.search-page h2 {
  font-size: .8rem; text-transform: uppercase;
  color: var(--texte-sec); letter-spacing: .05em;
  margin: 1.5rem 0 .5rem;
}
.search-page .lead { color: var(--texte-sec); margin-bottom: 1rem; }
.result-list { list-style: none; }
.result-list li {
  background: var(--carte);
  border: 1px solid var(--bordure);
  border-radius: 8px;
  padding: .65rem .9rem;
  margin-bottom: .5rem;
}
.result-list li a {
  display: flex; align-items: center; gap: .65rem;
  color: var(--texte); text-decoration: none;
}
.result-list li a:hover { text-decoration: none; }
.result-name { font-weight: 500; flex: 1; }
.empty {
  background: var(--carte);
  border: 1px dashed var(--bordure);
  border-radius: var(--rayon);
  padding: 1.5rem;
  text-align: center;
  color: var(--texte-sec);
}
.theme-mini-grid {
  display: grid;
  gap: .5rem;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}
.theme-mini {
  background: var(--carte);
  border: 1px solid var(--bordure);
  border-left: 3px solid var(--theme-color, var(--accent));
  padding: .75rem 1rem;
  border-radius: 8px;
  color: var(--texte);
  text-decoration: none;
  font-size: .9rem;
}
.theme-mini:hover { text-decoration: none; background: #f9fafb; }
.theme-mini i { color: var(--theme-color); margin-right: 6px; }

/* === Detail page === */
#app-detail {
  display: grid;
  grid-template-columns: 1fr 320px;
  height: calc(100vh - 56px);
}
#map-detail { width: 100%; height: 100%; }
#info-panel {
  background: var(--carte);
  border-left: 1px solid var(--bordure);
  overflow-y: auto;
  padding: 1.25rem;
}
#info-panel h1 { font-size: 1.25rem; margin-bottom: .25rem; }
#info-panel .meta { color: var(--texte-sec); font-size: .85rem; margin-bottom: 1rem; }
#info-panel .info-row { margin: .5rem 0; font-size: .9rem; }
#info-panel .info-row strong {
  display: block; font-size: .7rem;
  text-transform: uppercase; color: var(--texte-sec);
  letter-spacing: .04em; font-weight: 500;
  margin-bottom: 2px;
}
#info-panel h2 {
  font-size: .8rem; text-transform: uppercase;
  color: var(--texte-sec); letter-spacing: .05em;
  margin: 1.25rem 0 .5rem;
}
#info-panel .places-list { list-style: none; }
#info-panel .places-list li {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid #f3f4f6;
  font-size: .9rem;
}
#info-panel .dot {
  width: 10px; height: 10px;
  border-radius: 50%;
}
.dot-standard   { background: #2563eb; }
.dot-pmr        { background: #9333ea; }
.dot-electrique { background: #14b8a6; }
.dot-velo       { background: #0ea5e9; }
.dot-livraison  { background: #f59e0b; }
.dot-reserve    { background: #dc2626; }
#info-panel .badge {
  font-size: .7rem; padding: 2px 6px;
  border-radius: 4px;
  background: #f3f4f6;
  color: #374151;
}

/* === Popups Leaflet === */
.popup-row { margin: 4px 0; }
.popup-row strong { color: var(--texte-sec); font-weight: 500; margin-right: 4px; }

/* === Responsive === */
@media (max-width: 768px) {
  .navbar-inner { flex-wrap: wrap; gap: .5rem; }
  .search { order: 3; max-width: 100%; }

  .theme-page {
    grid-template-columns: 1fr;
    grid-template-rows: 50vh 1fr;
    height: auto;
    min-height: calc(100vh - 56px);
  }
  .theme-sidebar { order: 2; border-right: none; border-top: 1px solid var(--bordure); }
  .theme-map { order: 1; height: 50vh; }

  #app-detail {
    grid-template-columns: 1fr;
    grid-template-rows: 50vh 1fr;
    height: auto;
  }
  #info-panel { border-left: none; border-top: 1px solid var(--bordure); }

  .hero h1 { font-size: 1.5rem; }
}
