/* ============================================================
   Shopaale — Category Page Redesign
   Same visual language (white / #6e1597 purple / soft pink),
   rebuilt layout so nothing overlaps or gets clipped.
   ============================================================ */

body.category-page {
  --rd-brand: #6e1597;
  --rd-brand-dark: #531073;
  --rd-brand-soft: #faf0fb;
  --rd-ink: #2c2530;
  --rd-muted: #8a8494;
  --rd-line: #ece8ee;
  --rd-card: #ffffff;
  --rd-radius: 14px;
  background: #fbfafc;
}

/* ------------------------------------------------------------
   1. DESKTOP HEADER + PILLS STRIP
   Normal document flow — no clipping under the sticky header.
   ------------------------------------------------------------ */
@media (min-width: 821px) {
  /* Clear the fixed desktop header (70px) */
  body.category-page .category-header {
    position: relative;
    z-index: 5;
    background: #fff;
    border-bottom: 1px solid var(--rd-line);
    padding: 10px 0 6px;
    margin: 70px 0 0; /* 70px clears the fixed .header */
  }

  body.category-page .Subcategory-list {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 28px;
    display: block;
  }

  body.category-page .category-main-tabs {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding: 4px 2px 8px;
    margin: 0;
    scrollbar-width: none;
  }
  body.category-page .category-main-tabs::-webkit-scrollbar {
    display: none;
  }

  /* Pill */
  body.category-page .category-main-tab {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 0 0 auto;
    min-height: 60px;
    padding: 5px 18px 5px 6px;
    border: 1.5px solid var(--rd-line);
    border-radius: 16px;
    background: #fff;
    color: var(--rd-ink);
    cursor: pointer;
    transition: border-color .18s ease, background .18s ease, transform .18s ease;
  }
  body.category-page .category-main-tab:hover {
    border-color: #d9c6e6;
    transform: translateY(-1px);
  }
  body.category-page .category-main-tab img {
    width: 50px;
    height: 50px;
    border-radius: 11px;
    object-fit: cover;
    flex: 0 0 auto;
  }
  body.category-page .category-main-tab span {
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
  }
  body.category-page .category-main-tab.active {
    border: 2px solid var(--rd-brand);
    background: var(--rd-brand-soft);
    color: var(--rd-brand);
    padding: 4px 17px 4px 5px; /* compensate for thicker border */
  }

  /* ------------------------------------------------------------
     2. PAGE SHELL — clean two-column, no translateY hacks
     ------------------------------------------------------------ */
  body.category-page .category-page-shell {
    display: flex;
    align-items: flex-start;
    gap: 26px;
    max-width: 1400px;
    margin: 0 auto;
    padding: 2px 28px 60px;
  }

  body.category-page .category-sidebar-rail {
    flex: 0 0 172px;
    position: sticky;
    top: 96px;
    transform: none !important;
    margin: 0 !important;
    /* Independently scrollable so all departments are reachable */
    max-height: calc(100vh - 116px);
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: #d9cfe2 transparent;
    background: #fff;
    border: 1px solid var(--rd-line);
    border-radius: 18px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
  }
  body.category-page .category-sidebar-rail::-webkit-scrollbar {
    width: 5px;
  }
  body.category-page .category-sidebar-rail::-webkit-scrollbar-thumb {
    background: #d9cfe2;
    border-radius: 3px;
  }
  body.category-page .category-sidebar-rail::-webkit-scrollbar-track {
    background: transparent;
  }

  body.category-page .category-rail-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 0 0 auto; /* never shrink — enables sidebar scrolling */
    min-height: 0;
    padding: 10px 12px;
    border-radius: 12px;
    text-decoration: none;
    color: var(--rd-ink);
    transition: background .15s ease;
  }
  body.category-page .category-rail-item:hover {
    background: #f7f4f9;
  }
  body.category-page .category-rail-item img {
    width: 46px;
    height: 46px;
    border-radius: 10px;
    object-fit: cover;
    flex: 0 0 auto;
  }
  body.category-page .category-rail-item span {
    font-size: 13.5px;
    font-weight: 600;
    line-height: 1.3;
  }
  body.category-page .category-rail-item.active {
    background: var(--rd-brand-soft);
    color: var(--rd-brand);
  }
  body.category-page .category-rail-item.active::before {
    content: "";
    position: absolute;
    left: 0;
    top: 10px;
    bottom: 10px;
    width: 4px;
    border-radius: 0 4px 4px 0;
    background: var(--rd-brand);
  }

  body.category-page .main-container {
    flex: 1 1 auto;
    min-width: 0;
    padding: 0;
  }

  /* ------------------------------------------------------------
     3. RESULTS TOOLBAR — count + sort on one clean row
     ------------------------------------------------------------ */
  body.category-page .category-results-meta-centered {
    margin: 2px 0 14px;
    text-align: left;
    font-size: 15px;
    font-weight: 600;
    color: var(--rd-ink);
  }
  body.category-page .category-results-meta-centered #total_product_count {
    color: var(--rd-brand);
    font-weight: 700;
  }

  /* ------------------------------------------------------------
     4. HORIZONTAL FILTER BAR — breathing room, no overlap.
     overflow:visible so dropdowns drop OVER content (not clipped inside).
     ------------------------------------------------------------ */
  body.category-page .horizontal-filter-bar {
    position: relative;
    z-index: 100;
    background: #fff;
    border: 1px solid var(--rd-line);
    border-radius: var(--rd-radius);
    padding: 6px 8px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    row-gap: 8px;
    overflow: visible;
  }
  body.category-page .h-filter-item {
    padding: 8px 16px;
    flex-shrink: 0;
    position: relative;
  }
  /* Dropdown menus must overlay content below */
  body.category-page .h-filter-item .h-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 500;
  }

  /* ------------------------------------------------------------
     5. SUBCATEGORY CIRCLES — tidy scroll row
     ------------------------------------------------------------ */
  body.category-page .subcategory-chips-bar {
    position: static !important;
    z-index: auto !important;
    background: transparent !important;
    margin-bottom: 4px;
  }
  body.category-page .subcategory-chips-scroll {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    padding: 6px 2px 14px;
    scrollbar-width: none;
  }
  body.category-page .subcategory-chips-scroll::-webkit-scrollbar {
    display: none;
  }
  body.category-page .subcategory-chip {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
    width: 76px;
    text-decoration: none;
    color: var(--rd-ink);
  }
  body.category-page .subcategory-chip img {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--rd-line);
    background: #f5f3f7;
    transition: border-color .15s ease;
  }
  body.category-page .subcategory-chip span {
    font-size: 12px;
    font-weight: 500;
    text-align: center;
    line-height: 1.25;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    max-height: 30px;
  }
  body.category-page .subcategory-chip.active img {
    border-color: var(--rd-brand);
    box-shadow: 0 0 0 2px var(--rd-brand-soft);
  }
  body.category-page .subcategory-chip.active span {
    color: var(--rd-brand);
    font-weight: 700;
  }
  body.category-page .subcat-circles-row {
    display: flex;
    gap: 18px;
    overflow-x: auto;
    padding: 4px 2px 14px;
    margin-bottom: 6px;
    scrollbar-width: none;
  }
  body.category-page .subcategory-chips-scroll::-webkit-scrollbar,
  body.category-page .subcat-circles-row::-webkit-scrollbar {
    display: none;
  }
}

