/* ==================================================
   CONTENEDOR Y MAPA
   ================================================== */

#kideMapa {
  position: relative;
  isolation: isolate;

  width: 100%;
  height: 80vh;
  min-height: 600px;

  overflow: hidden;
}

.kideMapa_wrapper {
  position: absolute;
  inset: 0;

  width: 100%;
  height: 100%;

  z-index: 0;
}

#kideMapaMap {
  width: 100%;
  height: 100%;
}


/* ==================================================
   PANEL FLOTANTE
   ================================================== */

#mapaSidebar {
  position: absolute;

  top: 16px;
  left: 16px;
  bottom: 16px;

  width: 360px;
  max-width: calc(100% - 32px);

  box-sizing: border-box;
  padding: 20px;

  background: rgba(255, 255, 255, 0.97);

  border: 1px solid rgba(0, 87, 60, 0.12);
  border-radius: 12px;

  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12);

  z-index: 1000;
}

#mapaSidebarInner {
  display: flex;
  flex-direction: column;

  width: 100%;
  height: 100%;
  min-height: 0;

  gap: 20px;
}


/* ==================================================
   CABECERA
   ================================================== */

.kideMapa_header {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.kideMapa_heading h2 {
  margin: 0;

  color: #00573C;

  font-size: 25px;
  font-weight: 700;
  line-height: 1.2;
}

.kideMapa_heading p {
  margin: 5px 0 0;

  color: #64746D;
  font-size: 14px;
}


/* ==================================================
   BUSCADOR
   ================================================== */

.kideMapa_search {
  position: relative;
  display: flex;
  align-items: center;
}

.kideMapa_search > svg {
  position: absolute;
  left: 13px;

  width: 19px;
  height: 19px;

  color: #64746D;
  pointer-events: none;
}

.ehko_mapa-input {
  display: block;

  width: 100%;
  min-width: 0;
  box-sizing: border-box;

  margin: 0 !important;
  padding: 12px 12px 12px 42px !important;

  color: #263B32 !important;
  background: #F7F9F7 !important;

  border: 1px solid #D7E1DA !important;
  border-radius: 7px;

  font-family: 'Questrial', Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.4;

  transition:
    border-color 150ms ease,
    background-color 150ms ease,
    box-shadow 150ms ease;
}

.ehko_mapa-input:hover {
  background: #FFFFFF !important;
  color: #263B32 !important;
  border-color: #91B1A1 !important;
}

.ehko_mapa-input:focus {
  background: #FFFFFF !important;
  border-color: #00573C !important;
  outline: none;

  box-shadow: 0 0 0 3px rgba(0, 87, 60, 0.10);
}


/* ==================================================
   FILTROS
   ================================================== */

.kideMapa_filters {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.kideMapa_section-heading,
.kideMapa_results-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;

  gap: 12px;
}

.kideMapa_section-heading h3,
.kideMapa_results-heading h3 {
  margin: 0;

  color: #263B32;

  font-size: 16px;
  font-weight: 700;
  line-height: 1.3;
}

.kideMapa_filter {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.kideMapa_label {
  display: block;

  color: #52635A;

  font-size: 13px;
  font-weight: 600;
}


/* ==================================================
   SELECTORES
   ================================================== */

.kideMapa_multiselect,
.kideMapa_select-wrapper {
  position: relative;
  width: 100%;
}

.kideMapa_select-button,
.ehko_mapa-select {
  display: flex;
  align-items: center;
  justify-content: space-between;

  width: 100%;
  min-height: 44px;
  box-sizing: border-box;

  margin: 0 !important;
  padding: 10px 12px !important;

  color: #263B32 !important;
  background: #FFFFFF !important;

  border: 1px solid #D7E1DA !important;
  border-radius: 7px;

  font-family: 'Questrial', Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.4;

  text-align: left;
  cursor: pointer;

  transition: border-color 150ms ease;
}

.kideMapa_select-button:hover,
.ehko_mapa-select:hover {
  color: #263B32 !important;
  background: #FFFFFF !important;

  border-color: #00573C !important;
}

.kideMapa_select-button:focus-visible,
.ehko_mapa-select:focus-visible {
  outline: 2px solid #00573C;
  outline-offset: 2px;
}

.kideMapa_select-value {
  min-width: 0;

  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kideMapa_chevron {
  flex: 0 0 18px;

  width: 18px;
  height: 18px;

  margin-left: 10px;

  transition: transform 150ms ease;
}

.kideMapa_chevron.is-open {
  transform: rotate(180deg);
}

.kideMapa_select-wrapper select {
  appearance: none;
  padding-right: 38px !important;
}

.kideMapa_select-wrapper::after {
  content: "";

  position: absolute;
  top: 50%;
  right: 14px;

  width: 8px;
  height: 8px;

  border-right: 1.5px solid #52635A;
  border-bottom: 1.5px solid #52635A;

  transform: translateY(-70%) rotate(45deg);

  pointer-events: none;
}


/* ==================================================
   DESPLEGABLE DE CATEGORÍAS
   ================================================== */

.kideMapa_dropdown {
  position: absolute;

  top: calc(100% + 6px);
  left: 0;
  right: 0;

  display: flex;
  flex-direction: column;

  max-height: min(420px, 55vh);

  background: #FFFFFF;

  border: 1px solid #D7E1DA;
  border-radius: 9px;

  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.14);

  z-index: 1100;
  overflow: hidden;
}

.kideMapa_dropdown-search {
  padding: 10px;

  border-bottom: 1px solid #E8EEE9;
}

.kideMapa_dropdown-search input {
  width: 100%;
  box-sizing: border-box;

  padding: 9px 10px;

  color: #263B32;
  background: #F7F9F7;

  border: 1px solid #D7E1DA;
  border-radius: 6px;

  font-family: 'Questrial', Helvetica, Arial, sans-serif;
  font-size: 14px;
}

.kideMapa_dropdown-search input:focus {
  outline: 2px solid rgba(0, 87, 60, 0.2);
  border-color: #00573C;
}

.kideMapa_category-list {
  overflow-y: auto;
  overscroll-behavior: contain;

  padding: 6px 10px;
}

.kideMapa_category-group {
  padding: 3px 0;
}

.kideMapa_category-parent {
  padding: 9px 7px 5px;

  color: #00573C;

  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.035em;
}

.kideMapa_checkbox-row {
  display: flex;
  align-items: flex-start;

  gap: 9px;

  padding: 7px;

  color: #35483E;

  font-size: 14px;
  line-height: 1.4;

  cursor: pointer;
  border-radius: 5px;
}

.kideMapa_checkbox-row:hover {
  background: #F1F6F2;
}

.kideMapa_checkbox-row input {
  flex: 0 0 16px;

  width: 16px;
  height: 16px;

  margin: 2px 0 0;

  accent-color: #00573C;
}

.kideMapa_checkbox-child {
  padding-left: 17px;
}

.kideMapa_dropdown-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;

  gap: 8px;

  padding: 10px;

  color: #64746D;
  font-size: 12px;

  border-top: 1px solid #E8EEE9;
  background: #FFFFFF;
}

.kideMapa_dropdown-footer button,
.kideMapa_clear {
  padding: 4px 0;

  color: #00573C;
  background: transparent;

  border: 0;

  font-family: 'Questrial', Helvetica, Arial, sans-serif;
  font-size: 13px;
  font-weight: 600;

  cursor: pointer;
}

.kideMapa_dropdown-footer button:hover,
.kideMapa_clear:hover {
  text-decoration: underline;
}


/* ==================================================
   RESULTADOS
   ================================================== */

.kideMapa_results {
  display: flex;
  flex-direction: column;

  flex: 1;
  min-height: 0;

  border-top: 1px solid #E1E8E2;
  padding-top: 16px;
}

.kideMapa_results-heading {
  padding-bottom: 10px;
}

.kideMapa_result-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  min-width: 26px;
  height: 26px;
  padding: 0 7px;
  box-sizing: border-box;

  color: #00573C;
  background: #EAF3ED;

  border-radius: 20px;

  font-size: 12px;
  font-weight: 700;
}

