/* ====== Layout de base ====== */
html, body {
  height: 100%;
  margin: 0;
  font-family: system-ui, Arial, sans-serif;
}
#map {
  position: absolute;
  inset: 0;
}
#map canvas {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  -webkit-user-select: none;
  user-select: none;
}

/* ====== Statut ====== */
.status {
  position: absolute;
  top: 10px; right: 10px;
  z-index: 10030;
  background: rgba(0,0,0,0.6);
  color: #fff;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 12px;
  pointer-events: none;
}

/* ====== Barre de swipe + poignée ====== */
#divider {
  position: absolute;
  top: 0; bottom: 0;
  left: 50%;
  width: 28px;
  transform: translateX(-50%);
  z-index: 10010;
  cursor: col-resize;
  touch-action: none;
  background: transparent;
}
#divider::before {
  content: "";
  position: absolute;
  top: 0; bottom: 0;
  left: 50%;
  width: 2px;
  transform: translateX(-1px);
  background: #fff;
  box-shadow: 0 0 0 1px rgba(0,0,0,.35), 0 0 12px rgba(0,0,0,.28);
  pointer-events: none;
}
#handle {
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: 56px; height: 56px;
  border-radius: 50%;
  background: radial-gradient(120% 120% at 30% 30%, #66b1ff, #2b6be9);
  border: 3px solid #fff;
  z-index: 10011;
  box-shadow: 0 6px 18px rgba(0,0,0,.25), inset 0 0 0 2px rgba(0,0,0,.15);
  cursor: col-resize;
  touch-action: none;
  user-select: none;
}
#handle::before,
#handle::after {
  content: "";
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 0; height: 0;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,.2));
}
#handle::before { left: 12px; border-right: 12px solid #fff; }
#handle::after  { right: 12px; border-left: 12px solid #fff; }
#handle:hover { filter: brightness(1.05); }
#handle:active { transform: translate(-50%, -50%) scale(0.98); }

@media (max-width: 640px) {
  #handle { width: 64px; height: 64px; }
  #divider { width: 40px; }
}

/* ====== Panneau flottant (contient rubriques + légende) ====== */
#panel {
  position: absolute;
  left: 12px; top: 12px;
  z-index: 10020;
  background: transparent;           /* pas de grande plaque blanche */
  box-shadow: none;
  padding: 8px;
  min-width: 220px;
}

/* ====== Menu vertical Rubriques (carte dédiée) ====== */
#rubriques {
  display: flex;
  flex-direction: column;
  gap: 8px;                          /* espace entre boutons */
  background: rgba(255,255,255,.96); /* carte blanche séparée */
  border: 1px solid rgba(0,0,0,.08);
  border-radius: 12px;
  box-shadow: 0 6px 18px rgba(0,0,0,.15);
  padding: 8px;
  margin-bottom: 12px;               /* séparation d'avec la légende */
}
#rubriques .item {
  appearance: none;
  background: #fff;
  color: #000;
  font-weight: 700;
  border: 1px solid rgba(0,0,0,.12);
  border-radius: 8px;
  text-align: left;
  font-size: 13px;
  padding: 8px 12px;
  cursor: pointer;
  line-height: 1.2;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
#rubriques .item:hover {
  background: #f4f7ff;
  border-color: rgba(0,0,0,.25);
}
#rubriques .item.active {
  background: #e8f0ff;
  border-color: #2b6be9;
  color: #000;
}

/* ====== Légende repliable (carte dédiée, plus compacte) ====== */
#legend {
  background: rgba(255,255,255,.96); /* carte blanche séparée */
  border: 1px solid rgba(0,0,0,.08);
  border-radius: 12px;
  box-shadow: 0 6px 18px rgba(0,0,0,.12);
  padding: 8px;
}
#legendToggle{
  width: 100%;
  appearance: none;
  background: transparent;           /* le conteneur porte la carte */
  border: 0;
  padding: 0;
  font-size: 12px;
  color: #000;
  font-weight: 700;
  cursor: pointer;
  display: flex; align-items: center; justify-content: space-between;
}
#legendBody{
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid rgba(0,0,0,.08);
}
#legend.collapsed #legendBody{ display:none; }
.legend-bar{
  height: 8px;
  border-radius: 4px;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.12);
}
.legend-scale{
  margin-top: 2px;
  display:flex; justify-content: space-between;
  font-size: 10px; color:#000; font-weight:700;
}

/* ====== Tooltip curseur ====== */
#tempTip{
  background: rgba(0,0,0,.78);
  color:#fff;
  padding:4px 6px;
  border-radius:6px;
  font-size:12px;
  line-height:1;
  pointer-events:none;
  white-space:nowrap;
  z-index:10040;
}

/* Optionnel: style appliqué si tu ajoutes .dragging au body côté JS */
body.dragging {
  user-select: none;
  cursor: col-resize;
}
