/* ===== Меню каталогу (html/catalog_menu.tpl, js/catalog_menu.js) ===== */

.cm {
  position: relative;
  z-index: 20;
  background: #007236;
  border-radius: 15px 15px 0 0;
  font-size: 14px;
}

/* --- смуга --- */
.cm-bar {
  display: flex;
  align-items: stretch;
  height: 38px;
}

.cm-toggle {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 22px 0 20px;
  border: 0;
  border-radius: 15px 0 0 0;
  background: #005c2b;
  color: #fff;
  font: inherit;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .03em;
  cursor: pointer;
  transition: background .2s ease, color .2s ease;
}
.cm-toggle:hover {
  background: #004d24;
}
.cm-toggle:focus-visible {
  outline: 2px solid #fff;
  outline-offset: -4px;
}
.cm.is-open .cm-toggle {
  background: #f9f9f9;
  color: #007236;
}

.cm-burger,
.cm-burger::before,
.cm-burger::after {
  display: block;
  width: 16px;
  height: 2px;
  background: currentColor;
  transition: transform .2s ease, background .2s ease;
}
.cm-burger {
  position: relative;
}
.cm-burger::before,
.cm-burger::after {
  content: '';
  position: absolute;
  left: 0;
}
.cm-burger::before { top: -5px; }
.cm-burger::after  { top: 5px; }
.cm.is-open .cm-burger { background: transparent; }
.cm.is-open .cm-burger::before { transform: translateY(5px) rotate(45deg); }
.cm.is-open .cm-burger::after  { transform: translateY(-5px) rotate(-45deg); }

/* швидкі посилання: що не влізло в рядок — переноситься і ховається (catalog_menu.js) */
.cm-quick {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  height: 38px;
  overflow: hidden;
  margin: 0;
  padding: 0 4px;
  list-style: none;
}
.cm-quick-item {
  position: relative;
  padding: 0 15px;
  line-height: 38px;
  white-space: nowrap;
}
.cm-quick-item + .cm-quick-item::before {
  content: '|';
  position: absolute;
  top: 0;
  left: 0;
  transform: translateX(-50%);
  color: #fff;
  font-weight: 300;
}
.cm-quick-item.is-hidden {
  visibility: hidden;
}
.cm-quick-link {
  position: relative;
  padding-bottom: 2px;
  border-bottom: 1px solid transparent;
  color: #fff;
  text-decoration: none;
}
.cm-quick-link:hover,
.cm-quick-link:focus-visible,
.cm-quick-link.is-active,
.cm-quick-link.is-current {
  color: #fff;
  border-bottom-color: #fff;
  outline: none;
}

.cm-remont {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  padding: 0 22px;
  border-radius: 0px 8px 0 0;
  background: #FF6600;
  color: #fff;
  text-transform: uppercase;
  text-decoration: none;
  transition: background .2s ease;
}
.cm-remont:hover,
.cm-remont:focus-visible,
.cm-remont.is-current {
  background: #339933;
  color: #fff;
}

/* --- мега-панель --- */
.cm-panel {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  display: flex;
  max-height: 520px;
  background: #f9f9f9;
  border: 1px solid #cecece;
  border-top: 0;
  border-radius: 0 0 10px 10px;
  box-shadow: 0 14px 28px rgba(0, 0, 0, .14), 1px 2px 2px 1px rgba(0, 0, 0, .075);
  overflow: hidden;
  visibility: hidden;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .18s ease, transform .18s ease, visibility 0s linear .18s;
}
.cm.is-open .cm-panel {
  visibility: visible;
  opacity: 1;
  transform: none;
  transition: opacity .18s ease, transform .18s ease;
}

.cm-roots-wrap,
.cm-subs {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

/* ліворуч — розділи у дві колонки */
.cm-roots-wrap {
  flex: 0 0 46%;
  max-width: 520px;
  padding: 12px 0 12px 12px;
  border-right: 1px solid #e0e0e0;
}
.cm-roots {
  columns: 2;
  column-gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}
.cm-roots > li {
  break-inside: avoid;
  padding: 1px 12px 1px 0;
}
.cm-root {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 12px 6px 18px;
  border-radius: 5px;
  color: #000;
  line-height: 18px;
  text-decoration: none;
  transition: background .15s ease, color .15s ease;
}
.cm-root.has-sub::after {
  content: '';
  flex: 0 0 auto;
  width: 6px;
  height: 6px;
  margin-right: 2px;
  border-top: 1.5px solid #9a9a9a;
  border-right: 1.5px solid #9a9a9a;
  transform: rotate(45deg);
}
.cm-root:hover,
.cm-root:focus-visible {
  color: #007236;
  outline: none;
}
.cm-root.is-current {
  font-weight: 600;
}
.cm-root.is-active {
  background: #007236;
  color: #fff;
}
.cm-root.is-active::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 7px;
  transform: translateY(-50%);
  border: 3px solid;
  border-color: transparent transparent transparent #fff;
}
.cm-root.is-active::after {
  border-color: #fff;
}