#kideakList {
  flex: 1;
  min-height: 0;

  overflow-y: auto;
  overscroll-behavior: contain;
}

.kideaItem {
  display: flex;
  align-items: center;

  width: 100%;
  box-sizing: border-box;

  gap: 11px;
  padding: 11px 8px;

  color: #263B32;
  background: transparent;

  border: 0;
  border-bottom: 1px solid #EDF1ED;
  border-radius: 6px;

  font-family: 'Questrial', Helvetica, Arial, sans-serif;
  text-align: left;

  cursor: pointer;

  transition: background-color 150ms ease;
}

.kideaItem:hover {
  color: #263B32 !important;
  background: #F0F6F1 !important;
}

.kideaItem:focus-visible {
  outline: 2px solid #00573C;
  outline-offset: -2px;
}

.kideaItem_image {
  display: flex;
  align-items: center;
  justify-content: center;

  flex: 0 0 42px;

  width: 42px;
  height: 42px;
}

.kideaItem_image img {
  display: block;

  width: 100%;
  height: 100%;

  object-fit: contain;
}

.kideaItem_content {
  display: flex;
  flex-direction: column;
  align-items: flex-start;

  flex: 1;
  min-width: 0;

  gap: 5px;
}

.kideaItem_name {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;

  overflow-wrap: anywhere;
}

