/* Витрина склада (/parts). Палитра и шрифты — те же, что у страниц машин
   (product_page.css), шапка — общий topbar.css. Свой файл, а не блок
   <style> внутри HTML: страница живая, её будут править, а искать стили
   внутри разметки неудобно. */

:root {
  --red:       #E63012;
  --red-dark:  #C42A0F;
  --black:     #111111;
  --dark:      #2A2A2A;
  --gray-700:  #4A4A4A;
  --gray-500:  #8A8A8A;
  --gray-300:  #D1D1D1;
  --gray-100:  #F3F3F3;
  --white:     #FFFFFF;
  --ok:        #1E7A4B;
  --font:      'DM Sans', system-ui, -apple-system, sans-serif;
  --mono:      'Space Mono', 'SF Mono', ui-monospace, monospace;
  --radius:    12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.06);
  --shadow-md: 0 6px 22px rgba(0,0,0,.10);
  --ease:      cubic-bezier(.25,.46,.45,.94);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { background: var(--white); color: var(--dark); font-family: var(--font); line-height: 1.5; }
.topbar { position: sticky; top: 0; z-index: 60; }

/* ── Каркас: поиск сверху, слева фильтры, справа корзина ──────────────── */
.ps-wrap { max-width: 1440px; margin: 0 auto; padding: 0 20px 64px; }

.ps-searchbar {
  position: sticky; top: 56px; z-index: 50; background: var(--white);
  padding: 16px 0 12px; border-bottom: 1px solid var(--gray-300);
}
.ps-searchrow { display: flex; gap: 10px; align-items: center; }
.ps-search {
  flex: 1; min-width: 0; padding: 13px 16px; font-size: 15px; font-family: var(--font);
  border: 1px solid var(--gray-300); border-radius: var(--radius-sm); outline: none;
  transition: border-color .15s var(--ease);
}
.ps-search:focus { border-color: var(--red); }
.ps-hint-dim { color: var(--gray-500); }
.ps-hint { font-size: 12.5px; color: var(--gray-500); margin-top: 7px; min-height: 18px; }
.ps-hint b { color: var(--dark); }
/* Подсказка «что ищем» — не украшение: одно поле принимает четыре разных
   вида запроса, и человек должен видеть, как система его поняла. */
.ps-mode {
  display: inline-block; font-family: var(--mono); font-size: 10.5px;
  text-transform: uppercase; letter-spacing: .06em; color: var(--red);
  border: 1px solid var(--red); border-radius: 3px; padding: 1px 6px; margin-right: 7px;
}

.ps-body { display: grid; grid-template-columns: 210px 1fr 300px; gap: 24px; padding-top: 20px; }

.ps-side { position: sticky; top: 150px; align-self: start; max-height: calc(100vh - 170px); overflow: auto; }
.ps-side h2, .ps-cart h2 {
  font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  color: var(--gray-500); margin-bottom: 10px;
}
.ps-cat {
  display: flex; justify-content: space-between; gap: 8px; width: 100%;
  padding: 7px 10px; margin-bottom: 3px; font: inherit; font-size: 13px;
  text-align: left; background: none; border: 1px solid transparent;
  border-radius: var(--radius-sm); cursor: pointer; color: var(--gray-700);
}
.ps-cat:hover { background: var(--gray-100); }
.ps-cat.on { background: var(--red); color: var(--white); border-color: var(--red); }
.ps-cat span { font-variant-numeric: tabular-nums; opacity: .7; font-size: 12px; }

/* ── Карточки ─────────────────────────────────────────────────────────── */
.ps-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.ps-card {
  display: flex; flex-direction: column; background: var(--white);
  color: inherit; text-decoration: none;
  border: 1px solid var(--gray-300); border-radius: var(--radius); overflow: hidden;
  transition: box-shadow .15s var(--ease), border-color .15s var(--ease);
}
.ps-card:hover { border-color: var(--gray-500); box-shadow: var(--shadow-md); }
.ps-card-img {
  width: 100%; aspect-ratio: 4/3; object-fit: contain; background: var(--gray-100);
  padding: 8px; cursor: zoom-in; display: block;
}
.ps-card-noimg {
  width: 100%; aspect-ratio: 4/3; background: var(--gray-100);
  display: flex; align-items: center; justify-content: center; font-size: 30px; opacity: .35;
}
.ps-card-body { padding: 11px 12px 12px; display: flex; flex-direction: column; flex: 1; gap: 6px; }
.ps-pn { font-family: var(--mono); font-size: 13px; font-weight: 700; color: var(--black); }
.ps-desc { font-size: 12.5px; color: var(--gray-700); line-height: 1.35; flex: 1; }
.ps-price { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }
.ps-price small { font-size: 11px; font-weight: 400; color: var(--gray-500); }
.ps-stock { font-size: 11.5px; font-weight: 600; }
.ps-stock.ok { color: var(--ok); }
.ps-stock.out { color: var(--gray-500); }
.ps-add {
  width: 100%; padding: 8px; font: inherit; font-size: 13px; font-weight: 600;
  color: var(--white); background: var(--red); border: 0; border-radius: var(--radius-sm);
  cursor: pointer; transition: background .15s var(--ease);
}
.ps-add:hover { background: var(--red-dark); }
.ps-add.in { background: var(--ok); }
.ps-times { font-size: 11px; color: var(--red); font-weight: 600; }

