/* ====================================
   PAC.CO Inventory Builder — Cleaned & Scoped
   Scoped under #page-inventory-builder
   Flat PAC.CO style: no shadows, no motion, no !important abuse
   ==================================== */

/* Outer frame margin on center preview wrapper */
#page-inventory-builder .builder-frame-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 16px 24px;
  box-sizing: border-box;
  overflow: hidden;
}

/* Floating Preview Frame */
#page-inventory-builder #inventoryCanvasBody {
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
  height: 100%;
  border: 2px solid #111;
  background: #fff;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  box-sizing: border-box;
  padding: 24px;
}

/* Product grid spacing */
#page-inventory-builder .ds-prod-grid {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 12px;
  gap: 12px;
  box-sizing: border-box;
}

/* ================================================
   INVENTORY PRODUCT CARD (Standalone Tile System)
   ================================================ */

#page-inventory-builder .ds-prod-grid-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  padding: 12px;
  width: 100%;
  box-sizing: border-box;
}

/* Card container — flex column, outer border, clickable */
#page-inventory-builder .inventory-product-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #fff;
  border: 2px solid #111;
  cursor: pointer;
  position: relative;
}

/* Selected state — inset gray shadow instead of yellow outline */
#page-inventory-builder .inventory-product-card.is-selected {
  box-shadow: inset 0 0 0 2px #111;
}

/* Drag state */
#page-inventory-builder .inventory-product-card.is-dragging {
  opacity: 0.45;
}

/* Image area — 1:1 ratio with 2px bottom border */
#page-inventory-builder .inventory-product-image {
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-bottom: 2px solid #111;
  background: #efefef;
  position: relative;
}

#page-inventory-builder .inventory-product-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* Status pill on image */
#page-inventory-builder .inventory-img-status {
  position: absolute;
  top: 6px;
  left: 6px;
  padding: 2px 6px;
  font-size: 8px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .04em;
  background: #fff;
  border: 2px solid #111;
  color: #111;
  line-height: 1.2;
  border-radius: 0;
}

/* Card body — flex column, fills remaining space */
#page-inventory-builder .inventory-product-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 14px;
  gap: 8px;
  min-height: 0;
}

/* Brand, title, description */
#page-inventory-builder .inventory-product-top {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

#page-inventory-builder .inventory-product-brand {
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
  color: #888;
  letter-spacing: .08em;
}

#page-inventory-builder .inventory-product-title {
  font-size: 16px;
  font-weight: 900;
  line-height: 1.15;
  color: #111;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

#page-inventory-builder .inventory-product-desc {
  font-size: 13px;
  color: #666;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Color swatches */
#page-inventory-builder .inventory-swatch-row {
  display: flex;
  gap: 6px;
  align-items: center;
  min-height: 20px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

#page-inventory-builder .inventory-swatch-row .swatch {
  width: 18px;
  height: 18px;
  border: 2px solid #111;
  display: inline-block;
  flex-shrink: 0;
}

/* Price area — pushes to bottom via margin-top */
#page-inventory-builder .inventory-price-area {
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  width: 100%;
  min-height: 24px;
  flex-wrap: nowrap;
}

#page-inventory-builder .price-group {
  display: flex;
  flex-direction: row;
  align-items: flex-end;
  gap: 6px;
  flex-wrap: nowrap;
}

#page-inventory-builder .discount-placeholder {
  width: 36px;
  height: 14px;
  visibility: hidden;
  flex-shrink: 0;
}

#page-inventory-builder .inventory-price-sale {
  font-size: 22px;
  font-weight: 900;
  line-height: 1;
  color: #111;
}

#page-inventory-builder .inventory-price-normal {
  font-size: 22px;
  font-weight: 900;
  line-height: 1;
  color: #111;
}

/* Discount badge — compact red pill */
#page-inventory-builder .inventory-discount-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  height: 14px;
  background: #ff1d1d;
  color: white;
  font-size: 9px;
  font-weight: 900;
  line-height: 14px;
  border-radius: 2px;
  flex-shrink: 0;
}