/* праворуч — підкатегорії активного розділу */
.cm-subs {
  flex: 1 1 auto;
  min-width: 0;
  padding: 14px 22px 18px;
  background: #fff;
}
.cm-sub[hidden] {
  display: none;
}
.cm-sub-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 16px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid #e9e9e9;
}
.cm-sub-title {
  color: #007236;
  font-size: 17px;
  font-weight: 600;
  text-decoration: none;
}
.cm-sub-title:hover {
  text-decoration: underline;
}
.cm-sub-all {
  color: #FF6600;
  font-size: 13px;
  white-space: nowrap;
}
.cm-sub-all:hover {
  color: #339933;
}

.cm-sub-list {
  columns: 190px 3;
  column-gap: 28px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.cm-sub-list > li {
  break-inside: avoid;
}
.cm-sub-link {
  display: block;
  padding: 3px 0;
  color: #000;
  font-size: 13px;
  line-height: 18px;
  text-decoration: none;
}
.cm-sub-link:hover,
.cm-sub-link:focus-visible {
  color: #007236;
  text-decoration: underline;
  outline: none;
}
.cm-sub-link.is-current {
  color: #007236;
  font-weight: 600;
}
.cm-count {
  margin-left: 5px;
  color: #9a9a9a;
  font-size: 11px;
}

/* 3-й рівень (напр. Фільтр → Фільтр масляний → бренди) */
.cm-group {
  margin-bottom: 8px;
}
.cm-sub-link.cm-group-title {
  color: #007236;
  font-weight: 600;
}
.cm-sub-nested {
  margin: 0 0 4px 2px;
  padding: 0 0 0 12px;
  border-left: 2px solid #e9e9e9;
  list-style: none;
}

/* вузькі вікна десктопа */
@media (max-width: 991.98px) {
  .cm-toggle { padding: 0 16px; }
  .cm-quick-item { padding: 0 11px; }
  .cm-remont { padding: 0 14px; }
  .cm-roots-wrap { flex-basis: 260px; }
  .cm-roots { columns: 1; }
}


/* ===== Мобільне меню (html/catalog_menu_mobile.tpl) ===== */

.mm-remont {
  display: block;
  margin-bottom: 4px;
  padding: 10px 12px;
  border-radius: 3px;
  background: #FF6600;
  color: #fff;
  font-size: 16px;
  text-align: center;
  text-transform: uppercase;
  text-decoration: none;
}
.mm-remont:hover,
.mm-remont:active {
  background: #339933;
  color: #fff;
}

.mm-caption {
  margin: 14px 0 2px;
  color: #9a9a9a;
  font-size: 12px;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.mm-view[hidden] {
  display: none;
}
.mm-view.is-in-fwd  { animation: mm-in-fwd .22s ease both; }
.mm-view.is-in-back { animation: mm-in-back .22s ease both; }
@keyframes mm-in-fwd {
  from { opacity: 0; transform: translateX(24px); }
  to   { opacity: 1; transform: none; }
}
@keyframes mm-in-back {
  from { opacity: 0; transform: translateX(-24px); }
  to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .mm-view.is-in-fwd,
  .mm-view.is-in-back { animation: none; }
}

.mm-list {
  margin: 0;
  padding: 0;
  list-style: none;
}
.mm-link {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 10px 2px;
  border-bottom: 2px solid #e9e9e9;
  color: #212529;
  font-size: 16px;
  line-height: 20px;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.mm-link:active {
  background: #f3f3f3;
}
.mm-name {
  flex: 1 1 auto;
  min-width: 0;
}
.mm-count {
  flex: 0 0 auto;
  color: #9a9a9a;
  font-size: 12px;
}
.mm-link.has-sub::after {
  content: '';
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  margin: 0 4px 0 2px;
  border-top: 2px solid #9a9a9a;
  border-right: 2px solid #9a9a9a;
  transform: rotate(45deg);
}
.mm-link.is-current {
  color: #007236;
  font-weight: 600;
}
.mm-link.mm-all {
  color: #007236;
  font-weight: 600;
}

.mm-back {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 6px 0 10px;
  border: 0;
  background: none;
  color: #007236;
  font-size: 15px;
  text-align: left;
}
.mm-back::before {
  content: '';
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  margin-left: 4px;
  border-bottom: 2px solid currentColor;
  border-left: 2px solid currentColor;
  transform: rotate(45deg);
}
.mm-title {
  padding: 2px 0 10px;
  border-bottom: 2px solid #007236;
  font-size: 18px;
  font-weight: 700;
  line-height: 22px;
}

/* сторінки й контакти — лише на першому екрані */
.offcanvas-body.mm-deep .mm-extra {
  display: none;
}
