/* ============================================================
   FILTERS - Map Filters, Subcategory Filters, Select2,
   Search, Active Indicators, Filter Tags
   Scene Locations Theme
   ============================================================ */

/* ---- Main Filter Wrapper ---- */
.filters-wrapper {
  font-family: var(--sl-font-family);
  font-size: 16px;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
  margin-bottom: 15px;
}

.filters-selects {
  display: flex;
  flex-wrap: nowrap;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.filters-selects .custom-select-wrapper {
  flex: 1 1 0;
  min-width: 0;
  width: auto !important;
}

.filters-selects .custom-select-wrapper .custom-select-trigger {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.filters-buttons {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
  order: 2;
}

.filters-selects {
  order: 1;
}

/* ---- Mobile Accordion Toggle ---- */
.filters-toggle-mobile {
  display: none;
}

@media (max-width: 1024px) {
  .filters-toggle-mobile {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    background: var(--sl-color-secondary);
    color: var(--sl-color-text);
    border: 1px solid var(--sl-color-border);
    border-radius: var(--sl-radius-md);
    padding: 12px 16px;
    font-family: var(--sl-font-family);
    font-size: var(--sl-font-size-sm);
    font-weight: var(--sl-font-weight-medium);
    cursor: pointer;
    transition: all var(--sl-transition-fast);
    margin-bottom: 15px;
  }

  .filters-toggle-mobile:hover {
    background: var(--sl-color-accent);
    color: var(--sl-color-white);
    border-color: var(--sl-color-border);
  }

  .filters-toggle-mobile.is-open {
    background: var(--sl-color-primary);
    color: var(--sl-color-white);
    border-color: var(--sl-color-primary);
  }

  .filters-toggle-mobile:focus,
  .filters-toggle-mobile:active {
    outline: none;
    -webkit-tap-highlight-color: transparent;
  }

  .filters-toggle-mobile > span:first-child {
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .filters-toggle-arrow svg {
    transition: transform var(--sl-transition-fast);
  }

  .filters-toggle-mobile.is-open .filters-toggle-arrow svg {
    transform: rotate(180deg);
  }

  .filters-wrapper {
    display: none;
    flex-direction: column;
    flex-wrap: wrap;
    gap: 10px;
    
  }

  .filters-wrapper.is-open {
    display: flex;
  }

  .filters-selects {
    flex-direction: column;
    order: 1;
  }

  .filters-selects .custom-select-wrapper {
    width: 100% !important;
    min-width: 100%;
  }

  .filters-buttons {
    flex-direction: row;
    width: 100%;
    order: 2;
  }

  .filters-buttons button {
    flex: 1;
  }
}


/* ---- Active Filter Indicators ---- */
.sl-active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 8px 0;
}

.sl-active-filters__label {
  font-family: var(--sl-font-family);
  font-size: var(--sl-font-size-xs);
  color: var(--sl-color-text);
  font-weight: var(--sl-font-weight-medium);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.sl-filter-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background-color: rgba(76, 80, 255, 0.15);
  border: 1px solid rgba(76, 80, 255, 0.3);
  border-radius: 20px;
  font-family: var(--sl-font-family);
  font-size: var(--sl-font-size-xs);
  color: var(--sl-color-primary);
  transition: all var(--sl-transition-fast);
}

.sl-filter-tag:hover {
  background-color: rgba(76, 80, 255, 0.25);
}

.sl-filter-tag__remove {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: var(--sl-radius-circle);
  background: transparent;
  border: none;
  color: var(--sl-color-primary);
  font-size: 12px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: all var(--sl-transition-fast);
}

.sl-filter-tag__remove:hover {
  background-color: var(--sl-color-primary);
  color: var(--sl-color-white);
}

.sl-clear-all-filters {
  font-family: var(--sl-font-family);
  font-size: var(--sl-font-size-xs);
  color: var(--sl-color-text);
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: underline;
  padding: 4px 8px;
  transition: color var(--sl-transition-fast);
}

.sl-clear-all-filters:hover {
  color: var(--sl-color-white);
}


/* ---- Map Filter Inputs (High-Priority) ---- */
.filters-wrapper select,
.filters-wrapper input,
#filtro-categoria,
#filtro-subcategoria,
#filtro-ano,
#filtro-autor {
  padding: 10px 12px !important;
  border: 1px solid var(--sl-color-border) !important;
  border-radius: 8px !important;
  font-size: 14px !important;
  background-color: var(--sl-color-secondary) !important;
  color: var(--sl-color-text) !important;
  appearance: none !important;
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  width: 100% !important;
  min-width: 0 !important;
}

.filters-wrapper select {
  background-image: url('/wp-content/uploads/2025/06/Triangulo.svg') !important;
  background-repeat: no-repeat !important;
  background-position: right 10px center !important;
  background-size: 8px !important;
  padding-right: 30px !important;
}

#aplicar-filtros,
#reset-filtros,
#reset-filtros-subcats {
  padding: 10px 20px !important;
  border: none !important;
  border-radius: 8px !important;
  cursor: pointer !important;
  font-size: 14px !important;
  font-family: var(--sl-font-family) !important;
  transition: all 0.2s !important;
}

#aplicar-filtros {
  background: var(--sl-color-primary) !important;
  color: white !important;
}

#reset-filtros,
#reset-filtros-subcats {
  background: var(--sl-color-secondary) !important;
  color: var(--sl-color-text) !important;
}


/* ---- Map Search (Subcategory) ---- */
.search-subcat-wrapper {
  position: relative;
  display: flex;
  gap: 8px;
  align-items: center;
}

.search-subcat-wrapper input#search-subcategoria {
  flex: 1;
  padding: 6px 8px;
  border: 1px solid var(--sl-color-secondary) !important;
  border-radius: 8px;
  background-color: var(--sl-color-secondary) !important;
  color: var(--sl-color-text) !important;
  font-size: 16px;
}

