:root {
  --category-brand: #6e1597;
  --category-brand-dark: #531073;
  --category-brand-soft: #fff4f8;
  --category-ink: #2c2530;
  --category-muted: #77717a;
  --category-line: #ece8ee;
}

html, body.category-page { height: auto !important; min-height: 100vh !important; overflow: visible !important; }
body.category-page {
  margin: 0;
  padding-top: 0 !important;
  /* overflow-x: hidden; */
  background: #fff;
  color: var(--category-ink);
  font-family: Arial, Helvetica, sans-serif !important;
}

@media (min-width: 701px) {
  body.category-page .header {
    display: flex !important;
  }
}

body.category-page .header {
  position: sticky;
  top: 0;
  z-index: 140;
  min-height: 70px;
  height: 70px;
  padding: 0 max(16px, calc((100% - 1180px) / 2)) !important;
  background: #fff !important;
  border-bottom: 1px solid var(--category-line);
  box-shadow: none !important;
}

body.category-page .header_section {
  display: flex !important;
  width: 100%;
  padding: 0 !important;
}

body.category-page .logo_container img {
  max-height: 34px;
}

body.category-page .search_bar_contain {
  display: flex !important;
  flex: 1;
  max-width: 560px;
  margin: 0 auto;
}

body.category-page .search_bar {
  width: 100%;
  min-height: 40px;
  border: 1px solid #ded9e0;
  border-radius: 3px;
  background: #fff;
}

body.category-page .icon-top .icons {
  color: var(--category-ink);
}



body.category-page .marginTop {
  display: none;
}

body.category-page .category-header {
  position: static;
  z-index: 130;
  margin-top: 0;
  transform: none;
  margin-bottom: 0;
  padding: 14px max(16px, calc((100% - 1180px) / 2)) 12px;
  background: #fff;
  border-bottom: 1px solid var(--category-line);
}

body.category-page .subcate_container {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  scrollbar-width: none;
}

body.category-page .category-main-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
  overflow-x: auto;
  scrollbar-width: none;
}

body.category-page .category-main-tabs::-webkit-scrollbar {
  display: none;
}

body.category-page .category-main-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  min-height: 54px;
  padding: 4px 14px 4px 5px;
  border: 1px solid var(--category-line);
  border-radius: 13px;
  background: #fff;
  color: var(--category-ink);
  font: inherit;
  cursor: pointer;
}

body.category-page .category-main-tab img {
  width: 44px;
  height: 44px;
  border-radius: 9px;
  object-fit: cover;
}

body.category-page .category-main-tab span {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

body.category-page .category-main-tab.active {
  border: 2px solid var(--category-brand);
  color: var(--category-brand);
  background: var(--category-brand-soft);
}

body.category-page .category-main-tabs:not(:empty) + .subcate_container {
  display: none !important;
}

body.category-page .subcate_container::-webkit-scrollbar {
  display: none;
}

body.category-page .subcate_container > a {
  flex: 0 0 78px;
}

body.category-page .subcate_container .Category-Box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

body.category-page .subcate_container > a.active .Category-Box {
  color: var(--category-brand);
}

body.category-page .subcate_container > a:first-child .Category-Box {
  color: var(--category-brand);
}

body.category-page .subcate_container .Category-Box img {
  width: 62px;
  height: 62px;
  border: 1px solid #e7e7eb;
  border-radius: 50%;
  background: #f7f7f8;
  object-fit: cover;
}

body.category-page .subcate_container .Category-Box h6 {
  margin: 0;
  color: var(--category-ink);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.15;
  text-align: center;
  white-space: nowrap;
}

body.category-page .subcate_container > a.active .Category-Box img,
body.category-page .subcate_container > a:first-child .Category-Box img {
  border: 2px solid var(--category-brand);
}

body.category-page .subcate_container > a.active .Category-Box h6,
body.category-page .subcate_container > a:first-child .Category-Box h6 {
  color: var(--category-brand);
  font-weight: 700;
}

body.category-page .category-page-shell {
  width: min(100%, 1280px);
  margin: 0 auto;
}

body.category-page .category-sidebar-rail {
  flex-basis: 180px;
  top: 138px;
  min-height: calc(100vh - 138px);
  transform: translateY(-82px);
  margin-bottom: -82px;
}

body.category-page .category-rail-item {
  min-height: 148px;
  padding: 16px 12px 13px;
}

body.category-page .category-rail-item img {
  width: 116px;
  height: 82px;
  border-radius: 12px;
}

body.category-page .category-rail-item span {
  font-size: 15px;
}

body.category-page .category-rail-item.active {
  color: var(--category-brand);
}

body.category-page .main-container {
  padding: 24px 24px 120px;
}

body.category-page .products-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  gap: 28px 18px;
}

