/* =========================
   MUNCASTER CBS STYLES (CLEAN + FIXED)
   - Removed duplicate/conflicting blocks
   - FIXED: Compare + My RFQs sit SIDE-BY-SIDE (same row)
   - Keeps existing class names so it won’t break JS/HTML
========================= */

/* =========================
   BRAND TOKENS
========================= */
:root{
  --m-blue:#0078d7;
  --m-green:#00b050;
  --m-bg:#f7fbff;
  --m-text:#102a43;
  --m-muted:#52606d;
  --m-card:#ffffff;
  --m-border:#e6eef7;
  --m-shadow:0 6px 16px rgba(0,0,0,0.10);
}

html, body{
  max-width:100%;
  overflow-x:hidden !important;
}

*{ box-sizing:border-box; }

body{
  margin:0;
  background: var(--m-bg);
  color: var(--m-text);
  font-family: "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
}

/* =========================
   PAGE / HERO
========================= */
.cbs-page{ min-height:70vh; padding-top:16px; }

.cbs-hero{
  background: linear-gradient(135deg, var(--m-blue), var(--m-green));
  color:#fff;
  padding:18px 16px;
  border-bottom:3px solid rgba(255,255,255,0.22);

  border-radius:28px;
  overflow:hidden;
  margin:16px auto 24px;
  box-shadow:
    0 18px 40px rgba(2,6,23,0.18),
    inset 0 0 0 1px rgba(255,255,255,0.15);
}

.cbs-hero-inner{
  max-width:1150px;
  margin:0 auto;
  display:flex;
  gap:16px;
  justify-content:center;
  align-items:center;
  flex-direction:column;
  text-align:center;
  padding-left:16px;
  padding-right:16px;
}

.cbs-hero h1{
  margin:0 0 6px;
  font-size:1.45rem;
  font-weight:800;
  letter-spacing:.2px;
}

.cbs-subtitle{
  margin:0;
  opacity:.92;
  font-size:.95rem;
  max-width:720px;
}

.cbs-hero-badges{
  display:flex;
  gap:8px;
  margin-top:10px;
  flex-wrap:wrap;
  justify-content:center;
}

.pill{
  display:inline-flex;
  align-items:center;
  padding:6px 10px;
  border-radius:999px;
  background:rgba(255,255,255,0.14);
  border:1px solid rgba(255,255,255,0.34);
  font-weight:700;
  font-size:.82rem;
  white-space:nowrap;
}

.cbs-hero-actions,
.cbs-actions{
  display:flex;
  gap:12px;
  justify-content:center;
  flex-wrap:wrap;
}

