/* ============================================================
   TOUR ARCHIVE / TAXONOMÍAS (doc maestro §8.2)
   ============================================================ */

/* El header de archivo (.emt-archive-hero) se movio a archive-hero.css
   (compartido: Tours, Destinos y Asesores). */

.emt-listing {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--emt-spacing-xl);
  padding-block: var(--emt-spacing-2xl);
}
@media (min-width: 1024px) {
  .emt-listing { grid-template-columns: 260px 1fr; align-items: start; }
}

/* ---- Filtros (rediseño 2026): tarjeta blanca con grupos colapsables ----
   Los controles son listas compactas con conteo; los filtros ACTIVOS se
   muestran como chips arriba de los resultados. Degradación sin JS: todo
   abierto y visible (la clase .emt-filters--js la agrega tour-filter.js). */
.emt-filters {
  display: block;
  background: var(--emt-blanco);
  border: 1px solid var(--emt-color-border);
  border-radius: var(--emt-radius-card);
  box-shadow: var(--emt-shadow-sm);
  overflow: hidden;
}
@media (min-width: 1024px) { .emt-filters { position: sticky; top: 90px; } }

/* Buscador de tours (texto libre) arriba de todo */
.emt-filters__search { padding: var(--emt-spacing-md) var(--emt-spacing-md) 0; }
.emt-filters__search input { width: 100%; padding: var(--emt-spacing-sm) var(--emt-spacing-md); border: 1px solid var(--emt-color-border); border-radius: var(--emt-radius-md); font-family: var(--emt-font-body); }
.emt-filters__search input:focus-visible { outline: none; box-shadow: var(--emt-focus-ring); }

/* Grupo colapsable (acordeón) */
.emt-facet { border-top: 1px solid var(--emt-color-border); }
.emt-filters__search + .emt-facet { border-top: 0; margin-top: var(--emt-spacing-md); }
.emt-facet__head {
  width: 100%;
  display: flex; align-items: center; justify-content: space-between; gap: var(--emt-spacing-sm);
  background: none; border: 0; cursor: pointer;
  padding: 0.85rem var(--emt-spacing-md);
  font-family: var(--emt-font-display); font-weight: var(--emt-fw-semibold); font-size: var(--emt-fs-sm);
  color: var(--emt-azul-profundo); text-align: left;
}
.emt-facet__head:focus-visible { outline: none; box-shadow: var(--emt-focus-ring); border-radius: var(--emt-radius-sm); }
.emt-facet__caret { width: 9px; height: 9px; border-right: 2px solid var(--emt-azul-brillante); border-bottom: 2px solid var(--emt-azul-brillante); transform: rotate(45deg); transition: transform var(--emt-transition-base); flex: 0 0 auto; }
.emt-filters--js .emt-facet.is-open .emt-facet__caret { transform: rotate(-135deg); }
.emt-facet__body { padding: 0 var(--emt-spacing-md) var(--emt-spacing-md); }

/* Sin JS: todo abierto/visible. Con JS: acordeón + colapsables + buscador. */
.emt-facet__caret,
.emt-facet__search,
.emt-facet__more { display: none; }
.emt-filters--js .emt-facet__caret { display: block; }
.emt-filters--js .emt-facet__search { display: block; }
.emt-filters--js .emt-facet__more { display: inline-block; }
.emt-filters--js .emt-facet__body { display: none; }
.emt-filters--js .emt-facet.is-open .emt-facet__body { display: block; }

/* Buscador dentro del grupo (Destinos) */
.emt-facet__search { position: relative; margin-bottom: var(--emt-spacing-sm); }
.emt-facet__search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--emt-color-text-muted); }
.emt-facet__search-input { width: 100%; padding: 0.45rem 0.6rem 0.45rem 2rem; border: 1px solid var(--emt-color-border); border-radius: var(--emt-radius-md); background: var(--emt-surface-tint); font-family: var(--emt-font-body); font-size: var(--emt-fs-sm); }
.emt-facet__search-input:focus-visible { outline: none; box-shadow: var(--emt-focus-ring); }

