/**
 * Globalmar Search — overlay. Tokens tomados del tema (iqitthemeeditor custom_s_1.css):
 * primario #0067b9, borde del buscador #2183e6, acento #f4b147, radio 0, sombras del tema.
 * Miniaturas, botones, checkboxes y badges usan las clases del propio tema.
 */
.gms {
  --gms-primary: #0067b9;
  --gms-primary-h: #187ccc;
  --gms-search-border: #2183e6;
  --gms-accent: #f4b147;
  --gms-border: #f0f0f0;
  --gms-muted: #6c757d;
  --gms-shadow: 0 6px 30px rgba(0, 0, 0, .15);
  --gms-ease: cubic-bezier(.7, 0, .3, 1);
  position: fixed;
  inset: 0;
  z-index: 99000; /* sobre header sticky (5005), bajo los modales del tema (999992+) para el modal del carrito */
  display: flex;
  flex-direction: column;
  background: #fff;
  color: #000;
  opacity: 0;
  transition: opacity .18s var(--gms-ease);
}
.gms.is-open { opacity: 1; }
.gms[hidden], .gms [hidden] { display: none !important; }
html.gms-lock, html.gms-lock body { overflow: hidden; }

.gms-container {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 15px;
}

/* ---------- barra superior: misma piel que el header ---------- */
.gms-top {
  flex: none;
  background: var(--gms-primary);
  box-shadow: var(--gms-shadow);
  padding: 12px 0;
  position: relative;
  z-index: 3;
}
.gms-top-inner { display: flex; align-items: center; gap: 24px; }
.gms-logo { flex: none; line-height: 0; }
.gms-logo img { height: 58px; width: auto; }
.gms-form { flex: 1; max-width: 780px; margin: 0 auto; }
.gms-form .input-group { position: relative; }
.gms .gms-form .form-search-control {
  height: 56px;
  padding: .6rem 3.5rem .6rem 1rem;
  border: 5px solid var(--gms-search-border);
  border-radius: 0;
  background: #fff;
  font-size: 1.15rem;
  color: #000;
  box-shadow: none;
  -webkit-appearance: none;
  appearance: none;
}
.gms .gms-form .form-search-control::-webkit-search-cancel-button { -webkit-appearance: none; }
.gms .gms-form .form-search-control:focus { border-color: var(--gms-search-border); outline: 0; }
.gms .gms-form .search-btn {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 3.5rem;
  border: 0;
  background: transparent;
  color: var(--gms-primary);
  font-size: 1.3rem;
  z-index: 3;
}
.gms .search-btn .fa-circle-o-notch, .gms.is-loading .search-btn .fa-search { display: none; }
.gms.is-loading .search-btn .fa-circle-o-notch { display: inline-block; }
.gms-close {
  flex: none;
  width: 48px;
  height: 48px;
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
  transition: transform .2s var(--gms-ease);
}
.gms-close:hover, .gms-close:focus { transform: rotate(90deg); outline: 0; }

/* ---------- cuerpo ---------- */
.gms-body {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.gms-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 30px;
  padding-top: 24px;
  padding-bottom: 40px;
}
.gms.is-idle .gms-sidebar, .gms.is-idle .gms-tools { visibility: hidden; }

/* ---------- facetas (clases del tema: block-title, facet-label, custom-checkbox, magnitude) ---------- */
.gms-sidebar {
  position: sticky;
  top: 24px;
  align-self: start;
  max-height: calc(100vh - 150px);
  overflow-y: auto;
  scrollbar-width: thin;
}
.gms-drawer-head, .gms-drawer-foot, .gms-backdrop, .gms-filters-btn { display: none; }
.gms-facet { margin-bottom: 1.5rem; }
.gms-facet ul { list-style: none; margin: 0; padding: 0; }
.gms .facet-label {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin: 0 0 .35rem;
  cursor: pointer;
  font-size: .95rem;
  line-height: 1.35;
}
.gms .facet-label .custom-checkbox { flex: none; margin-top: 1px; }
.gms .facet-label .gms-facet-name { flex: 1; }
.gms .facet-label .magnitude { flex: none; color: var(--gms-muted); font-size: .85rem; }
.gms .facet-label.active .gms-facet-name { font-weight: 700; }
.gms .facet-label.is-disabled { opacity: .45; }
.gms .facet-label:hover .gms-facet-name { color: var(--gms-primary); }
.gms .facet-label.is-partial .custom-checkbox input + span { border-color: var(--gms-primary); }
.gms .facet-label.is-partial .custom-checkbox input + span::after {
  content: '';
  display: block;
  width: 8px;
  height: 2px;
  margin: 6px auto 0;
  background: var(--gms-primary);
}
.gms-fam-row { display: flex; align-items: flex-start; }
.gms-fam-row .facet-label { flex: 1; min-width: 0; }
.gms-fam-toggle {
  flex: none;
  border: 0;
  background: transparent;
  padding: 0 4px 0 8px;
  color: var(--gms-muted);
  font-size: 1.1rem;
  line-height: 1.3;
  cursor: pointer;
}
.gms-fam-toggle i { transition: transform .2s var(--gms-ease); }
.gms-fam.is-open > .gms-fam-row .gms-fam-toggle i { transform: rotate(180deg); }
.gms-subs { display: none; padding: 0 0 .4rem 22px !important; }
.gms-fam.is-open > .gms-subs { display: block; }
.gms-subs .facet-label { font-size: .9rem; }
.gms-more {
  margin-top: .4rem;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--gms-primary);
  font-weight: 700;
  cursor: pointer;
}
.gms-more:hover { text-decoration: underline; }

