/* ============================================================
   MAP - Wrapper, Loader, Popups, Controls, Markers, Route Map
   Scene Locations Theme
   ============================================================ */

/* ---- Map Wrapper ---- */
#mapa-pines-wrapper {
  position: relative;
  width: 100%;
}

#mapa-pines {
  height: calc(100vh - 290px);
  border-radius: 8px;
}

@media (max-width: 1024px) {
  #mapa-pines {
    height: calc(100vh - 359px);
  }
}


/* ---- Map Loader ---- */
#mapa-pines-loader {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

#mapa-pines-loader .spinner {
  display: block;
  width: 50px;
  height: 50px;
}


/* ---- Map Controls ---- */
.leaflet-control-zoom a,
.leaflet-control-zoom a:hover {
  color: black;
}

.leaflet-top.leaflet-left {
  top: 50% !important;
  transform: translateY(-50%);
}

.sl-map-picker .leaflet-top.leaflet-left {
  top: 10px !important;
  transform: none;
}


/* ---- Marker Clusters ---- */
.marker-cluster span {
  color: black !important;
}


/* ---- Custom Pin Markers ---- */
.custom-pin-marker {
  background: none !important;
  border: none !important;
}

.custom-pin-marker img {
  display: block;
  transition: transform 0.2s ease;
}

.custom-pin-marker img.marker-bounce {
  animation: pinBounce 0.6s ease-in-out infinite !important;
}

.custom-pin-marker img {
  width: 40px !important;
  height: 40px !important;
}


/* ---- Map Popups (Leaflet) ---- */
.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  background-color: var(--sl-color-secondary) !important;
  max-width: 200px;
  border-radius: 8px !important;
}

.leaflet-popup-content {
  min-width: 180px;
  min-height: 25px;
  margin: 7px !important;
  line-height: 1.4;
  color: var(--sl-color-text);
}

.popup-thumbnail {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 4px !important;
  margin-bottom: 5px;
  display: block;
}

h3.popup-title {
  font-family: var(--sl-font-family);
  font-weight: 400;
  font-size: 12px !important;
  color: white;
  margin: 0px;
  padding: 0px;
}

.leaflet-container a.leaflet-popup-close-button {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background-color: rgba(0, 0, 0, 0.7) !important;
  text-decoration: none;
  color: var(--sl-color-text);
  font-size: 14px;
  padding: 0px 0px 2px 0px;
  margin: 12px 12px 0px 0px;
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.leaflet-container a.leaflet-popup-close-button:hover {
  background-color: rgba(0, 0, 0, 0.9) !important;
  color: white !important;
  transform: scale(1.1);
}

/* Popup content wrapper */
.popup-content {
  position: relative !important;
}

.popup-content > a {
  display: block !important;
  text-decoration: none !important;
}

.popup-loading {
  text-align: center !important;
  padding: 20px !important;
  font-family: var(--sl-font-family) !important;
}


/* ---- Route Creator Popup ---- */
.route-popup-image {
  width: 200px;
  height: 120px;
  object-fit: cover;
  border-radius: 4px;
  display: block;
}

.route-popup-title {
  font-family: var(--sl-font-family);
  font-size: 14px;
  font-weight: 400;
  color: white;
}

.leaflet-popup-content .route-popup-link {
  color: var(--sl-color-text) !important;
  margin-top: 8px;
  display: inline-block;
  font-family: var(--sl-font-family);
  text-decoration: none;
}

.leaflet-popup-content .route-popup-link:hover {
  color: var(--sl-color-primary) !important;
  text-decoration: underline;
}


/* ---- Favorites Map Popup ---- */
.sl-popup img {
  width: 100% !important;
  height: 150px !important;
  object-fit: cover !important;
  margin-bottom: 10px !important;
  border-radius: 4px !important;
}

.sl-popup h3 {
  margin: 0 0 8px 0 !important;
  font-size: 16px !important;
}

.sl-popup h3 a {
  color: #0073aa !important;
  text-decoration: none !important;
}

.sl-popup p {
  margin: 4px 0 !important;
  font-size: 13px !important;
  color: #666 !important;
}

.sl-popup .favorite-heart {
  position: static !important;
  margin-top: 8px !important;
  border: none !important;
  background: none !important;
  cursor: pointer !important;
  font-size: 20px !important;
  padding: 0px;
}


/* ---- Route Creator - Loading Overlay ---- */
#route-loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
}

#route-loading-overlay.active {
  display: flex;
}

.route-loader-content {
  text-align: center;
  color: white;
  font-family: var(--sl-font-family);
}

.route-loader-spinner {
  width: 60px;
  height: 60px;
  margin: 0 auto 20px;
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top: 4px solid white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.route-loader-progress {
  width: 300px;
  height: 6px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 3px;
  margin: 20px auto;
  overflow: hidden;
}

.route-loader-bar {
  height: 100%;
  background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
  animation: progressBar 2s ease-in-out infinite;
}

.route-loader-text {
  font-size: 18px;
  font-weight: 600;
  margin-top: 10px;
}


/* ---- Route Creator - Info Panel ---- */
#route-info-panel {
  background: var(--sl-color-secondary);
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  margin-bottom: 15px;
  display: none;
}

.route-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  text-align: center;
}

.route-info-item {
  font-family: var(--sl-font-family);
}

#route-distance,
#route-duration,
#route-locations {
  font-size: 32px;
  font-weight: 700;
}

#route-distance {
  color: #3498db;
}

#route-duration {
  color: #e74c3c;
}

#route-locations {
  color: #2ecc71;
}

.route-info-item div:last-child {
  color: var(--sl-color-text);
  margin-top: 5px;
  font-family: var(--sl-font-family);
}


/* ---- Route Creator - Map ---- */
#route-map {
  width: 100%;
  height: 600px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  position: relative;
}

#map-loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  z-index: 1000;
  font-family: var(--sl-font-family);
}

#map-loading > div:first-child {
  font-size: 48px;
  margin-bottom: 15px;
}

#map-loading > div:last-child {
  font-size: 18px;
  color: #7f8c8d;
}

.leaflet-routing-container {
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  font-family: var(--sl-font-family);
}


/* ---- Route Creator - Gallery ---- */
#route-gallery {
  background: var(--sl-color-secondary);
  padding: 30px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  margin-top: 15px;
  display: none;
}

#route-gallery h3 {
  margin: 0 0 30px 0;
  color: white;
  border-bottom: 1px solid var(--sl-color-primary);
  padding-bottom: 10px;
  font-family: var(--sl-font-family);
  font-weight: 300;
}

#gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 20px;
  margin-top: 20px;
}


/* ---- Favorites Map ---- */
#favoritos-map-container {
  display: none;
}

#map-favoritos {
  height: 600px !important;
  width: 100% !important;
  border-radius: 8px !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
}