/* ============================================================
   MOBILE  (<= 820px)
   ============================================================ */
@media (max-width: 820px) {
  /* 1. Main categories (Men/Women/Kids) as a horizontal chip row —
     NOT hidden, so users can switch departments on mobile. */
  body.category-page .category-sidebar-rail {
    display: flex !important;
    flex-direction: row;
    gap: 10px;
    overflow-x: auto;
    padding: 10px 12px;
    margin: 0;
    background: #fff;
    border-bottom: 1px solid var(--rd-line);
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    position: relative;
    top: auto;
    transform: none !important;
    min-height: 0;
    flex-basis: auto;
    border-radius: 0;
    border-left: none;
    border-right: none;
    border-top: none;
    /* Fade on right edge = "swipe for more" */
    -webkit-mask-image: linear-gradient(to right, #000 88%, transparent 100%);
    mask-image: linear-gradient(to right, #000 88%, transparent 100%);
  }
  body.category-page .category-sidebar-rail::-webkit-scrollbar {
    display: none;
  }
  body.category-page .category-rail-item {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 0;
    padding: 6px 14px 6px 6px;
    border: 1.5px solid var(--rd-line);
    border-radius: 999px;
    background: #fff;
    text-decoration: none;
    color: var(--rd-ink);
    position: relative;
  }
  body.category-page .category-rail-item::before {
    display: none; /* no left bar on mobile chips */
  }
  body.category-page .category-rail-item img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    flex: 0 0 auto;
  }
  body.category-page .category-rail-item span {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    line-height: 1.2;
  }
  body.category-page .category-rail-item.active {
    border: 2px solid var(--rd-brand);
    background: var(--rd-brand-soft);
    color: var(--rd-brand);
    padding: 5px 13px 5px 5px;
  }

  /* 1b. Hide the redundant Filters/Sort button bar AND the horizontal
     filter dropdowns — the floating SORT/FILTER buttons cover this. */
  body.category-page .sidebar-filter-open.category-action-bar,
  body.category-page .horizontal-filter-bar {
    display: none !important;
  }

  body.category-page .category-page-shell {
    display: block;
    padding: 0;
    margin: 0;
    max-width: 100%;
  }
  body.category-page .main-container {
    padding: 0 12px 170px; /* 170px clears the floating SORT/FILTER bar */
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
  }

  /* 2. Pills strip — fully visible below the sticky mobile header */
  body.category-page .category-header {
    position: relative;
    z-index: 5;
    background: #fff;
    border-bottom: 1px solid var(--rd-line);
    padding: 12px 0 10px;
    margin: 0;
  }
  body.category-page .Subcategory-list {
    display: block;
    padding: 0 !important;
    margin-top: 0 !important;
    height: auto;
  }
  body.category-page .category-main-tabs {
    display: flex;
    gap: 10px;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    padding: 6px 12px 10px 12px;
    margin: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
    -webkit-overflow-scrolling: touch !important;
  }
  body.category-page .category-main-tabs::-webkit-scrollbar {
    display: none !important;
  }
  /* Ensure parent doesn't constrain scroll */
  body.category-page .Subcategory-list {
    overflow: hidden !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
  body.category-page .category-main-tabs .category-main-tab:first-child {
    margin-left: 0;
    flex-shrink: 0;
  }
  body.category-page #PrintMainCate {
    overflow: visible !important;
    width: 100% !important;
  }
  /* Gender switcher - Men/Women/Kids */
  body.category-page .gender-switcher {
    display: flex;
    gap: 8px;
    padding: 8px 12px;
    margin-bottom: 4px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  body.category-page .gender-switcher::-webkit-scrollbar {
    display: none;
  }
  body.category-page .gender-btn {
    flex: 0 0 auto;
    min-width: 80px;
    padding: 10px 16px;
    white-space: nowrap;
  }
  body.category-page .gender-btn {
    flex: 1;
    padding: 10px;
    border: 1.5px solid var(--rd-line);
    border-radius: 12px;
    background: #fff;
    font-size: 14px;
    font-weight: 700;
    color: var(--rd-ink);
    cursor: pointer;
  }
  body.category-page .gender-btn.active {
    background: var(--rd-brand);
    border-color: var(--rd-brand);
    color: #fff;
  }

  /* Mobile: vertical left sidebar with main categories */
  body.category-page .category-page-shell {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: flex-start !important;
    justify-content: flex-start !important;
    width: 100% !important;
    max-width: 100vw !important;
    overflow-x: hidden !important;
    position: relative !important;
    box-sizing: border-box !important;
  }
  body.category-page .category-sidebar-rail,
  body.category-page aside.category-sidebar-rail {
    display: flex !important;
    visibility: visible !important;
    flex-direction: column !important;
    width: 84px !important;
    min-width: 84px !important;
    max-width: 84px !important;
    height: auto !important;
    max-height: calc(100vh - 120px) !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    position: relative !important;
    top: auto !important;
    left: auto !important;
    align-self: flex-start !important;
    background: #fff !important;
    border-right: 1px solid #f0e8f5 !important;
    padding: 8px 4px !important;
    gap: 4px !important;
    z-index: 10 !important;
    scrollbar-width: none !important;
  }
  body.category-page .category-sidebar-rail::-webkit-scrollbar {
    display: none !important;
  }
  body.category-page .category-rail-item {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: 4px !important;
    padding: 8px 2px !important;
    border-radius: 12px !important;
    text-decoration: none !important;
    border: none !important;
    background: transparent !important;
    cursor: pointer !important;
    width: 100% !important;
  }
  body.category-page .category-rail-item img {
    width: 44px !important;
    height: 44px !important;
    border-radius: 50% !important;
    object-fit: cover !important;
    border: 2px solid #f0e8f5 !important;
  }
  body.category-page .category-rail-item.active {
    background: #f8f0fc !important;
  }
  body.category-page .category-rail-item.active img {
    border-color: var(--rd-brand) !important;
  }
  body.category-page .category-rail-item span {
    font-size: 8.5px !important;
    font-weight: 600 !important;
    text-align: center !important;
    line-height: 1.25 !important;
    color: var(--rd-ink) !important;
    word-break: break-word !important;
    overflow-wrap: break-word !important;
    max-width: 100% !important;
    width: 100% !important;
    padding: 0 1px !important;
    display: block !important;
  }
  /* Main content takes remaining width */
  body.category-page .category-main-content,
  body.category-page .category-content,
  body.category-page .main-container {
    flex: 1 1 auto !important;
    min-width: 0 !important;
    max-width: calc(100vw - 84px) !important;
    width: calc(100vw - 84px) !important;
    margin-left: 0 !important;
    box-sizing: border-box !important;
  }
  /* Hide the gender switcher on mobile since sidebar covers it */
  body.category-page .gender-switcher {
    display: none !important;
  }
  body.category-page .category-main-tabs::-webkit-scrollbar {
    display: none;
  }
  body.category-page .category-main-tab {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
    min-height: 44px;
    padding: 3px 12px 3px 3px;
    border: 1.5px solid var(--rd-line);
    border-radius: 22px;
    background: #fff;
  }
  body.category-page .category-main-tab img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    flex: 0 0 auto;
  }
  body.category-page .category-main-tab span {
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
  }
  body.category-page .category-main-tab.active {
    border-color: var(--rd-brand);
    background: #f8f0fc;
    color: var(--rd-brand);
  }
  body.category-page .category-main-tab.active {
    border: 2px solid var(--rd-brand);
    background: var(--rd-brand-soft);
    color: var(--rd-brand);
    padding: 3px 13px 3px 4px;
  }

  /* 3. Filters / Sort action bar — hidden on mobile (floating buttons cover it) */
  body.category-page .sidebar-filter-open.category-action-bar {
    display: none !important;
  }

  /* 4. Results count */
  body.category-page .category-results-meta-centered {
    margin: 20px 0 12px;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    position: relative;
    z-index: 10;
    clear: both;
    line-height: 1.5;
    padding: 6px 12px;
    background: #fff;
  }
  body.category-page .category-main-tabs {
    position: relative;
    z-index: 1;
  }
  body.category-page .category-results-meta-centered #total_product_count {
    color: var(--rd-brand);
  }

  /* 5. Horizontal filter bar — scrollable, items never squash */
  body.category-page .horizontal-filter-bar {
    display: flex;
    gap: 0;
    overflow-x: auto;
    background: #fff;
    border: 1px solid var(--rd-line);
    border-radius: 12px;
    margin: 0 0 14px;
    padding: 4px 6px;
    scrollbar-width: none;
  }
  body.category-page .horizontal-filter-bar::-webkit-scrollbar {
    display: none;
  }
  body.category-page .h-filter-item {
    flex: 0 0 auto;
    padding: 8px 14px;
    border-right: 1px solid var(--rd-line);
  }
  body.category-page .h-filter-item:last-child {
    border-right: none;
  }

  /* 6. Subcategory circles — clean scroll row */
  body.category-page .subcategory-chips-bar {
    position: static !important;
    z-index: auto !important;
    background: transparent !important;
    margin-bottom: 2px;
  }
  body.category-page .subcategory-chips-scroll {
    display: flex;
    gap: 14px;
    overflow-x: auto;
    padding: 4px 2px 12px;
    scrollbar-width: none;
  }
  body.category-page .subcategory-chips-scroll::-webkit-scrollbar {
    display: none;
  }
  body.category-page .subcategory-chip {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 7px;
    flex: 0 0 auto;
    width: 68px;
    text-decoration: none;
    color: var(--rd-ink);
  }
  body.category-page .subcategory-chip img {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--rd-line);
    background: #f5f3f7;
  }
  body.category-page .subcategory-chip span {
    font-size: 11px;
    font-weight: 500;
    text-align: center;
    line-height: 1.25;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    max-height: 28px;
  }
  body.category-page .subcategory-chip.active img {
    border-color: var(--rd-brand);
    box-shadow: 0 0 0 2px var(--rd-brand-soft);
  }
  body.category-page .subcategory-chip.active span {
    color: var(--rd-brand);
    font-weight: 700;
  }

  /* 7. Product grid — two columns, full width, no right-side gap.
     NOTE: uses #products ID for specificity to beat purplle-home.css */
  body.category-page #products.products-grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 14px 10px;
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
    justify-content: stretch;
  }
  body.category-page #products.products-grid .product,
  body.category-page #products.products-grid > div,
  body.category-page #products.products-grid > a {
    min-width: 0 !important;
    max-width: none !important;
    width: 100% !important;
    flex-basis: auto !important;
    margin: 0 !important;
  }
  /* Show Add to Cart button on mobile (was display:none) */
  body.category-page .product .action-row {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin: 8px 0 0 !important;
    opacity: 1 !important;
    visibility: visible !important;
  }
  body.category-page .product .add-to-cart {
    display: block !important;
    flex: 1 !important;
    opacity: 1 !important;
    visibility: visible !important;
    background: var(--rd-brand) !important;
    color: #fff !important;
    border: none !important;
    border-radius: 10px !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    padding: 10px 0 !important;
    text-align: center !important;
    cursor: pointer !important;
  }
  body.category-page .product .add-to-cart:active {
    background: var(--rd-brand-dark) !important;
  }
  body.category-page .product .wishlist-icon {
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
    display: grid !important;
    place-items: center;
    border: 1.5px solid var(--rd-line);
    border-radius: 50%;
    background: #fff;
    color: var(--rd-ink);
    font-size: 16px;
    cursor: pointer;
    opacity: 1 !important;
    visibility: visible !important;
  }
  body.category-page .product .wishlist-icon.active {
    color: var(--rd-brand);
    border-color: var(--rd-brand);
    background: var(--rd-brand-soft);
  }

  /* 8. Floating SORT / FILTER bar — lift above bottom nav */
  body.category-page .category-floating-controls {
    bottom: 78px !important;
    z-index: 60;
  }

  /* 9. Mobile sort bottom sheet */
  body.category-page .mobile-sheet-overlay {
    position: fixed;
    inset: 0;
    background: rgba(20, 10, 28, 0.5);
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: opacity .25s ease, visibility .25s ease;
  }
  body.category-page .mobile-sheet-overlay.open {
    opacity: 1;
    visibility: visible;
  }
  body.category-page .mobile-sort-sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2001;
    background: #fff;
    border-radius: 20px 20px 0 0;
    padding: 10px 20px calc(20px + env(safe-area-inset-bottom));
    transform: translateY(105%);
    transition: transform .3s cubic-bezier(.32, .72, 0, 1);
    max-height: 70vh;
    overflow-y: auto;
    box-shadow: 0 -8px 32px rgba(60, 20, 90, 0.18);
  }
  body.category-page .mobile-sort-sheet.open {
    transform: translateY(0);
  }
  body.category-page .mobile-sheet-handle {
    width: 44px;
    height: 5px;
    border-radius: 3px;
    background: #e3dde7;
    margin: 4px auto 12px;
  }
  body.category-page .mobile-sheet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
  }
  body.category-page .mobile-sheet-header h3 {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
    color: var(--rd-ink);
  }
  body.category-page .mobile-sheet-close {
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 50%;
    background: #f4f1f6;
    color: var(--rd-ink);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
  }
  body.category-page .mobile-sort-options {
    display: flex;
    flex-direction: column;
  }
  body.category-page .mobile-sort-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 4px;
    border-bottom: 1px solid var(--rd-line);
    font-size: 15px;
    color: var(--rd-ink);
    cursor: pointer;
  }
  body.category-page .mobile-sort-option:last-child {
    border-bottom: none;
  }
  body.category-page .mobile-sort-option input[type="radio"] {
    width: 20px;
    height: 20px;
    accent-color: var(--rd-brand);
    flex: 0 0 auto;
  }
  body.category-page .mobile-sort-option:has(input:checked) span {
    color: var(--rd-brand);
    font-weight: 700;
  }
  body.category-page .mobile-sort-apply {
    width: 100%;
    margin-top: 14px;
    padding: 14px;
    border: none;
    border-radius: 12px;
    background: var(--rd-brand);
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
  }
  body.category-page .mobile-sort-apply:active {
    background: var(--rd-brand-dark);
  }
}

