/**
 * BIOMER Catalog Styles (v2.8.8)
 *
 * ИЗМЕНЕНИЯ v2.8.8 (08.10.2026): плашка «Все отрасли …» под тулбаром каталога
 *                    (.ind-quickfilter → .ind-filter) — перенос блока отраслей
 *                    с главной; клик фильтрует сетку по отрасли через AJAX.
 * ИЗМЕНЕНИЯ v2.8.7 (этап 3 аудита): CTA «Получить КП» в Hero каталога
 *                    (.hero-cta → /contacts/) + липкая нижняя панель на моб.
 *                    ≤767px (.mobile-cta-bar, включается JS-ом, когда Hero-кнопка
 *                    ушла из вида; body.biomer-cta-visible даёт отступ снизу).
 * ИЗМЕНЕНИЯ v2.8.0: аккордеон сайдбара — hover для десктопа, плавная анимация раскрытия,
 *                    курсор-указатель на группах (поведение старого сайта / Smart Menus).
 * ИЗМЕНЕНИЯ v2.7.0: иерархические группы категорий (parent → children) в сайдбаре
 * ИЗМЕНЕНИЯ v2.6.0: sidebar filters → category links
 * 
 * Вынесено из header-shop.php для:
 * - Единой системы стилей
 * - Корректного кэширования браузером
 * - Возможности редактирования через FTP
 * 
 * Используется на: /production/, /product-category/*, /library/
 */

:root {
    --biomer-blue: #1e5aa8;
    --biomer-blue-dark: #154380;
    --biomer-blue-light: #e8f0fb;
    --biomer-red: #d93636;
    --biomer-green: #2ea65f;
    --biomer-orange: #f59e0b;
    --biomer-text: #1a1a1a;
    --biomer-text-muted: #475569;
    --biomer-border: #e5e7eb;
    --biomer-bg: #f8f9fb;
    --biomer-white: #ffffff;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.05);
    --shadow-md: 0 4px 12px rgba(0,0,0,.08);
    --shadow-lg: 0 10px 30px rgba(0,0,0,.12);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--biomer-bg);
    color: var(--biomer-text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.container { max-width: 1400px; margin: 0 auto; padding: 0 24px; }

svg:not([width]):not([height]) { width: 24px; height: 24px; }

/* ===== BREADCRUMBS & PAGE TITLE ===== */
.breadcrumbs { padding: 16px 0; font-size: 13px; color: var(--biomer-text-secondary); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.breadcrumbs a { color: var(--biomer-text-secondary); text-decoration: none; }
.breadcrumbs a:hover { color: var(--biomer-blue); }
.breadcrumbs .sep { opacity: .5; }
.breadcrumbs .current { color: var(--biomer-text); font-weight: 500; }
.page-title-section { padding: 24px 0 32px; }
.page-title-section h1 { font-size: 36px; font-weight: 800; margin-bottom: 8px; color: var(--biomer-text); }
.page-subtitle { color: var(--biomer-text-secondary); font-size: 15px; }
.page-subtitle strong { color: var(--biomer-blue); }

/* ===== CTA «ПОЛУЧИТЬ КП» (v2.8.7, этап 3 аудита) =====
   Кнопка в Hero каталога (все архивы) + липкая панель на мобильных.
   Цель — /contacts/ (страница контактов, там же форма и телефоны). */
.hero-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 48px;
    padding: 12px 28px;
    margin-top: 20px;
    background: var(--biomer-blue);
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    text-decoration: none;
    border-radius: 10px;
    box-shadow: var(--shadow-md);
    transition: background .2s ease, transform .2s ease;
}
.hero-cta:hover,
.hero-cta:focus-visible {
    background: var(--biomer-blue-dark);
    color: #fff;
    transform: translateY(-1px);
}

/* Липкая нижняя панель — только мобильные ≤767px.
   Панель выезжает (JS переключает body.biomer-cta-visible), когда Hero-кнопка
   ушла из вида — не перекрывает контент в начале страницы. */
.mobile-cta-bar {
    display: none;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 997;
    align-items: center;
    gap: 10px;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px));
    background: rgba(255, 255, 255, .97);
    box-shadow: 0 -6px 20px rgba(0, 0, 0, .14);
    transform: translateY(110%);
    transition: transform .25s ease;
}
.mobile-cta-bar .hero-cta {
    flex: 1;
    margin-top: 0;
    min-height: 46px;
    padding: 10px 16px;
    font-size: 15px;
}
.mobile-cta-call {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 46px;
    height: 46px;
    border: 1px solid var(--biomer-border);
    border-radius: 10px;
    background: #fff;
    color: var(--biomer-blue);
}
.mobile-cta-call svg { width: 22px; height: 22px; }

