/* --- OUTER CONTAINER ISOLATION --- */
.woodshop-container-outer {
  width: 100% !important;
  clear: both !important;
  margin-bottom: 15px !important;
  display: block !important;
}

/* --- WOODSHOP RIBBON CONTAINER --- */
.woodshop-ribbon-wrapper {
  background: #fff;
  border: 1px solid #ccd0d4;
  padding: 15px;
  margin-bottom: 12px;
  border-radius: 6px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.woodshop-super-cats-ribbon {
  display: flex;
  gap: var(--ws-spacing);
  flex-wrap: wrap;
  margin-bottom: 12px;
  align-items: center;
}

.ws-super-cat-item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 18px;
  background: #f1f1f1;
  color: #333;
  text-decoration: none;
  border-radius: 6px;
  font-size: var(--ws-font-size);
  font-weight: 600;
  border: 2px solid #ddd;
  transition: all 0.2s ease;
}

.ws-super-cat-item.active,
.ws-super-cat-item:hover {
  background: #fff;
  border-color: var(--ws-active-color);
  color: var(--ws-active-color);
}

.ws-home-btn {
  padding: 10px 14px;
}

/* --- SUBCATEGORY RIBBON & ROW TRACKS --- */
.woodshop-sub-group {
  display: none;
  align-items: center;
  gap: 10px;
  background: var(--ws-inactive-color);
  padding: 10px 12px;
  border-radius: 6px;
  margin-bottom: 8px;
  position: relative;
}

.woodshop-sub-group.ws-active-group {
  display: flex;
}

.ws-sub-row-track {
  display: flex;
  flex-wrap: wrap;
  gap: var(--ws-spacing);
  align-items: center;
  flex: 1;
  width: 100%;
}

.ws-sub-cat-pill {
  display: inline-block;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  text-decoration: none;
  border-radius: 4px;
  font-size: calc(var(--ws-font-size) - 1px);
  font-weight: 500;
  transition: background 0.2s;
  flex: 1 1 calc((100% - (var(--ws-spacing) * (var(--ws-desktop-cols, 5) - 1))) / var(--ws-desktop-cols, 5));
  max-width: calc((100% - (var(--ws-spacing) * (var(--ws-desktop-cols, 5) - 1))) / var(--ws-desktop-cols, 5));
  text-align: center;
  box-sizing: border-box;
}

.ws-sub-cat-pill:hover,
.ws-sub-cat-pill.active {
  background: #fff;
  color: #333;
}

/* --- DESKTOP ROW SWITCHER BUTTON ("MORE") --- */
.ws-row-switcher-btn {
  background: rgba(0, 0, 0, 0.25);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.4);
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 11px;
  text-transform: uppercase;
  flex-shrink: 0;
  line-height: 1.2;
  transition: background 0.2s ease;
  user-select: none;
}

.ws-row-switcher-btn:hover {
  background: rgba(0, 0, 0, 0.45);
}

.ws-row-switcher-btn .dashicons {
  font-size: 14px;
  width: 14px;
  height: 14px;
  cursor: pointer;
}

/* --- CTA BUTTON HOLDER & STYLING --- */
.ws-cta-button-holder {
  display: flex !important;
  justify-content: flex-start !important;
  align-items: center !important;
  margin: 10px 0 5px 0 !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

.ws-custom-cta-btn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 10px 20px !important;
  border-radius: 6px !important;
  text-decoration: none !important;
  font-weight: 600 !important;
  line-height: 1.3 !important;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.12) !important;
  border: none !important;
  cursor: pointer !important;
  box-sizing: border-box !important;
  transition: all 0.2s ease-in-out !important;
  max-width: 100% !important;
  text-align: center !important;
  white-space: nowrap !important;
}

.ws-custom-cta-btn:hover {
  opacity: 0.92 !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.18) !important;
  text-decoration: none !important;
}

/* RTL Alignment */
body.rtl .ws-cta-button-holder,
html[dir="rtl"] .ws-cta-button-holder {
  justify-content: flex-start !important;
}

/* --- WOODMART SHOP TOOLBAR INTEGRATION & MOBILE FIXES --- */
.shop-loop-head,
.wd-shop-tools,
.woodmart-shop-tools {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  flex-wrap: wrap !important;
  gap: 10px !important;
  margin-top: 15px !important;
  margin-bottom: 20px !important;
  width: 100% !important;
  clear: both !important;
}

.woodmart-filter-buttons,
.wd-filter-buttons,
.open-filters-btn,
.wd-show-sidebar-btn,
.woodmart-show-sidebar-btn {
  pointer-events: auto !important;
  cursor: pointer !important;
  z-index: 5 !important;
}

@media (max-width: 768px) {
  /* Prevent WoodMart Toolbar items from wrapping into weird tight rows */
  .shop-loop-head,
  .wd-shop-tools,
  .woodmart-shop-tools {
    gap: 8px !important;
  }

  .woodmart-filter-buttons,
  .wd-filter-buttons,
  .open-filters-btn,
  .wd-show-sidebar-btn,
  .woodmart-show-sidebar-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    height: 42px !important;
    padding: 0 14px !important;
    border-radius: 5px !important;
    background: #f8f8f8 !important;
    border: 1px solid #e0e0e0 !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    flex-shrink: 0 !important;
  }

  .woocommerce-ordering {
    margin: 0 !important;
    flex: 1 1 auto !important;
  }

  .woocommerce-ordering select {
    height: 42px !important;
    border-radius: 5px !important;
    padding: 0 10px !important;
    font-size: 13px !important;
    width: 100% !important;
  }

  .ws-cta-button-holder {
    margin: 8px 0 !important;
  }

  .ws-custom-cta-btn[data-mobile-full="1"] {
    width: 100% !important;
    display: flex !important;
  }

  .woodshop-sub-group.ws-active-group[data-mobile-vertical="0"] {
    display: block !important;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
    padding: 10px;
  }
  
  .woodshop-sub-group[data-mobile-vertical="0"]::-webkit-scrollbar {
    height: 4px;
  }
  
  .woodshop-sub-group[data-mobile-vertical="0"]::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.4);
    border-radius: 2px;
  }
  
  .woodshop-sub-group[data-mobile-vertical="0"] .ws-sub-ribbon-track,
  .woodshop-sub-group[data-mobile-vertical="0"] .ws-sub-row-track {
    display: flex !important;
    flex-wrap: nowrap !important;
    gap: var(--ws-spacing);
    width: max-content;
  }
  
  .woodshop-sub-group[data-mobile-vertical="0"] .ws-sub-cat-pill {
    flex: 0 0 auto !important;
    max-width: none !important;
    width: auto !important;
    white-space: nowrap;
    padding: 8px 14px;
  }
  
  .woodshop-sub-group[data-mobile-vertical="0"] .ws-row-switcher-btn {
    display: none !important;
  }

  .woodshop-ribbon-wrapper {
    --ws-cols: var(--ws-mobile-cols);
  }
  
  .woodshop-sub-group[data-mobile-vertical="1"] .ws-sub-cat-pill {
    flex: 1 1 calc((100% - (var(--ws-spacing) * (var(--ws-cols, 3) - 1))) / var(--ws-cols, 3));
    max-width: calc((100% - (var(--ws-spacing) * (var(--ws-cols, 3) - 1))) / var(--ws-cols, 3));
  }
}