@import url("https://unpkg.com/maplibre-gl@latest/dist/maplibre-gl.css");
@import url("https://unpkg.com/@maplibre/maplibre-gl-geocoder/dist/maplibre-gl-geocoder.css");
@import url("https://fonts.googleapis.com/css2?family=Open+Sans:wght@300;400;600;700&family=Roboto:wght@300;400;500;700&display=swap");
body {
  margin: 0;
  padding: 0;
}

.map-container {
  position: relative;
  overflow: visible;
}
.map-container .map-caption {
  padding: 6px 15px;
  font-size: 0.8rem;
  color: #888;
  text-align: left;
  width: 100%;
  margin-top: 0px;
  font-family: "Roboto", sans-serif;
  line-height: 1.4;
}
@media (max-width: 480px) {
  .map-container .map-caption {
    font-size: 0.75rem;
    padding: 4px 10px;
  }
}

#map {
  width: 100%;
  height: 650px;
  margin: 0 auto;
}

.legend-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 10px auto;
  width: 100%;
  text-align: center;
  font-family: "Open Sans", sans-serif;
  color: #333;
}
.legend-container h3 {
  margin-bottom: 10px;
  font-size: 1.6rem;
  font-weight: bold;
  color: #666;
  padding: 0 16px;
}
.legend-container .container-especial {
  max-width: 650px;
  margin: 0 auto;
  padding: 0 16px;
  text-align: left;
}
.legend-container .container-especial p {
  font-size: 1.1rem;
  line-height: 1.75;
  margin-bottom: 30px;
  max-width: 700px;
  font-family: "Open Sans", sans-serif;
  color: #666666;
  font-weight: 400;
}
.legend-container .container-especial a {
  color: #444444;
  transition: 0.4s;
  border-bottom: 0.13rem solid #b92b27;
  text-decoration: none;
}
.legend-container .container-especial a:hover {
  color: #b92b27;
}
@media (max-width: 768px) {
  .legend-container .container-especial {
    padding: 0 12px;
  }
}
@media (max-width: 480px) {
  .legend-container .container-especial {
    padding: 0 18px;
  }
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  justify-content: center;
  align-items: center;
  max-width: 100%;
  padding: 0 16px;
}
@media (max-width: 480px) {
  .legend {
    gap: 8px 12px;
    padding: 0 8px;
  }
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.8rem;
  font-family: "Roboto", sans-serif;
  cursor: pointer;
  transition: opacity 0.25s ease;
  user-select: none;
}
@media (max-width: 480px) {
  .legend-item {
    font-size: 0.72rem;
    gap: 3px;
  }
}
.legend-item:hover {
  opacity: 0.8;
}
.legend-item.dimmed {
  opacity: 0.35;
}
.legend-item.active {
  font-weight: 600;
  opacity: 1;
}
.legend-item.active .color-box {
  box-shadow: 0 0 0 2px #E5B529;
}

.legend-reset {
  flex-basis: 100%;
  text-align: center;
  display: none;
  justify-content: center;
  cursor: pointer;
  font-size: 0.75rem;
  color: #b92b27;
  margin-top: 2px;
  padding: 3px 0;
  transition: color 0.2s ease;
  font-family: "Roboto", sans-serif;
}
.legend-reset:hover {
  color: #333;
}

.legend-bar-container {
  width: 40px;
  height: 10px;
  background: #eee;
  border-radius: 2px;
  overflow: hidden;
  flex-shrink: 0;
}
@media (max-width: 480px) {
  .legend-bar-container {
    width: 28px;
    height: 8px;
  }
}

.legend-bar {
  height: 100%;
  background: #E5B529;
  border-radius: 2px;
  transition: width 0.4s ease;
  width: 0%;
}

.color-box {
  width: 15px;
  height: 15px;
  border: 1px solid #ccc;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  flex-shrink: 0;
}

.maplibregl-ctrl-top-right {
  position: relative;
}

.maplibregl-popup {
  padding: 0 !important;
  border: none !important;
  background: transparent !important;
}

.maplibregl-popup-content {
  padding: 0 !important;
  border: none !important;
  background: none !important;
  box-shadow: none !important;
  overflow: visible !important;
}

.maplibregl-popup-tip {
  display: none !important;
}

.separator {
  width: 100%;
  max-width: 600px;
  height: 1px;
  background: #ddd;
  margin: 20px auto;
  border: none;
}
@media (max-width: 768px) {
  .separator {
    max-width: 80%;
  }
}
@media (max-width: 480px) {
  .separator {
    max-width: 90%;
    margin: 15px auto;
  }
}

