.inventory-map-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,.08);
  overscroll-behavior: contain;
  z-index: 1;
}

.map-container {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: contain;
  z-index: 2;
}

#map2d {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transform: scale(1.01);
  transition: opacity .35s ease, transform .35s ease;
  pointer-events: auto;
  touch-action: pan-x pan-y !important; /* ✅ allow drag & zoom */
}

#map2d.active {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
  touch-action: pan-x pan-y !important;
}

.spinner-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,.12);
  z-index: 10;
  pointer-events: none; /* ✅ prevents blocking map when hidden */
  transition: opacity .3s ease;
}

.spinner-overlay[style*="display: flex"] {
  pointer-events: auto; /* only active during loading */
}

.spinner {
  width: 50px;
  height: 50px;
  border: 5px solid rgba(255,255,255,.3);
  border-radius: 50%;
  border-top-color: #e20613;
  animation: spin 1s ease-in-out infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.map-buttons { position: absolute; top: 12px; right: 12px; display: flex; flex-direction: column; gap: 6px; z-index: 12; }
.map-buttons button { background: #222; color:#fff; border:0; border-radius: 0; padding: 10px 12px; font-size: 12px; letter-spacing:.02em; cursor:pointer; opacity:.95; }
.map-buttons button:hover { opacity:1; }
.map-buttons button.active { background: #e20613; }

.leaflet-marker-icon { width: 35px !important; height: 35px !important; }
.leaflet-control-zoom a { background:#222; color:#fff; border:0; }
.leaflet-top .leaflet-control { margin-top: 20px; }
.leaflet-bar a:hover, .leaflet-bar a:focus { background-color:#e20613; transition: background-color .3s ease-in-out; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background:#222; color:#fff; box-shadow:0 3px 10px rgba(0,0,0,.4); }
.leaflet-popup-content-wrapper { border-radius: 8px; padding: 0; }
.leaflet-popup-content { margin: 0; padding: 0; }
.leaflet-container a.leaflet-popup-close-button { display:none; }

.inventory-popup {
  display: flex;
  flex-direction: column;
  width: 300px;
  font: 14px/1.4 system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: #222;
  color: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.inventory-popup .thumb { width: 100%; margin: 0; }
.inventory-popup .thumb img { width: 100%; object-fit: cover; display: block; }
.inventory-popup .meta { padding: 16px; }
.inventory-popup .meta h3 { margin: 0 0 12px; font-size: 14px; color: #fff; font-weight: 600; line-height: 1.3; }
.inventory-popup .meta a {
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  padding: 10px 16px;
  background: #e20613;
  border-radius: 6px;
  display: inline-block;
  transition: all 0.2s ease;
  width: 100%;
  text-align: center;
  box-sizing: border-box;
}
.inventory-popup .meta a:hover {
  background: #b8050f;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(226, 6, 19, 0.3);
}
