/* Estilos del Mapa Satelital (Esri + OpenStreetMap) para el Tour 360° · SUR */

.tour-map-panel {
  position: fixed;
  left: var(--tour-edge, 24px);
  bottom: calc(var(--tour-edge, 24px) + 120px);
  width: 330px;
  height: 250px;
  background: rgba(18, 48, 39, 0.94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 12px;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 4;
  color: #fff;
  transition: width 0.2s ease, height 0.2s ease, transform 0.2s ease;
}

.tour-map-panel[hidden] {
  display: none !important;
}

.tour-map-panel.expanded {
  width: min(560px, calc(100vw - 48px));
  height: min(440px, calc(100vh - 220px));
}

.map-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: rgba(15, 38, 31, 0.85);
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  gap: 8px;
  flex-shrink: 0;
}

.map-panel-title {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.map-eyebrow {
  font-size: 7.5px;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: #a4c4b0;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.map-panel-title h3 {
  margin: 1px 0 0;
  font-size: 11px;
  font-weight: 550;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.map-panel-actions {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.map-panel-actions .icon-button.sm {
  width: 28px;
  height: 28px;
  min-height: 28px;
  font-size: 16px;
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 0.15s, border-color 0.15s;
}

.map-panel-actions .icon-button.sm:hover,
.map-panel-actions .icon-button.sm:focus-visible {
  background: rgba(255, 255, 255, 0.25);
  border-color: #ffffff;
}

.tour-map-canvas {
  flex: 1;
  width: 100%;
  min-height: 0;
  background: #11261f;
  position: relative;
}

.map-panel-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: rgba(15, 38, 31, 0.85);
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 9.5px;
  color: #d2e4d7;
  flex-shrink: 0;
}

.map-legend-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 6px #22c55e;
  flex-shrink: 0;
}

/* Anular estilos por defecto de Leaflet en divIcon (fondo blanco + borde) */
.leaflet-div-icon {
  background: transparent !important;
  border: none !important;
}

/* Marcadores Leaflet personalizados */
.tour-map-marker-wrap {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
}

.tour-map-marker {
  position: relative;
  width: 32px;
  height: 32px;
  cursor: pointer;
}

.marker-core {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #166534;
  border: 2px solid #ffffff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
  display: grid;
  place-items: center;
  transition: transform 0.2s ease, background 0.2s ease;
}

.marker-main .marker-core {
  background: #15803d;
  border-color: #f0fdf4;
}

.marker-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #86efac;
}

.tour-map-marker:hover .marker-core {
  transform: translate(-50%, -50%) scale(1.2);
  background: #22c55e;
}

.tour-map-marker.active .marker-core {
  background: #22c55e;
  border-color: #ffffff;
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.4), 0 3px 8px rgba(0, 0, 0, 0.7);
  animation: pulse-marker 2s infinite;
}

.tour-map-marker.active .marker-dot {
  background: #ffffff;
}

@keyframes pulse-marker {
  0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.6), 0 3px 8px rgba(0, 0, 0, 0.7); }
  70% { box-shadow: 0 0 0 8px rgba(34, 197, 94, 0), 0 3px 8px rgba(0, 0, 0, 0.7); }
  100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0), 0 3px 8px rgba(0, 0, 0, 0.7); }
}

.marker-label {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-top: 3px;
  font-size: 8.5px;
  font-weight: 550;
  color: #ffffff;
  background: rgba(14, 38, 30, 0.9);
  padding: 2px 5px;
  border-radius: 4px;
  white-space: nowrap;
  pointer-events: none;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
  display: none;
}

.tour-map-marker:hover .marker-label,
.tour-map-marker.active .marker-label {
  display: block;
}

/* Cono de radar que rota en tiempo real con la orientación 360° */
.marker-radar {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 48px;
  height: 48px;
  pointer-events: none;
  transform-origin: 50% 100%;
  transform: translate(-50%, -100%) rotate(0deg);
  background: conic-gradient(from 330deg at 50% 100%, rgba(34, 197, 94, 0.45) 0deg, rgba(34, 197, 94, 0.7) 30deg, rgba(34, 197, 94, 0.45) 60deg, transparent 60.1deg);
  border-radius: 50% 50% 0 0;
  filter: drop-shadow(0 0 4px rgba(34, 197, 94, 0.5));
  transition: transform 0.05s linear;
}

.marker-radar.hidden {
  display: none !important;
}

/* Personalización de la barra de atribución de Leaflet (Esri | © OpenStreetMap) */
.tour-map-canvas .leaflet-control-attribution {
  font-size: 8px !important;
  background: rgba(14, 38, 30, 0.8) !important;
  color: #c9dbcd !important;
  padding: 2px 6px !important;
  border-radius: 4px 0 0 0 !important;
}

.tour-map-canvas .leaflet-control-attribution a {
  color: #86efac !important;
  text-decoration: none;
}

.tour-map-canvas .leaflet-control-zoom a {
  background: rgba(18, 48, 39, 0.9) !important;
  color: #ffffff !important;
  border-color: rgba(255, 255, 255, 0.25) !important;
  width: 26px !important;
  height: 26px !important;
  line-height: 24px !important;
  font-size: 14px !important;
}

/* Adaptación responsive */
@media (max-width: 1000px) {
  .tour-map-panel {
    bottom: calc(var(--tour-edge, 16px) + 105px);
    width: 290px;
    height: 230px;
  }
}

@media (max-width: 700px) {
  .tour-map-panel {
    left: 8px;
    right: 8px;
    bottom: 8px;
    width: auto !important;
    height: 280px !important;
    max-height: 52dvh;
    border-radius: 12px;
    z-index: 10;
  }
  .tour-map-panel.expanded {
    max-height: 75dvh;
  }
}