.btn-primary,
.btn-secondary{
  border:none;
  cursor:pointer;
  border-radius:12px;
  padding:10px 14px;
  font-weight:800;
  box-shadow:0 4px 12px rgba(0,0,0,0.18);
  transition:transform .15s ease, opacity .15s ease;
}
.btn-primary{ background:#fff; color:var(--m-blue); }
.btn-secondary{
  background:rgba(255,255,255,0.14);
  color:#fff;
  border:1px solid rgba(255,255,255,0.35);
}
.btn-primary:hover,.btn-secondary:hover{ transform:translateY(-1px); opacity:.95; }

.count-badge{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width:26px;
  padding:2px 8px;
  margin-left:6px;
  border-radius:999px;
  background:linear-gradient(135deg,var(--m-blue),var(--m-green));
  color:#fff;
  font-weight:900;
  font-size:.82rem;
}

@media (min-width:1024px){
  .cbs-hero,
  .cbs-hero-inner{ border-radius:34px; }
}
@media (max-width:768px){
  .cbs-hero,
  .cbs-hero-inner{ border-radius:20px; }
}

/* =========================
   CONTROLS
========================= */
.cbs-controls{
  max-width:1150px;
  margin:0 auto;
  padding:16px;
  display:grid;
  grid-template-columns:1fr;
  gap:14px;
}

.cbs-search input{
  width:100%;
  padding:12px 12px;
  border-radius:12px;
  border:1px solid var(--m-border);
  outline:none;
  font-size:1rem;
  background:#fff;
}
.cbs-search input:focus{
  border-color:rgba(0,120,215,0.55);
  box-shadow:0 0 0 4px rgba(0,120,215,0.12);
}

.cbs-toggles{
  display:grid;
  grid-template-columns:repeat(3, minmax(180px, 1fr));
  gap:12px;
}
@media (max-width:900px){
  .cbs-toggles{ grid-template-columns:1fr; }
}

.toggle{
  height:54px;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:10px;
  background:#fff;
  border:1px solid var(--m-border);
  padding:10px 12px;
  border-radius:12px;
  font-weight:800;
  color:var(--m-muted);
}
.toggle input{ transform:scale(1.15); cursor:pointer; }

/* =========================
   CATEGORY BAR
========================= */
.cbs-categorybar{
  max-width:1150px;
  margin:0 auto;
  padding:10px 16px 6px;
  border-top:1px solid var(--m-border);
  overflow:visible;
}

.catbar{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  align-items:center;
  min-height:56px;
}

.catbtn{
  border:1px solid var(--m-border);
  background:#fff;
  color:#0b3d91;
  padding:8px 14px;
  border-radius:999px;
  font-weight:900;
  cursor:pointer;
  white-space:nowrap;
  line-height:1.2;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  transition:transform .12s ease, opacity .12s ease, background .12s ease;
  min-height:44px;
  max-width:260px;
  overflow:hidden;
  text-overflow:ellipsis;
}
.catbtn:not(.active){ box-shadow:0 4px 10px rgba(0,0,0,0.12); }
.catbtn:hover{ transform:translateY(-1px); opacity:.95; }
.catbtn.active{
  background:linear-gradient(135deg,var(--m-blue),var(--m-green));
  color:#fff;
  border-color:transparent;
}
.catbar .catbtn:first-child{ order:-1; }

/* Mobile category collapse (optional, if you use .cbs-category-toggle JS) */
@media (max-width:768px){
  .cbs-category-toggle{
    display:block;
    width:100%;
    padding:10px 14px;
    border-radius:999px;
    background:linear-gradient(135deg,#0078d7,#00b050);
    color:#fff;
    font-weight:800;
    text-align:center;
    margin-bottom:10px;
    cursor:pointer;
  }
  .cbs-categorybar .catbar{
    max-height:0;
    overflow:hidden;
    transition:max-height .3s ease;
  }
  .cbs-categorybar.open .catbar{ max-height:600px; }
}
@media (min-width:769px){
  .cbs-category-toggle{ display:none; }
}

/* =========================
   GRID + CARDS
========================= */
.cbs-grid{
  display:grid;
  grid-template-columns:repeat(auto-fill, minmax(240px,1fr));
  gap:16px;
}

@media (max-width:520px){
  .cbs-grid{
    grid-template-columns:repeat(2, minmax(0,1fr));
    gap:12px;
  }
}
@media (min-width:521px) and (max-width:900px){
  .cbs-grid{
    grid-template-columns:repeat(3, minmax(0,1fr));
    gap:14px;
  }
}

.cbs-card{
  background:var(--m-card);
  border:1.5px solid #cdeedd;
  border-radius:14px;
  box-shadow:0 2px 8px rgba(0,0,0,0.05);
  padding:12px;
  display:flex;
  flex-direction:column;
  gap:10px;
  transition:transform .15s ease, box-shadow .15s ease;
}
.cbs-card:hover{
  transform:translateY(-3px);
  box-shadow:0 6px 18px rgba(0,0,0,0.12);
}

.cbs-img{
  width:100%;
  height:170px;
  object-fit:contain;
  border-radius:10px;
  background:#f1f5f9;
}
.cbs-img[src*="placeholder"]{ object-fit:contain; }

.cbs-topline{
  display:flex;
  gap:10px;
  justify-content:space-between;
  align-items:flex-start;
}
.cbs-title{
  margin:0;
  font-size:1.03rem;
  font-weight:900;
  line-height:1.2;
}
.cbs-meta{
  margin:0;
  color:var(--m-muted);
  font-weight:700;
  font-size:.86rem;
}

.badge{
  display:inline-flex;
  align-items:center;
  padding:4px 8px;
  border-radius:999px;
  font-size:.78rem;
  font-weight:900;
  color:#fff;
  white-space:nowrap;
}
.badge-local{ background:var(--m-green); }
.badge-import-local{ background:#f39c12; }
.badge-import-order{ background:var(--m-blue); }

.section,
.mode,
.lane{
  border:1px solid var(--m-border);
  border-radius:12px;
  padding:10px;
  background:#fff;
}

.section h4{
  margin:0 0 6px;
  font-size:.92rem;
  color:var(--m-blue);
  font-weight:900;
}

.market-range,
.price-big,
.lane-range{
  font-weight:1000;
  color:#0b3d2e;
}
.market-range{ font-size:.98rem; }
.price-big{ font-size:1.05rem; }

.small-note{
  color:var(--m-muted);
  font-weight:700;
  font-size:.82rem;
  margin-top:4px;
}

.mode-title,
.lane-title{
  font-weight:900;
  color:var(--m-blue);
  font-size:.92rem;
}
.lane-title{ margin:0 0 4px; }

.mode-line,
.lane-meta{
  color:var(--m-muted);
  font-weight:750;
  font-size:.84rem;
}
.lane-meta{ margin:0 0 8px; }

.btn{
  border:none;
  border-radius:12px;
  padding:10px 12px;
  font-weight:950;
  cursor:pointer;
  transition:transform .12s ease, opacity .12s ease;
}
.btn:hover{ transform:translateY(-1px); opacity:.95; }

.btn-buy{
  background:linear-gradient(135deg,var(--m-blue),var(--m-green));
  color:#fff;
}
.btn-rfq{
  background:#eaf7ef;
  color:#0b3d2e;
  border:1px solid rgba(0,176,80,0.35);
}
.btn-import{
  background:#eef6ff;
  color:var(--m-blue);
  border:1px solid rgba(0,120,215,0.25);
}

.secondary-actions{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}
.link-btn{
  flex:1 1 auto;
  text-align:center;
  padding:10px 10px;
  border-radius:12px;
  border:1px solid var(--m-border);
  background:#fff;
  font-weight:900;
  color:var(--m-blue);
  cursor:pointer;
}

/* Expand/collapse (works if you toggle .expanded in JS) */
.cbs-card .card-details{ display:none; }
.cbs-card.expanded .card-details{ display:block; }

.card-expand-btn{
  display:block;
  width:100%;
  margin-top:auto;
  padding:10px 12px;
  border-radius:10px;
  border:1px dashed var(--m-border);
  background:#f8fbff;
  font-weight:900;
  color:var(--m-blue);
  text-align:center;
  cursor:pointer;
}
@media (max-width:767px){
  .cbs-card .card-details{ display:none; }
  .cbs-card.expanded .card-details{ display:block; }
}

/* Card highlight states */
.cbs-card.highlight-buynow{
  border:3px solid #10b981;
  background:#f0fff7;
  box-shadow:0 0 0 4px rgba(16,185,129,0.25);
}
.cbs-card.highlight-import{
  border:3px dashed #8b5cf6;
  background:#f6f1ff;
  box-shadow:0 0 0 4px rgba(139,92,246,0.25);
}
.cbs-card.highlight-rfq{
  border:3px solid #f97316;
  background:#fff7ed;
  box-shadow:0 0 0 4px rgba(249,115,22,0.25);
}

/* Empty state + toast */
.empty-state{
  background:#fff;
  border:1px solid var(--m-border);
  border-radius:14px;
  padding:22px;
  box-shadow:var(--m-shadow);
  margin-top:12px;
}
.toast{
  position:fixed;
  left:50%;
  bottom:18px;
  transform:translateX(-50%);
  background:#111827;
  color:#fff;
  padding:12px 14px;
  border-radius:12px;
  font-weight:850;
  z-index:10000;
  box-shadow:0 12px 30px rgba(0,0,0,0.35);
  max-width:min(560px,92vw);
}

/* category click feedback */
#productGrid.grid-flash{
  outline:3px solid rgba(0,120,215,0.35);
  border-radius:12px;
}

/* RFQ mini select */
.mini-label{
  font-size:.78rem;
  font-weight:900;
  color:var(--m-muted);
  margin-top:2px;
}
.mini-select{
  width:100%;
  padding:10px 10px;
  border-radius:12px;
  border:1px solid var(--m-border);
  background:#fff;
  font-weight:800;
}

/* =========================
   HEADER (MOBILE FIX)
========================= */
@media (max-width:768px){
  header{
    position:fixed;
    top:0; left:0; right:0;
    height:64px;
    padding:8px 12px;
    background:linear-gradient(135deg,#0078d7,#00b050);
    z-index:10000;
  }
  body{ padding-top:64px; padding-bottom:110px; }

  header > div,
  header .header-inner{
    display:flex;
    align-items:center;
    justify-content:space-between;
    width:100%;
  }

  .logo-area{
    display:flex;
    align-items:center;
    gap:8px;
    max-width:calc(100% - 48px);
  }
  .logo-area img{
    height:32px;
    width:auto;
    flex-shrink:0;
  }
  .brand-text{
    display:flex;
    flex-direction:column;
    line-height:1.1;
  }
  .brand-text h1{
    font-size:.95rem;
    margin:0;
    white-space:nowrap;
  }
  .brand-text p{
    font-size:.7rem;
    margin:0;
    opacity:.85;
    white-space:nowrap;
  }
  .menu-toggle{
    font-size:1.6rem;
    background:none;
    border:none;
    color:#fff;
    flex-shrink:0;
  }
}
/* =====================================================
   CBS — FLOATING BUTTONS (CLEAN, SINGLE SOURCE OF TRUTH)
   - Only: Compare + My RFQs
   - Desktop: side-by-side bottom-right
   - Mobile: stacked
   - No overlap, no double clicks
===================================================== */

#floatCompareBtn,
#floatMyRFQsBtn{
  position: fixed !important;
  z-index: 99999 !important;

  height: 52px !important;
  min-width: 190px !important;
  padding: 0 14px 0 16px !important;

  border-radius: 999px !important;
  border: 1px solid rgba(255,255,255,0.35) !important;

  display: inline-flex !important;
  align-items: center !important;
  gap: 12px !important;

  color: #fff !important;
  background: linear-gradient(135deg,#0078d7,#00b050) !important;

  box-shadow:
    0 24px 60px rgba(2,6,23,.18),
    0 10px 24px rgba(2,6,23,.10),
    inset 0 1px 0 rgba(255,255,255,.7) !important;

  cursor: pointer !important;
  user-select: none !important;

  /* IMPORTANT: prevents weird "click-through" behavior */
  pointer-events: auto !important;
}

/* badge (count) pinned to right */
#floatCompareBtn .compare-count,
#floatMyRFQsBtn .float-count{
  margin-left: auto !important;
  min-width: 34px !important;
  height: 34px !important;
  padding: 0 10px !important;

  border-radius: 999px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;

  font-weight: 950 !important;
  font-size: 12px !important;

  background: #0b1220 !important;
  color: #fff !important;

  box-shadow:
    0 10px 20px rgba(2,6,23,.22),
    inset 0 1px 0 rgba(255,255,255,.25) !important;
}

/* DESKTOP: side-by-side bottom-right */
#floatMyRFQsBtn{
  right: 14px !important;
  bottom: 28px !important;
}
#floatCompareBtn{
  right: 220px !important; /* sits left of My RFQs */
  bottom: 28px !important;
}