/* Stock pill — black bg, white text */
#page-inventory-builder .inventory-stock-pill {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
  height: 14px;
  background: #111;
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  flex-shrink: 0;
  white-space: nowrap;
  align-self: flex-end;
}

/* Admin actions grid — 2 equal columns */
#page-inventory-builder .inventory-product-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-top: 2px solid #111;
  flex-shrink: 0;
}

#page-inventory-builder .inventory-product-actions button {
  height: 34px;
  border: none;
  background: #fff;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
  cursor: pointer;
  letter-spacing: .03em;
  padding: 0;
}

#page-inventory-builder .inventory-product-actions button:first-child {
  border-right: 2px solid #111;
}

#page-inventory-builder .inventory-product-actions button.edit-btn:hover {
  background: #ffd400;
  color: #111;
}

#page-inventory-builder .inventory-product-actions button.delete-btn:hover {
  background: #dc2626;
  color: #fff;
}

/* === List View Grid === */
#page-inventory-builder .ds-prod-grid.ds-prod-grid-list {
  grid-auto-rows: minmax(90px, auto);
  align-items: stretch;
}

#page-inventory-builder .ds-prod-grid.ds-prod-grid-list .ds-prod-card.inventory-list-card {
  justify-content: flex-start;
  align-items: stretch;
  margin-bottom: 6px;
}

/* List card image column */
#page-inventory-builder .list-img-col {
  width: 56px;
  height: 56px;
  border: 2px solid #111;
  background: #f7f7f8;
  overflow: hidden;
  flex-shrink: 0;
}

#page-inventory-builder .list-img-col img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* List card info column */
#page-inventory-builder .list-info-col {
  min-width: 150px;
  text-align: left;
  flex: 1;
}

#page-inventory-builder .list-info-col .list-product-title {
  font-weight: 900;
  font-size: 0.8rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 2px;
}

#page-inventory-builder .list-info-col .list-product-sku {
  font-size: 0.65rem;
  color: #666;
  font-weight: 600;
}

/* List card status badge inline */
#page-inventory-builder .list-info-col .list-product-badge {
  display: inline-block;
  align-self: flex-start;
  font-size: 7px;
  font-weight: 900;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 2px 6px;
  margin-top: 4px;
}

/* List card price column */
#page-inventory-builder .list-price-col {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  flex-shrink: 0;
  min-width: 80px;
  padding: 0 12px;
  box-sizing: border-box;
}

#page-inventory-builder .list-price-val {
  font-weight: 800;
  font-size: 0.75rem;
  text-align: right;
  white-space: nowrap;
}

/* List card actions column */
#page-inventory-builder .list-actions-col {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  flex-shrink: 0;
  width: 120px;
  justify-content: flex-end;
  padding: 0 6px;
  box-sizing: border-box;
}

#page-inventory-builder .list-actions-col button.ds-btn-edit,
#page-inventory-builder .list-actions-col button.ds-btn-delete {
  height: 28px;
  min-width: 54px;
  padding: 0 10px;
  font-size: 0.58rem;
  font-weight: 900;
  text-transform: uppercase;
  border: 2px solid #111 !important;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  background: #fff;
  color: #111;
}

#page-inventory-builder .list-actions-col button.ds-btn-edit:hover {
  background: #ffd400 !important;
  color: #111 !important;
}

#page-inventory-builder .list-actions-col button.ds-btn-delete:hover {
  background: #dc2626 !important;
  color: #fff !important;
}

/* Clean Toolbar — no motion */
.builder-frame-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  border: 2px solid #111;
  background: #fff;
  gap: 12px;
  flex-wrap: nowrap;
  min-height: 48px;
  height: auto;
  box-sizing: border-box;
  flex-shrink: 0;
  margin-bottom: 16px;
}

