/* Buscador AJAX de la tienda. Solo se carga en /shop/ y archivos de producto. Ver search/README.md. */

.eyes-ss {
  --ss-navy: #112640;
  --ss-blue: var(--color-primary, #1e73be);
  --ss-line: #e3e8ef;
  --ss-muted: #5b6878;
  --ss-soft: #f3f8ff;
  font-size: 15px;
  color: var(--ss-navy);
}

/* ---------- Toggle, boton flotante y bottom sheet (<= 1024px) ---------- */

.eyes-ss__toggle,
.eyes-ss__fab,
.eyes-ss__sheet-head,
.eyes-ss__sheet-foot {
  display: none;
}

.eyes-ss__icon {
  width: 20px;
  height: 20px;
  flex: none;
}

.eyes-ss__toggle,
.eyes-ss__fab {
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 20px;
  border-radius: 999px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.eyes-ss__toggle {
  width: 100%;
  border: 1px solid var(--ss-navy);
  background: #fff;
  color: var(--ss-navy);
}

.eyes-ss__fab {
  position: fixed;
  left: 16px;
  bottom: 20px;
  z-index: 9990;
  border: 0;
  background: var(--ss-navy);
  color: #fff;
  box-shadow: 0 8px 24px rgba(17, 38, 64, 0.28);
}

.eyes-ss__backdrop {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  background: rgba(17, 38, 64, 0.5);
}

.eyes-ss__backdrop[hidden],
.eyes-ss__fab[hidden] {
  display: none !important;
}

@media (max-width: 1024px) {
  /* Sidebar + grid pasan a una columna: el panel lateral no cabe (~135px en tablet). */
  .e-con:has(> .e-con > .elementor-widget-shortcode .eyes-ss) {
    flex-direction: column !important;
  }

  .e-con:has(> .e-con > .elementor-widget-shortcode .eyes-ss) > .e-con {
    width: 100% !important;
    max-width: 100%;
  }

  /* will-change: transform en un ancestro convierte el fixed del sheet en relativo a el. */
  .e-con:has(.eyes-ss.is-open) {
    will-change: auto !important;
    transform: none !important;
  }

  .eyes-ss__toggle,
  .eyes-ss__fab {
    display: inline-flex;
  }

  .eyes-ss .eyes-ss__panel {
    display: none;
  }

  .eyes-ss.is-open .eyes-ss__panel {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2147483001;
    max-height: 88dvh;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 0 20px;
    border-radius: 20px 20px 0 0;
    background: #fff;
    box-shadow: 0 -12px 40px rgba(17, 38, 64, 0.25);
    animation: eyes-ss-sheet-in 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  }

  .eyes-ss__sheet-head,
  .eyes-ss__sheet-foot {
    display: flex;
    position: sticky;
    z-index: 1;
    background: #fff;
  }

  .eyes-ss__sheet-head {
    top: 0;
    align-items: center;
    justify-content: space-between;
    margin: 0 -20px;
    padding: 8px 12px 8px 20px;
    border-bottom: 1px solid var(--ss-line);
  }

  .eyes-ss__sheet-title {
    font-size: 17px;
    font-weight: 700;
  }

  .eyes-ss__close {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: none;
    color: var(--ss-navy);
    cursor: pointer;
  }

  .eyes-ss__close svg {
    width: 22px;
    height: 22px;
  }

  .eyes-ss__close:hover {
    background: var(--ss-soft);
  }

  .eyes-ss__sheet-foot {
    bottom: 0;
    margin: 0 -20px;
    padding: 12px 20px calc(12px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--ss-line);
  }

  .eyes-ss__apply {
    width: 100%;
    min-height: 48px;
    border: 0;
    border-radius: 999px;
    background: var(--ss-blue);
    color: #fff;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
  }

  /* Filas de checkbox con area tactil de 44px. */
  .eyes-ss__item label {
    min-height: 44px;
  }

  .eyes-ss__more,
  .eyes-ss__clear {
    min-height: 44px;
  }

  .eyes-ss__chip {
    min-height: 36px;
  }
}

html.eyes-ss-lock,
html.eyes-ss-lock body {
  overflow: hidden;
}

@keyframes eyes-ss-sheet-in {
  from {
    transform: translateY(24px);
    opacity: 0;
  }
}

/* ---------- Panel ---------- */

.eyes-ss__panel {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.eyes-ss__title {
  display: block;
  margin: 0 0 10px;
  padding: 0;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ss-navy);
}

.eyes-ss input[type="search"] {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border: 1px solid var(--ss-line);
  border-radius: 10px;
  background: var(--ss-soft);
  font: inherit;
  color: var(--ss-navy);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.eyes-ss input[type="search"]:focus {
  outline: none;
  border-color: var(--ss-blue);
  box-shadow: 0 0 0 3px rgba(30, 115, 190, 0.18);
}

.eyes-ss .eyes-ss__facet-filter {
  height: 36px;
  margin-bottom: 8px;
  font-size: 14px;
}

.eyes-ss__facet {
  margin: 0;
  padding: 0 0 20px;
  border: 0;
  border-bottom: 1px solid var(--ss-line);
  min-width: 0;
}

.eyes-ss__facet:last-child {
  border-bottom: 0;
}

.eyes-ss button:focus-visible,
.eyes-ss input[type="checkbox"]:focus-visible {
  outline: 2px solid var(--ss-blue);
  outline-offset: 2px;
}

/* ---------- Estado y chips ---------- */

.eyes-ss__status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 1.4em;
}

.eyes-ss__status:has(.eyes-ss__count:empty):has(.eyes-ss__clear[hidden]) {
  display: none;
}

.eyes-ss__count {
  margin: 0;
  font-size: 14px;
  color: var(--ss-muted);
}

.eyes-ss__clear,
.eyes-ss__more {
  padding: 0;
  border: 0;
  background: none;
  color: var(--ss-blue);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.eyes-ss__clear:hover,
.eyes-ss__more:hover {
  text-decoration: underline;
}

.eyes-ss__clear[hidden],
.eyes-ss__more[hidden],
.eyes-ss__facet[hidden] {
  display: none;
}

.eyes-ss__more {
  margin-top: 8px;
}

.eyes-ss__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: -12px 0 0;
  padding: 0;
  list-style: none;
}

.eyes-ss__chips:empty {
  display: none;
}

.eyes-ss__chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border: 0;
  border-radius: 999px;
  background: var(--ss-navy);
  color: #fff;
  font: inherit;
  font-size: 13px;
  line-height: 1.3;
  cursor: pointer;
}

.eyes-ss__chip::after {
  content: "\00d7";
  font-size: 16px;
  line-height: 1;
  opacity: 0.75;
}

.eyes-ss__chip:hover::after {
  opacity: 1;
}

/* ---------- Lista de terminos ---------- */

.eyes-ss__list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.eyes-ss__item label {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  cursor: pointer;
}

.eyes-ss__item input {
  flex: none;
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--ss-blue);
  cursor: pointer;
}