/* MOBILE: stack (no squeezing, no overlap) */
@media (max-width: 520px){
  #floatMyRFQsBtn{
    right: 14px !important;
    bottom: 20px !important;
    min-width: 210px !important;
  }
  #floatCompareBtn{
    right: 14px !important;
    bottom: 82px !important;
    min-width: 210px !important;
  }
}
/* =========================================================
   FIX 1 — MOBILE CARDS LOOK CLEAN (less height, better spacing)
   - tighter padding/gaps
   - smaller image
   - readable title/meta
   - buttons become clean + consistent
========================================================= */
@media (max-width: 680px){
  .cbs-grid{
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
  }

  .cbs-card{
    padding: 10px !important;
    gap: 8px !important;
    border-radius: 14px !important;
  }

  .cbs-img{
    height: 118px !important;
    border-radius: 10px !important;
  }

  .cbs-title{
    font-size: .92rem !important;
    line-height: 1.15 !important;
  }

  .cbs-meta{
    font-size: .78rem !important;
    line-height: 1.2 !important;
  }

  /* If your card has those section boxes, make them tighter on phone */
  .section, .mode, .lane{
    padding: 8px !important;
    border-radius: 12px !important;
  }

  .section h4{
    font-size: .86rem !important;
    margin-bottom: 4px !important;
  }

  .market-range, .price-big, .lane-range{
    font-size: .95rem !important;
  }

  /* Buttons: reduce padding + keep consistent */
  .btn,
  .link-btn{
    padding: 9px 10px !important;
    border-radius: 12px !important;
    font-weight: 900 !important;
    font-size: .86rem !important;
  }

  /* If you have secondary actions (Compare/Details) make them full width & neat */
  .secondary-actions{
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 8px !important;
  }
  .secondary-actions .link-btn{
    width: 100% !important;
  }
}


