/* Category page filters: chips, menus and the sort menu (frontend/views/product/categoryProducts.php).
   The site's palette: black, #5a5a5b, the light greys; the bar keeps the old sort row's grey box. */

.cat-filter {
  margin: 30px 10px 40px;
  scroll-margin-top: 70px;   /* the fixed site header */
}

.cat-filter__bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  max-width: 1830px;
  margin: 0 auto;
  padding: 8px;
  border-radius: 10px;
  background-color: #f6f6f6;
}

.cat-filter__chips,
.cat-filter__menus {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.cat-filter__chips + .cat-filter__menus { margin-left: 8px; }

/* chips and menu buttons */
.cat-chip,
.cat-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  margin: 0;
  padding: 0 16px;
  border-radius: 8px;
  background: #fff;
  color: #000;
  font-family: gilroy-medium, sans-serif;
  font-size: 14px;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  user-select: none;
  transition: background-color .15s ease, color .15s ease;
}

.cat-chip:hover,
.cat-toggle:hover { background: #ebebeb; color: #000; text-decoration: none; }

.cat-chip.is-on,
.cat-chip.is-on:hover { background: #000; color: #fff; }

.cat-chip.is-off,
.cat-chip.is-off:hover { background: #fff; color: #c8c8c8; cursor: default; }

/* the chip's checkbox stays focusable for the keyboard */
.cat-chip input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.cat-chip:focus-within,
.cat-chip:focus-visible,
.cat-toggle:focus-visible { outline: 2px solid #000; outline-offset: 2px; }

/* menus */
.cat-menu { position: relative; }

.cat-toggle { list-style: none; }
.cat-toggle::-webkit-details-marker { display: none; }
.cat-toggle::marker { content: ''; }
.cat-toggle:focus { outline: none; }

.cat-toggle i {
  font-size: 10px;
  color: #5a5a5b;
  transition: transform .15s ease;
}

.cat-menu[open] > .cat-toggle i { transform: rotate(180deg); }

.cat-toggle.has-choice { font-family: gilroy-semi, gilroy-medium, sans-serif; }

.cat-toggle__n {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: #000;
  color: #fff;
  font-family: gilroy-bold, sans-serif;
  font-size: 11px;
}

.cat-menu__panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 30;
  min-width: 220px;
  max-height: 360px;
  overflow-y: auto;
  padding: 6px;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .14);
}

.cat-menu--end .cat-menu__panel { left: auto; right: 0; }

.cat-menu__head {
  margin: 0;
  padding: 10px 10px 4px;
  color: #5a5a5b;
  font-family: gilroy-semi, gilroy-medium, sans-serif;
  font-size: 12px;
}

.cat-opt {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 9px 10px;
  border-radius: 6px;
  color: #000;
  font-family: gilroy-regular, sans-serif;
  font-size: 14px;
  white-space: nowrap;
  cursor: pointer;
}

.cat-opt:hover { background: #f6f6f6; }

.cat-opt input {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: #000;
  cursor: pointer;
}

.cat-opt small {
  margin-left: auto;
  padding-left: 16px;
  color: #8a8a8a;
  font-size: 12px;
}

.cat-opt.is-off { color: #c8c8c8; cursor: default; }
.cat-opt.is-off:hover { background: none; }
.cat-opt.is-off input { cursor: default; }

/* sort */
.cat-filter__sort {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.cat-filter__sort-label {
  color: #5a5a5b;
  font-family: gilroy-regular, sans-serif;
  font-size: 14px;
  white-space: nowrap;
}

.cat-filter__found {
  max-width: 1830px;
  margin: 14px auto 0;
  padding: 0 10px;
  color: #5a5a5b;
  font-family: gilroy-regular, sans-serif;
  font-size: 14px;
}

.cat-filter__found:empty { display: none; }

/* phones: two rows, the chips, then the menus and the sort; each row scrolls sideways. The menus open across
   the bar's width (positioned against the bar, so the scrolling rows do not clip them). */
@media (max-width: 768px) {
  .cat-filter { margin: 20px 0 24px; }
  .cat-filter__bar { position: relative; flex-wrap: wrap; }
  .cat-filter__chips,
  .cat-filter__menus {
    flex-wrap: nowrap;
    overflow-x: auto;
    margin: -2px;
    padding: 2px;
    scrollbar-width: none;
  }
  .cat-filter__chips { flex: 1 1 100%; }
  .cat-filter__menus { flex: 1 1 0; min-width: 0; }
  .cat-filter__chips::-webkit-scrollbar,
  .cat-filter__menus::-webkit-scrollbar { display: none; }
  .cat-filter__chips + .cat-filter__menus { margin-left: -2px; }
  .cat-filter__sort { margin-left: 0; }
  .cat-menu { position: static; }
  .cat-menu__panel,
  .cat-menu--end .cat-menu__panel { left: 8px; right: 8px; min-width: 0; }
  .cat-chip,
  .cat-toggle { height: 36px; padding: 0 14px; }
}

@media (max-width: 420px) {
  .cat-filter__sort-label { display: none; }
}
