* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

body {
  display: flex;
  flex-direction: column;
  height: 100vh;
  background-color: #f5f7f5;
  color: #333;
  line-height: 1.6;
}

header {
  background: linear-gradient(135deg, #8eb69b 0%, #5d8a6f 100%);
  padding: 8px 15px;
  text-align: center;
  border-bottom: none;
  color: white;
  box-sizing: border-box;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  margin-bottom: 15px;
}

.header-container {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 15px;
}

.logo img {
  width: 60px;
  height: 60px;
  transition: transform 0.3s ease;
}

.logo img:hover {
  transform: scale(1.05);
}

@media (max-width: 1400px) {
  .header-container {
    padding: 0 10px;
  }
}

@media (max-width: 768px) {
  .header-container {
    padding: 0 5px;
  }

  .logo img,
  .user-icon img {
    width: 45px;
    height: 45px;
  }
}

@media (max-width: 480px) {
  .header-container {
    padding: 0 5px;
  }

  .logo img,
  .user-icon img {
    width: 40px;
    height: 40px;
  }
}

.search-bar {
  position: relative;
  display: flex;
  align-items: center;
  border: 2px solid #8eb69b;
  border-radius: 20px;
  padding: 6px 12px;
  background-color: #f9fbf9;
  width: fit-content;
  max-width: 60%;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
}

.search-bar:hover,
.search-bar:focus-within {
  box-shadow: 0 3px 8px rgba(93, 138, 111, 0.2);
  border-color: #5d8a6f;
}

@media (min-width: 769px) {
  .search-bar {
    max-width: 90%; /* Increased max-width for larger screens */
    width: 50%;
  }
}

@media (max-width: 768px) {
  .search-bar {
    max-width: 90%; /* Increased max-width for mobile version */
  }
}

@media (max-width: 480px) {
  .search-bar {
    max-width: 60%; /* Further reduced max-width for smaller screens */
    padding: 4px 8px; /* Reduced padding */
  }

  #search {
    max-width: 60%; /* Further reduced max-width for smaller screens */
  }

  .search-bar .search-button img,
  .search-bar .filter-button img {
    width: 20px; /* Further reduced width for smaller screens */
  }
}

.search-bar .filter-button {
  background-color: transparent;
  border: none;
  cursor: pointer;
  padding: 6px;
  margin-right: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background-color 0.2s ease;
}

.search-bar .filter-button:hover {
  background-color: rgba(93, 138, 111, 0.1);
  transform: scale(1.05);
}

.search-bar .filter-button img {
  width: 20px;
  height: 20px;
  opacity: 0.8;
  transition: opacity 0.3s ease;
}

.search-bar .filter-button:hover img {
  opacity: 1;
}

.search-bar input[type="text"] {
  flex-grow: 1;
  border: none;
  outline: none;
  padding: 8px 10px;
  font-size: 15px;
  background-color: transparent;
  color: #333;
}

.search-bar input[type="text"]::placeholder {
  color: #999;
  opacity: 0.8;
}

.search-bar .search-button {
  background-color: transparent;
  border: none;
  cursor: pointer;
  padding: 6px;
  margin-left: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background-color 0.2s ease;
}

.search-bar .search-button:hover {
  background-color: rgba(93, 138, 111, 0.1);
  transform: scale(1.05);
}

.search-bar .search-button img {
  width: 20px;
  height: 20px;
  opacity: 0.8;
  transition: opacity 0.3s ease;
}

.search-bar .search-button:hover img {
  opacity: 1;
}

/* Mejora del foco en el campo de búsqueda */
.search-bar input[type="text"]:focus {
  outline: none;
  box-shadow: none;
}

.search-bar:focus-within {
  box-shadow: 0 0 0 2px rgba(93, 138, 111, 0.3);
}

/* Estado activo para el botón de filtros */
.search-bar .filter-button.active-filter {
  background-color: rgba(93, 138, 111, 0.2);
  box-shadow: 0 0 0 2px #5d8a6f;
  transform: scale(1.05);
}

.search-bar .filter-button.active-filter img {
  opacity: 1;
}