/* =========================================================
   FIX 2 — FLOATING BUTTONS NEVER OVERLAP + BADGES ALWAYS VISIBLE
   Key changes:
   - stack on <= 760px (not 520px)
   - button width clamps to screen
   - badge becomes ABSOLUTE on right
   - safe-area bottom support (Android/iPhone)
========================================================= */
#floatCompareBtn,
#floatMyRFQsBtn{
  overflow: visible !important;        /* prevents badge clipping */
  max-width: calc(100vw - 28px) !important;
  min-width: 0 !important;             /* allow shrinking properly */
  width: clamp(210px, 60vw, 340px) !important;
  padding-right: 56px !important;      /* reserve space for badge */
  position: fixed !important;
}

/* Make each button a positioning context so badge can anchor */
#floatCompareBtn,
#floatMyRFQsBtn{
  position: fixed !important;
}

/* Badge pinned to right, always visible */
#floatCompareBtn .compare-count,
#floatMyRFQsBtn .float-count{
  position: absolute !important;
  right: 10px !important;
  top: 50% !important;
  transform: translateY(-50%) !important;

  margin-left: 0 !important;
  z-index: 2 !important;
}

/* Default (desktop/tablet wide): side-by-side only if there's room */
@media (min-width: 761px){
  #floatMyRFQsBtn{
    right: 14px !important;
    bottom: calc(22px + env(safe-area-inset-bottom)) !important;
  }
  #floatCompareBtn{
    right: calc(14px + clamp(210px, 60vw, 340px) + 12px) !important;
    bottom: calc(22px + env(safe-area-inset-bottom)) !important;
  }
}

