/**
 * BoxandBuy Search — Full-Page Overlay (Motive-style)
 * High-specificity selectors to prevent theme conflicts
 */

/* ===== Overlay Shell ===== */
#bab-overlay {
  position: fixed !important;
  top: 0 !important; left: 0 !important; right: 0 !important; bottom: 0 !important;
  z-index: 999999 !important;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  font-family: 'Inter', 'Amazon Ember', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: #333;
  box-sizing: border-box;
}
#bab-overlay *, #bab-overlay *::before, #bab-overlay *::after {
  box-sizing: border-box;
}
#bab-overlay.bab-active {
  visibility: visible;
  opacity: 1;
}

#bab-overlay .bab-overlay-backdrop {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: transparent;
}

/* Panel — full page */
#bab-overlay .bab-overlay-panel {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  width: 100%;
  background: #fff;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ===== Top Bar: Logo + Close ===== */
#bab-overlay .bab-topbar {
  flex-shrink: 0;
  border-bottom: 1px solid #eee;
  background: #fff;
}
#bab-overlay .bab-topbar-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
#bab-overlay .bab-logo {
  display: block;
  text-decoration: none !important;
}
#bab-overlay .bab-logo-img {
  height: 36px;
  width: auto;
  display: block;
}
/* Topbar right group */
#bab-overlay .bab-topbar-right {
  display: flex; align-items: center; gap: 12px;
}
#bab-overlay .bab-cart-link {
  position: relative; display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; text-decoration: none !important;
}
#bab-overlay .bab-cart-link:hover svg path { fill: #c45500; }
#bab-overlay .bab-cart-count {
  position: absolute; top: -2px; right: -4px;
  background: #c45500; color: #fff; font-size: 10px; font-weight: 700;
  min-width: 18px; height: 18px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 4px; line-height: 1;
}
#bab-overlay .bab-overlay-close {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #232f3e;
  color: #fff;
  border: none;
  border-radius: 50%;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s;
}
#bab-overlay .bab-overlay-close:hover {
  background: #37475a;
}
#bab-overlay .bab-close-arrow { display: none; }
#bab-overlay .bab-close-x { display: inline; }

/* ===== Search Bar (centered) ===== */
#bab-overlay .bab-search-bar {
  flex-shrink: 0;
  background: #fff;
  padding: 20px 24px 16px;
}
#bab-overlay .bab-search-bar-inner {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  border-bottom: 2px solid #333;
  padding-bottom: 8px;
  gap: 12px;
}
#bab-overlay #bab-overlay-input {
  flex: 1;
  border: none !important;
  outline: none !important;
  font-size: 18px;
  font-weight: 400;
  color: #222;
  background: transparent !important;
  font-family: inherit;
  padding: 0 !important;
  margin: 0 !important;
  height: auto !important;
  box-shadow: none !important;
}
#bab-overlay #bab-overlay-input::placeholder {
  color: #999;
  font-weight: 400;
}
#bab-overlay .bab-search-icon {
  flex-shrink: 0;
  opacity: 0.4;
}

/* ===== Controls Bar (shown during search) ===== */
#bab-overlay .bab-controls-bar {
  flex-shrink: 0;
  background: #fff;
  border-bottom: 1px solid #eee;
  font-size: 13px;
  color: #666;
}
#bab-overlay .bab-controls-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 8px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
#bab-overlay .bab-ms { color: #aaa; font-size: 11px; }
#bab-overlay .bab-sort-select {
  padding: 4px 24px 4px 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 12px;
  color: #555;
  background: #fff;
  cursor: pointer;
}

/* ===== Body ===== */
#bab-overlay .bab-overlay-body {
  flex: 1;
  display: flex;
  overflow: hidden;
  min-height: 0;
}