/* ---------- barra de resultados ---------- */
.gms-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 16px;
  padding-bottom: 12px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--gms-border);
}
.gms-count { margin: 0; font-size: 1.1rem; }
.gms-tools { display: flex; align-items: center; gap: 10px; }
.gms-sort { display: flex; align-items: center; gap: 8px; margin: 0; font-weight: 400; white-space: nowrap; }
.gms-sort select { width: auto; min-width: 170px; }
.gms-notice {
  margin-bottom: 14px;
  padding: 8px 12px;
  border-left: 3px solid var(--gms-accent);
  background: #fff8ec;
  font-size: .95rem;
}
.gms-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 14px; }
.gms-chips:empty { display: none; }
.gms-chip i { margin-left: 4px; }
.gms-clear {
  border: 0;
  background: transparent;
  padding: 0 4px;
  color: #000;
  text-decoration: underline;
  cursor: pointer;
}

/* ---------- rejilla: miniaturas del tema ---------- */
.gms-grid { transition: opacity .2s var(--gms-ease); }
.gms.is-loading .gms-grid { opacity: .45; }
.gms .gms-grid .product-title a { color: inherit; }
.gms .gms-hl { font-weight: 700; }
.gms-grid > .js-product-miniature-wrapper { animation: gms-in .32s var(--gms-ease) both; animation-delay: calc(var(--i, 0) * 12ms); }
@keyframes gms-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .gms, .gms-grid > .js-product-miniature-wrapper, .gms-sidebar { animation: none !important; transition: none !important; }
}
.gms-sentinel { height: 1px; }
.gms-status { padding: 24px 0 8px; text-align: center; color: var(--gms-muted); }
.gms-status:empty { padding: 0; }
.gms-empty { padding: 48px 0; text-align: center; }
.gms-empty-title { font-size: 1.3rem; margin-bottom: 1rem; }
.gms-empty-tips { display: inline-block; margin: 0 0 1.5rem; padding-left: 1.2rem; text-align: left; color: var(--gms-muted); }

/* ---------- tablet / móvil: cajón de filtros ---------- */
@media (max-width: 991.98px) {
  .gms-top { padding: 8px 0; }
  .gms-top-inner { gap: 8px; }
  .gms-logo { display: none; }
  .gms .gms-form .form-search-control { height: 48px; border-width: 3px; font-size: 16px; /* evita zoom en iOS */ }
  .gms-close { width: 40px; height: 40px; font-size: 26px; }
  .gms-layout { grid-template-columns: minmax(0, 1fr); gap: 0; padding-top: 12px; }
  .gms-filters-btn { display: inline-flex; align-items: center; gap: 6px; }
  .gms-sort span { display: none; }
  .gms-sort select { min-width: 0; }
  .gms-sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 5;
    display: flex;
    flex-direction: column;
    width: min(86vw, 360px);
    height: 100%;
    max-height: none;
    align-self: stretch; /* en grid, un hijo fixed con align-self:start no se estira entre top y bottom */
    overflow: hidden;
    background: #fff;
    box-shadow: var(--gms-shadow);
    transform: translateX(-102%);
    transition: transform .25s var(--gms-ease);
  }
  .gms.drawer-open .gms-sidebar { transform: none; }
  .gms-drawer-head {
    display: flex;
    flex: none;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: var(--gms-primary);
    color: #fff;
    font-weight: 700;
    font-size: 1.1rem;
  }
  .gms-drawer-close { border: 0; background: transparent; color: #fff; font-size: 24px; }
  .gms-facets { flex: 1; overflow-y: auto; padding: 16px; }
  .gms-drawer-foot { display: block; flex: none; padding: 12px 16px; border-top: 1px solid var(--gms-border); }
  .gms-backdrop { position: fixed; inset: 0; z-index: 4; background: rgba(0, 0, 0, .4); }
  .gms.drawer-open .gms-backdrop { display: block; }
  .gms.is-idle .gms-filters-btn { display: none; }
}
@media (max-width: 575.98px) {
  .gms-count { font-size: 1rem; width: 100%; }
  .gms-tools { width: 100%; justify-content: space-between; }
  .gms .gms-grid .product-description-short { display: none; }
}
.gms.is-empty .gms-sidebar, .gms.is-empty .gms-tools { visibility: hidden; }

/* ---------- esqueleto de carga (primera respuesta) ---------- */
.gms-skel { margin-bottom: 10px; }
.gms-skel-card { padding: 10px; border: 1px solid var(--gms-border); }
.gms-skel-img, .gms-skel-line, .gms-skel-btn {
  background: linear-gradient(90deg, #f2f2f2 25%, #e9e9e9 37%, #f2f2f2 63%);
  background-size: 400% 100%;
  animation: gms-shimmer 1.2s ease infinite;
}
.gms-skel-img { aspect-ratio: 236 / 305; margin-bottom: 12px; }
.gms-skel-line { height: 12px; margin-bottom: 8px; }
.gms-skel-line.is-short { width: 60%; }
.gms-skel-btn { width: 70%; height: 34px; margin-top: 14px; }
.gms.is-loading .gms-grid.is-skel { opacity: 1; }
@keyframes gms-shimmer { from { background-position: 100% 50%; } to { background-position: 0 50%; } }
@media (prefers-reduced-motion: reduce) { .gms-skel-img, .gms-skel-line, .gms-skel-btn { animation: none; } }