/* Phones / narrow widths: STACK so they never collide */
@media (max-width: 760px){
  #floatMyRFQsBtn{
    right: 14px !important;
    left: 14px !important;  /* makes it stable */
    bottom: calc(18px + env(safe-area-inset-bottom)) !important;
    width: auto !important;
  }
  #floatCompareBtn{
    right: 14px !important;
    left: 14px !important;
    bottom: calc(78px + env(safe-area-inset-bottom)) !important;
    width: auto !important;
  }
}
/* ✅ FINAL HIT-TEST FIX: floating buttons never overlap and Compare sits above */
#floatCompareBtn{ z-index: 100020 !important; }
#floatMyRFQsBtn{ z-index: 100010 !important; }

@media (max-width: 760px){
  #floatCompareBtn,
  #floatMyRFQsBtn{
    left: 14px !important;
    right: 14px !important;
    width: auto !important;
    max-width: calc(100vw - 28px) !important;
  }

  #floatMyRFQsBtn{
    bottom: calc(18px + env(safe-area-inset-bottom)) !important;
  }

  #floatCompareBtn{
    bottom: calc(86px + env(safe-area-inset-bottom)) !important;
  }
}
/* =========================================================
   FINAL MOBILE FIX — FLOATING BUTTONS (Compare + My RFQs)
   Goals:
   - NOT full width (compact pills on the right)
   - Sit ABOVE bottom nav bar
   - Clean spacing + smaller badge
   - Still stacked on mobile
========================================================= */

/* tweak this if your bottom nav is taller/shorter */
:root{
  --m-bottom-nav: 72px; /* phone bottom bar height */
}

@media (max-width: 760px){
  #floatCompareBtn,
  #floatMyRFQsBtn{
    /* ✅ compact, not full width */
    left: auto !important;
    right: 12px !important;
    width: auto !important;
    max-width: calc(100vw - 24px) !important;
    min-width: 170px !important;

    height: 46px !important;
    padding: 0 12px 0 12px !important;
    padding-right: 52px !important; /* space for badge */

    border-radius: 14px !important;
    gap: 10px !important;

    /* keep text clean */
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;

    box-shadow: 0 14px 30px rgba(2,6,23,.18) !important;
  }

  /* ✅ place them above your bottom nav */
  #floatMyRFQsBtn{
    bottom: calc(var(--m-bottom-nav) + 10px + env(safe-area-inset-bottom)) !important;
  }
  #floatCompareBtn{
    bottom: calc(var(--m-bottom-nav) + 64px + env(safe-area-inset-bottom)) !important;
  }

  /* badge smaller + cleaner */
  #floatCompareBtn .compare-count,
  #floatMyRFQsBtn .float-count{
    width: 30px !important;
    height: 30px !important;
    min-width: 30px !important;
    padding: 0 !important;
    font-size: 12px !important;

    right: 10px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;

    border-radius: 999px !important;
    background: rgba(11,18,32,.92) !important;
    box-shadow: 0 10px 18px rgba(2,6,23,.22) !important;
  }
}
/* =========================================================
   MOBILE FIX: Category list should show ALL categories
   - Make category area expand
   - Turn chips into a clean vertical list on phone
========================================================= */
@media (max-width: 520px){

  /* Ensure wrapper can expand */
  #categoryWrapper{
    overflow: visible !important;
    max-height: none !important;
  }

  /* If your CSS collapses categoryBar by default,
     this ensures the OPEN state really opens */
  #categoryWrapper.open .catbar{
    max-height: none !important;
    overflow: visible !important;
  }

  /* Force categories into a single-column list */
  #categoryBar{
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 10px !important;
    padding: 10px 6px 6px !important;
  }

  /* Make each category button full width and readable */
  #categoryBar .catbtn{
    width: 100% !important;
    text-align: center;
    white-space: normal !important;      /* allow wrapping */
    line-height: 1.15;
    padding: 12px 12px !important;
    border-radius: 999px;
  }
}
/* =========================================================
   FIX: Category chips (e.g. "All") being covered by first cards (mobile)
========================================================= */