/* Lista compacta de opciones + conteo */
.emt-opts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 1px; }
.emt-opt { display: flex; align-items: center; gap: var(--emt-spacing-sm); padding: 0.35rem 0.4rem; border-radius: var(--emt-radius-sm); cursor: pointer; font-size: var(--emt-fs-sm); }
.emt-opt:hover { background: var(--emt-surface-tint); }
.emt-opt input { width: 16px; height: 16px; accent-color: var(--emt-azul-brillante); cursor: pointer; flex: 0 0 auto; }
.emt-opt__name { flex: 1; color: var(--emt-color-text); }
.emt-opt__count { font-size: var(--emt-fs-xs); color: var(--emt-color-text-muted); font-variant-numeric: tabular-nums; }
.emt-opt-item.is-hidden { display: none !important; }
.emt-filters--js .emt-opt-item.is-extra { display: none; }
.emt-filters--js .emt-facet.show-all .emt-opt-item.is-extra,
.emt-filters--js .emt-facet.is-searching .emt-opt-item.is-extra { display: block; }
.emt-facet__nomatch { font-size: var(--emt-fs-sm); color: var(--emt-color-text-muted); padding: 0.35rem 0.4rem; margin: 0; }
.emt-facet__more { margin-top: var(--emt-spacing-sm); background: none; border: 0; cursor: pointer; font-family: var(--emt-font-display); font-weight: var(--emt-fw-semibold); font-size: var(--emt-fs-xs); color: var(--emt-azul-brillante); padding: 2px 4px; }
.emt-facet__more:hover { color: var(--emt-azul-profundo); text-decoration: underline; }
.emt-facet__more-menos { display: none; }
.emt-filters--js .emt-facet.show-all .emt-facet__more-mas { display: none; }
.emt-filters--js .emt-facet.show-all .emt-facet__more-menos { display: inline; }

.emt-filters__actions { display: flex; flex-direction: column; gap: var(--emt-spacing-sm); padding: var(--emt-spacing-md); border-top: 1px solid var(--emt-color-border); }
.emt-filters--js .emt-filters__actions button[type="submit"] { display: none; } /* con JS el filtrado es en vivo */
.emt-filters__clear { text-align: center; font-size: var(--emt-fs-sm); color: var(--emt-color-text-muted); text-decoration: underline; }

/* Chips de filtros ACTIVOS (arriba de los resultados) */
.emt-active-filters { display: flex; flex-wrap: wrap; align-items: center; gap: var(--emt-spacing-sm); margin-bottom: var(--emt-spacing-lg); }
.emt-active-filters[hidden] { display: none; }
.emt-active-filters__label { font-family: var(--emt-font-display); font-weight: var(--emt-fw-semibold); font-size: var(--emt-fs-xs); text-transform: uppercase; letter-spacing: 0.06em; color: var(--emt-color-text-muted); }
.emt-active-chip { display: inline-flex; align-items: center; gap: 0.4rem; background: var(--emt-azul-profundo); color: var(--emt-blanco); border-radius: var(--emt-radius-pill); padding: 0.28rem 0.4rem 0.28rem 0.8rem; font-family: var(--emt-font-body); font-size: var(--emt-fs-sm); font-weight: var(--emt-fw-medium); }
.emt-active-chip__x { display: inline-flex; align-items: center; justify-content: center; width: 17px; height: 17px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, 0.22); color: var(--emt-blanco); cursor: pointer; font-size: 13px; line-height: 1; padding: 0; }
.emt-active-chip__x:hover { background: rgba(255, 255, 255, 0.4); }
.emt-active-filters__clear { background: none; border: 0; color: var(--emt-azul-brillante); font-family: var(--emt-font-display); font-weight: var(--emt-fw-semibold); font-size: var(--emt-fs-sm); cursor: pointer; }
.emt-active-filters__clear:hover { text-decoration: underline; }