@media (max-width: 767px) {
    .mobile-cta-bar { display: flex; }
    body.biomer-cta-visible .mobile-cta-bar { transform: translateY(0); }
    body.biomer-cta-visible { padding-bottom: 68px; }
    .page-title-section .hero-cta { width: 100%; }
}

/* ===== CATALOG LAYOUT ===== */
.catalog-layout { display: grid; grid-template-columns: 280px 1fr; gap: 24px; padding-bottom: 64px; align-items: start; }

/* Desktop >=1200px: explicit 3 columns for products grid */
@media (min-width: 1200px) {
  #biomer-catalog-page .biomer-products-grid {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 24px !important;
  }
}

/* Tablet 768-1199px: sidebar is drawer, full-width content */
@media (min-width: 768px) and (max-width: 1199px) {
  #biomer-catalog-page .biomer-products-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)) !important;
    gap: 20px !important;
  }
}

/* ==== SIDEBAR: CATEGORIES (v2.6.0) ==== */
.biomer-sidebar { background: var(--biomer-white); border-radius: 12px; padding: 24px; height: fit-content; position: sticky; top: 90px; border: 1px solid var(--biomer-border); box-shadow: var(--shadow-sm); max-height: calc(100vh - 110px); overflow-y: auto; }
.sidebar-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; padding-bottom: 16px; border-bottom: 1px solid var(--biomer-border); }
.sidebar-header h3 { font-size: 18px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.sidebar-header svg { width: 20px; height: 20px; color: var(--biomer-blue); }
.biomer-filter-form-hidden { display: none !important; }
.biomer-cats-nav { padding: 4px 8px 12px; }
.biomer-cats-list { display: flex; flex-direction: column; gap: 2px; list-style: none; margin: 0; padding: 0; }
.biomer-category-link { display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px 10px; border-radius: 8px; text-decoration: none; color: var(--biomer-text);
  font-size: 14px; line-height: 1.3; transition: background .15s ease, color .15s ease; }
.biomer-category-link:hover { background: var(--biomer-blue-light); color: var(--biomer-blue); }
.biomer-category-link .cat-name { flex: 1 1 auto; }
.biomer-category-link .cat-count { flex: 0 0 auto; background: var(--biomer-bg);
  color: var(--biomer-text-secondary); border-radius: 10px; font-size: 12px; padding: 1px 8px; }
.biomer-cat-item.is-active > .biomer-category-link { background: var(--biomer-blue-light);
  color: var(--biomer-blue); font-weight: 600; box-shadow: inset 3px 0 0 var(--biomer-blue); }
.biomer-cat-item.is-active .cat-count { background: var(--biomer-blue-light); color: var(--biomer-blue); }

/* ==== CATEGORY GROUPS (v2.7.0 → v2.8.0) ==== */
.biomer-cats-top-level { display: flex; flex-direction: column; gap: 4px; }
.biomer-cat-group { border-radius: 8px; }
.biomer-cat-group-toggle { position: relative; padding-right: 28px; font-weight: 600; cursor: pointer; }
.biomer-cat-group-toggle:hover { background: var(--biomer-blue-light); color: var(--biomer-blue); }
.biomer-cat-group .cat-arrow {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%) rotate(-45deg);
  width: 7px; height: 7px; border-right: 2px solid var(--biomer-text-muted);
  border-bottom: 2px solid var(--biomer-text-muted); transition: transform .3s ease; flex: none;
}
.biomer-cat-group:hover > .biomer-cat-group-toggle,
.biomer-cat-group.open > .biomer-cat-group-toggle { background: var(--biomer-blue-light); color: var(--biomer-blue); }
.biomer-cat-group.open > .biomer-cat-group-toggle .cat-arrow { transform: translateY(-50%) rotate(45deg); }
.biomer-cat-group-children {
  display: none; flex-direction: column; gap: 2px;
  padding: 4px 0 6px 14px; margin: 0 0 0 10px; list-style: none;
  border-left: 2px solid var(--biomer-border);
}
.biomer-cat-group.open > .biomer-cat-group-children { display: flex; animation: biomerCatFade .18s ease; }
@keyframes biomerCatFade {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.biomer-cat-group-children .biomer-category-link { font-size: 13px; padding: 6px 10px 6px 12px; }
.biomer-cat-group.is-active > .biomer-cat-group-toggle { color: var(--biomer-blue); }
.biomer-cat-group.is-active:not(.open) > .biomer-cat-group-toggle .cat-arrow { border-color: var(--biomer-blue); }

.sidebar-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 999; opacity: 0; visibility: hidden; transition: opacity .3s ease, visibility .3s ease; }
.sidebar-overlay.show { opacity: 1; visibility: visible; }
.catalog-content { min-width: 0; width: 100%; }

