/* style.css - VERSIÓN COMPLETA CON SUGERENCIAS VISIBLES */
/* --- Ajustes base --- */
html, body {
  height: 100%;
  width: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  font-family: "Segoe UI", Roboto, Arial, sans-serif;
  background-color: #f5f5f5;
}

/* --- Ventana contenedora del mapa --- */
#map-window {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: calc(100vh - 70px);
  padding: 10px;
  background: white;
  border-bottom: 1px solid #ccc;
  border-radius: 0 0 10px 10px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
  z-index: 0;
  box-sizing: border-box;
}

/* --- Contenedor del mapa --- */
#map {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 6px;
}

/* --- Indicador de cache --- */
#cache-indicator {
  position: absolute;
  top: 10px;
  left: 10px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  z-index: 1000;
  display: none;
  box-shadow: 0 2px 4px rgba(0,0,0,0.25);
}

/* --- Cuadro de búsqueda --- */
#search-container {
  position: fixed;
  top: 25px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  background: rgba(255, 255, 255, 0.95);
  padding: 8px 12px;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
  display: flex;
  gap: 8px;
  align-items: center;
  backdrop-filter: blur(4px);
  width: fit-content;
  max-width: 90vw;
  white-space: nowrap;
}

/* --- Campo de texto --- */
#search-input {
  padding: 8px 10px;
  font-size: 14px;
  width: 220px;
  border: 1px solid #ccc;
  border-radius: 6px;
  outline: none;
  transition: border-color 0.2s;
  flex-shrink: 0;
}
#search-input:focus {
  border-color: #0078ff;
}

/* --- Botones --- */
#search-btn,
#locate-btn,
#toggle-view-btn {
  background-color: #0078ff;
  color: white;
  border: none;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 4px rgba(0,0,0,0.25);
  transition: background-color 0.2s, transform 0.1s;
  flex-shrink: 0;
}
#locate-btn:hover,
#search-btn:hover,
#toggle-view-btn:hover {
  background-color: #005dc1;
}
#locate-btn:active {
  transform: scale(0.95);
}

/* --- Iconos en botones --- */
#locate-btn img,
#search-btn img,
#toggle-view-btn img {
  width: 20px;
  height: 20px;
}

/* --- Caja de sugerencias - CORREGIDA --- */
#suggestions-box {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid #ccc;
  border-top: none;
  border-radius: 0 0 6px 6px;
  max-height: 200px;
  overflow-y: auto;
  z-index: 2000;
  display: none;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Estilos para las sugerencias de autocompletado - TEXTO VISIBLE */
#suggestions-box div {
  padding: 8px 12px;
  cursor: pointer;
  border-bottom: 1px solid #f0f0f0;
  transition: background-color 0.2s, color 0.2s;
  color: #333; /* Texto oscuro para buen contraste */
  font-size: 14px;
  line-height: 1.4;
}

#suggestions-box div:hover {
  background-color: #f8f9fa;
  color: #0056b3;
}

#suggestions-box div:last-child {
  border-bottom: none;
}

/* --- Contenedor de categorías --- */
#categories-container {
  position: fixed;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2000;
  background: rgba(255, 255, 255, 0.95);
  padding: 8px 12px;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
  display: none;
  gap: 10px;
  align-items: center;
  flex-wrap: nowrap;
  justify-content: center;
  backdrop-filter: blur(4px);
  max-width: 90vw;
}

/* --- Item de categoría --- */
.category-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

/* --- Botones de categorías --- */
.category-btn {
  background-color: white;
  color: white;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 4px rgba(0,0,0,0.25);
  transition: background-color 0.2s, transform 0.1s, filter 0.2s;
}
.category-btn:hover {
  background-color: #f0f0f0;
}
.category-btn:active {
  transform: scale(0.95);
}
.category-btn img {
  width: 24px;
  height: 24px;
}

.category-btn.inactive {
  opacity: 1;
}

/* --- Etiquetas de categorías --- */
.category-label {
  font-size: 11px;
  color: #333;
  font-weight: 500;
  text-align: center;
  max-width: 60px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* --- Mensaje inicial --- */
#initial-message {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 3000;
  background: rgba(255, 255, 255, 0.9);
  padding: 15px 25px;
  border-radius: 8px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.3);
  font-size: 16px;
  color: #333;
  display: none;
  text-align: center;
}

/* --- Mensaje de carga --- */
#loading-message {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 3000;
  background: rgba(255, 255, 255, 0.9);
  padding: 15px 25px;
  border-radius: 8px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.3);
  font-size: 16px;
  color: #333;
  display: none;
  text-align: center;
}

/* --- Responsivo para móviles --- */
@media (max-width: 600px) {
  #search-container {
    top: 15px;
    gap: 6px;
    padding: 8px 10px;
    max-width: 95vw;
  }
  #search-input {
    width: 140px;
    font-size: 13px;
    padding: 6px 8px;
  }
  #map-window {
    height: calc(100vh - 60px);
    padding: 5px;
  }
  #categories-container {
    bottom: 5px;
    padding: 6px;
    gap: 8px;
    flex-wrap: nowrap;
  }
  .category-btn {
    width: 36px;
    height: 36px;
  }
  .category-btn img {
    width: 20px;
    height: 20px;
  }
  .category-label {
    font-size: 10px;
    max-width: 50px;
  }
  #initial-message,
  #loading-message {
    font-size: 14px;
    padding: 10px 20px;
  }
  #search-btn,
  #locate-btn,
  #toggle-view-btn {
    width: 32px;
    height: 32px;
  }
  #locate-btn img,
  #search-btn img,
  #toggle-view-btn img {
    width: 16px;
    height: 16px;
  }
  #cache-indicator {
    top: 5px;
    left: 5px;
    width: 15px;
    height: 15px;
  }
  
  /* Sugerencias en móviles */
  #suggestions-box div {
    padding: 10px 12px;
    font-size: 13px;
  }
}

/* --- Para pantallas muy pequeñas --- */
@media (max-width: 375px) {
  #search-container {
    gap: 4px;
    padding: 6px 8px;
  }
  #search-input {
    width: 120px;
    font-size: 12px;
  }
  .category-btn {
    width: 32px;
    height: 32px;
  }
  .category-btn img {
    width: 18px;
    height: 18px;
  }
  .category-label {
    font-size: 9px;
    max-width: 45px;
  }
  #categories-container {
    gap: 6px;
    padding: 4px 6px;
  }
}

/* --- Estilos para los marcadores personalizados --- */
.custom-pin {
  background: transparent;
  border: none;
}

/* --- Ajustes para el popup de Leaflet --- */
.leaflet-popup-content {
  margin: 8px 12px;
  font-size: 14px;
  line-height: 1.4;
}

.leaflet-popup-content b {
  color: #333;
  font-weight: 600;
}
