/* HL mobile category drawer (hamburger) + hide legacy / page-content duplicates */

/* Never show the old page-content "Kategooriad" trigger */
.hl-catdrawer-trigger {
  display: none !important;
}

/* Kill Hummingbird Bootstrap offcanvas mobile menu */
#mobileMenu,
.ps-mainmenu--mobile.offcanvas,
.ps-mainmenu--mobile.js-menu-canvas {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
  width: 0 !important;
  height: 0 !important;
  overflow: hidden !important;
}

@media (min-width: 992px) {
  .hl-catdrawer.hl-mobile-nav,
  [data-hl-mobile-nav] {
    display: none !important;
  }

  .ps-mainmenu__mobile-toggle {
    display: none !important;
  }
}

@media (max-width: 991.98px) {
  .ps-mainmenu__desktop {
    display: none !important;
  }

  .ps-mainmenu__mobile-toggle,
  .menu-toggle {
    display: inline-flex !important;
  }
}

/* Category/product left column: catside desktop-only; hide column under 1100 */
@media (max-width: 1099.98px) {
  #left-column .hl-catside--desktop {
    display: none !important;
  }

  body:has(.hl-catside):not(#pagenotfound):not(.page-pagenotfound) #left-column,
  body:has(.hl-catside):not(#pagenotfound):not(.page-pagenotfound) #left-column.left-column,
  body:has(.hl-catside) #left-column {
    display: none !important;
    grid-column: auto !important;
  }

  body:has(.hl-catside):not(#pagenotfound):not(.page-pagenotfound) .columns-container > .row,
  body:has(.hl-catside) .columns-container > .row {
    grid-template-columns: minmax(0, 1fr) !important;
    column-gap: 0 !important;
  }

  body:has(.hl-catside):not(#pagenotfound):not(.page-pagenotfound) #center-column,
  body:has(.hl-catside):not(#pagenotfound):not(.page-pagenotfound) #content-wrapper,
  body:has(.hl-catside):not(#pagenotfound):not(.page-pagenotfound) #center-column.center-column,
  body:has(.hl-catside) #center-column,
  body:has(.hl-catside) #content-wrapper {
    grid-column: 1 / -1 !important;
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 100% !important;
  }
}

/* ===== Drawer shell ===== */
.hl-catdrawer[hidden] {
  display: none !important;
}

.hl-catdrawer:not([hidden]) {
  display: block;
  position: fixed;
  inset: 0;
  z-index: 10050;
}

.hl-catdrawer__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(17, 24, 39, .45);
}

.hl-catdrawer__panel {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(90vw, 420px);
  height: 100dvh;
  max-height: 100dvh;
  background: #fff;
  box-shadow: 8px 0 28px rgba(0, 0, 0, .15);
  display: flex;
  flex-direction: column;
  transform: translateX(-104%);
  transition: transform .18s ease;
}

.hl-catdrawer.is-open .hl-catdrawer__panel {
  transform: translateX(0);
}

.hl-catdrawer__header {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  align-items: center;
  column-gap: 4px;
  min-height: 56px;
  padding: 6px 8px;
  border-bottom: 1px solid var(--hl-cs-line, #ececec);
  background: #fff;
  position: sticky;
  top: 0;
  z-index: 2;
}

.hl-catdrawer__title {
  grid-column: 2;
  margin: 0;
  min-width: 0;
  text-align: center;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: .02em;
  text-transform: uppercase;
  color: var(--hl-cs-text, #18191a);
  /* Long drill-down names may ellipsis; root "Kategooriad" must fit */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hl-catdrawer__back,
.hl-catdrawer__close {
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--hl-cs-text, #18191a);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.hl-catdrawer__back {
  grid-column: 1;
  justify-self: start;
}

.hl-catdrawer__close {
  grid-column: 3;
  justify-self: end;
}

/* Keep the back slot in the grid when hidden — [hidden] would display:none
   and push the title into the 44px first column ("KAT..."). */
.hl-catdrawer__back[hidden] {
  display: inline-flex !important;
  visibility: hidden;
  pointer-events: none;
}

.hl-catdrawer__body {
  flex: 1 1 auto;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 8px 10px 28px;
  transition: transform .15s ease, opacity .15s ease;
}

.hl-catdrawer__body.is-slide-out {
  opacity: 0;
  transform: translateX(-12px);
}

.hl-catdrawer__body.is-slide-in {
  opacity: 1;
  transform: translateX(0);
}

.hl-catdrawer__view-all {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 4px 0 12px;
  padding: 12px;
  border-radius: 10px;
  background: var(--hl-cs-soft, #f5f6f7);
  color: var(--hl-cs-text, #18191a) !important;
  text-decoration: none !important;
  font-size: 14px;
  font-weight: 700;
}

.hl-catdrawer__list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.hl-catdrawer__item {
  border-bottom: 1px solid #f1f2f4;
}

.hl-catdrawer__item-link {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 50px;
  padding: 8px 4px;
  color: var(--hl-cs-text, #18191a) !important;
  text-decoration: none !important;
}

.hl-catdrawer__item.is-current .hl-catdrawer__item-link {
  background: var(--hl-cs-active, #fff0f0);
  border-radius: 8px;
  padding-left: 8px;
}

.hl-catdrawer__item-thumb {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  border-radius: 7px;
  background: #f3f4f6;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.hl-catdrawer__item-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.hl-catdrawer__item-thumb.is-fallback {
  background: linear-gradient(135deg, #f8f8f8, #efefef);
}

.hl-catdrawer__item-thumb.is-logo {
  padding: 6px;
  box-sizing: border-box;
}

.hl-catdrawer__item-thumb.is-logo img {
  opacity: .92;
}

.hl-catdrawer__item-label {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hl-catdrawer__item-chev {
  flex: 0 0 20px;
  color: var(--hl-cs-muted, #6b7280);
  font-size: 18px;
}

.hl-catdrawer__fallback {
  list-style: none;
  margin: 0;
  padding: 8px;
}

.hl-catdrawer__fallback a {
  display: block;
  padding: 12px 8px;
  color: var(--hl-cs-text, #18191a);
  text-decoration: none;
  border-bottom: 1px solid var(--hl-cs-line, #ececec);
}

body.hl-catdrawer-open {
  overflow: hidden !important;
  touch-action: none;
}

@media (max-width: 380px) {
  .hl-catdrawer__panel {
    width: 100vw;
    max-width: 100vw;
  }
}