.emt-listing__count { font-size: var(--emt-fs-sm); color: var(--emt-color-text-muted); margin: 0 0 var(--emt-spacing-lg); }
.emt-tours-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr; gap: var(--emt-spacing-lg); }
@media (min-width: 600px)  { .emt-tours-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .emt-tours-grid { grid-template-columns: repeat(3, 1fr); } }

.emt-pagination { display: flex; gap: var(--emt-spacing-xs); justify-content: center; margin-top: var(--emt-spacing-2xl); flex-wrap: wrap; }
.emt-pagination .page-numbers { display: inline-flex; min-width: 40px; height: 40px; align-items: center; justify-content: center; border-radius: var(--emt-radius-md); border: 1px solid var(--emt-color-border); text-decoration: none; color: var(--emt-azul-profundo); padding: 0 var(--emt-spacing-sm); }
.emt-pagination .page-numbers.current { background: var(--emt-azul-profundo); color: var(--emt-blanco); border-color: var(--emt-azul-profundo); }
.emt-listing__empty { padding: var(--emt-spacing-2xl); text-align: center; color: var(--emt-color-text-muted); }

/* ---- Slider de precio (rango doble) ---- */
.emt-range__slider { position: relative; height: 32px; }
.emt-range__track { position: absolute; top: 50%; left: 0; right: 0; height: 4px; transform: translateY(-50%); background: var(--emt-color-border); border-radius: 999px; }
.emt-range__fill { position: absolute; top: 50%; height: 4px; transform: translateY(-50%); background: var(--emt-azul-brillante); border-radius: 999px; }
.emt-range__input { position: absolute; top: 0; left: 0; width: 100%; height: 32px; margin: 0; background: none; pointer-events: none; -webkit-appearance: none; appearance: none; }
.emt-range__input::-webkit-slider-thumb { pointer-events: auto; -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%; background: var(--emt-azul-profundo); border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3); cursor: pointer; }
.emt-range__input::-moz-range-thumb { pointer-events: auto; width: 18px; height: 18px; border-radius: 50%; background: var(--emt-azul-profundo); border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3); cursor: pointer; }
.emt-range__input::-webkit-slider-runnable-track { background: none; }
.emt-range__input::-moz-range-track { background: none; }
.emt-range__input:focus-visible::-webkit-slider-thumb { outline: 2px solid var(--emt-azul-brillante); outline-offset: 2px; }
.emt-range__values { display: flex; justify-content: space-between; font-size: var(--emt-fs-sm); color: var(--emt-azul-profundo); font-weight: var(--emt-fw-semibold); margin-top: var(--emt-spacing-xs); }
.emt-range__note { font-size: var(--emt-fs-xs); color: var(--emt-color-text-muted); margin: var(--emt-spacing-xs) 0 0; }

/* ---- Estado de carga + "Cargar más" ---- */
.emt-listing__results { position: relative; }
.emt-listing__results.is-loading .emt-tours-grid { opacity: 0.5; transition: opacity 0.15s ease; }
.emt-listing__loader { display: none; position: absolute; inset: 0; align-items: flex-start; justify-content: center; padding-top: 100px; pointer-events: none; }
.emt-listing__results.is-loading .emt-listing__loader { display: flex; }
.emt-spinner { width: 40px; height: 40px; border: 3px solid var(--emt-color-border); border-top-color: var(--emt-azul-brillante); border-radius: 50%; animation: emt-spin 0.7s linear infinite; }
@keyframes emt-spin { to { transform: rotate(360deg); } }
.emt-listing__more { text-align: center; margin-top: var(--emt-spacing-xl); }
.emt-loadmore[hidden] { display: none; }

/* ---- Panel de filtros colapsable (móvil) ---- */
.emt-filters__toggle { display: none; }
@media (max-width: 1023px) {
  .emt-filters__toggle { display: inline-flex; width: 100%; justify-content: center; }
  .emt-filters { display: none; }
  .emt-listing.emt-filters--open .emt-filters { display: block; }
}