.builder-frame-toolbar .ds-toolbar-section {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Inventory toolbar: single-row layout with smooth push-out transitions.
   [Search (collapsible icon)] [Category]  [Tabs]  ...  [View] [New Product]
   Layout strategy:
     - Center-section (tabs) is STABLE: flex 0 0 auto, min-width fits all 5 tabs.
       Tabs never wrap, never shrink. The toolbar will clip them only at very
       narrow widths after all other elements have been pushed out.
     - Right-section is STABLE: flex 0 0 auto. View toggle and New Product
       stay pinned to the right edge.
     - Left-section is FLEXIBLE: flex 1 1 auto, min-width 0. It shrinks first
       as the window narrows. Search and category push out via smooth
       max-width + opacity transitions triggered at media query breakpoints.
     - Toolbar itself never wraps (flex-wrap: nowrap, overflow: hidden).
   Uses !important to win against homepage-builder.css's global .builder-frame-toolbar rule. */
#page-inventory-builder .builder-frame-toolbar {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: flex-start !important;
  height: auto !important;
  min-height: 48px;
  padding: 10px 16px !important;
  border: 2px solid #111 !important;
  background: #fff !important;
  box-sizing: border-box !important;
  flex-shrink: 0;
  flex-wrap: nowrap;
  gap: 10px;
  margin-bottom: 16px;
  overflow: hidden;
  transition: height 250ms ease-out, padding 250ms ease-out;
}

#page-inventory-builder .builder-frame-toolbar .ds-toolbar-section {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
  min-width: 0;
}

#page-inventory-builder .builder-frame-toolbar .left-section {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
}

#page-inventory-builder .builder-frame-toolbar .center-section {
  flex: 0 0 auto;
  justify-content: flex-start;
  min-width: 360px; /* Fits ALL + NEW + COMING SOON + RESTOCKED + PAUSED */
  overflow: hidden;
}

#page-inventory-builder .builder-frame-toolbar .right-section {
  flex: 0 0 auto;
  justify-content: flex-end;
  margin-left: auto; /* Push right section to the right edge */
}

.builder-frame-toolbar select {
  height: 28px;
  padding: 0 8px;
  border: 2px solid #111;
  font-size: 0.7rem;
  font-weight: 800;
  background: #fff;
  cursor: pointer;
  outline: none;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: max-width 300ms ease-out, opacity 300ms ease-out, margin 300ms ease-out, padding 300ms ease-out, border-color 300ms ease-out;
}

/* Search wrapper: collapsible icon button.
   Collapsed = 28px (just the icon, perfectly centered inside the border).
   Expanded = 240px (icon + input), triggered by :focus-within or .has-value. */
.builder-frame-toolbar .ds-search-wrapper {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #111;
  padding: 0;
  height: 28px;
  width: 28px;
  max-width: 240px;
  background: #fff;
  cursor: pointer;
  flex: 0 0 auto;
  box-sizing: border-box;
  overflow: hidden;
  border-radius: 0;
  transition: width 220ms ease-out, padding 220ms ease-out, background-color 150ms ease-out;
  position: relative;
}

.builder-frame-toolbar .ds-search-wrapper:hover {
  background: #ffe600;
}

.builder-frame-toolbar .ds-search-wrapper:focus-within,
.builder-frame-toolbar .ds-search-wrapper.has-value {
  width: 240px;
  padding: 0 8px;
  justify-content: flex-start;
  gap: 6px;
  cursor: text;
  background: #fff;
}

.builder-frame-toolbar .ds-search-wrapper .ds-search-icon {
  flex-shrink: 0;
  color: #111;
  display: block;
  width: 12px;
  height: 12px;
  position: relative !important;
  left: auto !important;
  top: auto !important;
  transform: none !important;
  opacity: 1 !important;
  margin: 0 !important;
  z-index: 1;
}

.builder-frame-toolbar .ds-search-wrapper input {
  border: none;
  padding: 0;
  margin: 0;
  font-size: 0.75rem;
  font-weight: 700;
  outline: none;
  flex: 1;
  min-width: 0;
  width: 100%;
  background: transparent;
  display: none;
  box-sizing: border-box;
}

.builder-frame-toolbar .ds-search-wrapper:focus-within input,
.builder-frame-toolbar .ds-search-wrapper.has-value input {
  display: block;
}

/* Type filter tabs */
.builder-frame-toolbar .ds-prod-filter-tabs {
  display: flex;
  gap: 4px;
}