/* Sidebar (Amazon-style) */
#bab-overlay .bab-sidebar {
  width: 260px;
  flex-shrink: 0;
  border-right: none;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: #fff;
  padding-right: 14px;
  margin-right: 0;
}
#bab-overlay .bab-sidebar-toggle { display: none; }
#bab-overlay .bab-filter-bar { display: none; }
#bab-overlay .bab-sidebar-inner { padding: 14px 0 14px 20px; }
#bab-overlay .bab-facet-block { margin-bottom: 20px; padding-bottom: 16px; border-bottom: 1px solid #e3e6e6; }
#bab-overlay .bab-facet-block:last-child { border-bottom: none; }
#bab-overlay .bab-facet-title {
  font-size: 14px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.04em; color: #565959;
  margin: 0 0 10px 0; padding: 0 0 6px 0;
  border-bottom: none;
}
/* Price display */
#bab-overlay .bab-price-display {
  font-size: 14px; font-weight: 600; color: #1a56db; margin-bottom: 10px;
}
/* Dual range slider */
#bab-overlay .bab-slider-wrap {
  position: relative; height: 30px; margin-bottom: 14px;
}
#bab-overlay .bab-slider-track {
  position: absolute; top: 13px; left: 0; right: 0; height: 4px;
  background: #d5d9d9; border-radius: 2px; pointer-events: none;
}
#bab-overlay .bab-slider-fill {
  position: absolute; top: 0; height: 100%;
  background: #1a56db; border-radius: 2px;
}
#bab-overlay .bab-slider {
  position: absolute; top: 0; left: 0; width: 100%; height: 30px;
  -webkit-appearance: none; appearance: none;
  background: transparent; pointer-events: none; margin: 0; padding: 0;
}
#bab-overlay .bab-slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 20px; height: 20px; border-radius: 50%;
  background: #fff; border: 3px solid #1a56db;
  cursor: pointer; pointer-events: all;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
  position: relative; z-index: 2;
}
#bab-overlay .bab-slider::-moz-range-thumb {
  width: 20px; height: 20px; border-radius: 50%;
  background: #fff; border: 3px solid #1a56db;
  cursor: pointer; pointer-events: all;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}
#bab-overlay .bab-slider-min { z-index: 3; }
#bab-overlay .bab-slider-max { z-index: 4; }
/* Quick price links */
#bab-overlay .bab-price-links {
  display: flex; flex-direction: column; gap: 4px;
}
#bab-overlay .bab-price-link {
  background: none; border: none; text-align: left; padding: 3px 0;
  font-size: 14px; color: #1a56db; cursor: pointer; font-family: inherit;
}
#bab-overlay .bab-price-link:hover { text-decoration: underline; }
#bab-overlay .bab-ref-list { list-style: none; padding: 0; margin: 0; max-height: 300px; overflow-y: auto; }
#bab-overlay .bab-ref-item { padding: 4px 0; }
#bab-overlay .bab-ref-label { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; color: #0f1111; transition: color 0.15s; line-height: 1.3; }
#bab-overlay .bab-ref-label span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#bab-overlay .bab-ref-label:hover { color: #1a56db; }
#bab-overlay .bab-ref-active .bab-ref-label { color: #1a56db; font-weight: 700; }
#bab-overlay .bab-ref-check { accent-color: #1a56db; width: 17px; height: 17px; cursor: pointer; flex-shrink: 0; }
#bab-overlay .bab-ref-count { margin-left: auto; font-size: 11px; color: #888; background: none; padding: 0; border-radius: 0; flex-shrink: 0; }
#bab-overlay .bab-ref-search { width: 100%; padding: 8px 10px; border: 1px solid #cdcdcd; border-radius: 4px; font-size: 14px; margin-bottom: 8px; color: #0f1111; }
#bab-overlay .bab-ref-search:focus { border-color: #1a56db; box-shadow: 0 0 0 2px rgba(26,86,219,0.2); outline: none; }
#bab-overlay .bab-ref-more { background: none; border: none; color: #1a56db; font-size: 13px; cursor: pointer; padding: 8px 0 2px; font-weight: 600; }
#bab-overlay .bab-ref-more:hover { text-decoration: underline; }
#bab-overlay .bab-clear-btn { display: inline-block; padding: 7px 16px; background: #232f3e; color: #fff; border: none; border-radius: 4px; font-size: 13px; font-weight: 600; cursor: pointer; margin-bottom: 14px; }
#bab-overlay .bab-clear-btn:hover { background: #37475a; }
#bab-overlay .bab-clear-disabled { display: none; }
/* On Sale Toggle */
#bab-overlay .bab-toggle-block { padding-bottom: 16px; }
#bab-overlay .bab-toggle-row { display: flex; align-items: center; justify-content: space-between; }
#bab-overlay .bab-toggle-label { font-size: 14px; font-weight: 700; color: #0f1111; text-transform: uppercase; letter-spacing: 0.04em; color: #565959; }
#bab-overlay .bab-toggle-btn {
  position: relative; width: 44px; height: 24px;
  background: #cdcdcd; border: none; border-radius: 12px;
  cursor: pointer; transition: background 0.2s; padding: 0;
}
#bab-overlay .bab-toggle-btn .bab-toggle-knob {
  position: absolute; top: 2px; left: 2px;
  width: 20px; height: 20px; background: #fff;
  border-radius: 50%; transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
