/* =============================================================
   ic-catalog.css — СКИН страницы листинга категории (product/category)
   под тему OpenCart 3.0.4.1 / tt_madina1.

   Подключается ТОЛЬКО на странице каталога, в дополнение к ic-theme.css
   (оттуда берутся токены, шапка/футер и общий .product-item).

   Правила (бриф каталога):
   • Каркас — Bootstrap-грид .container > .row > .col-sm-3 / .col-sm-9.
     Свой грид/контейнер не вводим.
   • Никаких правил на голые теги; все стили — под scope .ic-catalog.
   • Цепляемся за хуки темы фильтра: .pt-filter .layered
     .filter-attribute-container .a-filter .filter-price #slider-price
     .input-price — а НЕ за .panel/.list-group/.form-control/.row.
   • Опции фильтра — ссылки <a class="a-filter add-filter">; вид «чекбокс»
     даём чистым CSS-скином, разметку и JS не трогаем.
   • Цена — слайдер диапазона jQuery UI (#slider-price + .input-price).
   • Карточка — общий .product-item (стилизован в ic-theme.css).
   • Листинг — статичный грид (.product-items / .product-layout), НЕ карусель.
   • Пагинация — генерится OC (.pagination), скин поверх готового HTML.
   • Свои flex-утилиты — .ic-row (не .row).
   ============================================================= */

/* ---------- LAYOUT ---------- */
.ic-catalog { padding: 22px 15px 64px; }
.ic-catalog .ic-crumbs { margin: 0 0 18px; }
.ic-catalog .breadcrumb { background: transparent; padding: 0; margin: 0; font-size: 12px; list-style: none; display: flex; flex-wrap: wrap; gap: 6px; }
.ic-catalog .breadcrumb > li { color: var(--ic-fg-4); }
.ic-catalog .breadcrumb > li + li::before { content: "/"; color: var(--ic-border-2); padding-right: 6px; }
.ic-catalog .breadcrumb > li > a { color: var(--ic-fg-3); text-decoration: none; }
.ic-catalog .breadcrumb > li > a:hover { color: var(--ic-accent); }