body.category-page .product {
  background: #fff;
}

body.category-page .product-img {
  aspect-ratio: 0.78;
  border: 1px solid #e8e4e9;
  border-radius: 16px;
  background: #faf7fb;
}

body.category-page .product_info > p {
  color: var(--category-ink);
  font-size: 14px;
}

body.category-page .product_info > h2 {
  color: var(--category-muted);
  font-size: 13px;
}

body.category-page .new-pricebpcs,
body.category-page .new-price {
  color: var(--category-ink);
}

body.category-page .discount-label {
  color: var(--category-brand);
}

body.category-page .add-to-cart {
  border-color: var(--category-brand);
  color: var(--category-brand);
}

body.category-page .category-floating-controls {
  bottom: 22px;
  border-color: #e5dce8;
}

@media (max-width: 700px) {
  body.category-page {
    padding-bottom: 64px;
  }

  body.category-page .header {
    display: none !important;
  }

  body.category-page .header_21 {
    position: sticky;
    top: 0;
    z-index: 140;
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    height: 64px !important;
    min-height: 64px;
    padding: 0 14px;
    background: #fff;
    border-bottom: 1px solid var(--category-line);
  }

  body.category-page .header_21 .logo {
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 0;
  }

  body.category-page .header_21 .logo img {
    width: 34px;
    height: 34px;
    object-fit: contain;
  }

  body.category-page .header_21 .logo strong {
    color: var(--category-ink);
    font-size: 22px;
    font-weight: 700;
  }

  body.category-page .category-header-icons {
    display: none !important;
  }

  body.category-page .category-header {
    top: 64px;
    height: auto !important;
    min-height: 0 !important;
    margin-left: 90px;
    padding: 6px 8px 8px;
  }

  body.category-page .category-main-tabs {
    gap: 8px;
    margin-bottom: 8px;
    padding-left: 4px;
  }

  body.category-page .category-main-tab {
    min-height: 43px;
    padding: 3px 9px 3px 4px;
    border-radius: 9px;
  }

  body.category-page .category-main-tab img {
    width: 34px;
    height: 34px;
    border-radius: 7px;
  }

  body.category-page .category-main-tab span {
    font-size: 9px;
  }

  body.category-page .category-results-toolbar {
    display: none !important;
  }

  body.category-page .Subcategory-list,
  body.category-page .subcate_container {
    height: auto !important;
    min-height: 0 !important;
  }

  body.category-page .subcate_container > a {
    flex-basis: 68px;
  }

  body.category-page .subcate_container .Category-Box {
    gap: 5px;
  }

  body.category-page .subcate_container .Category-Box img {
    width: 56px;
    height: 56px;
    border-radius: 50%;
  }

  body.category-page .subcate_container .Category-Box h6 {
    font-size: 9px;
  }

  body.category-page .category-sidebar-rail {
    flex-basis: 90px;
    top: 124px;
    min-height: calc(100vh - 124px);
    transform: translateY(-70px);
    margin-bottom: -70px;
  }

  body.category-page .category-rail-item {
    min-height: 100px;
    padding: 11px 5px 8px;
  }

  body.category-page .category-rail-item img {
    width: 58px;
    height: 42px;
    border-radius: 9px;
  }

  body.category-page .category-rail-item span {
    font-size: 11px;
    line-height: 1.15;
  }

  body.category-page .main-container {
    padding: 12px 8px 90px;
  }

  body.category-page .products-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 24px 8px;
  }

  body.category-page .product-img {
    border-radius: 16px;
  }

  body.category-page .product_info {
    padding: 8px 2px 0 !important;
  }

  body.category-page .product_info > p {
    font-size: 11px;
    line-height: 1.3;
  }

  body.category-page .product_info > h2 {
    margin: 3px 0 0;
    font-size: 10px;
  }

  body.category-page .new-pricebpcs,
  body.category-page .new-price {
    font-size: 12px;
  }

  body.category-page .old-pricepcs,
  body.category-page .old-price,
  body.category-page .discount-label {
    font-size: 10px;
  }

  body.category-page .wishlist-icon {
    top: 7px;
    right: 7px;
    width: 28px;
    height: 28px;
  }

  body.category-page .add-to-cart {
    right: 5px;
    bottom: 43px;
    width: 32px;
    height: 32px;
    border-radius: 9px;
  }

  body.category-page .category-floating-controls {
    bottom: 74px;
  }

  body.category-page .category-floating-controls button {
    min-width: 88px;
    height: 48px;
    font-size: 10px;
  }
}