/* ===== TOOLBAR ===== */
.catalog-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; background: var(--biomer-white); padding: 14px 18px; border-radius: 12px; border: 1px solid var(--biomer-border); }
.products-count { font-size: 14px; color: var(--biomer-text-muted); }
.products-count strong { color: var(--biomer-text); font-weight: 700; }
.toolbar-right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.sort-select { padding: 8px 12px; border: 1px solid var(--biomer-border); border-radius: 8px; font-family: inherit; font-size: 14px; cursor: pointer; background: white; }
.sort-select:focus { outline: none; border-color: var(--biomer-blue); }
.per-page-wrapper { display: flex; align-items: center; gap: 6px; }
.per-page-label { font-size: 13px; color: var(--biomer-text-muted); white-space: nowrap; }
.view-toggle { display: flex; gap: 4px; }
.view-btn { width: 44px; height: 44px; border: 1px solid var(--biomer-border); background: white; border-radius: 8px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all .2s; }
.view-btn.active, .view-btn:hover { background: var(--biomer-blue); border-color: var(--biomer-blue); }
.view-btn.active svg, .view-btn:hover svg { color: white; }
.view-btn svg { width: 16px; height: 16px; color: var(--biomer-text-muted); }

.toolbar-search { position: relative; display: flex; align-items: center; flex: 1; min-width: 180px; max-width: 340px; }
.toolbar-search-icon { position: absolute; left: 12px; width: 18px; height: 18px; color: var(--biomer-text-muted); pointer-events: none; transition: color .2s; }
.toolbar-search:focus-within .toolbar-search-icon { color: var(--biomer-blue); }
.toolbar-search input { width: 100%; height: 40px; padding: 0 40px 0 40px; border: 1px solid var(--biomer-border); border-radius: 8px; font-family: inherit; font-size: 14px; background: var(--biomer-bg); transition: all .2s; }
.toolbar-search input:focus { outline: none; border-color: var(--biomer-blue); background: white; }
.toolbar-search-clear { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); width: 24px; height: 24px; border: none; background: transparent; cursor: pointer; color: var(--biomer-text-muted); font-size: 16px; line-height: 1; border-radius: 50%; display: flex; align-items: center; justify-content: center; transition: all .2s; }
.toolbar-search-clear:hover { background: var(--biomer-border); color: var(--biomer-text); }
.toolbar-search-suggestions { position: absolute; top: calc(100% + 6px); right: 0; left: auto; min-width: min(440px, 90vw); background: white; border: 1px solid var(--biomer-border); border-radius: 12px; box-shadow: var(--shadow-lg); z-index: 100; max-height: 360px; overflow-y: auto; display: none; }
.toolbar-search-suggestions.active { display: block; }
.suggestion-item { display: flex; align-items: center; gap: 12px; padding: 10px 14px; cursor: pointer; border-bottom: 1px solid var(--biomer-border); transition: background .15s; }
.suggestion-item:last-child { border-bottom: none; }
.suggestion-item:hover, .suggestion-item.active { background: var(--biomer-blue-light); }
.suggestion-thumb { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; background: var(--biomer-bg); flex-shrink: 0; }
.suggestion-info { flex: 1; min-width: 0; }
.suggestion-name { font-size: 13px; font-weight: 500; color: var(--biomer-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.suggestion-meta { display: flex; align-items: center; flex-wrap: nowrap; gap: 8px; margin-top: 2px; font-size: 12px; color: var(--biomer-text-muted); white-space: nowrap; }
.suggestion-sku { font-size: 12px; color: var(--biomer-text-muted); white-space: nowrap; }
.suggestion-price { font-size: 13px; font-weight: 700; color: var(--biomer-blue); white-space: nowrap; }

@media (max-width: 640px) {
    .toolbar-search-suggestions { left: 0; right: auto; width: 100%; min-width: 0; }
    .toolbar-search-suggestions .suggestion-thumb { display: none; }
    .suggestion-item { gap: 10px; padding: 9px 12px; }
    .suggestion-thumb { width: 34px; height: 34px; }
    .suggestion-name { font-size: 12.5px; }
    .suggestion-meta { font-size: 11.5px; gap: 5px; }
    .suggestion-price { font-size: 12px; }
}
.suggestion-empty, .suggestion-loading { padding: 20px; text-align: center; font-size: 13px; color: var(--biomer-text-muted); }

/* ===== PRODUCTS GRID ===== */
.biomer-products-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px; }
.biomer-products-grid.loading { opacity: .4; pointer-events: none; }
/* ===== LIST VIEW ===== */
#biomer-catalog-page .biomer-products-grid.list-view { grid-template-columns: 1fr !important; }
#biomer-catalog-page .biomer-products-grid.list-view .product-card { flex-direction: row !important; align-items: flex-start; text-align: left; gap: 16px; }
#biomer-catalog-page .biomer-products-grid.list-view .product-image-wrapper { width: 100px !important; max-width: 100px !important; height: 100px !important; padding-bottom: 0 !important; flex-shrink: 0; margin-right: 0; }
#biomer-catalog-page .biomer-products-grid.list-view .product-image-wrapper img { position: static !important; width: 100% !important; height: 100% !important; }
#biomer-catalog-page .biomer-products-grid.list-view .product-info { flex: 1 1 0 !important; min-width: 0; }
#biomer-catalog-page .biomer-products-grid.list-view .product-footer { flex-shrink: 0; display: flex; align-items: center; align-self: center !important; height: fit-content; margin-top: 0 !important; }


/* ===== PRODUCT CARD ===== */
.product-card { background: var(--biomer-white); border: 1px solid var(--biomer-border); border-radius: 12px; overflow: hidden; transition: transform .2s, box-shadow .2s; display: flex; flex-direction: column; }
.product-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.product-image-wrapper { position: relative; aspect-ratio: 1; background: linear-gradient(135deg, var(--biomer-bg) 0%, #eef1f5 100%); overflow: hidden; }
.product-image-wrapper img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s; }
.product-card:hover .product-image-wrapper img { transform: scale(1.05); }
.product-placeholder { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font-size: 48px; }
.product-badges { position: absolute; top: 12px; left: 12px; display: flex; flex-direction: column; gap: 6px; z-index: 2; }
.badge { padding: 4px 10px; border-radius: 6px; font-size: 11px; font-weight: 700; color: white; }
.badge-sale { background: var(--biomer-red); }
.badge-hit { background: var(--biomer-orange); }
.badge-recommended { background: var(--biomer-green); }
.badge-new { background: var(--biomer-blue); }
.product-actions { position: absolute; top: 12px; right: 12px; display: flex; flex-direction: column; gap: 6px; z-index: 2; opacity: 0; transform: translateX(8px); transition: opacity .2s, transform .2s; }
.product-card:hover .product-actions { opacity: 1; transform: translateX(0); }
.action-btn { width: 44px; height: 44px; border-radius: 50%; border: none; background: white; box-shadow: var(--shadow-md); cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all .2s; color: var(--biomer-text-muted); }
.action-btn:hover { background: var(--biomer-blue-light); color: var(--biomer-blue); }
.action-btn.active { background: var(--biomer-blue); color: white; }

/* ========================================================
   ПАГИНАЦИЯ КАТАЛОГА (восстановлено 2026-09-18: блок был
   утрачен при обрезке catalog.css 16.09.2026)
   ============================================= */

/* ========================================================
   MOBILE FILTER BUTTON
   Hidden on desktop (>=1200px), visible on tablet/mobile
   ======================================================== */
.mobile-filter-btn {
  display: none;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 16px;
  margin: 0 0 16px;
  border: 1.5px solid var(--biomer-border);
  border-radius: 10px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  color: var(--biomer-text);
  background: var(--biomer-white);
  cursor: pointer;
  transition: border-color .15s ease, color .15s ease, background .15s ease;
}
.mobile-filter-btn:hover {
  border-color: var(--biomer-blue);
  color: var(--biomer-blue);
}
.mobile-filter-btn svg {
  width: 18px;
  height: 18px;
  flex: none;
}
.mobile-filter-btn .filter-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 99px;
  background: var(--biomer-red);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}

/* Tablet & Mobile (<=1199px): show filter button */
@media (max-width: 1199px) {
  .mobile-filter-btn {
    display: inline-flex;
  }
}


/* ========================================================
   FIXES: Fonts, List View, Horizontal View
   ======================================================== */

@font-face {
  font-family: 'Inter';
  font-display: swap;
}

html {
  font-display: swap;
}

@media (min-width: 768px) {
  #biomer-catalog-page .biomer-products-grid.list-view .product-image-wrapper {
    width: 140px !important;
    max-width: 140px !important;
    height: 140px !important;
  }
  
  #biomer-catalog-page .biomer-products-grid.list-view .product-price-row {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    width: 100% !important;
  }
  
  #biomer-catalog-page .biomer-products-grid.list-view .product-stock {
    white-space: nowrap !important;
    flex-shrink: 0 !important;
  }
  
  #biomer-catalog-page .biomer-products-grid.list-view .product-footer {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    width: 100% !important;
    margin-top: 8px !important;
  }
  
  #biomer-catalog-page .biomer-products-grid.list-view .product-info {
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
  }
  
  #biomer-catalog-page .biomer-products-grid.list-view .product-price-row {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 12px !important;
    width: 100% !important;
    margin-bottom: 12px !important;
  }
  
  #biomer-catalog-page .biomer-products-grid.list-view .product-footer {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    width: 100% !important;
  }
}

