/* =========================================================================
   JPATS — Carte partagée du briefing (Leaflet + overlay canvas de dessin)
   ========================================================================= */

.jbm {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--bg-deep);
}

/* Toolbar */
.jbm-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border-default);
  flex-wrap: wrap;
}
.jbm-tool-group {
  display: flex;
  align-items: center;
  gap: 4px;
  padding-right: 12px;
  border-right: 1px solid var(--border-subtle);
}
.jbm-tool-group:last-of-type { border-right: none; padding-right: 0; }
.jbm-tool-spacer { flex: 1; }

.jbm-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.12s;
}
.jbm-btn:hover { border-color: var(--accent-flame); color: var(--text-primary); }
.jbm-btn.is-active {
  background: var(--accent-flame);
  border-color: var(--accent-flame);
  color: #1a0f05;
}
.jbm-btn.danger { color: var(--accent-red); }
.jbm-btn.danger:hover { background: rgba(216, 17, 68, 0.1); border-color: var(--accent-red); }
.jbm-btn svg { width: 12px; height: 12px; stroke: currentColor; fill: none; stroke-width: 2; }

/* Palette couleurs */
.jbm-colors { gap: 5px; }
.jbm-color {
  width: 24px; height: 24px;
  border-radius: 50%;
  border: 2px solid var(--border-subtle);
  cursor: pointer;
  padding: 0;
  transition: transform 0.1s, border-color 0.12s, box-shadow 0.12s;
}
.jbm-color:hover { transform: scale(1.12); }
.jbm-color.is-active {
  border-color: var(--text-primary);
  box-shadow: 0 0 0 2px rgba(245, 242, 232, 0.4);
  transform: scale(1.12);
}

/* Tailles de pinceau */
.jbm-sizes { gap: 4px; }
.jbm-size {
  width: 26px; height: 26px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: border-color 0.12s;
}
.jbm-size:hover { border-color: var(--accent-flame); }
.jbm-size.is-active {
  border-color: var(--accent-flame);
  background: rgba(161, 120, 76, 0.15);
}
.jbm-size span {
  background: var(--text-primary);
  border-radius: 50%;
  display: block;
}

/* Présence temps réel */
.jbm-presence {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: rgba(90, 179, 120, 0.12);
  border: 1px solid rgba(90, 179, 120, 0.3);
  border-radius: 20px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: #5ab378;
  letter-spacing: 1px;
  max-width: 260px;
}
.jbm-presence.is-offline {
  background: rgba(216, 17, 68, 0.12);
  border-color: rgba(216, 17, 68, 0.3);
  color: var(--accent-red);
  animation: jbmPulse 1s ease-in-out infinite;
}
@keyframes jbmPulse { 50% { opacity: 0.55; } }

.jbm-presence-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 6px currentColor;
}
.jbm-presence-count {
  font-weight: 700;
  min-width: 8px;
}
.jbm-presence-list {
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 180px;
}

/* Zone carte + overlay dessin */
.jbm-canvas-wrap {
  position: relative;
  flex: 1 1 auto;
  overflow: hidden;
  background: #060811;
}
.jbm-leaflet {
  position: absolute;
  inset: 0;
  z-index: 1;
}
.jbm-draw {
  position: absolute;
  inset: 0;
  z-index: 500;   /* au-dessus des tuiles et markers Leaflet */
  cursor: crosshair;
  touch-action: none;
}
/* Mode pan : le canvas laisse passer tous les évènements vers Leaflet */
.jbm-draw.is-pan {
  pointer-events: none;
}
/* Les contrôles de zoom Leaflet doivent rester cliquables même si canvas devant.
   Astuce : on remonte leur z-index au-dessus du canvas. */
.jbm-leaflet .leaflet-control-container {
  position: absolute;
  inset: 0;
  z-index: 600;
  pointer-events: none;
}
.jbm-leaflet .leaflet-control-container .leaflet-control {
  pointer-events: auto;
}

.jbm-loading {
  position: absolute;
  inset: 0;
  z-index: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(6, 8, 17, 0.9);
  color: var(--accent-flame);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 3px;
}

/* Barre de statut basse */
.jbm-status-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 6px 12px;
  background: var(--bg-panel);
  border-top: 1px solid var(--border-default);
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}
.jbm-status-code {
  color: var(--accent-flame);
  font-weight: 700;
  letter-spacing: 1.5px;
}
.jbm-status-route {
  color: var(--text-secondary);
}
.jbm-status-hint {
  margin-left: auto;
  color: var(--text-dim);
  font-style: italic;
}
