/* Keep the wrapping admin toolbar clear of the active storefront header.
   WordPress admin/dashboard and the disabled storefront remain unchanged. */
html:has(body.bestpan-header-active) {
  margin-top: 0 !important;
}
body.bestpan-header-active #wpadminbar {
  display: none !important;
}
body.bestpan-header-private .bphp-private-control {
  position: fixed;
  inset-inline-start: 12px;
  bottom: max(12px, env(safe-area-inset-bottom));
  z-index: 990;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: calc(100vw - 104px);
  min-height: 44px;
  padding: 7px 13px;
  border: 1px solid #d9d7d0;
  border-radius: 8px;
  background: #fffefa;
  color: #33332f;
  box-shadow: 0 2px 10px rgb(0 0 0 / 6%);
  font: 500 11px/1.35 Arial, sans-serif;
  text-align: center;
  text-decoration: none;
}
body.bestpan-header-private .bphp-private-control:hover { color: #961d2b; }
body.bestpan-header-private .bphp-private-control:focus-visible {
  outline: 2px solid #961d2b;
  outline-offset: 3px;
}
body.bestpan-header-private:is(.mobile-menu-open, .cart-panel-open, .header-search-open) .bphp-private-control {
  visibility: hidden;
}
/* Keep the floating shortcut behind open navigation, search and cart panels. */
body.bestpan-header-active:is(.mobile-menu-open, .cart-panel-open, .header-search-open) #bestpan-to-top,
body.bestpan-header-active:has(#nm-header.bestpan-mobile-search-open) #bestpan-to-top,
body.bestpan-header-active:has(.nm-right-menu #nm-header-search-2:focus-within) #bestpan-to-top {
  visibility: hidden !important;
  pointer-events: none !important;
}
/* A hidden chat trigger can retain a visible, clickable close descendant.
   Remove its whole box during overlays, keeping the chat state intact. */
body.bestpan-header-active:is(.mobile-menu-open, .cart-panel-open, .header-search-open) .mwai-chatbot-container,
body.bestpan-header-active:has(#nm-header.bestpan-mobile-search-open) .mwai-chatbot-container {
  display: none !important;
}
/* Keep the native close control below the currently visible WordPress toolbar. */
body.bestpan-header-active #nm-cart-panel {
  top: var(--bpsh-admin-offset, 0px);
  height: calc(100% - var(--bpsh-admin-offset, 0px));
}
@supports (height: 100dvh) {
  body.bestpan-header-active #nm-cart-panel {
    height: calc(100dvh - var(--bpsh-admin-offset, 0px));
  }
}
/* Native inert disables the closed panel without interrupting Savoy's slide. */
body.bestpan-header-active:not(.cart-panel-open) #nm-cart-panel {
  pointer-events: none;
}
/* Only older browsers need visibility as the keyboard-focus fallback. */
body.bestpan-header-active:not(.cart-panel-open) #nm-cart-panel[data-bphp-inert-fallback] {
  visibility: hidden;
}
@media (max-width: 600px) {
  body.bestpan-header-private .bphp-private-control { max-width: 190px; font-size: 10px; }
}
/* Savoy offsets the minus button outside an overflow:hidden parent. Keep the
   complete touch targets inside the actual panel and retain native handlers. */
body.bestpan-header-active #nm-cart-panel .nm-cart-panel-quantity-pricing {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 8px;
}
body.bestpan-header-active #nm-cart-panel .product-quantity,
body.bestpan-header-active #nm-cart-panel .nm-cart-panel-item-price { float: none; }
body.bestpan-header-active #nm-cart-panel .nm-cart-panel-item-price { margin-inline-start: auto; }
body.bestpan-header-active #nm-cart-panel .nm-quantity-wrap .quantity {
  display: inline-flex;
  align-items: center;
  margin: 0;
}
body.bestpan-header-active #nm-cart-panel .quantity .nm-qty-minus,
body.bestpan-header-active #nm-cart-panel .quantity .nm-qty-plus {
  width: 44px;
  height: 44px;
  line-height: 44px;
  text-align: center;
  color: inherit;
  flex: 0 0 44px;
}
body.bestpan-header-active #nm-cart-panel .quantity .qty {
  width: 32px;
  height: 44px;
  line-height: 44px;
  flex: 0 0 32px;
}
body.bestpan-header-active #nm-cart-panel .quantity [role="button"]:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: -3px;
}
body.bestpan-header-active .nm-right-menu #nm-header-search-2 form > .icon-search[role="button"] { cursor: pointer; }
body.bestpan-header-active .nm-right-menu #nm-header-search-2 form > .icon-search[role="button"]:focus-visible {
  outline: 2px solid #961d2b;
  outline-offset: 2px;
}
@media (min-width: 993px) {
  /* Preserve the collapsed icon's click-through to the search input. */
  body.bestpan-header-active .nm-right-menu #nm-header-search-2:focus-within #nm-header-search-form-2 > .icon-search[role="button"] {
    pointer-events: auto;
  }
}
@media (max-width: 992px) {
  /* Keep mobile search legible in both the full and compact header. */
  body.bestpan-header-active #nm-header #mobile-search-form input[name="s"] {
    font-size: 16px !important;
    min-height: 44px;
  }
  /* The homepage's generic section padding also reaches cart sections.
     Restore the recommendation widget's own spacing inside this panel. */
  body.bestpan-header-active #nm-cart-panel .wfsc-preview-mini-cart-fragment .wfsc-preview {
    padding: 13px 0 0 !important;
  }
  body.bestpan-header-active #nm-cart-panel .wfsc-preview__suggestions {
    padding: 11px 0 0 !important;
  }
  body.bestpan-header-active #nm-cart-panel .wfsc-preview__suggestions-list {
    grid-template-columns: minmax(0, 1fr);
    min-width: 0;
    max-height: none;
    overflow: visible;
    padding-right: 0;
    scrollbar-gutter: auto;
  }
  body.bestpan-header-active #nm-cart-panel .wfsc-preview__suggestion {
    min-width: 0;
  }
  body.bestpan-header-active #nm-cart-panel .wfsc-preview__suggestion-add {
    min-width: 44px !important;
    min-height: 44px !important;
  }
  /* Recommendations can be taller than the phone. Use one scrollable body
     beneath the close control, so neither items nor checkout links get cut off. */
  body.bestpan-header-active #nm-cart-panel .widget_shopping_cart_content {
    display: block;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }
  body.bestpan-header-active #nm-cart-panel .nm-cart-panel-list-wrap {
    height: auto !important;
    min-height: 0;
    overflow: visible;
  }
}