.reset-search-btn {
  padding: 6px 12px;
  border: 1px solid #344160;
  background: var(--sl-color-accent);
  color: var(--sl-color-text);
  border-radius: var(--sl-radius-sm);
  cursor: pointer;
  font-family: var(--sl-font-family);
  font-size: var(--sl-font-size-xs);
  transition: all var(--sl-transition-fast);
}

.reset-search-btn:hover {
  background: var(--sl-color-hover);
  color: var(--sl-color-white);
}

.search-subcat-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 999;
  display: none;
  background-color: var(--sl-color-secondary) !important;
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--sl-color-secondary);
  max-height: 300px;
  overflow-y: auto;
  border-radius: 8px;
}

.search-subcat-results li {
  padding: 8px;
  cursor: pointer;
  color: var(--sl-color-text) !important;
  font-size: 16px;
}

.search-subcat-results li:hover {
  background-color: var(--sl-color-accent) !important;
  color: white !important;
}


/* ---- Route Autocomplete ---- */
.route-autocomplete-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #121a30;
  border: 1px solid #2a3552;
  border-top: none;
  border-radius: 0 0 4px 4px;
  max-height: 300px;
  overflow-y: auto;
  z-index: 1000;
  display: none;
  margin: 0;
  padding: 0;
  list-style: none;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.route-autocomplete-results li {
  color: #6f7c91;
  font-size: 14px;
  padding: 10px 15px;
  cursor: pointer;
  border-bottom: 1px solid #2a3552;
  font-family: var(--sl-font-family);
  transition: background-color var(--sl-transition-fast);
}

.route-autocomplete-results li:hover {
  background: var(--sl-color-hover);
  color: var(--sl-color-white);
}

.route-autocomplete-results li:last-child {
  border-bottom: none;
}

.route-filter-group {
  position: relative;
}

#route-country,
#route-city {
  width: 100%;
}

#route-country::placeholder,
#route-city::placeholder {
  color: #6f7c91;
  opacity: 1;
  font-size: 14px;
}


/* ---- Subcategory Filters ---- */
.filters-wrapper-subcats {
  font-family: var(--sl-font-family);
  font-size: 16px;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
  margin-bottom: 15px;
}

.toggle-filtros-mobile {
  display: none;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: var(--sl-color-secondary);
  color: var(--sl-color-text);
  border: 1px solid var(--sl-color-border);
  border-radius: 8px;
  padding: 12px 16px;
  font-family: var(--sl-font-family);
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 15px;
  cursor: pointer;
  transition: all 0.2s;
  z-index: 10;
}

.toggle-filtros-mobile:hover {
  background: var(--sl-color-accent);
  color: white;
}

.toggle-filtros-mobile.active {
  background: var(--sl-color-primary);
  color: white;
  border-color: var(--sl-color-primary);
}

.toggle-filtros-mobile:focus,
.toggle-filtros-mobile:active {
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

@media (max-width: 1024px) {
  .toggle-filtros-mobile {
    display: flex;
    width: 100%;
  }

  .filters-wrapper-subcats {
    flex-direction: column;
    gap: 10px;
  }

  .filters-wrapper-subcats input,
  .filters-wrapper-subcats select,
  .filters-wrapper-subcats .custom-select-wrapper {
    width: 100% !important;
    flex: 1 0 auto !important;
    min-width: 0 !important;
  }

  #reset-filtros-subcats {
    width: 100%;
  }
}

#filtro-titulo-subcats::placeholder {
  color: var(--sl-color-text) !important;
}

.filters-wrapper-subcats input,
.filters-wrapper-subcats select {
  padding: 10px 12px !important;
  border: 1px solid var(--sl-color-border) !important;
  border-radius: 8px !important;
  font-size: 14px !important;
  background-color: var(--sl-color-secondary) !important;
  color: var(--sl-color-text) !important;
  appearance: none !important;
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  font-family: var(--sl-font-family);
}

/* Search input takes more space than selects */
.filters-wrapper-subcats #filtro-titulo-subcats {
  flex: 2 1 0;
  min-width: 0;
  width: 100%;
}

/* custom-select wrappers (letters / years) */
.filters-wrapper-subcats .custom-select-wrapper {
  flex: 1 1 120px;
  min-width: 120px;
  width: auto;
}

/* Reset button stays natural size */
#reset-filtros-subcats {
  flex-shrink: 0;
  white-space: nowrap;
}

.filters-wrapper-subcats select {
  background-image: url('/wp-content/uploads/2025/06/Triangulo.svg');
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 8px;
  padding-right: 30px;
}

#filtro-ano-subcats:focus,
#filtro-letra-subcats:focus,
#filtro-titulo-subcats:focus {
  outline: 1px solid var(--sl-color-primary);
  outline-offset: 1px;
}


/* ---- Toggle Filter Arrow ---- */
.toggle-filtros-mobile > span:first-child {
  display: flex;
  align-items: center;
  gap: 10px;
}

.toggle-filtros-mobile svg:first-child {
  display: inline-block;
  vertical-align: middle;
  line-height: 0;
}

.toggle-filtros-arrow {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
}

.toggle-filtros-arrow svg {
  transition: transform var(--sl-transition-normal);
}

.toggle-filtros-arrow svg.rotated {
  transform: rotate(180deg);
}


/* ---- Filter Count Badge ---- */
.sl-filter-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  background-color: var(--sl-color-primary);
  color: var(--sl-color-white);
  border-radius: 10px;
  font-size: 11px;
  font-weight: var(--sl-font-weight-bold);
  font-family: var(--sl-font-family);
  margin-left: 6px;
}