/* ==========================================================
   Milwaukee Service — Stage 8 table and product page fixes
   2026-05-27
   Исправления после визуальной проверки:
   - тёмный sticky-столбец корзины в таблицах схем;
   - аккуратный каталог /zapchasti/;
   - читаемые страницы товаров /zapchasti/<article>/;
   - переносы длинных названий, артикулов и категорий.
   ========================================================== */

:root{
  --mw-stage8-bg:#08090d;
  --mw-stage8-card:#12151d;
  --mw-stage8-card-2:#171b24;
  --mw-stage8-line:rgba(255,255,255,.12);
  --mw-stage8-line-soft:rgba(255,255,255,.075);
  --mw-stage8-text:#f7f8fa;
  --mw-stage8-muted:rgba(255,255,255,.70);
  --mw-stage8-muted-2:rgba(255,255,255,.54);
  --mw-stage8-red:#db011c;
}

/* Общая защита от вылезания длинных строк */
.mw-card,
.mw-card-body,
.mw-product-layout,
.mw-product-main,
.mw-product-side,
.mw-table-wrap,
.mw-popular-parts,
.mw-popular-part,
.mw-fit-table,
.mw-fit-table td,
.mw-fit-table th,
.mw-parts-table,
.mw-parts-table td,
.mw-parts-table th{
  min-width:0;
}

.mw-fit-table a,
.mw-fit-table small,
.mw-popular-part strong,
.mw-popular-part small,
.mw-popular-part span,
.mw-product-fact strong,
.mw-product-metric strong,
.mw-parts-table td,
.mw-parts-table code{
  overflow-wrap:anywhere;
  word-break:normal;
}

/* 1) Таблица схем: убираем белую подложку sticky-столбца корзины */
.mw-table-wrap table.mw-parts-table th:last-child,
.mw-table-wrap table.mw-parts-table td:last-child,
.mw-parts-table th:last-child,
.mw-parts-table td:last-child{
  color:var(--mw-stage8-text) !important;
  border-left:1px solid rgba(255,255,255,.08) !important;
  box-shadow:-10px 0 18px rgba(8,9,13,.55) !important;
}

.mw-table-wrap table.mw-parts-table thead th:last-child,
.mw-parts-table thead th:last-child{
  background:linear-gradient(180deg, rgba(37,41,53,.98), rgba(28,32,42,.98)) !important;
}

.mw-table-wrap table.mw-parts-table tbody tr:nth-child(odd) td:last-child,
.mw-parts-table tbody tr:nth-child(odd) td:last-child{
  background:linear-gradient(180deg, rgba(21,24,32,.98), rgba(18,21,29,.98)) !important;
}

.mw-table-wrap table.mw-parts-table tbody tr:nth-child(even) td:last-child,
.mw-parts-table tbody tr:nth-child(even) td:last-child{
  background:linear-gradient(180deg, rgba(17,20,27,.98), rgba(15,18,25,.98)) !important;
}

.mw-table-wrap table.mw-parts-table tbody tr:hover td:last-child,
.mw-parts-table tbody tr:hover td:last-child{
  background:linear-gradient(180deg, rgba(62,24,31,.98), rgba(35,20,27,.98)) !important;
}

.mw-parts-table .mw-cart-cell{
  padding-left:12px !important;
  padding-right:12px !important;
  background:transparent !important;
}

.mw-parts-table .mw-cart-add{
  background:linear-gradient(180deg, rgba(255,255,255,.105), rgba(255,255,255,.055)) !important;
  color:#fff !important;
  border:1px solid rgba(255,255,255,.18) !important;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.08) !important;
  backdrop-filter:none !important;
}

.mw-parts-table .mw-cart-add:hover,
.mw-parts-table .mw-cart-add:focus-visible{
  background:linear-gradient(135deg, rgba(219,1,28,.98), rgba(151,0,18,.98)) !important;
  border-color:rgba(255,255,255,.24) !important;
  box-shadow:0 8px 18px rgba(219,1,28,.18) !important;
}