.builder-frame-toolbar .ds-prod-filter-btn {
  height: 28px;
  padding: 0 10px;
  font-size: 0.65rem;
  font-weight: 800;
  border: 2px solid #111;
  background: #fff;
  cursor: pointer;
}

.builder-frame-toolbar .ds-prod-filter-btn:first-child {
  border-left: 2px solid #111;
}

.builder-frame-toolbar .ds-prod-filter-btn.active {
  background: #ffe600;
}

/* View mode switcher */
.builder-frame-toolbar .ds-view-mode-group {
  display: flex;
  border: 2px solid #111;
  gap: 0;
  box-sizing: border-box;
  height: 28px;
}

.builder-frame-toolbar .ds-view-mode-btn {
  height: 100%;
  width: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-right: 2px solid #111;
  background: #fff;
  cursor: pointer;
  box-sizing: border-box;
}

.builder-frame-toolbar .ds-view-mode-btn:last-child {
  border-right: none;
}

.builder-frame-toolbar .ds-view-mode-btn.active {
  background: #ffe600;
}

.builder-frame-toolbar .ds-new-product-btn {
  height: 28px;
  padding: 0 12px;
  font-size: 0.7rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 2px solid #111;
  background: #111;
  color: #fff;
  cursor: pointer;
}

/* Default: hide the + icon, show the text. The phone media query below
   overrides this to show + and hide text. This rule MUST come before the
   phone media query so the override works. */
.builder-frame-toolbar .ds-new-product-btn .ds-new-product-plus {
  display: none;
}

.builder-frame-toolbar .ds-new-product-btn:hover {
  background: #ffe600;
  color: #111;
}

/* Selected state for lists */
#page-inventory-builder .ds-section-card.active {
  background: #ffe600;
  border-color: #111;
}

/* Sidebar Header */
#page-inventory-builder .ds-sidebar-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 2px solid #111;
  background: #faf9f6;
  flex-shrink: 0;
  min-height: 48px;
  box-sizing: border-box;
}

/* Inventory / Style mode tabs - match homepage builder */
#page-inventory-builder .builder-tab-nav {
  flex-shrink: 0;
}
#page-inventory-builder .builder-tab.active {
  color: #111 !important;
  background: #ffe600 !important;
}

#page-inventory-builder .ds-sidebar-section-head span {
  font-size: 0.75rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #111;
}

/* Add section button */
#page-inventory-builder .ds-add-section-btn {
  width: 30px;
  height: 30px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 2px solid #111;
  background: #fff;
  cursor: pointer;
  border-radius: 0;
  box-sizing: border-box;
}

#page-inventory-builder .ds-add-section-btn:hover {
  background: #ffe600;
}

/* Sidebar Scroll */
#page-inventory-builder .ds-sidebar-scroll {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow-y: auto;
  flex: 1;
}

/* Right settings panel body */
#page-inventory-builder .ds-right-controls-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
  flex: 1;
}

/* Three-panel editor layout */
#page-inventory-builder.active .ds-editor-container {
  flex: 1;
  min-height: 0;
  height: 100%;
  width: 100%;
  display: flex;
  flex-direction: row;
  gap: 16px;
  padding: 16px;
  border: none;
  overflow: hidden;
  position: relative;
  box-sizing: border-box;
}

/* Left panel */
#page-inventory-builder #inventorySidebar {
  width: clamp(200px, 18vw, 260px);
  min-width: 200px;
  max-width: 260px;
  flex-shrink: 0;
  border: 2px solid #111;
  display: flex;
  flex-direction: column;
  height: 100%;
  box-sizing: border-box;
}

/* Center canvas */
#page-inventory-builder #inventoryCanvas {
  flex: 1;
  min-width: 0;
  width: auto;
  display: flex;
  flex-direction: column;
  height: 100%;
  background: transparent;
  gap: 0;
}

/* Right settings panel */
#page-inventory-builder #inventorySettingsPanel {
  width: clamp(260px, 22vw, 320px);
  min-width: 260px;
  max-width: 320px;
  flex-shrink: 0;
  border: 2px solid #111;
  display: flex;
  flex-direction: column;
  height: 100%;
  box-sizing: border-box;
}