/* Desktop: never show the mobile sort sheet */
@media (min-width: 821px) {
  body.category-page .mobile-sort-sheet,
  body.category-page .mobile-sheet-overlay {
    display: none !important;
  }

  /* Keep wishlist icon inside the product card */
  body.category-page .product {
    overflow: hidden;
  }
  body.category-page .product .action-row {
    margin-left: 12px !important;
    margin-right: 12px !important;
    max-width: calc(100% - 24px);
    box-sizing: border-box;
  }
  body.category-page .product .wishlist-icon {
    flex: 0 0 auto;
    max-width: 100%;
  }
}
}

/* Mobile filter bottom sheet (same pattern as sort sheet) */
@media (max-width: 820px) {
  body.category-page .mobile-filter-section {
    margin-bottom: 18px;
  }
  body.category-page .mobile-filter-section h4 {
    margin: 0 0 10px;
    font-size: 14px;
    font-weight: 700;
    color: var(--rd-ink);
  }
  body.category-page .mobile-filter-options {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
  }
  body.category-page .mobile-filter-chip {
    border: 1.5px solid #e5e0eb;
    background: #fff;
    border-radius: 12px;
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 600;
    color: #333;
    cursor: pointer;
    transition: all .15s ease;
    min-width: 0;
  }
  body.category-page .mobile-filter-chip:active {
    transform: scale(.96);
  }
  body.category-page .mobile-filter-chip.active {
    border-color: var(--rd-brand);
    background: var(--rd-brand);
    color: #fff;
    box-shadow: 0 2px 8px rgba(110,21,151,.25);
  }
  body.category-page .mobile-filter-section h4 {
    font-size: 15px;
    font-weight: 700;
    margin: 0 0 10px;
    color: #1a1a1a;
  }
  body.category-page .mobile-filter-section {
    margin-bottom: 18px;
  }
  body.category-page .mobile-sheet-actions {
    display: flex;
    gap: 12px;
    margin-top: 8px;
  }
  body.category-page .mobile-filter-clear {
    flex: 1;
    border: 1.5px solid var(--rd-line);
    background: #fff;
    border-radius: 12px;
    padding: 14px;
    font-size: 14px;
    font-weight: 700;
    color: var(--rd-ink);
    cursor: pointer;
  }
  body.category-page .mobile-sheet-actions .mobile-sort-apply {
    flex: 2;
  }
  /* Filter sheet uses same open/close as sort sheet */
  body.category-page #mobile-filter-sheet {
    transform: translateY(100%);
    transition: transform .3s ease;
  }
  body.category-page #mobile-filter-sheet.open {
    transform: translateY(0);
  }
}

  /* Tighten pills-to-products gap (2026-10-04) */
  body.category-page .category-main-tabs {
    margin-bottom: 0 !important;
    padding-bottom: 4px !important;
  }
  body.category-page .subcate_container:empty {
    display: none !important;
  }
  body.category-page .category-header {
    padding-bottom: 4px !important;
  }
  /* Fix w_cate.css height:100% stretch (2026-10-04) */
  body.category-page .Subcategory-list {
    height: auto !important;
  }
  /* Fix w_cate.css fixed 165px header height (2026-10-04) */
  body.category-page .category-header {
    height: auto !important;
    min-height: 0 !important;
  }