/* Cuadro de Filtros Mejorado */
.filter-box {
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  background: white;
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15);
  z-index: 1000;
  transition: opacity 0.3s ease, transform 0.3s ease;
  border: 1px solid rgba(142, 182, 155, 0.3);
}

.filter-box.hidden {
  display: none;
  opacity: 0;
  transform: translateY(-10px);
}

.filter-content {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.filter-content label {
  font-weight: 500;
  color: #444;
  margin-bottom: 5px;
  display: block;
}

.star-filter {
  display: flex;
  align-items: center;
  gap: 15px;
}

.star-filter input[type="range"] {
  flex-grow: 1;
  height: 6px;
  -webkit-appearance: none;
  background: #e0e0e0;
  border-radius: 3px;
  outline: none;
}

.star-filter input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #5d8a6f;
  cursor: pointer;
  border: 2px solid white;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.star-filter input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #5d8a6f;
  cursor: pointer;
  border: 2px solid white;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.star-filter span {
  font-weight: bold;
  color: #5d8a6f;
  font-size: 16px;
  width: 10px;
  text-align: center;
}

.filter-box img {
  width: 16px;
  height: 16px;
  vertical-align: middle;
}

.checkbox-container {
  display: flex;
  align-items: center;
  gap: 10px;
}

.checkbox-container input[type="checkbox"] {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border: 2px solid #5d8a6f;
  border-radius: 4px;
  outline: none;
  cursor: pointer;
  position: relative;
  transition: background 0.2s ease;
}

.checkbox-container input[type="checkbox"]:checked {
  background: #5d8a6f;
}

.checkbox-container input[type="checkbox"]:checked::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 5px;
  width: 5px;
  height: 10px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

#apply-filters {
  background: #5d8a6f;
  color: white;
  border: none;
  padding: 12px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s ease;
  margin-top: 5px;
}

#apply-filters:hover {
  background: #4d7a5f;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.container {
  display: flex;
  height: calc(100vh - 60px);
}

.sidebar {
  width: 450px;
  background: #f4f4f4;
  padding: 15px;
  overflow-y: auto;
}

@media (max-width: 1050px) {
  .container {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    order: -1; /* Place the sidebar above the map */
  }

  .map-container {
    height: 210vh; /* Set a fixed height for the map container */
  }
}

.gallery-item {
  background: white;
  padding: 20px; /* Increased padding */
  border-radius: 8px;
  margin-bottom: 20px; /* Increased margin-bottom */
  box-shadow: 0 0 5px rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease;
  color: #333; /* Mejor contraste para el texto */
}

.gallery-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
}

.gallery-content {
  display: flex;
  justify-content: space-between;
  align-items: flex-start; /* Alinea los elementos en la parte superior */
}

.gallery-text {
  flex-grow: 1; /* Permite que el texto ocupe el espacio disponible */
  font-size: 1em; /* Default font size */
}

.rating {
  margin-top: 4px;
  color: #ffd700;
  text-shadow: 0 0 3px rgba(255, 215, 0, 0.3);
}

@media (max-width: 768px) {
  .gallery-text {
    font-size: 0.9em; /* Smaller font size for smaller screens */
  }
}

.gallery-image {
  flex-shrink: 0; /* Evita que la imagen se reduzca */
  margin-left: 10px; /* Espacio entre el texto y la imagen */
  max-width: 60%; /* Limit the width of the gallery image */
}

.gallery-item img {
  width: 100%;
  max-width: 120px;
  height: auto;
  border-radius: 8px;
  transition: all 0.3s ease;
}