.biomer-cat-item,
.nav-menu a,
.biomer-category-link,
.product-title a,
.product-price,
.product-stock,
.btn-add-cart,
.btn-request-price,
.biomer-section-title,
.page-title-section h1,
.page-subtitle {
  font-display: swap;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

#biomer-catalog-page .product-image-wrapper {
  min-height: 220px;
}

#biomer-catalog-page .product-image-wrapper img {
  object-fit: cover;
  transition: transform 0.3s ease;
}

/* ===== ПЛАШКА ОТРАСЛЕЙ ПОД ТУЛБАРОМ (v2.8.8) =====
   Тот же вид, что у блока отраслей на главной, но:
   - счётчики на кнопках = количество ТОВАРОВ в отрасли (сумма по подотраслям),
     чтобы совпадали с «Найдено» после клика;
   - кнопки шлют AJAX-фильтр (catalog.js → biomer_filter, параметр ind),
     а не переключают карточки, как на главной. */
.ind-quickfilter {
  margin: 14px 0 4px;
}

.ind-quickfilter .industry-filters {
  margin-bottom: 0;
}

.ind-quickfilter .ind-filter {
  padding: 10px 18px;
  border: 1px solid var(--biomer-border);
  border-radius: 8px;
  background: var(--biomer-white);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  color: var(--biomer-text-secondary);
  cursor: pointer;
  transition: all .2s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.ind-quickfilter .ind-filter:hover {
  border-color: var(--biomer-blue);
  color: var(--biomer-blue);
  background: var(--biomer-blue-light);
}

.ind-quickfilter .ind-filter.active {
  border-color: var(--biomer-blue);
  color: #fff;
  background: var(--biomer-blue);
}

.ind-quickfilter .ind-filter .f-count {
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 99px;
  background: var(--biomer-blue-light);
  color: var(--biomer-blue);
}

.ind-quickfilter .ind-filter.active .f-count {
  background: rgba(255, 255, 255, .2);
  color: #fff;
}

@media (max-width: 767px) {
  .ind-quickfilter .ind-filter {
    padding: 9px 14px;
    font-size: 13px;
  }
}