#search-container {
  position: relative;
  width: 90%;
  max-width: 450px;
  margin: 10px auto 40px auto;
  text-align: center;
}
@media (max-width: 768px) {
  #search-container {
    max-width: 400px;
    padding: 0 12px;
  }
}
@media (max-width: 480px) {
  #search-container {
    max-width: 100%;
    padding: 0 8px;
  }
}

#municipio-input {
  width: 100%;
  padding: 15px;
  font-size: 1rem;
  color: #5D5722;
  border: 2px solid #E0D28F;
  border-radius: 4px;
  box-sizing: border-box;
}
#municipio-input::placeholder {
  color: #9e9e9e;
  opacity: 1;
}
#municipio-input:focus {
  outline: none;
  border-color: #E5B529;
}

#suggestions-container {
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  max-width: 450px;
  max-height: 200px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid #E0D28F;
  border-top: none;
  z-index: 10;
  display: none;
  border-radius: 4px;
}
@media (max-width: 768px) {
  #suggestions-container {
    max-width: 400px;
  }
}
@media (max-width: 480px) {
  #suggestions-container {
    max-width: 100%;
  }
}

.suggestion-item {
  padding: 10px;
  font-size: 0.95rem;
  cursor: pointer;
  text-align: left;
  background: #FDFBF3;
  color: #5D5722;
  border-bottom: 1px solid #E0D28F;
  transition: background 0.3s, color 0.3s;
}
.suggestion-item:hover, .suggestion-item.selected {
  background: #E5B529;
  color: #4C4820;
}

.suggestion-hint {
  margin-top: 5px;
  font-size: 0.7rem;
  color: #777;
  text-align: left;
  padding-left: 8px;
}

.suggestion-label {
  padding: 6px 10px 4px;
  font-size: 0.7rem;
  font-weight: 700;
  color: #999;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: #f9f9f6;
  border-bottom: 1px solid #E0D28F;
}

#city-steps {
  margin: 20px auto;
  max-width: 820px;
  padding: 0 10px;
}

.city-guide-text, .search-instruction {
  font-size: 0.9rem;
  color: #9e9e9e;
  text-align: center;
  margin-bottom: 15px;
}

#city-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  padding-bottom: 5px;
  max-width: 560px;
  margin: 0 auto;
}

.city-link {
  flex: 0 0 auto;
  text-decoration: none;
  background: #FAF0C3;
  color: #5D5722;
  padding: 6px 10px;
  border-radius: 4px;
  border: 1px solid #E0D28F;
  transition: background 0.3s, color 0.3s;
  white-space: nowrap;
}
.city-link:hover {
  background: #E5B529;
  color: #4C4820;
}
.city-link.selected {
  background: #E5B529;
  color: #4C4820;
}

#narrative-panel {
  position: absolute;
  z-index: 20;
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid #E0D28F;
  padding: 0;
  border-radius: 4px;
  width: 350px;
  top: 20px;
  left: 30px;
  display: none;
  font-family: "Open Sans", sans-serif;
  color: #666666;
  line-height: 1.5;
  overflow: hidden;
}

#narrative-progress {
  width: 100%;
  height: 3px;
  background: #E0D28F;
  position: relative;
  flex-shrink: 0;
}

#narrative-progress-bar {
  height: 100%;
  width: 0%;
  background: #E5B529;
  transition: none;
}

#narrative-content {
  margin-bottom: 10px;
  padding: 15px 15px 0 15px;
}

#narrative-title {
  margin: 0 0 5px 0;
  font-size: 18px;
}

#narrative-text {
  font-size: 14px;
  line-height: 1.5;
}

#narrative-controls {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  align-items: center;
  padding: 0 15px 12px 15px;
}
#narrative-controls button {
  padding: 3px 12px;
  border: none;
  background: #FAF0C3;
  color: #5D5722;
  border: 1px solid #E0D28F;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.3s;
  font-size: 0.85rem;
}
#narrative-controls button:hover {
  background: #E5B529;
}

#tour-playpause {
  display: flex !important;
  align-items: center;
  justify-content: center;
  width: 28px !important;
  height: 28px !important;
  padding: 0 !important;
  border-radius: 50% !important;
  flex-shrink: 0;
  line-height: 1;
}
#tour-playpause svg {
  display: block;
  width: 14px;
  height: 14px;
  fill: #5D5722;
}

@media (max-width: 480px) {
  #city-list {
    max-width: 100%;
    gap: 8px;
  }
  .city-link {
    padding: 5px 9px;
  }
  #narrative-panel {
    width: 290px;
    left: 50%;
    transform: translateX(-50%);
  }
  #narrative-controls {
    gap: 6px;
    padding: 0 12px 10px 12px;
  }
  #narrative-panel {
    width: 100%;
    max-width: 290px;
    left: 45%;
    top: 10px;
    transform: translateX(-50%);
    right: auto;
  }
}
