#map { height: 100%; width: 100%; background-color: #E6EFE3; font-family: Inter, sans-serif; }
#map-wrap { position: relative; z-index: 0; isolation: isolate; contain: layout style; }

/* Pines 3D optimizados: sin backdrop-filter sobre WebGL y con CSS containment para 60/120 FPS */
.pin3d {
  display: flex; flex-direction: column; align-items: center; background: none; border: 0; padding: 0; cursor: pointer;
  transform-origin: bottom center; contain: layout style;
  transition: transform .2s cubic-bezier(.22,1,.36,1);
}
.pin3d:hover, .pin3d.is-active { transform: translate3d(0, -5px, 0) scale(1.08); z-index: 20; }
.pin3d-card {
  display: flex; align-items: center; gap: 7px; padding: 4px 10px 4px 4px; border-radius: 999px;
  background: rgba(255, 255, 255, .97); border: 2px solid var(--c);
  box-shadow: 0 6px 14px -4px rgba(15, 23, 42, .32);
}
.pin3d-card img { width: 28px; height: 28px; border-radius: 999px; object-fit: cover; flex: none; }
.pin3d-text { display: flex; flex-direction: column; align-items: flex-start; text-align: left; min-width: 0; }
.pin3d-label { font: 800 10.5px/1.15 "Plus Jakarta Sans", Inter, sans-serif; color: #0F172A; white-space: nowrap; max-width: 175px; overflow: hidden; text-overflow: ellipsis; }
.pin3d:hover .pin3d-label, .pin3d.is-active .pin3d-label { max-width: 280px; }
.pin3d-sub { font: 600 9px/1.1 Inter, sans-serif; color: var(--c, #1F5216); white-space: nowrap; margin-top: 1px; }
#map.hide-structure-names .pin3d-text { display: none !important; }
#map.hide-structure-names .pin3d-card { padding: 3px; }
.pin3d-stem { width: 2px; height: 14px; background: var(--c); }
.pin3d-dot {
  width: 12px; height: 12px; border-radius: 999px; background: var(--c); border: 2.5px solid #fff;
  box-shadow: 0 2px 6px rgba(15, 23, 42, .38);
}

/* Renderizado diferido de elementos fuera de pantalla en la lista lateral */
.map-list-item { content-visibility: auto; contain-intrinsic-size: 1px 104px; contain: layout style paint; }

/* Popup 3D MapLibre con entrada GPU */
@keyframes popup3DIn {
  from { opacity: 0; transform: translate3d(0, 12px, 0) scale(0.94); }
  to { opacity: 1; transform: translate3d(0, 0, 0) scale(1); }
}
.maplibregl-popup-content {
  padding: 0 !important; border-radius: 20px !important; overflow: hidden;
  box-shadow: 0 20px 42px -12px rgba(15,23,42,.45) !important; border: 1px solid rgba(38,88,19,.14); width: 300px;
  animation: popup3DIn .24s cubic-bezier(.22, 1, .36, 1) both;
}

/* Panel izquierdo: animaciones exclusivamente en compositor GPU (sin animar padding-left) */
.map-list-btn {
  position: relative;
  transition: background-color .18s ease, transform .2s cubic-bezier(.22, 1, .36, 1);
}
.map-list-btn::before {
  content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 4px; border-radius: 0 4px 4px 0;
  background: var(--c, #265813); transform: scaleY(0); transform-origin: center;
  transition: transform .22s cubic-bezier(.22, 1, .36, 1);
}
.map-list-btn:hover { transform: translate3d(3px, 0, 0); }
.map-list-btn[aria-current="true"]::before { transform: scaleY(1); }
.map-list-btn[aria-current="true"] { transform: translate3d(4px, 0, 0); }

@keyframes orbitPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(100, 149, 82, .5), 0 8px 18px -6px rgba(15,23,42,.28); }
  50% { box-shadow: 0 0 0 7px rgba(100, 149, 82, 0), 0 8px 18px -6px rgba(15,23,42,.28); }
}
.btn-orbit-active { background: #265813 !important; color: #fff !important; animation: orbitPulse 1.8s ease-in-out infinite; }
.maplibregl-popup-close-button { top: 8px !important; right: 8px !important; width: 28px; height: 28px; border-radius: 999px; background: rgba(255,255,255,.94) !important; color: #265813 !important; font-size: 19px; line-height: 26px; z-index: 5; }
.popup-photo { position: relative; height: 132px; display: block; overflow: hidden; }
.popup-photo img { transition: transform .4s cubic-bezier(.22,1,.36,1); }
.popup-photo:hover img { transform: scale(1.06); }
.popup-vr-badge { position: absolute; left: 10px; bottom: 10px; background: rgba(15,23,42,.88); color: #E09F3E; border: 1px solid rgba(224,159,62,.5); font: 700 9.5px/1 Inter, sans-serif; letter-spacing: .05em; text-transform: uppercase; padding: 5px 8px; border-radius: 999px; }
.popup-status { position: absolute; left: 10px; top: 10px; font: 700 10.5px/1 Inter, sans-serif; padding: 5px 9px; border-radius: 999px; z-index: 2; }
.popup-status.ok { background: #D1FAE5; color: #064E3B; }
.popup-status.wip { background: #FEF3C7; color: #78350F; }
.popup-body { padding: 14px 16px 16px; }
.popup-eje { display: flex; align-items: center; gap: 6px; margin: 0; font: 700 10.5px/1.2 Inter, sans-serif; letter-spacing: .05em; text-transform: uppercase; color: #3B7327; }
.popup-eje .dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.popup-body h3 { margin: 6px 0 4px; font: 800 15.5px/1.25 "Plus Jakarta Sans", sans-serif; color: #265813; }
.popup-meta-box { margin-top: 8px; padding: 8px 10px; border-radius: 12px; background: #F4F8F2; border: 1px solid #E2ECE0; font-size: 11.5px; color: #1E293B; display: grid; gap: 4px; }
.popup-reason { margin: 8px 0 0; font-size: 12.5px; color: #334155; }
.popup-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 12px; padding-top: 10px; border-top: 1px solid #E2E8F0; }
.popup-vr-btn { display: inline-flex; align-items: center; gap: 6px; background: #265813; color: #fff !important; font: 700 11.5px/1 Inter, sans-serif; padding: 8px 12px; border-radius: 999px; cursor: pointer; border: 0; transition: background .2s, transform .2s; }
.popup-vr-btn:hover { background: #3B7327; transform: translate3d(0, -1px, 0); }
.popup-link { font-size: 12px; font-weight: 700; color: #3B7327 !important; }

/* Modo selector de coordenadas */
#map.is-coord-mode,
#map.is-coord-mode .maplibregl-canvas-container,
#map.is-coord-mode .maplibregl-canvas {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='25' height='25' viewBox='0 0 25 25'%3E%3Cline x1='12.5' y1='0' x2='12.5' y2='9.5' stroke='%230F172A' stroke-width='1'/%3E%3Cline x1='12.5' y1='15.5' x2='12.5' y2='25' stroke='%230F172A' stroke-width='1'/%3E%3Cline x1='0' y1='12.5' x2='9.5' y2='12.5' stroke='%230F172A' stroke-width='1'/%3E%3Cline x1='15.5' y1='12.5' x2='25' y2='12.5' stroke='%230F172A' stroke-width='1'/%3E%3Ccircle cx='12.5' cy='12.5' r='1.3' fill='%23DC2626'/%3E%3C/svg%3E") 12 12, crosshair !important;
}
.coord-pin {
  display: grid; place-items: center; width: 22px; height: 22px; border-radius: 999px;
  background: #DC2626; color: #fff; border: 2px solid #fff;
  font: 700 10.5px/1 Inter, sans-serif; box-shadow: 0 4px 10px rgba(15, 23, 42, .4); pointer-events: none;
}

/* Etiquetas de sectorización territorial (sin backdrop-filter para evitar readback WebGL) */
.sector-pin {
  display: inline-flex; align-items: center; gap: 5px; padding: 4px 9px; border-radius: 999px;
  background: rgba(255, 255, 255, .96); border: 1.5px solid var(--sc, #1F5216); color: #0F172A;
  font: 600 11px/1 "Plus Jakarta Sans", Inter, sans-serif; white-space: nowrap; cursor: pointer;
  box-shadow: 0 4px 10px -2px rgba(15, 23, 42, .24); contain: layout style paint;
  transition: transform .18s ease, opacity .18s ease, background-color .18s ease, color .18s ease;
}
.sector-pin:hover { transform: scale(1.05); z-index: 15; }
.sector-pin.is-active { background: var(--sc, #1F5216); color: #fff; transform: scale(1.07); z-index: 16; }
.sector-pin.is-dim { opacity: .45; }
.sector-pin-dot { width: 8px; height: 8px; border-radius: 999px; background: var(--sc, #1F5216); flex: none; }
.sector-pin-sub { font-weight: 500; opacity: .78; }
.sector-pin.is-active .sector-pin-dot { background: #fff; }
#map.is-coord-mode .sector-pin { pointer-events: none; }

/* Escenario 3D interactivo del Visor VR */
.vr-stage { perspective: 1100px; overflow: hidden; }
.vr-card-3d { transform-style: preserve-3d; transition: transform .18s ease-out; }
@media (max-width: 1023px) { .m-hide { display: none !important; } }
@media (prefers-reduced-motion: reduce) {
  .pin3d, .map-list-btn, .sector-pin, .popup-photo img, .vr-card-3d { transition: none !important; }
  .maplibregl-popup-content, .btn-orbit-active { animation: none !important; }
}