/* Make controls sit ABOVE the grid in stacking order */
.cbs-controls{
  position: relative;
  z-index: 50;
}

/* Ensure category wrapper creates space before the first cards */
#categoryWrapper{
  position: relative;
  z-index: 60;
  margin-bottom: 14px;
}

/* Give the grid a little breathing room from controls */
.cbs-grid-wrap{
  position: relative;
  z-index: 1;
  padding-top: 10px;
}

/* If any card has a negative top margin somewhere, neutralize it on small screens */
@media (max-width: 520px){
  .cbs-card,
  .cbs-card-v2{
    margin-top: 0 !important;
  }
}
/* ==============================
   MOBILE FIX: Categories above cards
   ============================== */

/* make sure category area is ABOVE product grid */
.cbs-controls,
#categoryWrapper,
.cbs-categorybar,
.catbar {
  position: relative;
  z-index: 50;
}

/* ensure product cards can't overlap it */
.cbs-grid-wrap,
#productGrid,
.cbs-card {
  position: relative;
  z-index: 1;
}
/* give breathing space so All button doesn't sit into first cards */
.cbs-categorybar,
#categoryWrapper {
  margin-bottom: 14px;
}

/* extra insurance for mobile */
@media (max-width: 760px){
  .cbs-categorybar,
  #categoryWrapper{
    margin-bottom: 18px;
  }
}
@media (max-width: 760px){
  .cbs-grid-wrap{
    margin-top: 10px !important;
  }
  .cbs-card{
    transform: none !important;
  }
}
/* =========================================
   FIX: "All" button covered on mobile
========================================= */
@media (max-width: 560px){

  /* ensure the whole category block sits above cards */
  #categoryWrapper,
  .cbs-categorybar{
    position: relative;
    z-index: 50;
  }

  /* make the dropdown area not collapse into the grid */
  .catbar,
  #categoryBar{
    position: relative;
    z-index: 60;
    padding-bottom: 14px;  /* creates room so "All" doesn't touch cards */
    margin-bottom: 12px;
  }

  /* also lower the first row of cards slightly */
  .cbs-grid-wrap{
    position: relative;
    z-index: 1;
    margin-top: 8px;
  }

  /* optional: give "All" a little breathing room */
  .catbtn.active{
    margin-top: 6px;
  }
}
/* ==============================
   CBS CARD IMAGE CLEANUP
   - one clean rounded frame
   - remove “layered” borders
   - consistent look for any image
============================== */

/* the image holder */
.cbs-thumb{
  background: #ffffff !important;
  border-radius: 16px !important;
  padding: 10px !important;
  overflow: hidden !important;

  /* remove “double frame” look */
  border: none !important;
  box-shadow: 0 10px 24px rgba(2,6,23,.06) !important;
}

/* the actual image */
.cbs-thumb .cbs-img{
  width: 100% !important;
  height: 140px !important;         /* consistent height */
  object-fit: contain !important;   /* safe for any image */
  display: block !important;

  /* make image edges clean */
  border-radius: 12px !important;

  /* remove ugly borders/outlines from some images */
  border: none !important;
  outline: none !important;
  background: #f6f8fb !important;   /* helps transparent PNGs look clean */
}

/* optional: make image a bit bigger on mobile */
@media (max-width: 640px){
  .cbs-thumb .cbs-img{
    height: 150px !important;
  }
}
/* ===== IMAGE CLEAN FIX (FINAL) ===== */

.cbs-thumb{
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #f6f8fb;
  border-radius: 18px;
  overflow: hidden;
  padding: 16px;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.04);
}

.cbs-img{
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 14px;
  background: #ffffff;
  transition: transform .25s ease;
}

.cbs-card:hover .cbs-img{
  transform: scale(1.05);
}
/* ===== CBS THUMB BLEND FIX (NO CROP) ===== */

/* make the holder one clean surface */
.cbs-thumb{
  background: #ffffff !important;     /* same surface everywhere */
  padding: 10px !important;          /* small breathing space */
  border-radius: 18px !important;
  overflow: hidden !important;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.04) !important;
}

