/* ============================================================
   PRIORITTI — мобільні покращення UX, хвиля 1 (П1–П4)
   Вмикається лише на екранах ≤768px. Десктоп не зачіпається.
   Парний файл: prx-mobile.js
   Дата: 2026-07-16
   ============================================================ */

@media (max-width: 768px) {

  /* Щоб липкі панелі не перекривали контент/футер */
  body.prx-has-botnav { padding-bottom: 60px; }
  body.prx-has-actionbar { padding-bottom: 122px; } /* botnav 60 + actionbar 62 */

  /* -------- П1: нижня липка навігація -------- */
  .prx-botnav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 1040;
    display: flex; height: 60px;
    background: #fff; border-top: 1px solid #e6e2d8;
    box-shadow: 0 -2px 10px rgba(0,0,0,.06);
    -webkit-user-select: none; user-select: none;
  }
  .prx-botnav__item {
    flex: 1 1 0; display: flex; flex-direction: column; align-items: center;
    justify-content: center; gap: 2px; text-decoration: none;
    color: #4a4636; font-size: 11px; line-height: 1; padding: 6px 2px;
    background: none; border: 0; cursor: pointer;
  }
  .prx-botnav__item svg { width: 22px; height: 22px; stroke: #6b6552; fill: none; }
  .prx-botnav__item.is-active { color: #b8860b; }
  .prx-botnav__item.is-active svg { stroke: #b8860b; }
  .prx-botnav__badge {
    position: absolute; top: 4px; margin-left: 14px;
    min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px;
    background: #c0392b; color: #fff; font-size: 10px; line-height: 16px;
    text-align: center; font-weight: 600;
  }

  /* -------- П2: липка кнопка «Фільтр» + чипси -------- */
  /* НЕ sticky: липкий бар наїжджав на шапку і закривав огляд
     (скарга власника 16.07) — тепер звичайний блок над товарами */
  .prx-filterbar {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 10px; background: #faf8f3; border-bottom: 1px solid #e6e2d8;
    margin-bottom: 8px;
  }
  .prx-filterbtn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 14px; border: 1px solid #c9c2ad; border-radius: 22px;
    background: #fff; color: #4a4636; font-size: 14px; font-weight: 600;
    cursor: pointer; white-space: nowrap;
  }
  .prx-filterbtn svg { width: 16px; height: 16px; stroke: #6b6552; fill: none; }
  .prx-filterbtn .prx-filterbtn__n { color: #b8860b; }
  .prx-foundcount { font-size: 13px; color: #6b6552; margin-left: auto; white-space: nowrap; }

  .prx-chips { display: flex; gap: 6px; overflow-x: auto; padding: 8px 10px 2px;
    -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .prx-chips::-webkit-scrollbar { display: none; }
  .prx-chip {
    display: inline-flex; align-items: center; gap: 5px; flex: 0 0 auto;
    padding: 5px 10px; border-radius: 16px; background: #efe9db; color: #4a4636;
    font-size: 12.5px; white-space: nowrap;
  }
  .prx-chip button { border: 0; background: none; color: #8a8266; font-size: 15px;
    line-height: 1; cursor: pointer; padding: 0; }
  .prx-chips-clear { flex: 0 0 auto; align-self: center; font-size: 12.5px;
    color: #b8860b; text-decoration: underline; background: none; border: 0; cursor: pointer; }

  /* -------- V8: компактна шапка (2 ряди, еталон Rozetka) + товари одразу
     (запит власника 16.07: «шапка дуже велика, все зайве вниз») -------- */
  body { padding-top: 0 !important; }            /* 40px резерву під topline */
  .prx-promo { display: none !important; }        /* промо-рядок над шапкою */
  .prx-header .prx-util, .prx-header .prx-nav { display: none !important; }
  .prx-header .prx-main { padding: 6px 10px 8px !important; row-gap: 6px !important; align-items: center !important; }
  .prx-header .prx-main .prx-logo { order: 1; }
  .prx-header .prx-main .prx-actions { order: 2; margin-left: auto; }
  .prx-header .prx-actions .prx-phonewrap { display: none !important; } /* телефон дублює FAB */
  .prx-header .prx-main .prx-search { order: 3; flex: 1 1 100% !important; width: 100% !important; margin: 0 !important; }
  .prx-header .prx-search input { height: 40px !important; }
  .prx-header .prx-search button { padding: 6px 12px !important; }

  /* категорія: зайве вниз/компактно, щоб товари були одразу під пошуком */
  .prx-bc { padding: 6px 10px !important; font-size: 12px !important;
    flex-wrap: nowrap !important; overflow-x: auto !important;
    -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .prx-bc::-webkit-scrollbar { display: none; }
  .prx-bc a { white-space: nowrap; flex: 0 0 auto; }

  /* V8.1: шлях над фото — завжди 1 рядок (запит власника 17.07).
     Назва товару (останній span) — трикрапка; середні ланки JS згортає
     в кнопку «…» (класи prx-bc-hide / prx-bc-more / prx-bc--full). */
  .prx-bc svg { flex: 0 0 auto; }
  .prx-bc > span { flex: 0 1 auto; min-width: 48px; max-width: 60vw; white-space: nowrap;
    overflow: hidden; text-overflow: ellipsis; display: block; }
  .prx-bc .prx-bc-hide { display: none; }
  .prx-bc--full a.prx-bc-hide { display: inline-flex; }
  .prx-bc--full svg.prx-bc-hide { display: inline-block; }
  .prx-bc--full .prx-bc-more { display: none; }
  .prx-bc-more { border: 0; background: none; color: #8a8266; padding: 0 4px;
    font-size: 15px; line-height: 1; flex: 0 0 auto; cursor: pointer; }
  .prx-chero { padding: 8px 10px 4px !important; }
  .prx-chero .badges, .prx-chero p { display: none !important; } /* «200+ тендерів», «Безпечні матеріали», підзаголовок */
  .prx-chero h1 { font-size: 20px !important; margin: 0 !important; }
  .prx-cside { order: 2; } /* «Обладнуєте під ключ» — під сітку (.prx-clayout = grid, order діє) */
  .prx-ctool { padding: 4px 0 !important; margin: 0 !important; }
  .prx-ctool .cnt { display: none !important; } /* «Показано з 1 по 24…» */
  .prx-ctool .ctrls { display: flex; align-items: center; gap: 6px; flex-wrap: nowrap !important; }
  .prx-ctool .ctrls .grp { display: flex; align-items: center; gap: 4px; white-space: nowrap; flex: 1 1 auto; min-width: 0; }
  .prx-ctool .prx-sel { max-width: 100%; min-width: 0; flex: 1 1 auto; font-size: 13px; }

  /* -------- П12: автоховання липкої шапки при прокрутці вниз -------- */
  .prx-header.prx-autohide { transition: transform .25s ease; will-change: transform; }
  .prx-header.prx-header--hidden { transform: translateY(-100%); }

  /* Фільтр як висувна панель — ціль позначається класом у JS
     (.prx-filter-drawer), бо тема переносить фільтр між контейнерами */
  /* !important на геометрії: тема тримає фільтр в off-canvas #filter-mobile
     (240px, захований за лівим краєм margin'ом) — її правила специфічніші */
  .prx-filter-open .prx-filter-drawer {
    position: fixed !important; top: 0 !important; left: 0 !important; bottom: 0 !important;
    right: auto !important; width: 88% !important; max-width: 340px !important;
    height: auto !important; z-index: 1060 !important; background: #fff !important;
    overflow-y: auto !important; visibility: visible !important; display: block !important;
    box-shadow: 2px 0 16px rgba(0,0,0,.2); padding: 14px 14px 90px !important;
    transform: none !important; margin: 0 !important;
  }
  .prx-filter-backdrop {
    position: fixed; inset: 0; z-index: 1055; background: rgba(0,0,0,.4);
    opacity: 0; visibility: hidden; transition: opacity .2s;
  }
  .prx-filter-open .prx-filter-backdrop { opacity: 1; visibility: visible; }
  .prx-filter-apply {
    position: fixed; left: 0; bottom: 0; width: 88%; max-width: 340px; z-index: 1061;
    padding: 12px; background: #fff; border-top: 1px solid #e6e2d8;
  }
  .prx-filter-open .prx-filter-apply { display: block; }
  .prx-filter-apply button {
    width: 100%; padding: 12px; border: 0; border-radius: 8px;
    background: #b8860b; color: #fff; font-size: 15px; font-weight: 600; cursor: pointer;
  }
  .prx-filter-apply { display: none; }

  /* -------- П3: липка панель дій на картці товару -------- */
  .prx-actionbar {
    position: fixed; left: 0; right: 0; bottom: 60px; z-index: 1035;
    display: flex; align-items: center; gap: 10px;
    padding: 8px 12px; height: 62px; background: #fff;
    border-top: 1px solid #e6e2d8; box-shadow: 0 -2px 10px rgba(0,0,0,.08);
    transform: translateY(120%); transition: transform .22s ease;
  }
  body:not(.prx-has-botnav) .prx-actionbar { bottom: 0; }
  .prx-actionbar.is-visible { transform: translateY(0); }
  .prx-actionbar__price { font-size: 18px; font-weight: 700; color: #2f2c22; white-space: nowrap; }
  .prx-actionbar__btn {
    flex: 1 1 auto; text-align: center; padding: 13px 10px; border-radius: 8px;
    font-size: 15px; font-weight: 600; text-decoration: none; border: 0; cursor: pointer;
  }
  .prx-actionbar__btn--primary { background: #b8860b; color: #fff; }
  .prx-actionbar__btn--call { background: #2e7d32; color: #fff; }
  .prx-actionbar__btn--ghost { background: #fff; color: #b8860b; border: 1px solid #b8860b; }

  /* -------- П4: плаваюча B2B-кнопка «Менеджер/дзвінок» -------- */
  .prx-fab {
    position: fixed; right: 14px; bottom: 74px; z-index: 1038;
    width: 52px; height: 52px; border-radius: 50%;
    background: #2e7d32; box-shadow: 0 4px 14px rgba(0,0,0,.25);
    display: flex; align-items: center; justify-content: center; text-decoration: none;
  }
  .prx-fab svg { width: 26px; height: 26px; stroke: #fff; fill: none; }
  /* Коли видно actionbar на картці — FAB піднімаємо, щоб не накладались */
  body.prx-actionbar-visible .prx-fab { bottom: 138px; }
}

/* На десктопі всі мобільні елементи приховані */
@media (min-width: 769px) {
  .prx-botnav, .prx-filterbar, .prx-chips, .prx-actionbar, .prx-fab,
  .prx-filter-backdrop, .prx-filter-apply { display: none !important; }
}