.mw-parts-table .mw-cart-add.is-added{
  background:linear-gradient(135deg, #178544, #0d6530) !important;
  color:#fff !important;
}

.mw-parts-table .mw-cart-add.is-disabled,
.mw-parts-table .mw-cart-add:disabled{
  background:rgba(255,255,255,.08) !important;
  color:rgba(255,255,255,.46) !important;
  border-color:rgba(255,255,255,.10) !important;
}

.mw-parts-table .mw-cart-add__icon{
  background:rgba(255,255,255,.14) !important;
  color:#fff !important;
}

/* Мобильная подсказка прокрутки таблицы тоже в тёмном стиле */
@media (max-width:760px){
  .mw-table-wrap:before{
    color:rgba(255,255,255,.68) !important;
    background:rgba(10,12,18,.96) !important;
    border-bottom:1px solid rgba(255,255,255,.08) !important;
  }

  .mw-table-wrap table.mw-parts-table th:last-child,
  .mw-table-wrap table.mw-parts-table td:last-child{
    position:static !important;
    box-shadow:none !important;
  }
}

/* 2) Каталог /zapchasti/: карточки популярных запчастей больше не вылезают за рамки */
.mw-popular-parts{
  grid-template-columns:repeat(auto-fit, minmax(min(100%, 330px), 1fr)) !important;
  align-items:stretch;
}

.mw-popular-part{
  display:grid !important;
  grid-template-columns:minmax(0,1fr) auto;
  align-items:start;
  gap:12px !important;
  min-height:100%;
  overflow:hidden;
  background:linear-gradient(145deg, rgba(255,255,255,.075), rgba(255,255,255,.035)) !important;
  border:1px solid var(--mw-stage8-line) !important;
  color:var(--mw-stage8-text) !important;
}

.mw-popular-part span{
  display:block;
  min-width:0;
  color:var(--mw-stage8-muted) !important;
}

.mw-popular-part strong{
  display:block;
  color:#fff !important;
  line-height:1.25;
}

.mw-popular-part small{
  display:block;
  margin-top:6px;
  color:var(--mw-stage8-muted-2) !important;
  line-height:1.35;
}

.mw-popular-part b{
  align-self:start;
  white-space:nowrap;
  color:#fff !important;
  border:1px solid rgba(219,1,28,.35);
  background:rgba(219,1,28,.16);
  border-radius:999px;
  padding:6px 10px;
  font-size:12px;
}

/* 3) Страницы товара /zapchasti/<article>/: тёмная читаемая таблица совместимости */
.mw-product-layout{
  grid-template-columns:minmax(0,1fr) minmax(280px,340px) !important;
}

.mw-product-main .mw-card,
.mw-product-side .mw-card{
  background:linear-gradient(145deg, rgba(18,21,29,.96), rgba(11,13,19,.96)) !important;
  border:1px solid var(--mw-stage8-line) !important;
  color:var(--mw-stage8-text) !important;
}

.mw-product-main .mw-card-head,
.mw-product-side .mw-card-head{
  border-bottom:1px solid var(--mw-stage8-line) !important;
  background:rgba(255,255,255,.025) !important;
}

.mw-product-main .mw-card h2,
.mw-product-side .mw-card h2,
.mw-product-main .mw-card h3,
.mw-product-side .mw-card h3{
  color:#fff !important;
}

.mw-product-main .mw-card p,
.mw-product-side .mw-card p,
.mw-product-main .mw-card li,
.mw-product-side .mw-card li{
  color:var(--mw-stage8-muted) !important;
}

.mw-product-metric{
  border-bottom:1px solid var(--mw-stage8-line-soft) !important;
}

.mw-product-metric span{
  color:var(--mw-stage8-muted-2) !important;
}

.mw-product-metric strong,
.mw-product-metric code{
  color:#fff !important;
}

.mw-fit-table{
  min-width:760px !important;
  width:100%;
  table-layout:auto;
  background:rgba(8,9,13,.30);
}

.mw-fit-table th,
.mw-fit-table td{
  border-bottom:1px solid var(--mw-stage8-line-soft) !important;
  vertical-align:top;
}

.mw-fit-table th{
  background:linear-gradient(180deg, rgba(37,41,53,.92), rgba(24,28,38,.92)) !important;
  color:rgba(255,255,255,.86) !important;
  white-space:nowrap;
}

.mw-fit-table tbody tr:nth-child(odd){
  background:rgba(255,255,255,.025);
}

.mw-fit-table tbody tr:nth-child(even){
  background:rgba(255,255,255,.012);
}

.mw-fit-table tbody tr:hover{
  background:rgba(219,1,28,.08);
}

.mw-fit-table td{
  color:var(--mw-stage8-muted) !important;
  line-height:1.42;
}

.mw-fit-table a{
  display:block;
  color:#fff !important;
  font-weight:850;
  text-decoration:none;
  line-height:1.35;
}

.mw-fit-table a:hover{
  color:#ff6b7a !important;
}

.mw-fit-table td small{
  display:block !important;
  margin-top:5px;
  color:var(--mw-stage8-muted-2) !important;
  line-height:1.35;
}

.mw-fit-table td:nth-child(2),
.mw-fit-table td:nth-child(3),
.mw-fit-table td:nth-child(5){
  white-space:nowrap;
}

.mw-fit-position{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:26px;
  padding:3px 8px;
  border-radius:999px;
  background:rgba(219,1,28,.16);
  border:1px solid rgba(219,1,28,.32);
  color:#ffb8c0 !important;
}

.mw-product-side .mw-actions{
  display:grid;
  grid-template-columns:1fr 1fr;
}

.mw-product-side .mw-actions .mw-button{
  width:100%;
  min-width:0;
}

/* На узких экранах таблицы не ломают карточки, а аккуратно прокручиваются */
@media (max-width:980px){
  .mw-product-layout{
    grid-template-columns:1fr !important;
  }
}

@media (max-width:760px){
  .mw-fit-table{
    min-width:720px !important;
  }

  .mw-product-side .mw-actions{
    grid-template-columns:1fr;
  }

  .mw-popular-part{
    grid-template-columns:1fr;
  }

  .mw-popular-part b{
    justify-self:start;
  }
}