.ic-catalog .ic-cat-head { margin-bottom: 18px; }
.ic-catalog .ic-cat-head h1 { font-size: 30px; font-weight: 800; display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.ic-catalog .ic-cat-total { font-family: var(--ic-font-body); font-size: 13px; font-weight: 500; color: var(--ic-fg-3); }
.ic-catalog .ic-cat-intro { font-size: 14px; color: var(--ic-fg-2); line-height: 1.7; max-width: 760px; margin-top: 10px; }

/* sub-category quick chips (own prefix) */
.ic-catalog .ic-subcats { display: flex; gap: 8px; flex-wrap: wrap; margin: 18px 0 16px; }
.ic-catalog .ic-subcat { display: inline-flex; align-items: center; height: 34px; padding: 0 14px; border-radius: var(--ic-r-pill); background: #fff; border: 1px solid var(--ic-border-1); font-family: var(--ic-font-display); font-weight: 600; font-size: 13px; color: var(--ic-fg-2); text-decoration: none; transition: all var(--ic-fast); }
.ic-catalog .ic-subcat:hover { border-color: var(--ic-accent); color: var(--ic-accent); }
.ic-catalog .ic-subcat.is-active { background: var(--ic-navy-900); border-color: var(--ic-navy-900); color: #fff; }

/* =============================================================
   SIDEBAR — скин панелей темы (.pt-filter / .layered)
   ============================================================= */
.ic-catalog .ic-aside,
.ic-catalog #column-left { } /* col-sm-3 даёт ширину */
/* .layered-navigation-block — это ajax-оверлей затемнения темы (display:none по умолчанию). НЕ переопределять display, иначе затемняет весь экран. */
.ic-catalog #column-left .col-order-inner { display: flex; flex-direction: column; gap: 14px; }

/* панель фильтра темы */
.ic-catalog .pt-filter { background: #fff; border: 1px solid var(--ic-border-1); border-radius: var(--ic-r-md); overflow: hidden; box-shadow: none; }
.ic-catalog .ic-fbox-head { font-family: var(--ic-font-display); font-weight: 700; font-size: 14px; color: var(--ic-navy-900); padding: 16px 18px; border-bottom: 1px solid var(--ic-border-1); }
.ic-catalog .pt-filter .list-group,
.ic-catalog .pt-filter .list-group-item { border: none; box-shadow: none; margin: 0; padding-left: 0; padding-right: 0; background: transparent; }

/* category tree (module_category в column-left) */
.ic-catalog .ic-cat-tree { padding: 8px; display: flex; flex-direction: column; gap: 1px; }
.ic-catalog .ic-cat-link { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 9px 12px; border-radius: var(--ic-r-sm); color: var(--ic-fg-2); text-decoration: none; font-size: 13px; transition: background var(--ic-fast), color var(--ic-fast); }
.ic-catalog .ic-cat-link:hover { background: var(--ic-accent-tint); color: var(--ic-accent); }
.ic-catalog .ic-cat-link.is-active { background: var(--ic-accent); color: #fff; font-weight: 600; }
.ic-catalog .ic-cat-link .ic-cnt { font-size: 11px; color: var(--ic-fg-4); font-variant-numeric: tabular-nums; }
.ic-catalog .ic-cat-link:hover .ic-cnt { color: var(--ic-accent); }
.ic-catalog .ic-cat-link.is-active .ic-cnt { color: rgba(255,255,255,.8); }

/* ---------- PRICE FILTER — jQuery UI slider (#slider-price) ---------- */
.ic-catalog .filter-price { padding: 16px 18px 18px; }
.ic-catalog .filter-price .ic-fgroup-head { margin-bottom: 16px; }
.ic-catalog #slider-price.ui-slider { position: relative; height: 4px; background: var(--ic-border-2); border: none; border-radius: var(--ic-r-pill); margin: 8px 9px 18px; }
.ic-catalog #slider-price .ui-slider-range { position: absolute; top: 0; height: 100%; background: var(--ic-accent); border-radius: var(--ic-r-pill); }
.ic-catalog #slider-price .ui-slider-handle { position: absolute; top: 50%; width: 18px; height: 18px; margin-left: -9px; transform: translateY(-50%); background: #fff; border: 2px solid var(--ic-accent); border-radius: 50%; cursor: grab; box-shadow: var(--ic-shadow-1); outline: none; }
.ic-catalog #slider-price .ui-slider-handle:active { cursor: grabbing; }
.ic-catalog #slider-price .ui-slider-handle:focus { box-shadow: 0 0 0 4px var(--ic-accent-tint); }
.ic-catalog .ic-price-inputs { display: flex; align-items: center; gap: 10px; }
.ic-catalog .input-price { flex: 1; display: flex; align-items: center; gap: 6px; height: 40px; padding: 0 12px; border: 1px solid var(--ic-border-2); border-radius: var(--ic-r-sm); background: var(--ic-gray-50); }
.ic-catalog .input-price:focus-within { border-color: var(--ic-accent); background: #fff; box-shadow: 0 0 0 3px var(--ic-accent-tint); }
.ic-catalog .input-price label { font-size: 11px; color: var(--ic-fg-4); font-family: var(--ic-font-display); font-weight: 600; }
.ic-catalog .input-price input { flex: 1; min-width: 0; border: none; outline: none; background: transparent; font-family: var(--ic-font-display); font-weight: 700; font-size: 14px; color: var(--ic-ink); }
.ic-catalog .ic-price-dash { color: var(--ic-border-2); }

/* ---------- ATTRIBUTE GROUPS (.filter-attribute-container / .a-filter) ---------- */
.ic-catalog .filter-attribute-container { padding: 14px 18px; border-top: 1px solid var(--ic-border-1); }
.ic-catalog .ic-fgroup-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-family: var(--ic-font-display); font-weight: 700; font-size: 13px; color: var(--ic-navy-900); margin-bottom: 10px; cursor: pointer; user-select: none; }
.ic-catalog .ic-fgroup-head .ic-fchev { color: var(--ic-fg-4); display: inline-flex; transition: transform var(--ic-fast); }
/* Сворачивание групп фильтра: тогл .is-collapsed навешивает ic.js (делегировано, переживает ajax) */
.ic-catalog .filter-attribute-container.is-collapsed .ic-fopts { display: none; }
.ic-catalog .filter-attribute-container.is-collapsed .ic-fgroup-head .ic-fchev { transform: rotate(-90deg); }
/* ценовой блок не сворачивается — у его заголовка нет шеврона */
.ic-catalog .filter-price .ic-fgroup-head { cursor: default; }

.ic-catalog .ic-fopts { display: flex; flex-direction: column; gap: 2px; }
/* опция = ссылка темы <a class="a-filter add-filter">; рисуем как чекбокс-строку */
.ic-catalog .a-filter {
  display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: var(--ic-r-sm);
  color: var(--ic-fg-2); text-decoration: none; font-size: 13px; cursor: pointer;
  transition: background var(--ic-fast), color var(--ic-fast);
}
.ic-catalog .a-filter:hover { background: var(--ic-accent-tint); color: var(--ic-accent); }
.ic-catalog .a-filter::before {
  content: ""; flex-shrink: 0; width: 18px; height: 18px; border-radius: 5px;
  border: 1.5px solid var(--ic-border-2); background: #fff;
  background-position: center; background-repeat: no-repeat; transition: all var(--ic-fast);
}
.ic-catalog .a-filter:hover::before { border-color: var(--ic-accent); }
.ic-catalog .a-filter .ic-lbl { flex: 1; }
.ic-catalog .a-filter .ic-cnt { font-size: 11px; color: var(--ic-fg-4); font-variant-numeric: tabular-nums; }
/* выбранная опция (тема вешает класс selected/active на .a-filter) */
.ic-catalog .a-filter.selected,
.ic-catalog .a-filter.active { color: var(--ic-accent); font-weight: 600; background: var(--ic-accent-tint); }
.ic-catalog .a-filter.selected::before,
.ic-catalog .a-filter.active::before {
  background-color: var(--ic-accent); border-color: var(--ic-accent);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");
}

/* aside promo (own prefix) */
.ic-catalog .ic-aside-promo { background: var(--ic-navy-900); color: #fff; border-radius: var(--ic-r-md); padding: 22px 20px; }
.ic-catalog .ic-aside-promo h4 { color: #fff; font-size: 16px; font-weight: 700; margin-bottom: 8px; }
.ic-catalog .ic-aside-promo p { font-size: 13px; color: rgba(255,255,255,.78); line-height: 1.55; margin-bottom: 16px; }

/* mobile sidebar toggle hooks (.show-sidebar — JS темы) */
.ic-catalog .ic-filter-trigger { display: none; }
.ic-catalog .ic-aside-close { display: none; }

/* =============================================================
   TOOLBAR — скин готовых элементов (#input-sort/#input-limit/вид)
   ============================================================= */
.ic-catalog .ic-toolbar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  background: #fff; border: 1px solid var(--ic-border-1); border-radius: var(--ic-r-md);
  padding: 12px 16px; margin-bottom: 16px;
  justify-content: space-between;
}
.ic-catalog .ic-toolbar .ic-results { font-size: 13px; color: var(--ic-fg-3); margin-right: auto; }
.ic-catalog .ic-toolbar .ic-results b { color: var(--ic-navy-900); }
.ic-catalog .ic-tb-group { display: flex; align-items: center; gap: 8px; }
.ic-catalog .ic-tb-group > .control-label,
.ic-catalog .ic-tb-group > label { font-size: 12px; color: var(--ic-fg-3); font-weight: 500; margin: 0;white-space: nowrap;}
/* селекты темы по id (НЕ .form-control — оно утечёт) */
.ic-catalog #input-sort, .ic-catalog #input-limit {
  height: 38px; padding: 0 32px 0 12px; border: 1px solid var(--ic-border-2); border-radius: var(--ic-r-sm);
  background-color: var(--ic-gray-50); color: var(--ic-ink); font-family: var(--ic-font-display);
  font-weight: 600; font-size: 13px; cursor: pointer; -webkit-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%237B8A98' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
.ic-catalog #input-sort:focus, .ic-catalog #input-limit:focus { outline: none; border-color: var(--ic-accent); box-shadow: 0 0 0 3px var(--ic-accent-tint); }
.ic-catalog #input-limit { padding-right: 30px; }

/* вид список/сетка — кнопки темы (#grid-view/#list-view, category_view.changeView) */
.ic-catalog .btn-list-grid { display: inline-flex; gap: 4px; background: var(--ic-gray-100); border-radius: var(--ic-r-sm); padding: 3px; }
.ic-catalog #grid-view, .ic-catalog #list-view {
  width: 34px; height: 32px; border: none; border-radius: 5px; background: transparent; color: var(--ic-fg-3);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer; transition: all var(--ic-fast);
}
.ic-catalog #grid-view:hover, .ic-catalog #list-view:hover { color: var(--ic-navy-900); }
.ic-catalog #grid-view.active, .ic-catalog #list-view.active { background: #fff; color: var(--ic-accent); box-shadow: var(--ic-shadow-1); }

/* активные фильтры-чипы (own prefix) */
.ic-catalog .ic-active-filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.ic-catalog .ic-active-filters .ic-af-lead { font-size: 12px; color: var(--ic-fg-3); font-weight: 600; }
.ic-catalog .ic-af-chip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 6px 0 12px; border-radius: var(--ic-r-pill); background: var(--ic-accent-tint); color: var(--ic-accent); font-size: 12px; font-weight: 600; }
.ic-catalog .ic-af-chip button { border: none; background: transparent; color: var(--ic-accent); cursor: pointer; display: inline-flex; padding: 4px; border-radius: 50%; }
.ic-catalog .ic-af-chip button:hover { background: rgba(14,122,196,.15); }
.ic-catalog .ic-af-clear { border: none; background: transparent; color: var(--ic-fg-3); font-size: 12px; cursor: pointer; text-decoration: underline; }
.ic-catalog .ic-af-clear:hover { color: var(--ic-accent); }

/* =============================================================
   LISTING — статичный грид (.product-items / .product-layout)
   Карточка .product-item стилизована в ic-theme.css.
   ============================================================= */
.ic-catalog .ic-listing { position: relative; }
/* flex-wrap на контейнере листинга (это .row.product-items) — лечит
   неровную высоту float-колонок Bootstrap: ряды выравниваются по высоте.
   .product-items — ajax-хук темы, не переименовываем; ajax-перерисовка ок. */
.ic-catalog .product-items { display: flex; flex-wrap: wrap; }
.ic-catalog .product-layout { margin-bottom: 16px; display: flex; }
.ic-catalog .product-layout > .grid-style,
.ic-catalog .product-layout > .product-item { width: 100%; }

/* ajax-загрузчик темы поверх грида */
.ic-catalog .ajax-loader { position: absolute; inset: 0; background: rgba(255,255,255,.7); display: none; align-items: center; justify-content: center; z-index: 5; border-radius: var(--ic-r-md); }
.ic-catalog .ajax-loader.is-active { display: flex; }

/* ---- LIST VIEW (тема добавляет .product-list на .product-layout) ---- */
.ic-catalog .product-layout.product-list { width: 100%; }
@media (min-width: 768px) {
  .ic-catalog .product-layout.product-list .product-item { flex-direction: row; align-items: stretch; }
  .ic-catalog .product-layout.product-list .product-item .image { width: 240px; flex-shrink: 0; aspect-ratio: auto; }
  .ic-catalog .product-layout.product-list .product-item .caption { padding: 20px 22px; justify-content: center; }
  .ic-catalog .product-layout.product-list .product-item .caption h4 { font-size: 16px; min-height: 0; }
  .ic-catalog .product-layout.product-list .product-item .button-group { position: static; margin-top: 14px; }
  .ic-catalog .product-layout.product-list .product-item .button-group .inner { flex-direction: row; }
  .ic-catalog .product-layout.product-list .product-item .button-group button { opacity: 1; transform: none; }
}

/* =============================================================
   PAGINATION — скин поверх сгенерированного OC (.pagination)
   ============================================================= */
.ic-catalog .ic-pagination-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-top: 28px; }
.ic-catalog .pagination { display: inline-flex; gap: 4px; margin: 0; padding: 0; list-style: none; }
.ic-catalog .pagination > li > a,
.ic-catalog .pagination > li > span {
  display: inline-flex; align-items: center; justify-content: center; min-width: 38px; height: 38px; padding: 0 10px;
  border: 1px solid var(--ic-border-1); border-radius: var(--ic-r-sm); background: #fff; color: var(--ic-fg-2);
  font-family: var(--ic-font-display); font-weight: 600; font-size: 13px; text-decoration: none; transition: all var(--ic-fast);
}
.ic-catalog .pagination > li > a:hover { border-color: var(--ic-accent); color: var(--ic-accent); }
.ic-catalog .pagination > li.active > span,
.ic-catalog .pagination > li.active > a { background: var(--ic-accent); border-color: var(--ic-accent); color: #fff; }
.ic-catalog .ic-results-text { font-size: 12px; color: var(--ic-fg-3); }

/* =============================================================
   RESPONSIVE
   ============================================================= */
@media (max-width: 991px) {
  .ic-catalog .ic-toolbar .ic-results { width: 100%; margin: 0 0 4px; }
}
@media (max-width: 767px) {
  .ic-catalog .ic-filter-trigger {
    display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 16px;
    border: 1px solid var(--ic-border-2); border-radius: var(--ic-r-sm); background: #fff;
    font-family: var(--ic-font-display); font-weight: 600; font-size: 13px; color: var(--ic-navy-900); cursor: pointer;
  }
  /* off-canvas сайдбар; тема переключает класс .show-sidebar */
  .ic-catalog .ic-aside,
  .ic-catalog #column-left {
    position: fixed; top: 0; left: 0; bottom: 0; width: 320px; max-width: 88vw; z-index: 1100;
    background: var(--ic-gray-50); padding: 16px; overflow-y: auto; transform: translateX(-100%);
    transition: transform var(--ic-base) var(--ic-ease); box-shadow: var(--ic-shadow-2);
  }
  .ic-catalog .ic-aside.show-sidebar,
  .ic-catalog #column-left.show-sidebar { transform: none; }
  .ic-catalog .ic-aside-close { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; margin-left: auto; margin-bottom: 8px; border: none; background: var(--ic-gray-100); border-radius: 50%; color: var(--ic-fg-2); cursor: pointer; }
  .ic-catalog .ic-aside-scrim { display: none; position: fixed; inset: 0; background: rgba(11,40,64,.45); z-index: 1099; }
  .ic-catalog .ic-aside-scrim.is-open { display: block; }
}