/* Mobile category pills fix (2026-10-04) - clean horizontal scroll */
@media (max-width: 820px) {
  body.category-page .category-header {
    margin-top: 0 !important;
    padding-top: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    background: transparent !important;
    position: relative !important;
    top: auto !important;
    z-index: 1 !important;
    border-bottom: none !important;
    overflow: visible !important;
    width: 100% !important;
    max-width: 100vw !important;
    background: #fff !important;
    border-bottom: 1px solid #f0e8f5 !important;
    padding: 8px 0 !important;
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
  }
  body.category-page .Subcategory-list {
    display: block !important;
    height: auto !important;
    overflow: visible !important;
  }
  body.category-page .category-main-tabs {
    display: flex !important;
    flex-wrap: nowrap !important;
    padding-top: 8px !important;
    gap: 8px !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    padding: 4px 12px !important;
    margin: 0 !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: none !important;
  }
  body.category-page .category-main-tabs::-webkit-scrollbar {
    display: none !important;
  }
  body.category-page .category-main-tab {
    flex: 0 0 auto !important;
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    padding: 4px 12px 4px 4px !important;
    border: 1.5px solid #e8ddf0 !important;
    border-radius: 24px !important;
    background: #fff !important;
    min-height: 44px !important;
    max-height: 44px !important;
    overflow: hidden !important;
  }
  body.category-page .category-main-tab img {
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    border-radius: 50% !important;
    object-fit: cover !important;
  }
  body.category-page .category-main-tab span {
    font-size: 12px !important;
    font-weight: 600 !important;
    white-space: nowrap !important;
    color: #3a2b4d !important;
  }
  body.category-page .category-main-tab.active {
    border-color: #6e1597 !important;
    background: #f9f0fd !important;
  }
  body.category-page .category-main-tab.active span {
    color: #6e1597 !important;
  }
  /* Subcategory circles directly below main pills on mobile */
  body.category-page .subcate_container {
    background: transparent !important;
    display: flex !important;
    gap: 14px !important;
    overflow-x: auto !important;
    overflow-y: visible !important;
    padding: 10px 16px 12px 16px !important;
    margin: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    scrollbar-width: none !important;
    -webkit-overflow-scrolling: touch !important;
    scroll-padding: 16px !important;
  }
  body.category-page .subcate_container::-webkit-scrollbar {
    display: none !important;
  }
  body.category-page .subcate_container a {
    flex: 0 0 auto !important;
    text-decoration: none !important;
  }
  body.category-page .Category-Box {
    background: transparent !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: 6px !important;
    width: 68px !important;
    flex-shrink: 0 !important;
  }
  body.category-page .Category-Box img {
    width: 56px !important;
    height: 56px !important;
    border-radius: 50% !important;
    object-fit: cover !important;
    border: 2px solid #f0e8f5 !important;
  }
  body.category-page .subcate_container a.active .Category-Box img {
    border-color: #6e1597 !important;
  }
  body.category-page .Category-Box h6 {
    font-size: 11px !important;
    font-weight: 600 !important;
    color: #3a2b4d !important;
    margin: 0 !important;
    text-align: center !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    max-width: 64px !important;
  }
  body.category-page .subcate_container a.active .Category-Box h6 {
    color: #6e1597 !important;
  }
}