#bab-overlay .bab-toggle-btn.bab-toggle-on {
  background: #1a56db;
}
#bab-overlay .bab-toggle-btn.bab-toggle-on .bab-toggle-knob {
  transform: translateX(20px);
}

/* Main content */
#bab-overlay .bab-main {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px 16px 16px 20px;
  background: #fff;
  border-left: 1px solid #e3e6e6;
  min-width: 0;
}

/* Product Grid — 4-column on desktop */
#bab-overlay .bab-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px 16px;
  align-items: start;
}
#bab-overlay .bab-card {
  position: relative;
  display: flex; flex-direction: column;
  background: #fff;
  border: none;
  border-radius: 0;
  overflow: visible;
  transition: box-shadow 0.25s;
  font-family: 'Inter', -apple-system, 'Amazon Ember', Arial, sans-serif;
}
#bab-overlay .bab-card:hover { box-shadow: none; }
#bab-overlay .bab-card:hover .bab-card-img-wrap { box-shadow: 0 3px 14px rgba(0,0,0,0.12); }
#bab-overlay .bab-card-link {
  display: flex; flex-direction: column; flex: 1;
  padding-left: 0;
  text-decoration: none !important; color: #0f1111;
}
#bab-overlay .bab-card-link:hover {
  text-decoration: none !important; color: #0f1111;
}
#bab-overlay .bab-card-img-wrap {
  position: relative;
  aspect-ratio: 1/1;
  background: #fff;
  display: flex; align-items: center; justify-content: center;
  padding: 0;
  overflow: hidden;
}
#bab-overlay .bab-card-img {
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  transform: none;
  transition: transform 0.3s ease;
}
#bab-overlay .bab-card:hover .bab-card-img {
  transform: scale(1.04);
}
#bab-overlay .bab-card-info { padding: 5px 10px 2px; flex: 1; display: flex; flex-direction: column; }
#bab-overlay .bab-card-brand { font-size: 11px; color: #767676; font-weight: 500; margin-bottom: 1px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; text-transform: uppercase; letter-spacing: 0.3px; }
#bab-overlay .bab-card-name { font-size: 13px; font-weight: 400; line-height: 1.35; color: #0f1111; font-family: 'Inter', Arial, sans-serif; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-bottom: 2px; text-transform: none; height: auto; }
#bab-overlay .bab-card-cart-row { display: flex; align-items: center; gap: 6px; padding: 4px 10px 8px; }
#bab-overlay .bab-qty-wrap { display: flex; align-items: center; border: 1px solid #d5d9d9; border-radius: 20px; overflow: hidden; }
#bab-overlay .bab-qty-btn { width: 24px; height: 24px; border: none; background: #f0f2f2; color: #0f1111; font-size: 14px; font-weight: 700; cursor: pointer; display: flex; align-items: center; justify-content: center; font-family: inherit; line-height: 1; }
#bab-overlay .bab-qty-btn:hover { background: #e3e6e6; }
#bab-overlay .bab-qty-val { width: 26px; text-align: center; font-size: 12px; font-weight: 600; color: #0f1111; background: #fff; border: none; border-left: 1px solid #d5d9d9; border-right: 1px solid #d5d9d9; height: 24px; line-height: 24px; }
#bab-overlay .bab-card:hover .bab-card-name { color: #c7511f; }
#bab-overlay .bab-card-name mark,
#bab-overlay .bab-card-name .ais-Highlight-highlighted { background: none; color: inherit; font-weight: inherit; padding: 0; }
#bab-overlay .bab-card-desc { font-size: 11px; color: #767676; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-bottom: 2px; height: auto; }
#bab-overlay .bab-card-price { font-size: 20px; font-weight: 700; color: #0f1111; margin-top: auto; padding-top: 2px; padding-bottom: 0; font-family: 'Inter', Arial, sans-serif; }
#bab-overlay .bab-card-price .bab-price-symbol { font-size: 13px; font-weight: 700; color: #0f1111; vertical-align: top; position: relative; top: 4px; }
#bab-overlay .bab-card-price .bab-price-decimal { font-size: 13px; font-weight: 700; color: #0f1111; vertical-align: top; position: relative; top: 4px; }
/* Product Labels */
#bab-overlay .bab-card-labels {
  position: absolute; top: 8px; left: 8px; z-index: 2;
  display: flex; flex-wrap: wrap; gap: 4px;
}
#bab-overlay .bab-card-img-wrap { position: relative; }
#bab-overlay .bab-label {
  display: inline-block; font-size: 10px; font-weight: 700;
  padding: 3px 7px; border-radius: 3px;
  text-transform: uppercase; letter-spacing: 0.4px; line-height: 1;
}
#bab-overlay .bab-label-on-sale { background: #cc0c39; color: #fff; }
#bab-overlay .bab-label-reduced-price { background: #ff6600; color: #fff; }
#bab-overlay .bab-label-new { background: #cc0c39; color: #fff; }
#bab-overlay .bab-label-pack { background: #1a56db; color: #fff; }
#bab-overlay .bab-label-backordered { display: none; }
/* Sale price */
#bab-overlay .bab-sale-price { color: #B12704; }
#bab-overlay .bab-sale-price .bab-price-symbol,
#bab-overlay .bab-sale-price .bab-price-decimal { color: #B12704; }
#bab-overlay .bab-original-price { font-size: 13px; font-weight: 400; color: #565959; text-decoration: line-through; vertical-align: middle; }
#bab-overlay .bab-sale-badge { display: inline-block; font-size: 10px; font-weight: 700; color: #fff; background: #cc0c39; padding: 2px 6px; border-radius: 3px; vertical-align: middle; text-transform: uppercase; letter-spacing: 0.5px; }