.kideMapTag {
  display: inline-block;

  max-width: 100%;
  padding: 3px 7px;

  border-radius: 4px;

  color: #263B32;

  font-size: 11px;
  line-height: 1.3;
}

.kideaItem_arrow {
  flex: 0 0 16px;

  width: 16px;
  height: 16px;

  color: #84958A;

  opacity: 0;
  transition: opacity 150ms ease;
}

.kideaItem:hover .kideaItem_arrow,
.kideaItem:focus-visible .kideaItem_arrow {
  opacity: 1;
}

.kideMapa_empty {
  padding: 20px 8px;

  color: #64746D;
  font-size: 14px;
  text-align: center;
}

.kideMapa_empty button {
  padding: 0;

  color: #00573C;
  background: transparent;
  border: 0;

  font: inherit;
  font-weight: 600;

  cursor: pointer;
}

.kideMapa_empty button:hover {
  text-decoration: underline;
}


/* ==================================================
   ACCESIBILIDAD Y RESPONSIVE
   ================================================== */

[x-cloak] {
  display: none !important;
}

.screen-reader-text {
  position: absolute;

  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;

  overflow: hidden;
  clip: rect(0, 0, 0, 0);

  white-space: nowrap;
  border: 0;
}

/* ==================================================
   DISEÑO MÓVIL
   ================================================== */