@media (min-width: 701px) {
  body.category-page .category-header {
    margin-left: 180px;
    padding-top: 6px;
    padding-left: 12px;
  }
}

@media (min-width: 701px) and (max-width: 1050px) {
  body.category-page .products-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }
}


body.category-page .subcategory-chips-bar { top: 160px; z-index: 120; }

body.category-page .subcategory-chips-bar, body.category-page .subcate_container { background: #fff !important; z-index: 9999 !important; }
@media (min-width: 701px) { body.category-page .header_21 { display: none !important; } }


/* === CRITICAL MOBILE FIXES === */
@media (max-width: 768px) {
  body.category-page .category-header {
    margin-left: 90px !important;
    width: calc(100% - 90px) !important;
    max-width: calc(100% - 90px) !important;
    box-sizing: border-box !important;
  }

  /* 1. Prevent zooming out / horizontal scrolling */
  html, body {
    max-width: 100vw;
    overflow-x: hidden !important;
  }
  
  /* 2. Fix the width of the left sidebar so it perfectly matches the 90px hole */
  body.category-page .category-sidebar-rail {
    flex-basis: 90px !important;
    max-width: 90px !important;
    transform: translateY(-82px) !important;
    margin-bottom: -82px !important;
    z-index: 100 !important;
  }
  body.category-page .category-rail-item {
    min-height: 99px !important;
    padding: 11px 5px 8px !important;
  }
  body.category-page .category-rail-item img {
    width: 60px !important;
    height: 60px !important;
  }

  /* 3. Make the horizontal scrolling lists strictly stay inside their parent containers */
  .subcate_container, .category-main-tabs, .subcategory-chips-scroll, .h-filter-item { 
    display: flex !important; 
    overflow-x: auto !important; 
    flex-wrap: nowrap !important;
    scrollbar-width: none;
    max-width: 100% !important; 
  }
  .category-main-tabs::-webkit-scrollbar, .subcate_container::-webkit-scrollbar, .subcategory-chips-scroll::-webkit-scrollbar, .h-filter-item::-webkit-scrollbar { display: none; }
  
  /* 4. Fix the filter bar so it scrolls horizontally and fits */
  .category-action-bar {
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    scrollbar-width: none;
    padding: 10px !important;
    gap: 8px !important;
    width: 100% !important; 
    max-width: 100% !important; 
    justify-content: flex-start !important;
    border-bottom: none !important;
  }
  .category-action-bar::-webkit-scrollbar { display: none; }
  
  .category-action-bar .filter_btn {
    flex: 0 0 auto !important;
    white-space: nowrap !important;
    padding: 8px 12px !important;
    font-size: 11px !important;
  }

  /* 5. Ensure the main container wrapper doesn't expand past 100vw */
  .category-page-shell {
    max-width: 100vw !important;
  }
  .main-container {
    max-width: 100% !important;
    overflow-x: hidden !important;
  }
}