#bab-overlay .bab-start-msg { text-align: center; padding: 80px 20px; color: #bbb; font-size: 15px; }
#bab-overlay .bab-no-results { text-align: center; padding: 60px 20px; color: #999; }
#bab-overlay .bab-no-results p { font-size: 16px; margin-bottom: 4px; }
#bab-overlay .bab-no-results span { font-size: 13px; color: #aaa; }

/* Pagination */
#bab-overlay .bab-pag { margin-top: 20px; }
#bab-overlay .bab-pag-list { list-style: none; padding: 0; margin: 0; display: flex; justify-content: center; gap: 4px; }
#bab-overlay .bab-pag-link { display: inline-flex; align-items: center; justify-content: center; min-width: 32px; height: 32px; padding: 0 8px; border: 1px solid #ddd; border-radius: 4px; color: #555; text-decoration: none !important; font-size: 12px; }
#bab-overlay .bab-pag-link:hover { border-color: #232f3e; color: #232f3e; text-decoration: none !important; }
#bab-overlay .bab-pag-active .bab-pag-link { background: #232f3e; border-color: #232f3e; color: #fff; }

/* ===== Initial State (centered content) ===== */
#bab-overlay .bab-showing-initial .bab-sidebar { display: none !important; }
#bab-overlay .bab-showing-initial .bab-controls-bar { display: none !important; }
#bab-overlay .bab-showing-initial .bab-filter-bar { display: none !important; }
#bab-overlay .bab-showing-initial .bab-main { max-width: 100%; }
#bab-overlay .bab-showing-initial #bab-pagination { display: none !important; }

#bab-overlay .bab-initial-state {
  max-width: 900px;
  margin: 0 auto;
  padding: 24px 24px;
}

#bab-overlay .bab-initial-heading {
  font-size: 14px;
  font-weight: 700;
  color: #0f1111;
  margin: 0 0 12px 0;
  padding: 0;
}

/* Recent Searches */
#bab-overlay .bab-recent-section { margin-bottom: 32px; }
#bab-overlay .bab-recent-list { list-style: none; margin: 0; padding: 0; }
#bab-overlay .bab-recent-item {
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid #f5f5f5;
}
#bab-overlay .bab-recent-term {
  display: flex; align-items: center; gap: 12px;
  background: none; border: none; padding: 10px 0;
  cursor: pointer; font-size: 14px; color: #0f1111;
  flex: 1; text-align: left; font-family: inherit;
}
#bab-overlay .bab-recent-term:hover { color: #c45500; }
#bab-overlay .bab-recent-icon { flex-shrink: 0; opacity: 0.4; }
#bab-overlay .bab-recent-delete {
  background: none; border: none; color: #ccc;
  font-size: 18px; cursor: pointer; padding: 4px 8px; line-height: 1;
}
#bab-overlay .bab-recent-delete:hover { color: #c00; }
#bab-overlay .bab-recent-footer {
  display: flex; align-items: center; gap: 8px;
  padding-top: 10px; margin-top: 2px;
}
#bab-overlay .bab-recent-action {
  background: none; border: none; color: #c45500;
  font-size: 13px; cursor: pointer; padding: 2px 0;
  font-family: inherit; font-weight: 400;
}
#bab-overlay .bab-recent-action:hover { text-decoration: underline; }
#bab-overlay .bab-recent-sep { color: #ccc; font-size: 13px; }