@media (max-width: 760px) {
   /* El panel no debe recortar el selector abierto */
  #mapaSidebar {
    overflow: visible;
  }

  #mapaSidebarInner {
    overflow: visible;
  }

  /* Mantener los resultados dentro de su propia zona */
  .kideMapa_results {
    min-height: 0;
    overflow: hidden;
  }

  #kideakList {
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* El desplegable debe poder desplazarse */
  .kideMapa_dropdown {
    position: absolute;
    z-index: 2000;
    max-height: 35svh;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  .kideMapa_category-list {
    max-height: 25svh;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  #kideMapa {
    height: 150svh;
    min-height: 0;
    overflow: hidden;
  }

  /* Panel flotante compacto */
  #mapaSidebar {
    top: 10px;
    left: 10px;
    right: 10px;
    bottom: auto;

    width: auto;
    max-width: none;

    height: auto;
    max-height: 48%;
    box-sizing: border-box;

    padding: 12px;

  }

  /* Columna interior limitada a la altura del panel */
  #mapaSidebarInner {
    display: flex;
    flex-direction: column;

    width: 100%;
    height: auto;
    max-height: calc(48svh - 44px);
    min-height: 0;

    gap: 10px;
  }

  /* Cabecera compacta */
  .kideMapa_header {
    flex: 0 0 auto;
    gap: 8px;
  }

  .kideMapa_heading h2 {
    font-size: 20px;
  }

  .kideMapa_heading p {
    margin-top: 3px;
    font-size: 12px;
  }

  .ehko_mapa-input {
    padding-top: 9px !important;
    padding-bottom: 9px !important;
  }

  /* Filtros: no deben encogerse ni desbordarse */
  .kideMapa_filters {
    flex: 0 0 auto;
    gap: 8px;
    min-width: 0;
  }

  .kideMapa_section-heading h3,
  .kideMapa_results-heading h3 {
    font-size: 14px;
  }

  .kideMapa_filter {
    min-width: 0;
    gap: 5px;
  }

  .kideMapa_label {
    font-size: 12px;
  }

  .kideMapa_select-button,
  .ehko_mapa-select {
    min-height: 38px;
    padding: 8px 10px !important;
    font-size: 13px;
  }

  /* Resultados: el espacio restante se convierte en scroll */
  .kideMapa_results {
    display: flex;
    flex: 1 1 0;
    flex-direction: column;

    min-height: 0;
    overflow: hidden;

    padding-top: 8px;
  }

  .kideMapa_results-heading {
    flex: 0 0 auto;
    padding-bottom: 6px;
  }

  #kideakList {
    flex: 1 1 0;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  .kideaItem {
    gap: 8px;
    padding: 7px 4px;
  }

  .kideaItem_image {
    flex-basis: 34px;
    width: 34px;
    height: 34px;
  }

  .kideaItem_name {
    font-size: 13px;
  }

  .kideaItem_arrow {
    opacity: 1;
  }

  /* El desplegable no debe quedar recortado por el panel */
  .kideMapa_dropdown {
    max-height: min(320px, 40svh);
  }

  .kideMapa_category-list {
    min-height: 0;
    overflow-y: auto;
  }
}

@media (max-width: 760px) {
  .kideMapa_filters,
  .kideMapa_filter,
  .kideMapa_filter > div {
    overflow: visible;
  }
}

/* ==================================================
   POPUP DE LEAFLET
   ================================================== */
.leaflet-popup-content-wrapper {
  background-color: #00573c !important; 
  display: flex !important; 
  flex-direction: row !important; 
  gap: 10px !important; 
  padding: 10px !important;
  color: #fff !important;
}

.leaflet-popup-content,
.leaflet-popup-content *,
.leaflet-popup-content h1,
.leaflet-popup-content h2,
.leaflet-popup-content h3,
.leaflet-popup-content h4,
.leaflet-popup-content h5,
.leaflet-popup-content h6 {
    color: #fff !important;
}

.leaflet-popup-tip {
  background-color: #00573c !important; 
}

.mapa-icon {
  color: #fff;
  width: 1rem;
  height: 1rem;
}

.mapa-icon-social {
  fill: #fff;
  width: 1rem;
  height: 1rem;
}

.kideMapaContact {
    display: flex;
    flex-flow: wrap;
    gap: 10px;
}

.kideMapaContactItem {
  display: flex;
  flex-flow: wrap;
  gap: 10px;
  list-style: none;
  padding: 0;
  margin: 0;
}

.kideMapaContactItem a {
  color: #fff !important;
  display: flex;
  gap: 4px;
  align-items: center;
}

.kideMapPopupLabel {
  font-weight: bold;
  margin: 10px 0 5px 0;
  display: block;
}