/* =========================================================
   PGA — BUSCADOR de /tour/ (tours.php). Filtra en la misma página.
   Arriba: fila de ACTIVIDAD en pastillas (cuadradas de 8px, como las del Home) con su número.
   Los demás filtros (cordillera, duración, dificultad, nivel de servicio):
     · fd--top  = barra de DESPLEGABLES bajo las pastillas, a la izquierda del "Sort by"
     · fd--side = COLUMNA fija a la izquierda con los grupos abiertos
     · celular  = botón "Filters" que abre un PANEL desde abajo
   Activo = azul secondary relleno (como la pestaña activa de los niveles); hover = borde azul.
   ========================================================= */
.fd { --gut: max(24px, calc((100% - 1280px) / 2)); padding: 3.5rem var(--gut) 6rem; background: var(--idx-white); font-family: var(--idx-font-body), sans-serif; }

/* número de cada opción */
.fd-n { margin-left: .25rem; color: var(--idx-muted); font-size: .75rem; font-weight: 500; font-variant-numeric: tabular-nums; }
.fd-n:empty { display: none; }

/* ---------- actividad ---------- */
.fd-top { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1.5rem; margin-bottom: 1.25rem; }
.fd-acts { display: flex; flex-wrap: wrap; gap: .5rem; }
.fd-act { display: inline-flex; align-items: center; height: 2.75rem; padding-inline: 1.125rem; border: 1px solid var(--idx-border); border-radius: 8px; background: var(--idx-white); color: var(--idx-title); font: 600 .9375rem/1 var(--idx-font-body), sans-serif; cursor: pointer; transition: background-color .25s ease, border-color .25s ease, color .25s ease; }
.fd-act[aria-pressed="true"] { border-color: var(--idx-secondary); background: var(--idx-secondary); color: var(--idx-white); }
.fd-act[aria-pressed="true"] .fd-n { color: var(--idx-on-dark-muted); }
@media (hover: hover) { .fd-act:not([aria-pressed="true"]):hover { border-color: var(--idx-secondary); color: var(--idx-secondary); } }

/* ---------- buscador por nombre (al final de la fila de actividad; en celular arriba, a todo el ancho) ---------- */
.fd-search { position: relative; display: flex; align-items: center; flex: 1 1 16rem; max-width: 24rem; margin-left: auto; }
.fd-search .ico { position: absolute; left: .875rem; width: 1.125rem; height: 1.125rem; color: var(--idx-muted); pointer-events: none; transition: color .25s ease; }
.fd-search input { width: 100%; height: 2.75rem; padding: 0 1rem 0 2.625rem; border: 1px solid var(--idx-border); border-radius: 8px; background: var(--idx-soft); color: var(--idx-title); font: 500 .9375rem/1 var(--idx-font-body), sans-serif; transition: border-color .25s ease, background-color .25s ease, box-shadow .25s ease; }
.fd-search input::placeholder { color: var(--idx-muted); }
.fd-search input:focus { border-color: var(--idx-secondary); background: var(--idx-white); box-shadow: 0 0 0 3px var(--idx-secondary-soft); outline: none; }
.fd-search:focus-within .ico { color: var(--idx-secondary); }
.fd-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---------- opciones (pastillas chicas dentro de cada grupo) ---------- */
.fd-opts { display: flex; flex-wrap: wrap; gap: .375rem; }
.fd-opt { display: inline-flex; align-items: center; height: 2.25rem; padding-inline: .75rem; border: 1px solid var(--idx-border); border-radius: 8px; background: var(--idx-white); color: var(--idx-title); font: 500 .875rem/1 var(--idx-font-body), sans-serif; cursor: pointer; transition: background-color .25s ease, border-color .25s ease, color .25s ease; }
.fd-opt[aria-pressed="true"] { border-color: var(--idx-secondary); background: var(--idx-secondary); color: var(--idx-white); }
.fd-opt[aria-pressed="true"] .fd-n { color: var(--idx-on-dark-muted); }
.fd-opt:disabled { opacity: .4; cursor: default; }   /* sin tours con lo ya elegido */
@media (hover: hover) { .fd-opt:not([aria-pressed="true"]):not(:disabled):hover { border-color: var(--idx-secondary); color: var(--idx-secondary); } }
.fd-note { flex-basis: 100%; margin: .375rem 0 0; color: var(--idx-muted); font-size: .75rem; line-height: 1.45; }
.fd-act:focus-visible, .fd-opt:focus-visible, .fd-group summary:focus-visible, .fd-open:focus-visible, .fd-sort select:focus-visible { outline: 2px solid var(--idx-primary); outline-offset: 2px; }