/* Settings toggle button (shown on tablet/phone) */
#page-inventory-builder #inventorySettingsToggle {
  display: none;
  width: 28px;
  height: 28px;
  padding: 0;
  align-items: center;
  justify-content: center;
  border: 2px solid #111;
  background: #fff;
  cursor: pointer;
}
#page-inventory-builder #inventorySettingsToggle:hover {
  background: #ffe600;
}
#page-inventory-builder #inventorySettingsToggle svg {
  width: 14px;
  height: 14px;
}

/* Tablet: right panel becomes drawer */
@media (max-width: 1100px) {
  #page-inventory-builder #inventorySettingsPanel {
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    z-index: 100;
    transform: translateX(100%);
    width: 300px;
    min-width: 300px;
    max-width: 300px;
  }
  #page-inventory-builder.settings-open #inventorySettingsPanel {
    transform: translateX(0);
  }
  #page-inventory-builder .ds-settings-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 90;
    background: rgba(0,0,0,0.3);
  }
  #page-inventory-builder.settings-open .ds-settings-overlay {
    display: block;
  }
  #page-inventory-builder #inventorySettingsToggle {
    display: inline-flex;
  }
}

/* ───────── Responsive Breakpoints ───────── */



/* Medium/narrow desktop (1100–1400px): tighter spacine */
@media (max-width: 1400px) {
  #page-inventory-builder.active .ds-editor-container {
    gap: 16px;
    padding: 16px;
  }
  #page-inventory-builder .builder-frame-toolbar {
    gap: 10px;
    padding: 10px 14px;
  }
  #page-inventory-builder .builder-frame-body {
    padding: 12px 16px;
  }
}

/* Legacy responsive overrides commented out to prevent conflict with unified studio layout system */

/* ===== Image Editor (Edit Product modal — global) ===== */
.ds-image-preview-v2 {
  width: 100%;
  aspect-ratio: 1 / 1;
  min-height: 220px;
  position: relative;
  overflow: hidden;
  display: block;
  flex: none;
  background: #f7f7f8;
  border: 2px solid #111;
  cursor: crosshair;
}

.ds-image-preview-v2 img {
  width: 100%;
  height: 100%;
  position: absolute;
  inset: 0;
  transform-origin: center;
}

.ds-ratio-picker {
  display: flex;
  gap: 4px;
}

.ds-ratio-btn {
  flex: 1;
  padding: 8px 4px;
  background: #fff;
  border: 2px solid #111;
  font-size: 0.7rem;
  font-weight: 800;
  color: #111;
  cursor: pointer;
  text-align: center;
}

.ds-ratio-btn.active {
  background: #ffe600;
  border-color: #111;
  color: #111;
}

.ds-ratio-btn:hover:not(.active) {
  background: #f5f0e8;
}

.ds-zoom-controls {
  position: absolute;
  top: 10px;
  left: 10px;
  display: flex;
  z-index: 10;
}

.ds-reset-btn {
  width: 40px;
  height: 40px;
  background: #fff;
  border: 2px solid #111;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 18px;
  font-weight: 900;
  color: #111;
}

.ds-reset-btn:hover {
  background: #ffe600;
}

.ds-thumb-item {
  width: 64px;
  height: 64px;
  flex: none;
  border: 2px solid #111;
  overflow: hidden;
  position: relative;
  cursor: pointer;
}

.ds-thumb-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.ds-thumb-item.active {
  border-width: 3px;
  border-color: #111;
  background: #f8f8f3;
}

.ds-thumb-remove-btn {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  background: #fff;
  border: 2px solid #111;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 900;
  color: #111;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.ds-thumb-remove-btn:hover {
  background: #dc2626;
  color: #fff;
}

.ds-thumb-main-badge {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: #111;
  color: #fff;
  font-size: 7px;
  font-weight: 900;
  text-align: center;
  text-transform: uppercase;
  padding: 2px;
  letter-spacing: 0.03em;
  line-height: 1.2;
}

.ds-thumb-add-btn {
  width: 64px;
  height: 64px;
  flex: none;
  border: 2px dashed #111;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #111;
  background: #fff;
}