/* Recommended Products — horizontal scrollable row */
#bab-overlay .bab-recommended-section { margin-bottom: 16px; }
#bab-overlay .bab-recommended-row {
  display: flex;
  gap: 0;
  overflow-x: auto;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 8px;
}
/* Hide scrollbar but keep scrollable */
#bab-overlay .bab-recommended-row::-webkit-scrollbar { height: 4px; }
#bab-overlay .bab-recommended-row::-webkit-scrollbar-track { background: transparent; }
#bab-overlay .bab-recommended-row::-webkit-scrollbar-thumb { background: #ddd; border-radius: 4px; }

#bab-overlay .bab-rec-card {
  flex: 0 0 auto;
  width: 200px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 0;
  border-radius: 0;
  background: none;
}
#bab-overlay .bab-rec-card:hover { background: none; }
#bab-overlay .bab-rec-link {
  display: flex; flex-direction: column; align-items: stretch;
  text-decoration: none !important; color: #333;
}
#bab-overlay .bab-rec-link:hover {
  text-decoration: none !important; color: #333;
}
#bab-overlay .bab-rec-img-wrap {
  width: 100%;
  aspect-ratio: 1/1;
  overflow: hidden;
  background: none;
  margin-bottom: 5px;
  display: flex; align-items: center; justify-content: center;
}
#bab-overlay .bab-rec-img {
  width: 100%; height: 100%; display: block;
  object-fit: contain;
  mix-blend-mode: multiply;
}
#bab-overlay .bab-rec-info {
  text-align: center; padding: 2px 2px 0;
  display: flex; flex-direction: column; align-items: center;
  width: 100%;
}
#bab-overlay .bab-rec-name {
  font-size: 11px; font-weight: 400; line-height: 1.3; color: #0066c0;
  display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
  max-width: 100%;
}
#bab-overlay .bab-rec-category {
  font-size: 10px; color: #565959; margin-top: 1px;
}
#bab-overlay .bab-rec-price {
  font-size: 12px; font-weight: 700; color: #1a56db; margin-top: 2px;
}

/* ===== Initial State Ad Banner ===== */
/* Slim banner inside the initial state block, below recommended products */
#bab-overlay .bab-initial-banner {
  margin-top: 12px;
  padding-bottom: 4px;
  overflow: hidden;
}
#bab-overlay .bab-initial-banner img {
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: 6px;
}
#bab-overlay .bab-initial-banner a {
  display: block;
  text-decoration: none !important;
}

/* Stock text and delivery — shown everywhere */
#bab-overlay .bab-card-stock-text { display: block; font-size: 11px; font-weight: 600; color: #c45500; margin-top: 4px; }
#bab-overlay .bab-card-stock-text.bab-in-stock { color: #007600; }
#bab-overlay .bab-card-delivery { display: block; font-size: 11px; font-weight: 400; color: #555; margin-top: 4px; line-height: 1.4; }

/* ===== Right Ad Column ===== */
#bab-overlay .bab-ad-column {
  width: 320px;
  flex-shrink: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px 16px 16px 12px;
  border-left: 1px solid #e3e6e6;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: #fff;
}
#bab-overlay .bab-ad-slot {
  background: #f8f9fa;
  border: 1px dashed #d0d0d0;
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
#bab-overlay .bab-ad-300x250 { width: 300px; height: 250px; flex-shrink: 0; }
#bab-overlay .bab-ad-300x600 { width: 300px; height: 600px; flex-shrink: 0; }
#bab-overlay .bab-ad-label {
  font-size: 10px;
  color: #bbb;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
}

/* Hide ad column on mobile and in initial state */
#bab-overlay .bab-showing-initial .bab-ad-column { display: none !important; }

/* ===== Mobile Inline Ad Banner (shown ≤1100px where side column is hidden) ===== */
#bab-overlay .bab-mobile-ad-banner {
  display: none; /* hidden on desktop — side column handles it */
}
#bab-overlay .bab-showing-initial .bab-mobile-ad-banner { display: none !important; }
#bab-overlay .bab-mobile-ad-custom img { display: block; width: 100%; height: auto; }
#bab-overlay .bab-mobile-ad-custom a { display: block; }
#bab-overlay .bab-mobile-ad-slot { text-align: center; }

/* ===== Cart modal must appear above overlay ===== */
#blockcart-modal { z-index: 9999999 !important; }
#blockcart-modal + .modal-backdrop,
.modal-backdrop { z-index: 9999998 !important; }