/* ---------- grupos (details) ---------- */
.fd-group summary { display: flex; align-items: center; gap: .5rem; cursor: pointer; list-style: none; }
.fd-group summary::-webkit-details-marker { display: none; }
.fd-gl { color: var(--idx-title); font: 600 .6875rem/1 var(--idx-font-title), sans-serif; letter-spacing: .1em; text-transform: uppercase; }
.fd-gv { color: var(--idx-title); font-size: .875rem; font-weight: 600; }
.fd-chev { width: 1rem; height: 1rem; margin-left: auto; color: var(--idx-muted); transition: transform .25s ease; }
.fd-group[open] .fd-chev { transform: rotate(180deg); }
.fd-group.is-set .fd-gv { color: var(--idx-secondary); }

/* ---------- barra de resultados ---------- */
.fd-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1rem; margin-bottom: 1.5rem; }
.fd-count { margin: 0; color: var(--idx-text); font-size: .9375rem; }
.fd-count b { color: var(--idx-title); font: 700 1.125rem/1 var(--idx-font-title), sans-serif; }
.fd-chips { display: flex; flex-wrap: wrap; gap: .375rem; }
.fd-chips:empty { display: none; }
.fd-chip { display: inline-flex; align-items: center; gap: .375rem; height: 2rem; padding: 0 .5rem 0 .75rem; border: 0; border-radius: 8px; background: var(--idx-secondary-soft); color: var(--idx-secondary); font: 600 .8125rem/1 var(--idx-font-body), sans-serif; cursor: pointer; }
.fd-chip .ico { width: .875rem; height: .875rem; }
.fd-chip-clear { height: 2rem; padding: 0 .25rem; border: 0; background: none; color: var(--idx-muted); font: 600 .8125rem/1 var(--idx-font-body), sans-serif; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
@media (hover: hover) { .fd-chip:hover { background: var(--idx-secondary); color: var(--idx-white); } .fd-chip-clear:hover { color: var(--idx-primary); } }
.fd-sort { display: flex; align-items: center; gap: .5rem; margin-left: auto; color: var(--idx-muted); font-size: .8125rem; font-weight: 500; }
.fd-sort select { height: 2.5rem; padding: 0 2.25rem 0 .875rem; border: 1px solid var(--idx-border); border-radius: 8px; background: var(--idx-white) none right .75rem center / 1rem no-repeat; color: var(--idx-title); font: 600 .875rem/1 var(--idx-font-body), sans-serif; cursor: pointer; appearance: auto; }
.fd-open { display: none; }

/* ---------- rejilla ---------- */
.fd-empty { display: grid; justify-items: center; gap: .5rem; padding: 4rem 1.5rem; border: 1px dashed var(--idx-border); border-radius: 14px; text-align: center; color: var(--idx-text); }
.fd-empty[hidden] { display: none; }
.fd-empty p { margin: 0; }
.fd-empty-t { color: var(--idx-title); font: 700 1.25rem/1.3 var(--idx-font-title), sans-serif !important; }
.fd-empty .idx-btn { margin-top: 1rem; border: 0; cursor: pointer; }

.fd-sheet-head, .fd-sheet-foot { display: none; }

/* =========================================================
   TOP: desplegables en fila bajo las pastillas (compu y tableta)
   ========================================================= */
@media (min-width: 768px) {
  .fd--top .fd-layout { position: relative; }
  .fd--top .fd-filters { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; padding-bottom: 1.25rem; border-bottom: 1px solid var(--idx-border); }
  .fd--top .fd-group { position: relative; }
  .fd--top .fd-group summary { height: 2.75rem; padding: 0 .875rem; border: 1px solid var(--idx-border); border-radius: 8px; background: var(--idx-white); transition: border-color .25s ease; }
  .fd--top .fd-group[open] summary, .fd--top .fd-group.is-set summary { border-color: var(--idx-secondary); }
  @media (hover: hover) { .fd--top .fd-group summary:hover { border-color: var(--idx-secondary); } }
  .fd--top .fd-gl { margin-right: .125rem; }
  .fd--top .fd-chev { margin-left: .25rem; }
  .fd--top .fd-opts { position: absolute; top: calc(100% + .5rem); left: 0; z-index: 30; width: max-content; max-width: 22rem; padding: .875rem; border: 1px solid var(--idx-border); border-radius: 12px; background: var(--idx-white); box-shadow: 0 6px 14px var(--idx-shadow), 0 22px 40px var(--idx-shadow); }
}

@media (max-width: 1024px) {
  .fd { padding-block: 2.75rem 5rem; }
}

/* =========================================================
   CELULAR: pastillas que se deslizan + botón "Filters" que abre un panel desde abajo
   ========================================================= */
@media (max-width: 767px) {
  .fd { padding: 2rem 16px 4.5rem; }
  .fd-acts { flex-wrap: nowrap; margin: 0 -16px; padding: 0 16px .25rem; overflow-x: auto; scrollbar-width: none; }
  .fd-acts::-webkit-scrollbar { display: none; }
  .fd-top { flex-direction: column; flex-wrap: nowrap; align-items: stretch; gap: .75rem; margin-bottom: 1rem; }   /* nowrap: con wrap la línea tomaba el ancho de TODAS las pastillas y la página se movía de lado */
  .fd-search { order: -1; flex: none; max-width: none; margin: 0; }   /* celular: el buscador arriba a todo el ancho; las pastillas debajo se deslizan */
  .fd-act { flex: none; height: 2.5rem; padding-inline: .875rem; font-size: .875rem; }
  .fd-bar { gap: .625rem; }
  .fd-count { flex-basis: 100%; }
  .fd-open { display: inline-flex; align-items: center; gap: .5rem; height: 2.5rem; padding: 0 .875rem; border: 1px solid var(--idx-border); border-radius: 8px; background: var(--idx-white); color: var(--idx-title); font: 600 .875rem/1 var(--idx-font-body), sans-serif; cursor: pointer; }
  .fd-open .ico { width: 1.0625rem; height: 1.0625rem; }
  .fd-badge { display: grid; place-items: center; min-width: 1.25rem; height: 1.25rem; padding: 0 .25rem; border-radius: 6px; background: var(--idx-secondary); color: var(--idx-white); font-size: .6875rem; }
  .fd-badge[hidden] { display: none; }
  .fd-sort { margin-left: auto; }
  .fd-sort span { display: none; }
  .fd-chips { order: 5; flex-basis: 100%; }

  /* panel desde abajo */
  .fd-filters { position: fixed; inset: auto 0 0; z-index: 70; display: flex; flex-direction: column; max-height: 85svh; padding: 0 16px; border-radius: 16px 16px 0 0; background: var(--idx-white); box-shadow: 0 -12px 40px var(--idx-shadow-strong); transform: translateY(105%); visibility: hidden; transition: transform .35s var(--ease-out), visibility 0s linear .35s; overflow-y: auto; overscroll-behavior: contain; }
  .fd-filters.is-open { transform: none; visibility: visible; transition: transform .35s var(--ease-out), visibility 0s; }
  .fd-sheet-head { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; padding: 1rem 0 .75rem; border-bottom: 1px solid var(--idx-border); background: var(--idx-white); }
  .fd-sheet-head p { margin: 0; color: var(--idx-title); font: 700 1.125rem/1 var(--idx-font-title), sans-serif; }
  .fd-x { display: grid; place-items: center; width: 2.5rem; height: 2.5rem; border: 0; border-radius: 8px; background: var(--idx-soft); color: var(--idx-title); cursor: pointer; }
  .fd-x .ico { width: 1.125rem; height: 1.125rem; }
  .fd-group { padding: 1rem 0; border-bottom: 1px solid var(--idx-border); }
  .fd-group summary { margin-bottom: .75rem; pointer-events: none; }
  .fd-gv, .fd-chev { display: none; }
  .fd-sheet-foot { position: sticky; bottom: 0; display: flex; align-items: center; gap: .75rem; margin-top: auto; padding: .875rem 0 calc(.875rem + env(safe-area-inset-bottom)); background: var(--idx-white); }
  .fd-sheet-foot .fd-clear { padding: 0 .5rem; border: 0; background: none; color: var(--idx-title); font: 600 .875rem/1 var(--idx-font-body), sans-serif; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
  .fd-show { flex: 1; gap: .3em; border: 0; border-radius: 10px; cursor: pointer; }   /* gap: el botón es flex y se comía los espacios de "Show 31 tours" */
  .fd-scrim { position: fixed; inset: 0; z-index: 69; background: var(--idx-overlay); opacity: 0; transition: opacity .3s ease; }
  .fd-scrim.is-on { opacity: 1; }
  .fd-scrim[hidden] { display: none; }
  body.fd-lock { overflow: hidden; }
}


@media (prefers-reduced-motion: reduce) { .fd-filters, .fd-scrim, .fd-act, .fd-opt, .fd-search input, .fd-chev { transition: none !important; } }
/* The archive container already supplies width and spacing. */
body .fd { padding: 0; min-width: 0; max-width: 100%; --ease-out: cubic-bezier(.16,1,.3,1); }
body .fd *, body .fd *::before, body .fd *::after { box-sizing: border-box; }
body .fd .ico { fill: none; stroke: currentColor; stroke-width: 2; flex-shrink: 0; }
body .fd [hidden] { display: none !important; }
body .fd-search { min-width: 0; }
body .fd-sort select { max-width: 100%; }
body .fd .fd-show, body .fd-empty .idx-btn { display: inline-flex; justify-content: center; align-items: center; padding: .875rem 1.25rem; background: var(--idx-primary); color: var(--idx-white); font: 600 .875rem/1.3 var(--idx-font-body), sans-serif; }
body .fd-act, body .fd-opt { text-transform: none; letter-spacing: normal; }
body .fd-acts { min-width: 0; max-width: 100%; }
@media (max-width: 767px) {
  body .fd-acts { margin-inline: 0; padding-inline: 0; }
  body .fd-search input { min-width: 0; }
  body .fd-sort { min-width: 0; }
}
