/* ── Layout SPA ── */
html, body { height: 100%; overflow: hidden; }
#app { display: flex; flex-direction: column; height: calc(100vh - 52px); }

/* ── Map ── */
#map-wrap { flex: 1 1 var(--map-h, 52vh); position: relative; min-height: 20vh; max-height: 85vh; }
#map { height: 100%; }

/* ── Drag handle ── */
#drag-handle {
  height: 28px;                    /* larger touch target (min 44px recommended, but 28px + padding works) */
  background: #e9ecef;
  cursor: row-resize;
  user-select: none;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;              /* prevent browser scroll during drag */
}
#drag-handle::before {
  content: "";
  display: block;
  width: 48px; height: 5px;        /* bigger visual gripper */
  background: #adb5bd;
  border-radius: 3px;
  transition: background 0.2s, height 0.2s, transform 0.1s;
}
#drag-handle:hover::before,
#drag-handle.dragging::before {
  background: #495057;
  height: 7px;
  transform: scaleX(1.1);
}
#drag-handle:focus-visible {
  outline: 2px solid var(--accent, #0d6efd);
  outline-offset: -2px;
}
#drag-handle:active::before {
  background: #212529;
  height: 8px;
}

/* ── Barre stats / recherche ── */
#search-bar {
  flex-shrink: 0;
  background: #fff; border-bottom: 1px solid #dee2e6;
  padding: .35rem 1rem;
  display: flex; align-items: center; gap: .75rem; flex-wrap: wrap;
}
.stat-pill {
  background: #f1f3f5; border-radius: 20px;
  padding: .1rem .6rem; font-size: .78rem; color: #495057;
}
.stat-pill strong { color: #1a1a2e; }

/* ── Mode cache (bouton carte + pill) ─────────────────────────────────── */
.cache-ctrl button.cache-btn {
  width: 38px; height: 38px;
  font-size: 17px;
  display: block;
  background: #fff;
  border: 0;
  cursor: pointer;
}
.cache-ctrl button.cache-btn.cache-on {
  background: #d1f7d1;              /* vert = cache actif */
  box-shadow: inset 0 0 0 2px #198754;
}
.cache-ctrl button.cache-btn:focus-visible {
  outline: 2px solid var(--accent, #0d6efd);
  outline-offset: -2px;
}
#cache-pill { max-width: 60ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Panneau détail ── */
#detail-wrap { flex: 0 0 var(--detail-h, 35vh); overflow-y: auto; background: #f5f7fa; min-height: 15vh; max-height: 80vh; }

#detail-placeholder {
  height: 100%; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  color: #adb5bd; gap: .5rem; user-select: none;
}

/* ── Fiche pastilles ── */
.fiche-pills {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .35rem;
  padding: .6rem;
}
.fiche-pill {
  display: flex;
  flex-direction: column;
  background: #f1f3f5;
  border-radius: 8px;
  padding: .3rem .55rem;
  min-width: 0;
}
.fiche-pill-label {
  font-size: .65rem;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: #868e96;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fiche-pill-value {
  font-size: .82rem;
  font-weight: 700;
  color: #1a1a2e;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.section-text { white-space: pre-line; font-size: .87rem; line-height: 1.65; }

/* ── Ligne dernière observation de débit ── */
.debit-dot {
  display: inline-block;
  width: .6rem; height: .6rem;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Icône ℹ superposée en haut à droite du graphe de débit : positionnée par
   rapport au slot #debit-chart (position:relative), semi-transparente. */
#debit-chart { position: relative; }
.debit-info-btn {
  position: absolute;
  top: .15rem;
  right: .3rem;
  width: 1.4rem; height: 1.4rem;
  padding: 0;
  border: 1px solid #adb5bd;
  border-radius: 50%;
  background: rgba(255, 255, 255, .55);
  color: #495057;
  font-size: .72rem;
  font-weight: 700;
  font-style: italic;
  font-family: Georgia, 'Times New Roman', serif;
  line-height: 1;
  cursor: pointer;
  z-index: 5;
}
.debit-info-btn:hover {
  background: rgba(255, 255, 255, .85);
  color: #1a1a2e;
}
.accordion-button { font-size: .88rem; font-weight: 600; }
.accordion-button:not(.collapsed) { background: #eef4ff; color: #1a1a2e; }

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: .75rem;
}
.photo-grid img {
  width: 100%; aspect-ratio: 4 / 3; object-fit: cover;
  border-radius: 4px;
}
.photo-thumbnail {
  appearance: none; border: 0; padding: 0; background: transparent;
  cursor: pointer;
}
.photo-thumbnail:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.photo-viewer {
  min-height: 100%; display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center; gap: 1rem;
  background: #111; color: #fff;
}
.photo-viewer img {
  max-width: 100%; max-height: calc(100vh - 9rem);
  width: auto; height: auto; margin: auto;
}
.photo-viewer-control {
  width: 3rem; height: 3rem; border: 0; border-radius: 50%;
  background: rgba(255, 255, 255, .18); color: #fff; font-size: 2rem;
}
.photo-viewer-back {
  position: absolute; top: 1rem; left: 1rem; z-index: 1;
}