.ds-thumb-add-btn:hover {
  background: #ffe600;
}

/* Style category buttons */
.ds-style-cat-btn {
  display: block;
  width: 100%;
  padding: 10px 12px;
  font-size: 0.7rem;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border: 2.5px solid #111;
  background: #fff;
  color: #111;
  cursor: pointer;
  text-align: left;
  box-sizing: border-box;
  transition: none;
}
.ds-style-cat-btn.active {
  background: #111;
  color: #fff;
}
.ds-style-cat-btn:hover:not(.active) {
  background: #f0f0f0;
}

/* ==========================================================================
   STUDIO INVENTORY BUILDER RESPONSIVE TOOLBAR OVERRIDES (NO HORIZONTAL SCROLL)
   ========================================================================== */
#page-inventory-builder .ds-prod-filter-btn,
#page-inventory-builder .ds-new-product-btn {
  white-space: nowrap !important;
  flex-shrink: 0 !important;
}

#page-inventory-builder .ds-prod-filter-tabs {
  display: flex;
  flex-wrap: nowrap; /* Tabs NEVER wrap. They stay on one row always. */
  gap: 4px; /* Match the base rule — keep tabs spaced, not stuck together */
  justify-content: flex-start;
  min-width: 0;
}

#page-inventory-builder .ds-prod-filter-btn {
  border-left: 2px solid #111 !important; /* Ensure all buttons have left borders */
  margin: 0;
}

/* Smooth push-out breakpoints.
   Layout invariant: toolbar never wraps, tabs never wrap, right-section (view + new product)
   never shrinks. Only the left-section (search + category) and the view toggle push out.
   Breakpoints are tuned so search/category disappear BEFORE the tiles icon would
   touch the paused tab text.
   - Default:  search 240px expanded, category visible
   - ≤1000px: search collapses to 28px (icon only) — first push
   - ≤850px:  category fades out — second push
   - ≤720px:  search (collapsed icon) fades out — third push
   - ≤520px:  view toggle (tiles/list) fades out, New Product becomes a + icon
   - ≤400px:  toolbar gets tighter padding; tabs may need horizontal scroll (handled below) */
@media (max-width: 1000px) {
  #page-inventory-builder .builder-frame-toolbar .ds-search-wrapper:not(:focus-within):not(.has-value) {
    width: 28px;
  }
}

@media (max-width: 850px) {
  #page-inventory-builder .builder-frame-toolbar #inventoryCategoryFilter {
    max-width: 0;
    opacity: 0;
    margin-left: 0;
    margin-right: 0;
    padding-left: 0;
    padding-right: 0;
    border-color: transparent;
    pointer-events: none;
  }
}

@media (max-width: 720px) {
  #page-inventory-builder .builder-frame-toolbar .ds-search-wrapper:not(:focus-within):not(.has-value) {
    width: 0;
    border-color: transparent;
    padding: 0;
    opacity: 0;
    pointer-events: none;
  }
}

/* Phone (≤520px): push out view toggle (tiles/list), shrink New Product to a + icon.
   Toolbar gets asymmetric padding (12px left, 14px right) so the + button
   has breathing room from the frame edge. */
@media (max-width: 520px) {
  #page-inventory-builder .builder-frame-toolbar {
    padding: 10px 14px 10px 12px !important;
    gap: 8px;
  }
  #page-inventory-builder .builder-frame-toolbar .ds-view-mode-group {
    max-width: 0;
    opacity: 0;
    margin: 0;
    padding: 0;
    border-color: transparent;
    pointer-events: none;
    overflow: hidden;
    transition: max-width 300ms ease-out, opacity 300ms ease-out, margin 300ms ease-out;
  }
  #page-inventory-builder .builder-frame-toolbar .ds-new-product-btn {
    width: 34px;
    height: 28px;
    padding: 0;
    min-width: 0;
    font-size: 0;
    line-height: 0;
    position: relative;
    transition: width 300ms ease-out, padding 300ms ease-out;
    justify-content: center;
  }
  #page-inventory-builder .builder-frame-toolbar .ds-new-product-btn .ds-new-product-plus {
    display: block;
    width: 14px;
    height: 14px;
    color: #fff;
    flex-shrink: 0;
  }
  #page-inventory-builder .builder-frame-toolbar .ds-new-product-btn:hover .ds-new-product-plus {
    color: #111;
  }
  #page-inventory-builder .builder-frame-toolbar .ds-new-product-btn .ds-new-product-text {
    display: none;
  }
}