/* ── Корзина ──────────────────────────────────────────────────────────── */
.ps-cart {
  position: sticky; top: 150px; align-self: start; max-height: calc(100vh - 170px);
  display: flex; flex-direction: column;
  border: 1px solid var(--gray-300); border-radius: var(--radius); padding: 14px;
}
.ps-cart-toggle { display: none; }
.ps-cart-items { overflow: auto; flex: 1; margin: 0 -4px; padding: 0 4px; }
.ps-cart-empty { font-size: 13px; color: var(--gray-500); padding: 18px 0; text-align: center; }
.ps-ci { display: grid; grid-template-columns: 40px 1fr auto; gap: 9px; align-items: center;
         padding: 9px 0; border-bottom: 1px solid var(--gray-100); }
.ps-ci img { width: 40px; height: 40px; object-fit: contain; background: var(--gray-100); border-radius: 4px; }
.ps-ci-pn { font-family: var(--mono); font-size: 12px; font-weight: 700; }
.ps-ci-desc { font-size: 11px; color: var(--gray-500); line-height: 1.25; }
.ps-qty { display: flex; align-items: center; gap: 4px; }
.ps-qty button {
  width: 22px; height: 22px; font: inherit; font-size: 14px; line-height: 1;
  border: 1px solid var(--gray-300); background: var(--white); border-radius: 4px; cursor: pointer;
}
.ps-qty input {
  width: 34px; padding: 3px 2px; text-align: center; font: inherit; font-size: 12px;
  border: 1px solid var(--gray-300); border-radius: 4px; font-variant-numeric: tabular-nums;
}
.ps-cart-total { display: flex; justify-content: space-between; align-items: baseline;
                 padding: 12px 0 4px; border-top: 2px solid var(--black); margin-top: 8px; }
.ps-cart-total b { font-size: 20px; font-variant-numeric: tabular-nums; }
.ps-cart-note { font-size: 11px; color: var(--gray-500); margin-bottom: 10px; }
.ps-send {
  width: 100%; padding: 11px; font: inherit; font-size: 14px; font-weight: 700;
  color: var(--white); background: var(--black); border: 0; border-radius: var(--radius-sm); cursor: pointer;
}
.ps-send:disabled { background: var(--gray-300); cursor: default; }
.ps-clear { width: 100%; padding: 7px; margin-top: 6px; font: inherit; font-size: 12px;
            color: var(--gray-500); background: none; border: 0; cursor: pointer; }

