/* ==============================================================
   TEKY / Weideng v7 — reliable sticky product-category card
   ============================================================== */

/*
 * IMPORTANT:
 * The sidebar itself must span the full height of the catalogue row.
 * The compact white card INSIDE it is the sticky element. Making the
 * short sidebar column itself sticky gives it no scrolling range on
 * some Gutenberg/Core Columns builds, which is why the card appeared
 * at the top and then disappeared when the page was scrolled.
 */
@media (min-width: 1025px) {
  .wp-block-columns.catalog-layout.classic-catalog {
    position: relative !important;
    align-items: stretch !important;
    overflow: visible !important;
  }

  .catalog-layout.classic-catalog > .catalog-sidebar.wp-block-column,
  .catalog-sidebar.wp-block-column.teky-sticky-ready {
    position: relative !important;
    top: auto !important;
    align-self: stretch !important;
    height: auto !important;
    min-height: 100% !important;
    max-height: none !important;
    padding: 0 !important;
    overflow: visible !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    z-index: 25 !important;
  }

  .catalog-sidebar .catalog-sidebar-sticky-inner {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    bottom: auto !important;
    width: 100% !important;
    max-height: calc(100vh - 126px) !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    border: 1px solid rgba(5,7,8,.12) !important;
    border-top: 4px solid var(--cyan) !important;
    border-radius: 14px !important;
    background: #fff !important;
    box-shadow: 0 15px 40px rgba(8,34,43,.06) !important;
    scrollbar-width: thin;
  }



  /* JS-driven fixed state is used as a reliable fallback across
     WordPress/Core Columns and hosting optimisation layers. */
  .catalog-sidebar .catalog-sidebar-sticky-inner.is-teky-fixed {
    position: fixed !important;
    top: var(--teky-sidebar-top, 108px) !important;
    left: var(--teky-sidebar-left, 0px) !important;
    bottom: auto !important;
    width: var(--teky-sidebar-width, 230px) !important;
    z-index: 35 !important;
  }

  .catalog-sidebar .catalog-sidebar-sticky-inner.is-teky-bottom {
    position: absolute !important;
    top: auto !important;
    left: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    z-index: 35 !important;
  }

  .catalog-sidebar .catalog-sidebar-sticky-inner::-webkit-scrollbar {
    width: 5px;
  }
  .catalog-sidebar .catalog-sidebar-sticky-inner::-webkit-scrollbar-thumb {
    background: rgba(5,7,8,.18);
    border-radius: 999px;
  }

  /* Keep the compact proportions from v5/v6. */
  .catalog-sidebar .catalog-sidebar-sticky-inner .sidebar-heading {
    margin: 0 !important;
    padding: 17px 18px 12px !important;
    font-size: 19px !important;
    line-height: 1.15 !important;
  }

  .catalog-sidebar .catalog-sidebar-sticky-inner .product-category-list {
    margin: 0 !important;
    padding: 0 10px 12px !important;
  }

  .catalog-sidebar .catalog-sidebar-sticky-inner .product-category-list a {
    min-height: 38px !important;
    padding: 7px 9px !important;
    font-size: 14px !important;
    line-height: 1.25 !important;
  }
}

/* Mobile/tablet remains a normal block. */
@media (max-width: 1024px) {
  .catalog-sidebar.wp-block-column,
  .catalog-sidebar.wp-block-column.teky-sticky-ready {
    position: static !important;
    top: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: visible !important;
  }

  .catalog-sidebar .catalog-sidebar-sticky-inner {
    position: static !important;
    top: auto !important;
    max-height: none !important;
    overflow: hidden !important;
    border: 1px solid rgba(5,7,8,.12) !important;
    border-top: 4px solid var(--cyan) !important;
    border-radius: 14px !important;
    background: #fff !important;
    box-shadow: 0 15px 40px rgba(8,34,43,.06) !important;
  }
}