/* ===== Add to Cart Button ===== */
#bab-overlay .bab-add-to-cart {
  flex: 1; padding: 6px 0;
  background: #FFD814; color: #0f1111;
  border: 1px solid #FCD200; border-radius: 20px; font-size: 12px; font-weight: 600;
  cursor: pointer; transition: background 0.15s, box-shadow 0.15s;
  font-family: 'Inter', Arial, sans-serif; text-align: center;
  box-shadow: 0 1px 2px rgba(213,162,0,0.3);
  letter-spacing: 0.1px;
  width: 100%;
}
#bab-overlay .bab-add-to-cart:hover { background: #F7CA00; box-shadow: 0 2px 5px rgba(213,162,0,0.5); }
#bab-overlay .bab-add-to-cart.bab-cart-loading { opacity: 0.6; cursor: wait; }
#bab-overlay .bab-add-to-cart.bab-cart-added { background: #0a7c42; color: #fff; }
#bab-overlay .bab-add-to-cart.bab-cart-backordered { background: #d5d9d9; color: #888; cursor: not-allowed; }
#bab-overlay .bab-add-to-cart.bab-cart-backordered:hover { background: #d5d9d9; }
#bab-overlay .bab-add-to-cart-sm {
  font-size: 11px; padding: 6px 0;
  width: calc(100% - 16px); margin: 0 8px 8px;
}
/* Show full text on desktop, short on mobile */
#bab-overlay .bab-cart-short { display: none; }
#bab-overlay .bab-cart-full { display: inline; }

/* ===== Responsive ===== */
@media (max-width: 1100px) {
  #bab-overlay .bab-grid { grid-template-columns: repeat(2, 1fr); }
  #bab-overlay .bab-ad-column { display: none; }
  #bab-overlay .bab-mobile-ad-banner {
    display: block;
    padding: 12px 16px 0;
  }
  #bab-overlay .bab-mobile-ad-custom {
    margin-bottom: 10px;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid #e3e6e6;
  }
  #bab-overlay .bab-mobile-ad-slot {
    margin-bottom: 10px;
  }
}