/* Very small phone (≤400px): tighter padding; allow toolbar horizontal scroll
   so the right-section (new product icon) stays reachable and tabs can scroll. */
/* Small phone (≤600px): hide filter tabs row, hide topbar, show hamburger in toolbar */
@media (max-width: 600px) {
  /* Hide the inventory builder's own mobile editor header (Groups/Settings/Preview) */
  .ds-mobile-editor-header {
    display: none !important;
  }
  /* Hide the filter tab row */
  #page-inventory-builder .builder-frame-toolbar .center-section {
    display: none !important;
  }
  /* Show the inventory toolbar's left-toggle button (now wired to main studio sidebar) */
  #page-inventory-builder .builder-frame-toolbar .ds-sidebar-toggle-btn.ds-left-toggle {
    display: inline-flex !important;
  }
  /* Show the tiles/list view mode group on phone */
  #page-inventory-builder .builder-frame-toolbar .ds-view-mode-group {
    max-width: none !important;
    opacity: 1 !important;
    margin: 0 !important;
    padding: 0 !important;
    border-color: #111 !important;
    pointer-events: auto !important;
    overflow: visible !important;
  }
  /* Show the bottom tabs (GROUPS / DETAILS / SETTINGS) on phone */
  .ds-tablet-bottom-tabs {
    display: flex !important;
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    height: 50px !important;
    background: #fff !important;
    z-index: 1003 !important;
    justify-content: space-around !important;
    align-items: center !important;
    border-top: 2px solid #111 !important;
  }
  .ds-tablet-bottom-tabs button {
    flex: 1 !important;
    height: 100% !important;
    border: none !important;
    border-right: 2px solid #111 !important;
    background: #fff !important;
    font-weight: 900 !important;
    font-size: 10px !important;
    text-transform: uppercase !important;
    cursor: pointer !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 2px !important;
    padding: 0 !important;
  }
  .ds-tablet-bottom-tabs button:last-child {
    border-right: none !important;
  }
  .ds-tablet-bottom-tabs button:hover,
  .ds-tablet-bottom-tabs button.active {
    background: #ffe600 !important;
  }
  /* Hide the entire main studio topbar on phone — no 2-row top bar */
  body.inventory-builder-active .ds-topbar {
    display: none !important;
  }
  body.inventory-builder-active .ds-sidebar {
    display: flex !important;
  }
  body.inventory-builder-active .ds-main {
    margin-left: 0 !important;
    padding-top: 0 !important;
    height: 100vh !important;
  }
  /* Make main studio sidebar slide in from left when toggled */
  .ds-sidebar {
    width: 240px !important;
    transform: translateX(-100%) !important;
    transition: transform 0.3s ease !important;
    z-index: 9998 !important;
  }
  .ds-sidebar.open {
    transform: translateX(0) !important;
  }
}

@media (max-width: 400px) {
  #page-inventory-builder .builder-frame-toolbar {
    padding: 8px 10px !important;
    gap: 6px;
    overflow-x: auto !important; /* Allow horizontal scroll instead of clipping */
    scrollbar-width: none;
  }
  #page-inventory-builder .builder-frame-toolbar::-webkit-scrollbar {
    display: none;
  }
  #page-inventory-builder .builder-frame-toolbar .center-section {
    overflow-x: auto;
    scrollbar-width: none;
    min-width: 300px; /* Reduced from 360px so toolbar fits at 400px */
  }
  #page-inventory-builder .builder-frame-toolbar .center-section::-webkit-scrollbar {
    display: none;
  }
  #page-inventory-builder .builder-frame-toolbar .right-section {
    margin-left: 0; /* Pack right-section right after center for predictable overflow */
  }
}