.eyes-ss__label {
  flex: 1;
  min-width: 0;
  line-height: 1.35;
}

.eyes-ss__item input:checked ~ .eyes-ss__label {
  font-weight: 600;
}

.eyes-ss__num {
  flex: none;
  min-width: 28px;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--ss-soft);
  font-size: 12px;
  text-align: center;
  color: var(--ss-muted);
}

.eyes-ss__num:empty {
  display: none;
}

/* Extra oculto hasta "Show all"; lo marcado siempre visible. Con el buscador de faceta: solo coincidencias. */
.eyes-ss__facet:not(.is-expanded):not(.is-filtering) .eyes-ss__item.is-extra:not(:has(input:checked)),
.eyes-ss__item.is-empty,
.eyes-ss__facet.is-filtering .eyes-ss__item:not(.is-match) {
  display: none;
}

.eyes-ss__facet.is-filtering .eyes-ss__more {
  display: none;
}

.eyes-ss__facet.is-expanded .eyes-ss__list {
  max-height: 360px;
  overflow-y: auto;
}

/* ---------- Grid de Elementor controlado por el buscador ---------- */

.eyes-ss-owned .e-loop__load-more,
.eyes-ss-owned .e-load-more-anchor,
.eyes-ss-owned .e-load-more-message {
  display: none !important;
}

.eyes-ss-loading .elementor-loop-container {
  opacity: 0.45;
  pointer-events: none;
  transition: opacity 0.2s;
}

.eyes-ss-loadmore {
  margin-top: 32px;
  text-align: center;
}

.eyes-ss-loadmore[hidden] {
  display: none;
}

.eyes-ss-empty {
  grid-column: 1 / -1;
  padding: 48px 16px;
  text-align: center;
  color: var(--ss-muted);
}

.eyes-ss-empty p {
  margin: 0 0 16px;
  font-size: 17px;
}

@media (prefers-reduced-motion: reduce) {
  .eyes-ss.is-open .eyes-ss__panel {
    animation: none;
  }

  .eyes-ss *,
  .eyes-ss-loading .elementor-loop-container {
    transition: none;
  }
}