@media (max-width: 768px) {
  /* Safe area insets for notched phones */
  #bab-overlay .bab-overlay-panel {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
  }

  #bab-overlay .bab-topbar-inner,
  #bab-overlay .bab-search-bar-inner,
  #bab-overlay .bab-controls-inner {
    padding-left: 16px; padding-right: 16px;
  }

  /* Topbar: back-arrow left, centered logo, cart right (Motive-style) */
  #bab-overlay .bab-topbar-inner {
    padding: 12px 16px;
    position: relative;
    min-height: 48px;
  }
  #bab-overlay .bab-logo {
    position: absolute;
    left: 50%; top: 50%;
    transform: translate(-50%, -50%);
  }
  #bab-overlay .bab-logo-img { height: 30px; }
  /* Close button → left side as back arrow */
  #bab-overlay .bab-overlay-close {
    position: absolute; left: 16px; top: 50%; transform: translateY(-50%);
    width: 32px; height: 32px; font-size: 24px;
    background: none; color: #333; border-radius: 0;
  }
  #bab-overlay .bab-overlay-close:hover { background: none; color: #000; }
  #bab-overlay .bab-close-x { display: none; }
  #bab-overlay .bab-close-arrow { display: inline; }
  /* Cart stays right — must NOT be position:absolute (would steal containing-block from close btn) */
  #bab-overlay .bab-topbar-right {
    position: static;
    margin-left: auto;
    transform: none;
  }
  #bab-overlay .bab-cart-link svg { width: 22px; height: 22px; }

  /* Search bar */
  #bab-overlay .bab-search-bar { padding: 14px 16px 12px; }
  #bab-overlay #bab-overlay-input { font-size: 16px; }

  /* Controls bar */
  #bab-overlay .bab-controls-inner { flex-wrap: wrap; gap: 6px; }

  /* Grid: single column, Amazon-style */
  #bab-overlay .bab-grid { grid-template-columns: 1fr; gap: 0; }
  #bab-overlay .bab-main { padding: 0; border-left: none; background: #fff; }

  /* Card: Amazon-style horizontal row on mobile — flex row (no absolute positioning) */
  #bab-overlay .bab-card { min-height: 0; }
  #bab-overlay .bab-card:hover { background: #fff; }
  /* Switch card link to row: image left, info right */
  #bab-overlay .bab-card-link { flex-direction: row; align-items: flex-start; padding-left: 0; }
  #bab-overlay .bab-card-img-wrap {
    position: relative; flex-shrink: 0;
    width: 150px; height: auto;
    aspect-ratio: 1/1; padding: 0;
  }
  #bab-overlay .bab-card-info { flex: 1; min-width: 0; padding: 12px 14px 8px 12px; }
  #bab-overlay .bab-card-name { font-size: 15px; -webkit-line-clamp: 3; }
  #bab-overlay .bab-card-brand { font-size: 12px; font-weight: 400; }
  #bab-overlay .bab-card-desc { font-size: 11px; }
  #bab-overlay .bab-card-price { font-size: 20px; padding-top: 0; padding-bottom: 2px; }
  #bab-overlay .bab-card-price .bab-price-symbol,
  #bab-overlay .bab-card-price .bab-price-decimal { font-size: 12px; }
  #bab-overlay .bab-original-price { display: inline; font-size: 13px; margin-left: 6px; }
  /* Backordered: hide image badge on mobile */
  #bab-overlay .bab-label-backordered { display: none; }
  #bab-overlay .bab-card-delivery { font-size: 11px; }

  /* Cart row: full width below, hide qty, taller button */
  #bab-overlay .bab-card-cart-row { padding: 6px 14px 14px 14px; gap: 0; }
  #bab-overlay .bab-qty-wrap { display: none; }
  #bab-overlay .bab-add-to-cart { height: 40px; font-size: 14px; padding: 0; min-width: 0; width: 100%; }
  #bab-overlay .bab-cart-short { display: none; }
  #bab-overlay .bab-cart-full { display: inline; }

  /* Hide ad column on mobile */
  #bab-overlay .bab-ad-column { display: none !important; }

  /* Sidebar: slide-out with backdrop */
  #bab-overlay .bab-overlay-body { position: relative; }
  #bab-overlay .bab-sidebar {
    position: absolute; top: 0; left: 0; bottom: 0;
    width: 280px; z-index: 10;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: 4px 0 20px rgba(0,0,0,0.1);
    background: #fff;
  }
  #bab-overlay .bab-sidebar.bab-sidebar-open { transform: translateX(0); }
  #bab-overlay .bab-sidebar-inner { padding: 14px 16px; }

  /* Sidebar backdrop overlay (added via JS) */
  #bab-overlay .bab-sidebar-backdrop {
    display: none; position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.4); z-index: 9;
  }
  #bab-overlay .bab-sidebar.bab-sidebar-open ~ .bab-sidebar-backdrop { display: block; }

  /* Filter toggle button */
  #bab-overlay .bab-sidebar-toggle {
    display: inline-flex; align-items: center; gap: 6px;
    position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
    z-index: 11;
    padding: 10px 24px; background: #232f3e; color: #fff;
    border: none; border-radius: 24px;
    font-size: 13px; font-weight: 600; cursor: pointer;
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
    bottom: calc(20px + env(safe-area-inset-bottom));
  }

  /* ===== Filter chip bar (mobile only) ===== */
  #bab-overlay .bab-filter-bar {
    display: block;
    flex-shrink: 0;
    background: #fff;
    border-bottom: 1px solid #e7e7e7;
  }
  #bab-overlay .bab-filter-bar-scroll {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow-x: auto;
    padding: 8px 14px;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
  }
  #bab-overlay .bab-filter-bar-scroll::-webkit-scrollbar { display: none; }
  #bab-overlay .bab-fchip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
    padding: 7px 14px;
    border: 1px solid #aaa;
    border-radius: 20px;
    background: #fff;
    color: #0f1111;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    font-family: inherit;
    transition: background 0.15s, border-color 0.15s;
    line-height: 1;
  }
  #bab-overlay .bab-fchip:hover { background: #f7f7f7; }
  #bab-overlay .bab-fchip-main { border-color: #0f1111; font-weight: 600; }
  #bab-overlay .bab-fchip-active {
    background: #0f1111;
    border-color: #0f1111;
    color: #fff;
  }
  #bab-overlay .bab-fchip-active:hover { background: #333; }

  /* Initial state */
  #bab-overlay .bab-initial-state { padding: 16px; }
  #bab-overlay .bab-recent-section { margin-bottom: 24px; }
  #bab-overlay .bab-recent-term { font-size: 15px; font-weight: 500; padding: 12px 0; }
  #bab-overlay .bab-recent-delete { font-size: 20px; padding: 8px 12px; }
  #bab-overlay .bab-initial-heading { font-size: 16px; font-weight: 700; margin-bottom: 8px; }
  #bab-overlay .bab-recent-action { font-size: 14px; font-weight: 500; color: #1a56db; }
  #bab-overlay .bab-recent-footer { padding-top: 8px; gap: 10px; }

  /* Recommended: Motive-style hero carousel on mobile */
  #bab-overlay .bab-recommended-row {
    gap: 0;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 12px;
  }
  #bab-overlay .bab-rec-card {
    width: 46vw;
    scroll-snap-align: start;
    padding: 0;
    border-radius: 0;
    background: none;
  }
  #bab-overlay .bab-rec-card:hover { background: none; }
  #bab-overlay .bab-rec-img-wrap {
    width: 100%; aspect-ratio: 1/1;
    overflow: hidden; background: none;
    border-radius: 0; margin-bottom: 8px; padding: 0;
  }
  #bab-overlay .bab-rec-img {
    width: 100%; height: 100%; object-fit: contain;
    mix-blend-mode: multiply;
  }
  #bab-overlay .bab-rec-info { text-align: center; }
  #bab-overlay .bab-rec-name {
    font-size: 14px; font-weight: 600; max-width: none;
    -webkit-line-clamp: 2; line-height: 1.35;
    color: #0f1111;
  }
  #bab-overlay .bab-rec-category {
    font-size: 12px; color: #565959; margin-top: 3px;
  }
  #bab-overlay .bab-rec-price {
    font-size: 18px; font-weight: 700; margin-top: 5px;
    background: linear-gradient(135deg, #1a56db, #0ea5e9);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
  }
  /* Hide cart button on recommended cards — mobile only */
  #bab-overlay .bab-add-to-cart-sm { display: none; }

  /* Labels smaller on mobile */
  #bab-overlay .bab-label { font-size: 9px; padding: 2px 5px; }

  /* Pagination: smaller on mobile */
  #bab-overlay .bab-pag-link { min-width: 28px; height: 28px; font-size: 11px; padding: 0 6px; }
}

