/* Mobile header: keep lupa inside the search field, not on the account icon. */
@media (max-width: 980px) {
  .header-main {
    grid-template-columns: auto minmax(0, 1fr) auto !important;
    gap: 6px !important;
    align-items: center;
  }
  .header-search,
  .bm-header-search,
  .bm-header-search .prsr-block-top,
  .bm-header-search .prsr-form {
    min-width: 0 !important;
    max-width: 100%;
    overflow: hidden;
  }
  .bm-header-search .prsr-form {
    display: flex !important;
    align-items: stretch;
    width: 100%;
  }
  .bm-header-search .prsr-input,
  .bm-header-search .prsr-input-wide {
    flex: 1 1 0% !important;
    width: 0 !important;
    min-width: 0 !important;
    max-width: none !important;
  }
  .bm-header-search .prsr-button {
    flex: 0 0 36px !important;
    width: 36px !important;
    min-width: 36px !important;
    height: 36px !important;
    position: relative;
    z-index: 1;
    margin: 0 !important;
  }
  .header-actions {
    gap: 2px !important;
    margin-left: 2px;
    flex-shrink: 0;
    z-index: 3;
  }
  .header-account {
    min-width: 36px;
    padding: 6px !important;
  }
}

/* Keep the whole shop from sliding sideways on touch. */
html, body {
  overflow-x: clip;
  overscroll-behavior-x: none;
  max-width: 100%;
}

/* Category type filters: one swipeable row on phones. */
.rpcf-bar,
.rpcf-bar__card,
.rpcf-bar__wrap {
  min-width: 0;
  max-width: 100%;
}
.rpcf-bar__nav {
  display: none !important;
}
.rpcf-bar__scroll {
  display: flex !important;
  flex-wrap: nowrap !important;
  justify-content: flex-start !important;
  align-items: stretch;
  gap: 8px !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  padding: 0 2px 8px !important;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
  touch-action: pan-x;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}
.rpcf-bar__scroll::-webkit-scrollbar {
  display: none;
  height: 0;
}
.rpcf-item {
  flex: 0 0 auto !important;
  scroll-snap-align: start;
}

@media (max-width: 760px) {
  html, body, #wrapper, .site-wrap, .bm-listing, main {
    overflow-x: clip;
    max-width: 100%;
  }

  .rpcf-bar {
    margin: 8px 0 16px;
    padding: 12px 12px 8px;
  }
  .rpcf-item {
    width: 88px !important;
    min-height: 0;
  }
  .rpcf-item__img {
    width: 64px !important;
    height: 64px !important;
  }

  .bm-subcats {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    padding-bottom: 4px;
  }
  .bm-subcats::-webkit-scrollbar {
    display: none;
    height: 0;
  }
  .bm-subcats__chip {
    flex: 0 0 auto;
    white-space: nowrap;
  }
}

/* Mobile product cards: photo first, 2 columns, no black "Ver producto" pill. */

@media (hover: none), (max-width: 980px) {
  .prod-card-add {
    display: none !important;
  }
}

@media (max-width: 1100px) {
  #products .products,
  #products .products.bm-product-grid,
  #js-product-list .products,
  #js-product-list .bm-product-grid,
  .bm-product-grid,
  .bm-rail .products,
  .bm-rail .bm-product-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  #products .products,
  #products .products.bm-product-grid,
  #js-product-list .products,
  #js-product-list .bm-product-grid,
  .bm-product-grid,
  .bm-rail .products,
  .bm-rail .bm-product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 12px !important;
  }

  .prod-card__name {
    font-size: 0.875rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .prod-card__body {
    padding: 12px 10px 14px;
  }
}