/* ── Крупная карточка и увеличение фото ───────────────────────────────── */
.ps-modal {
  position: fixed; inset: 0; z-index: 200; background: rgba(17,17,17,.72);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.ps-modal[hidden] { display: none; }
.ps-modal-box {
  background: var(--white); border-radius: var(--radius); max-width: 940px; width: 100%;
  max-height: 90vh; overflow: auto; box-shadow: var(--shadow-md);
  display: grid; grid-template-columns: 1fr 1fr;
}
.ps-modal-media { background: var(--gray-100); display: flex; align-items: center; justify-content: center; padding: 20px; }
.ps-modal-media img { max-width: 100%; max-height: 60vh; object-fit: contain; cursor: zoom-in; }
.ps-modal-side { padding: 26px 28px; }
.ps-modal-side h3 { font-family: var(--mono); font-size: 22px; margin-bottom: 4px; }
.ps-modal-desc { font-size: 16px; color: var(--gray-700); margin-bottom: 18px; }
.ps-modal-row { display: flex; justify-content: space-between; padding: 7px 0; font-size: 14px;
                border-bottom: 1px solid var(--gray-100); }
.ps-modal-row b { font-variant-numeric: tabular-nums; }
.ps-modal-models { margin-top: 16px; display: flex; flex-wrap: wrap; gap: 5px; }
.ps-chip { font-size: 11.5px; background: var(--gray-100); border-radius: 999px; padding: 3px 9px; }
.ps-close {
  position: absolute; top: 18px; right: 22px; width: 36px; height: 36px; font-size: 22px;
  line-height: 1; color: var(--white); background: rgba(0,0,0,.4); border: 0;
  border-radius: 50%; cursor: pointer;
}
/* Второй уровень увеличения: фото во весь экран. Читать номер на литой
   детали иначе невозможно — на карточке кадр 210 px. */
.ps-lightbox { position: fixed; inset: 0; z-index: 300; background: rgba(0,0,0,.92);
               display: flex; align-items: center; justify-content: center; cursor: zoom-out; }
.ps-lightbox[hidden] { display: none; }
.ps-lightbox img { max-width: 96vw; max-height: 96vh; object-fit: contain; }

.ps-empty { padding: 48px 0; text-align: center; color: var(--gray-500); }
.ps-more { display: block; margin: 22px auto 0; padding: 10px 26px; font: inherit; font-size: 14px;
           background: var(--white); border: 1px solid var(--gray-300); border-radius: var(--radius-sm); cursor: pointer; }
.ps-section-h { font-size: 15px; font-weight: 700; margin: 22px 0 12px; }
.ps-section-h span { font-weight: 400; color: var(--gray-500); font-size: 13px; }
.ps-machine {
  background: var(--gray-100); border-left: 3px solid var(--red);
  border-radius: var(--radius-sm); padding: 14px 16px; margin-bottom: 6px;
}
.ps-machine b { font-size: 17px; }
.ps-machine div { font-size: 13px; color: var(--gray-700); margin-top: 3px; }

@media (max-width: 1180px) {
  .ps-body { grid-template-columns: 180px 1fr; }
  /* top:auto ОБЯЗАТЕЛЕН: в основном правиле стоит top:150px под колонку
     sticky, и у fixed-плашки он побеждал bottom — корзина прилипала к верху
     экрана и накрывала поиск с категориями (Allan, 2026-09-04: «на мобильном
     в запчастях корзина всё закрывает сверху»). */
  .ps-cart { position: fixed; top: auto; right: 16px; bottom: 16px; width: 320px;
             max-height: 70vh; background: var(--white); box-shadow: var(--shadow-md);
             z-index: 70; }
  .ps-cart h2 { display: flex; align-items: center; gap: 8px; margin: 0; cursor: pointer; }
  .ps-cart h2 #psCartCount { margin-right: auto; }
  .ps-cart-toggle { display: inline-block; font-size: 13px; line-height: 1;
                    transition: transform .15s ease; }
  .ps-cart[data-collapsed="1"] .ps-cart-toggle { transform: rotate(180deg); }
  .ps-cart[data-collapsed="1"] .ps-cart-items,
  .ps-cart[data-collapsed="1"] .ps-cart-total,
  .ps-cart[data-collapsed="1"] .ps-cart-note,
  .ps-cart[data-collapsed="1"] .ps-send,
  .ps-cart[data-collapsed="1"] .ps-clear { display: none; }
}
@media (max-width: 760px) {
  .ps-body { grid-template-columns: 1fr; }
  /* Результаты ВЫШЕ списка категорий. В столбик колонки вставали в порядке
     разметки, и после поиска человек видел экран категорий, а найденное
     уезжало вниз — «поиск находит, но не виден результат» (Allan,
     2026-09-06). Порядок меняем только на узком экране: на широком колонки
     стоят рядом и их порядок правильный. */
  .ps-body > main { order: -1; }
  .ps-side { position: static; max-height: none; }
  .ps-side h2 { margin-top: 18px; }
  .ps-modal-box { grid-template-columns: 1fr; }
  .ps-cart { left: 16px; width: auto; }
}

/* ── Блок для поисковика и для человека, пришедшего по номеру детали ────
   Отдаётся сервером ДО выполнения JS: краулер видит номер, название, цену
   и наличие сразу, а не пустую витрину. */
.ps-seo { padding: 18px 0 4px; border-bottom: 1px solid var(--gray-100); }
.ps-crumbs { font-size: 12px; color: var(--gray-500); margin-bottom: 8px; }
.ps-crumbs a { color: var(--gray-500); text-decoration: none; }
.ps-crumbs a:hover { color: var(--red); }
.ps-seo-h1 { font-size: 19px; font-weight: 700; margin-bottom: 8px; }
.ps-seo-img { max-width: 140px; max-height: 140px; display: block; margin: 8px 0; }
.ps-seo-price { font-size: 22px; font-weight: 800; color: var(--red); margin: 6px 0 2px;
                font-variant-numeric: tabular-nums; }
.ps-seo-meta { font-size: 13px; color: var(--gray-700); }
.ps-seo-meta a { color: var(--red); text-decoration: none; }
.ps-seo-meta a:hover { text-decoration: underline; }

/* Цена с НДС под основной. Мельче и бледнее: покупателю с КМКР важнее
   первая строка, но вторая обязана быть — по ней Google сверяет фид. */
.ps-price-vat {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--gray-500, #7a7a7a);
  margin-top: 2px;
}
.ps-seo-price small { font-weight: 500; color: var(--gray-500, #7a7a7a); }

/* Подвал с реквизитами — см. product_page.css, тот же блок. Витрина склада
   не подключает product_page.css, поэтому правила нужны и здесь. */
.site-footer {
  max-width: 1400px; margin: 32px auto 0; padding: 22px 16px 28px;
  border-top: 1px solid var(--gray-300, #ddd);
  font-size: 13px; line-height: 1.7; color: var(--gray-500, #7a7a7a);
}
.site-footer .sf-name { font-weight: 800; color: #111; font-size: 14px; }
.site-footer a { color: var(--gray-700, #4a4a4a); }