/* ===== Small phones (< 480px) ===== */
@media (max-width: 480px) {
  #bab-overlay .bab-topbar-inner { padding: 8px 12px; min-height: 44px; }
  #bab-overlay .bab-logo-img { height: 26px; }
  #bab-overlay .bab-overlay-close { left: 12px; }

  #bab-overlay .bab-search-bar { padding: 10px 12px 8px; }
  #bab-overlay .bab-search-bar-inner { padding-bottom: 6px; gap: 8px; }
  #bab-overlay #bab-overlay-input { font-size: 16px; }

  #bab-overlay .bab-controls-inner { padding: 6px 12px; font-size: 12px; }
  #bab-overlay .bab-sort-select { font-size: 11px; padding: 3px 20px 3px 8px; }

  /* Small phones: slightly narrower image */
  #bab-overlay .bab-card-img-wrap { width: 120px; }
  #bab-overlay .bab-card-name { font-size: 14px; }
  #bab-overlay .bab-card-price { font-size: 18px; }
  #bab-overlay .bab-card-info { padding: 10px 10px 6px 10px; }
  #bab-overlay .bab-card-cart-row { padding: 6px 12px 12px 12px; }
  #bab-overlay .bab-add-to-cart { height: 38px; font-size: 13px; }

  /* Sidebar wider on small phones (takes full width minus a sliver) */
  #bab-overlay .bab-sidebar { width: calc(100% - 50px); }

  /* Initial state: rec cards on small phones */
  #bab-overlay .bab-initial-state { padding: 10px; }
  #bab-overlay .bab-rec-card { width: 44vw; }
  #bab-overlay .bab-rec-name { font-size: 13px; }
  #bab-overlay .bab-rec-price { font-size: 17px; }

  /* No results message */
  #bab-overlay .bab-no-results { padding: 40px 16px; }
  #bab-overlay .bab-no-results p { font-size: 14px; }
  #bab-overlay .bab-start-msg { padding: 50px 16px; font-size: 14px; }

  /* Sale badge smaller */
  #bab-overlay .bab-sale-badge { font-size: 9px; padding: 2px 4px; }
  #bab-overlay .bab-original-price { font-size: 11px; }
}

/* Fix: user account dropdown links invisible (white on white) due to nav4 inheriting #fff */
.header-nav .nav4 .user-info a {
  color: #333 !important;
}
.header-nav .nav4 .user-info a:hover {
  color: #05392e !important;
}

/* Fix: user account dropdown appears behind nav tabs (z-index: 1 < nav z-index: 2) */
.user-info {
  z-index: 999 !important;
}

/* Fix: cart page product images crushed because Bootstrap col-md-2 percentage width
   resolves against the 110px CSS Grid track, making the image column ~18-30px wide */
.product-line-grid .product-line-grid-left {
  width: 110px !important;
}
.product-line-grid-left img {
  width: 100% !important;
  height: auto !important;
  display: block;
}