.gallery-item img:hover {
  transform: scale(1.02);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.gallery-text img {
  width: 16px; /* Ajusta el ancho según lo necesites */
  height: 16px; /* Ajusta la altura según lo necesites */
  vertical-align: middle; /* Alinea el icono verticalmente con el texto */
  margin-right: 5px; /* Espacio opcional entre el icono y el texto */
}

.buttons {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
  flex-wrap: wrap; /* Allow buttons to wrap on smaller screens */
}

button {
  background-color: #5d8a6f;
  color: white;
  border: none;
  padding: 12px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1em;
  font-weight: 600;
  transition: all 0.3s ease;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  margin-bottom: 5px; /* Add some spacing between buttons when they wrap */
}

button:hover {
  background-color: #4d7a5f;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

button:active {
  transform: translateY(0);
  box-shadow: 0 2px 3px rgba(0, 0, 0, 0.1);
}

@media (max-width: 768px) {
  button,
  button.save {
    padding: 8px 5%; /* Reduce padding for smaller screens */
    font-size: 0.9em; /* Reduce font size for smaller screens */
  }
}

button.directions {
  background: #8b8b8b;
}

button.directions:hover {
  background: #777777;
}

button.save {
  background: none;
  color: #3d5745;
  font-size: 14px;
  box-shadow: none;
}

button.save:hover {
  transform: scale(1.1);
  background: none;
  box-shadow: none;
}

.explore:hover,
.directions:hover {
  background-color: #4d7a5f;
}

.map-container {
  flex-grow: 1;
  position: relative;
}

#map {
  width: 100%;
  height: 100%;
  z-index: 1;
}

#map img {
  width: 100%;
  height: 100%;
  object-fit: cover; /* Ajusta la imagen para cubrir todo el div */
  position: absolute; /* Posiciona la imagen dentro del div */
  top: 0;
  left: 0;
}

button.save img {
  width: 22px;
  height: auto;
}

/* Estilos para el marcador de ubicación del usuario */
.user-location-marker {
  display: flex;
  justify-content: center;
  align-items: center;
}

.user-location-marker .pulse {
  width: 15px;
  height: 15px;
  background-color: #4285f4;
  border-radius: 50%;
  position: relative;
  box-shadow: 0 0 0 rgba(66, 133, 244, 0.4);
  animation: pulse 2s infinite;
}

.user-location-marker .pulse:after {
  content: "";
  position: absolute;
  top: -2px;
  left: -2px;
  width: 19px;
  height: 19px;
  border-radius: 50%;
  border: 2px solid #4285f4;
  background-color: transparent;
}

.marker-icon {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: bold;
}

.marker-icon.gallery {
  background-color: #5d8a6f;
}

.marker-icon.marvel {
  background-color: #d4a017;
}

.gallery-item.marvel {
  border-left: 4px solid #d4a017;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(66, 133, 244, 0.4);
  }
  70% {
    box-shadow: 0 0 0 15px rgba(66, 133, 244, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(66, 133, 244, 0);
  }
}

/* Estilos para mejorar la apariencia de las rutas */
.leaflet-routing-container {
  background-color: white;
  padding: 10px;
  border-radius: 5px;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
  max-height: 300px;
  overflow-y: auto;
  width: 300px;
}

.leaflet-routing-alt {
  max-height: 250px;
}

@media (max-width: 768px) {
  .leaflet-routing-container {
    width: 250px;
    max-height: 200px;
  }
}

/* Estilos para el mensaje de "no se encontraron resultados" */
.no-results {
  text-align: center;
  padding: 30px 20px;
  background-color: #f9f9f9;
  border-radius: 8px;
  margin: 20px 0;
  color: #666;
  font-size: 16px;
  box-shadow: 0 0 5px rgba(0, 0, 0, 0.1);
}

.no-results p {
  margin: 0;
  line-height: 1.5;
}

/* Destacar las galerías favoritas */
.gallery-item.favorite {
  border-left: 3px solid #ffd700;
}

/* Estilos para accesibilidad */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Mejoras de foco para elementos interactivos */
button:focus,
input:focus,
select:focus,
textarea:focus,
a:focus {
  outline: 2px solid #5d8a6f;
  outline-offset: 2px;
}

/* Mejoras de contraste */
.gallery-item {
  background: white;
  padding: 20px;
  border-radius: 8px;
  margin-bottom: 20px;
  box-shadow: 0 0 5px rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease;
  color: #333; /* Mejor contraste para el texto */
}

/* Mejoras para el modo de alto contraste */
@media (prefers-contrast: more) {
  .gallery-item {
    border: 2px solid #000;
  }

  button {
    border: 2px solid #000;
  }
}

/* Mejoras para el modo de reducción de movimiento */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Mejoras para el modo oscuro */
@media (prefers-color-scheme: dark) {
  .gallery-item {
    background: #333;
    color: #fff;
  }

  .sidebar {
    background: #222;
  }
}