/* remove the “inner white box” look */
.cbs-img{
  background: transparent !important; /* IMPORTANT: no different bg */
  border-radius: 0 !important;        /* avoid “image card inside card” */
  width: 100% !important;
  height: 100% !important;
  object-fit: contain !important;
  object-position: center !important;
  display: block !important;
}
/* make images appear larger inside holder */
.cbs-img{
  transform: scale(1.08) !important;
}
/* ===== FIX: remove top white strip in thumbs (mobile + desktop) ===== */

/* make thumb a fixed frame */
.cbs-card .cbs-thumb{
  height: 170px !important;          /* adjust if you want taller */
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;

  padding: 0 !important;             /* ✅ kills the top strip */
  background: #ffffff !important;
  border-radius: 18px !important;
  overflow: hidden !important;
}

/* give the image its own breathing room INSIDE, not the container */
.cbs-card .cbs-thumb .cbs-img{
  width: 100% !important;
  height: 100% !important;

  padding: 10px !important;          /* moved padding here */
  box-sizing: border-box !important;

  object-fit: contain !important;
  object-position: center !important;

  background: transparent !important;
  display: block !important;
}

/* slightly different height on small phones */
@media (max-width: 480px){
  .cbs-card .cbs-thumb{ height: 155px !important; }
}

/* MOBILE CATEGORY DROPDOWN */
@media (max-width:768px){

  .cbs-category-toggle{
    display:block;
    width:100%;
    padding:12px;
    border-radius:999px;
    background:linear-gradient(135deg,#0078d7,#00b050);
    color:#fff;
    text-align:center;
    font-weight:900;
    cursor:pointer;
    margin-bottom:10px;
  }

  #categoryBar{
    display:none;
    margin-top:10px;
  }

  #categoryWrapper.open #categoryBar{
    display:flex;
    flex-wrap:wrap;
    gap:10px;
  }
}
/* =========================================================
   FINAL CBS MOBILE CATEGORY DROPDOWN
========================================================= */
@media (max-width:768px){

  .cbs-categorybar{
    padding:10px 8px 6px !important;
    margin-bottom:0 !important;
    overflow:visible !important;
  }

  .cbs-category-toggle{
    display:block !important;
    width:100% !important;
    padding:12px !important;
    border-radius:999px !important;
    background:linear-gradient(135deg,#0078d7,#00b050) !important;
    color:#fff !important;
    text-align:center !important;
    font-weight:900 !important;
    cursor:pointer !important;
    margin-bottom:8px !important;
  }

  #categoryBar{
    display:none !important;
    margin-top:8px !important;
    padding:0 4px 8px !important;
  }

  #categoryWrapper.open #categoryBar{
    display:flex !important;
    flex-wrap:wrap !important;
    gap:10px !important;
    align-items:center !important;
    justify-content:center !important;
  }

  #categoryBar .catbtn{
    width:auto !important;
    max-width:100% !important;
    min-height:40px !important;
    padding:9px 14px !important;
    border-radius:999px !important;
    white-space:normal !important;
    line-height:1.12 !important;
    text-align:center !important;
  }

  .cbs-grid-wrap{
    margin-top:0 !important;
    padding-top:0 !important;
  }
}

@media (min-width:769px){
  #categoryBar{
    display:flex !important;
    flex-wrap:wrap !important;
  }
}
/* FINAL FIX: make Categories button tappable and dropdown obey open state */
#catToggle,
.cbs-category-toggle{
  position:relative !important;
  z-index:99999 !important;
  pointer-events:auto !important;
  touch-action:manipulation !important;
  cursor:pointer !important;
}

@media (max-width:768px){
  #categoryWrapper:not(.open) #categoryBar{
    display:none !important;
  }

  #categoryWrapper.open #categoryBar{
    display:flex !important;
    flex-wrap:wrap !important;
    gap:10px !important;
    align-items:center !important;
    justify-content:center !important;
    max-height:none !important;
    overflow:visible !important;
  }
}
/* FINAL CATEGORY BUTTON FIX — last rule wins */
#catToggle{
  position:relative !important;
  z-index:999999 !important;
  pointer-events:auto !important;
  touch-action:manipulation !important;
  cursor:pointer !important;
  border:none !important;
  appearance:none !important;
  -webkit-appearance:none !important;
}

@media(max-width:768px){
  #categoryWrapper{
    position:relative !important;
    z-index:99999 !important;
    overflow:visible !important;
  }

  #categoryBar{
    display:none !important;
  }

  #categoryWrapper.open #categoryBar{
    display:flex !important;
    flex-wrap:wrap !important;
    gap:10px !important;
    justify-content:center !important;
    align-items:center !important;
    max-height:none !important;
    overflow:visible !important;
    padding:10px 4px 12px !important;
  }
}

@media(min-width:769px){
  #categoryBar{
    display:flex !important;
    flex-wrap:wrap !important;
  }
}
/* =====================================================
   CBS CATEGORY BUTTON — FINAL HARD LOCK
   ===================================================== */

#categoryWrapper{
  position:relative !important;
  z-index:100000 !important;
  overflow:visible !important;
  pointer-events:auto !important;
  text-align:center !important;
}

#catToggle{
  position:relative !important;
  z-index:100001 !important;
  pointer-events:auto !important;
  touch-action:manipulation !important;
  cursor:pointer !important;

  display:inline-flex !important;
  align-items:center !important;
  justify-content:center !important;

  width:auto !important;
  min-width:178px !important;
  max-width:none !important;
  margin:0 auto 10px !important;

  padding:12px 20px !important;
  border:0 !important;
  border-radius:999px !important;

  background:linear-gradient(135deg,#0078d7,#00b050) !important;
  color:#fff !important;
  font-weight:950 !important;
  font-size:15px !important;
  line-height:1.1 !important;

  box-shadow:0 14px 30px rgba(0,120,215,.24) !important;
}

#catToggle::before,
#catToggle::after{
  pointer-events:none !important;
}

#categoryBar{
  position:relative !important;
  z-index:100000 !important;
  pointer-events:auto !important;
}

@media(max-width:768px){
  #categoryWrapper:not(.open) #categoryBar{
    display:none !important;
  }

  #categoryWrapper.open #categoryBar{
    display:flex !important;
    flex-wrap:wrap !important;
    justify-content:center !important;
    align-items:center !important;
    gap:10px !important;
    max-height:none !important;
    overflow:visible !important;
    padding:10px 4px 14px !important;
  }
}

@media(min-width:769px){
  #categoryBar{
    display:flex !important;
    flex-wrap:wrap !important;
    justify-content:center !important;
    gap:10px !important;
  }

  #catToggle{
    display:none !important;
  }
}

.cbs-search-suggestions:empty{
  display:none !important;
  pointer-events:none !important;
}
/* =====================================================
   CBS CATEGORIES — FINAL NATIVE DROPDOWN FIX
===================================================== */

#categoryWrapper{
  position:relative !important;
  z-index:100000 !important;
  overflow:visible !important;
  text-align:center !important;
  margin-bottom:6px !important;
}

#catToggle{
  list-style:none !important;
  display:inline-flex !important;
  align-items:center !important;
  justify-content:center !important;
  min-width:178px !important;
  padding:12px 20px !important;
  margin:0 auto 10px !important;
  border-radius:999px !important;
  border:0 !important;
  background:linear-gradient(135deg,#0078d7,#00b050) !important;
  color:#fff !important;
  font-weight:950 !important;
  font-size:15px !important;
  cursor:pointer !important;
  box-shadow:0 14px 30px rgba(0,120,215,.24) !important;
}

#catToggle::-webkit-details-marker{
  display:none !important;
}

#categoryWrapper:not([open]) #categoryBar{
  display:none !important;
}

#categoryWrapper[open] #categoryBar{
  display:flex !important;
  flex-wrap:wrap !important;
  justify-content:center !important;
  align-items:center !important;
  gap:10px !important;
  max-height:none !important;
  overflow:visible !important;
  padding:10px 4px 14px !important;
}

#categoryBar .catbtn{
  width:auto !important;
  max-width:100% !important;
  min-height:40px !important;
  padding:9px 14px !important;
  border-radius:999px !important;
  white-space:normal !important;
  line-height:1.12 !important;
  text-align:center !important;
}

.cbs-grid-wrap{
  margin-top:0 !important;
  padding-top:0 !important;
}
/* =====================================================
   CBS MOBILE CARD COMPACT BUTTONS
   Goal: show more products on mobile without breaking JS
===================================================== */
@media (max-width: 640px){

  .cbs-card{
    padding:8px !important;
    gap:6px !important;
  }

  .cbs-card .cbs-thumb{
    height:118px !important;
    border-radius:14px !important;
  }

  .cbs-title{
    font-size:.82rem !important;
    line-height:1.12 !important;
    min-height:36px !important;
  }

  .cbs-meta{
    font-size:.70rem !important;
    line-height:1.15 !important;
  }

  .btn,
  .link-btn,
  .card-expand-btn{
    min-height:34px !important;
    padding:7px 8px !important;
    border-radius:10px !important;
    font-size:.78rem !important;
    line-height:1.05 !important;
    box-shadow:0 6px 12px rgba(2,6,23,.08) !important;
  }

  .secondary-actions{
    gap:6px !important;
  }

  .cbs-card button{
    margin-top:0 !important;
  }
}