/*
 * Каталог генераторов Mitsudiesel.
 * Все классы с префиксом mdc- : на сайте живёт Bootstrap 2 из шаблона Helix3,
 * у него свои .btn, .card, .row, .thumbnail — пересекаться с ними нельзя.
 * Шрифты не подключаем: Ubuntu и Open Sans уже грузит шаблон.
 */

.mdc,
.mdc-modal {
  --mdc-red: #eb4947;
  --mdc-red-dark: #cf1917;
  --mdc-red-soft: #fdeceb;
  --mdc-ink: #333;
  --mdc-ink-2: #555;
  --mdc-muted: #8a8a8a;
  --mdc-line: #e2e2e2;
  --mdc-line-2: #f0f0f0;
  --mdc-panel: #fff;

  color: var(--mdc-ink);
  font-size: 16px;
  line-height: 1.5;
}

.mdc *,
.mdc *::before,
.mdc *::after { box-sizing: border-box; }

/* Окно карточки переезжает в конец body, поэтому правило нужно и вне .mdc:
   без него display:flex перебивает атрибут hidden и окно висит открытым. */
.mdc [hidden],
.mdc-modal[hidden] { display: none !important; }

.mdc-heading {
  margin: 0 0 8px;
  font-size: 28px;
  line-height: 1.2;
}

.mdc-lead {
  margin: 0 0 18px;
  color: var(--mdc-ink-2);
  font-size: 15px;
}

.mdc-lead b { color: var(--mdc-ink); }

.mdc-alert {
  padding: 14px 18px;
  background: var(--mdc-red-soft);
  border-left: 3px solid var(--mdc-red);
  color: #8c2422;
}

/* ------------------------------------------------------------- разделы */

.mdc-groups {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

/* ------------------------------------------------------------- каркас */

.mdc-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.mdc-layout--nofilters { grid-template-columns: minmax(0, 1fr); }

.mdc-filters__toggle { display: none; }

.mdc-filters__box {
  display: grid;
  gap: 16px;
  padding: 16px;
  background: var(--mdc-panel);
  border: 1px solid var(--mdc-line);
  border-radius: 4px;
}

.mdc-field { display: block; margin: 0; }

.mdc-field__label {
  display: block;
  margin-bottom: 7px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--mdc-muted);
}

.mdc input[type="search"],
.mdc input[type="number"],
.mdc select {
  width: 100%;
  height: auto;
  margin: 0;
  padding: 8px 10px;
  border: 1px solid var(--mdc-line);
  border-radius: 4px;
  background: #fff;
  color: var(--mdc-ink);
  font: inherit;
  font-size: 15px;
  line-height: 1.4;
  box-shadow: none;
}

.mdc input:focus,
.mdc select:focus { border-color: var(--mdc-red); outline: none; box-shadow: none; }

.mdc-chips { display: flex; flex-wrap: wrap; gap: 6px; }

.mdc-chip {
  padding: 6px 11px;
  border: 1px solid var(--mdc-line);
  border-radius: 2px;
  background: #fff;
  color: var(--mdc-ink-2);
  font: inherit;
  font-size: 14px;
  line-height: 1.2;
  cursor: pointer;
  transition: border-color .15s, color .15s;
}

.mdc-chip:hover { border-color: var(--mdc-red); color: var(--mdc-red); }
.mdc-chip.is-on { background: var(--mdc-red); border-color: var(--mdc-red); color: #fff; font-weight: 500; }
.mdc-chip__n { opacity: .6; font-size: 12px; }

/* ------------------------------------------------------------- кнопки */

.mdc-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: var(--mdc-red);
  color: #fff;
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  text-shadow: none;
  cursor: pointer;
  transition: background .15s;
}

.mdc-btn:hover,
.mdc-btn:focus { background: var(--mdc-red-dark); color: #fff; text-decoration: none; }
.mdc-btn--ghost { background: #fff; border-color: var(--mdc-line); color: var(--mdc-ink-2); }
.mdc-btn--ghost:hover { background: #fff; border-color: var(--mdc-red); color: var(--mdc-red); }
.mdc-btn--block { width: 100%; }

/* ------------------------------------------------------------ панель */

.mdc-toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.mdc-found { font-size: 15px; color: var(--mdc-ink-2); }
.mdc-sort { display: flex; align-items: center; gap: 8px; margin: 0 0 0 auto; font-size: 14px; color: var(--mdc-muted); }
.mdc-sort select { width: auto; }

/* ------------------------------------------------------------ карточки */

.mdc-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.mdc[data-mdc-columns="2"] .mdc-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.mdc[data-mdc-columns="4"] .mdc-cards { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.mdc-card {
  display: flex;
  flex-direction: column;
  background: var(--mdc-panel);
  border: 1px solid var(--mdc-line);
  border-radius: 4px;
  overflow: hidden;
  transition: box-shadow .18s, border-color .18s, transform .18s;
}

.mdc-card:hover {
  border-color: var(--mdc-red);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .07), 0 10px 28px rgba(0, 0, 0, .06);
  transform: translateY(-2px);
}

.mdc-card__img {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 190px;
  padding: 10px;
  background: #fff;
  border-bottom: 1px solid var(--mdc-line-2);
}

.mdc-card__img img { max-width: 100%; max-height: 170px; width: auto; object-fit: contain; }

.mdc-card__body { display: flex; flex-direction: column; gap: 10px; flex: 1; padding: 14px 16px 16px; }

.mdc-card__name { margin: 0; font-size: 15px; font-weight: 600; line-height: 1.35; }

.mdc-card__specs { display: flex; flex-wrap: wrap; gap: 5px; }

.mdc-tag {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 2px;
  background: var(--mdc-line-2);
  color: var(--mdc-ink-2);
  font-size: 13px;
  line-height: 1.3;
  white-space: nowrap;
}

.mdc-tag--accent { background: var(--mdc-red-soft); color: var(--mdc-red-dark); }

.mdc-card__foot {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid var(--mdc-line-2);
}

.mdc-card__price { font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; }
.mdc-card__sku { font-size: 13px; color: var(--mdc-muted); }

.mdc-empty { padding: 40px; text-align: center; color: var(--mdc-muted); }

/* -------------------------------------------------------------- карточка */

.mdc-modal {
  position: fixed;
  inset: 0;
  /* шапка Helix3 липкая и лежит высоко, окно должно быть выше неё */
  z-index: 999999;
  color: var(--mdc-ink);
  font-size: 16px;
  line-height: 1.5;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 24px 16px;
  background: rgba(20, 20, 20, .6);
  overflow-y: auto;
}

.mdc-modal__box {
  position: relative;
  width: min(940px, 100%);
  margin: auto;
  padding: 24px 26px 26px;
  background: #fff;
  border-radius: 4px;
}

.mdc-modal__close {
  position: absolute;
  top: 10px;
  right: 14px;
  border: 0;
  background: none;
  color: var(--mdc-muted);
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
}

.mdc-modal__close:hover { color: var(--mdc-red); }

.mdc-detail { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 24px; }
.mdc-detail__photo { padding: 10px; border: 1px solid var(--mdc-line-2); text-align: center; }
.mdc-detail__photo img { max-width: 100%; max-height: 230px; }
.mdc-detail h3 { margin: 0 0 6px; font-size: 21px; line-height: 1.3; }
.mdc-detail__sku { color: var(--mdc-muted); font-size: 14px; }

.mdc-detail__price {
  margin: 14px 0;
  font-size: 26px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.mdc-detail__price small { display: block; font-size: 13px; font-weight: 400; color: var(--mdc-muted); }

.mdc-specs { width: 100%; margin: 0; border-collapse: collapse; font-size: 15px; }
.mdc-specs th,
.mdc-specs td { padding: 7px 9px; border-bottom: 1px solid var(--mdc-line-2); text-align: left; vertical-align: top; }
.mdc-specs th { width: 55%; font-weight: 400; color: var(--mdc-ink-2); }
.mdc-specs td { font-weight: 500; }

.mdc-section {
  margin: 20px 0 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--mdc-muted);
}

.mdc-desc { font-size: 15px; color: var(--mdc-ink-2); }
.mdc-desc p { margin: 0 0 10px; }

/* ------------------------------------------------------------- мобилка */

@media (max-width: 900px) {
  .mdc-layout { grid-template-columns: minmax(0, 1fr); }
  .mdc-cards { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .mdc-detail { grid-template-columns: minmax(0, 1fr); }

  .mdc-filters__toggle {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    padding: 12px 15px;
    background: #fff;
    border: 1px solid var(--mdc-line);
    border-radius: 4px 4px 0 0;
    color: var(--mdc-ink);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
  }

  .mdc-filters__toggle::after { content: '▴'; color: var(--mdc-muted); }
  .mdc-filters__box { border-radius: 0 0 4px 4px; border-top: 0; }
  .mdc-filters.is-collapsed .mdc-filters__toggle { border-radius: 4px; }
  .mdc-filters.is-collapsed .mdc-filters__toggle::after { content: '▾'; }
  .mdc-filters.is-collapsed .mdc-filters__box { display: none; }
}

@media (max-width: 560px) {
  .mdc-cards { grid-template-columns: minmax(0, 1fr) !important; }
  .mdc-sort { margin-left: 0; }
}

/* -------------------------------------------------------------- печать */

@media print {
  .mdc-filters, .mdc-toolbar, .mdc-groups, .mdc-more { display: none !important; }
  .mdc-layout { display: block; }
  .mdc-cards { display: block; }
  .mdc-card { break-inside: avoid; border-bottom: 1px solid #ccc; }
}


/* --------------------------------------------------- карточка как ссылка */

.mdc-card__link {
  display: flex;
  flex-direction: column;
  flex: 1;
  color: inherit;
  text-decoration: none;
}

.mdc-card__link:hover,
.mdc-card__link:focus { color: inherit; text-decoration: none; }
.mdc-card__link .mdc-more { margin-top: 4px; }

/* ------------------------------------------------------- страница модели */

.mdc-back { margin: 0 0 16px; font-size: 15px; }

.mdc-page {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}

.mdc-page__photo {
  padding: 12px;
  background: #fff;
  border: 1px solid var(--mdc-line);
  border-radius: 4px;
  text-align: center;
}

.mdc-page__photo img { max-width: 100%; height: auto; }

.mdc-page__buy {
  margin-top: 16px;
  padding: 16px;
  background: var(--mdc-panel);
  border: 1px solid var(--mdc-line);
  border-radius: 4px;
}

.mdc-page__price {
  margin-bottom: 14px;
  font-size: 28px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.mdc-page__price small { display: block; margin-top: 4px; font-size: 13px; font-weight: 400; color: var(--mdc-muted); }
.mdc-page__contact { margin: 10px 0 0; font-size: 14px; color: var(--mdc-ink-2); text-align: center; }

.mdc-page__title { margin: 0 0 8px; font-size: 26px; line-height: 1.25; }
.mdc-page__sku { margin: 0 0 14px; color: var(--mdc-muted); font-size: 14px; }
.mdc-page__tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 18px; }

.mdc-specs--short { margin-bottom: 20px; }
.mdc-specs--short th { width: 50%; }

.mdc-fold {
  margin-bottom: 12px;
  border: 1px solid var(--mdc-line);
  border-radius: 4px;
}

.mdc-fold > summary {
  padding: 12px 16px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}

.mdc-fold > summary::-webkit-details-marker { display: none; }
.mdc-fold > summary::after { content: ' ▾'; color: var(--mdc-muted); }
.mdc-fold[open] > summary { border-bottom: 1px solid var(--mdc-line-2); }
.mdc-fold[open] > summary::after { content: ' ▴'; }
.mdc-fold > *:not(summary) { padding: 8px 16px 16px; }
.mdc-fold .mdc-specs { width: calc(100% - 0px); }

.mdc-similar__title { margin: 32px 0 16px; font-size: 22px; }
.mdc-cards--similar { grid-template-columns: repeat(3, minmax(0, 1fr)); }

@media (max-width: 900px) {
  .mdc-page { grid-template-columns: minmax(0, 1fr); }
  .mdc-cards--similar { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
}


/* ----------------------------------------------------------- заявка */

.mdc-card__actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 0 16px 16px;
}

.mdc-card__actions .mdc-btn { padding: 8px 10px; font-size: 14px; }

.mdc-order__box { width: min(560px, 100%); }
.mdc-order__title { margin: 0 0 6px; font-size: 22px; }
.mdc-order__lead { margin: 0 0 18px; color: var(--mdc-ink-2); font-size: 15px; }

.mdc-order__model {
  margin-bottom: 16px;
  padding: 12px 14px;
  background: var(--mdc-line-2);
  border-radius: 4px;
}

.mdc-order__model-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--mdc-muted);
}

.mdc-order__model-name { display: block; margin-top: 4px; font-size: 15px; line-height: 1.35; }

.mdc-order__form { display: grid; gap: 14px; }
.mdc-order__form .mdc-field__label i { color: var(--mdc-red); font-style: normal; }

.mdc-order .mdc-field input[type="tel"],
.mdc-order .mdc-field input[type="text"],
.mdc-order .mdc-field textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--mdc-line);
  border-radius: 4px;
  background: #fff;
  color: var(--mdc-ink);
  font: inherit;
  font-size: 15px;
  line-height: 1.4;
}

.mdc-order .mdc-field input:focus,
.mdc-order .mdc-field textarea:focus { border-color: var(--mdc-red); outline: none; }

.mdc-order__agree {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  font-size: 14px;
  color: var(--mdc-ink-2);
  line-height: 1.4;
}

.mdc-order__agree input { margin-top: 3px; accent-color: var(--mdc-red); }

/* поле-ловушка: убрано из потока и недоступно людям */
.mdc-order__trap { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.mdc-order__phone { margin: 0; text-align: center; font-size: 14px; color: var(--mdc-ink-2); }

.mdc-order__result { margin: 0; font-size: 15px; }
.mdc-order__result.is-ok { color: #0f7a45; }
.mdc-order__result.is-err { color: var(--mdc-red-dark); }
.mdc-order__result:empty { display: none; }

@media (max-width: 560px) {
  .mdc-card__actions { grid-template-columns: 1fr; }
}

/* =======================================================================
   Полный каталог: разделы, хлебные крошки, страницы, галерея.
   Добавлено, когда каталог вырос с 33 моделей до всего ассортимента ТСС
   и фильтрация переехала на сервер: фильтр теперь ссылка, а не кнопка.
   ======================================================================= */

/* Фишки-фильтры стали ссылками — у ссылки нет ни рамки браузера, ни центровки */
a.mdc-chip {
  display: inline-block;
  text-decoration: none;
}

a.mdc-chip:hover,
a.mdc-chip:focus { text-decoration: none; }

/* --------------------------------------------------------- хлебные крошки */

.mdc-crumbs {
  margin: 0 0 12px;
  color: var(--mdc-muted);
  font-size: 14px;
}

.mdc-crumbs a { color: var(--mdc-ink-2); }
.mdc-crumbs a:hover { color: var(--mdc-red); }
.mdc-crumbs__sep { margin: 0 6px; opacity: .5; }
.mdc-crumbs__here { color: var(--mdc-ink); }

/* ------------------------------------------------------------ поиск сверху */

.mdc-searchbar {
  display: flex;
  gap: 8px;
  margin: 0 0 22px;
  max-width: 560px;
}

.mdc-searchbar input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--mdc-line);
  border-radius: 2px;
  font: inherit;
}

/* ------------------------------------------------------- витрина разделов */

.mdc-sections {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
  gap: 18px;
}

.mdc-section {
  padding: 16px 18px;
  border: 1px solid var(--mdc-line);
  border-radius: 2px;
  background: var(--mdc-panel);
}

.mdc-section__title {
  margin: 0 0 10px;
  font-size: 18px;
  line-height: 1.25;
}

.mdc-section__title a { color: var(--mdc-ink); }
.mdc-section__title a:hover { color: var(--mdc-red); }

.mdc-section__n {
  margin-left: 6px;
  color: var(--mdc-muted);
  font-size: 12px;
  font-weight: 400;
}

.mdc-section__list,
.mdc-subcats {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 14px;
}

.mdc-section__list li,
.mdc-subcats li { padding: 3px 0; }

.mdc-section__list a,
.mdc-subcats a { color: var(--mdc-ink-2); }

.mdc-section__list a:hover,
.mdc-subcats a:hover { color: var(--mdc-red); }

.mdc-section__more { color: var(--mdc-red) !important; }

.mdc-subcats {
  max-height: 260px;
  overflow-y: auto;
}

/* --------------------------------------------------------------- фильтры */

.mdc-filters form.mdc-field { margin-bottom: 16px; }

.mdc-filters form.mdc-field input[type="search"] {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--mdc-line);
  border-radius: 2px;
  font: inherit;
}

.mdc-range {
  display: flex;
  gap: 6px;
  align-items: center;
}

.mdc-range input {
  width: 100%;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--mdc-line);
  border-radius: 2px;
  font: inherit;
}

.mdc-range .mdc-btn { padding: 8px 12px; }

/* ------------------------------------------------------------- страницы */

.mdc-pager {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 26px 0 0;
}

.mdc-pager__item {
  display: inline-block;
  min-width: 38px;
  padding: 8px 11px;
  border: 1px solid var(--mdc-line);
  border-radius: 2px;
  color: var(--mdc-ink-2);
  text-align: center;
  text-decoration: none;
  font-size: 14px;
}

.mdc-pager__item:hover { border-color: var(--mdc-red); color: var(--mdc-red); text-decoration: none; }

.mdc-pager__item.is-on {
  background: var(--mdc-red);
  border-color: var(--mdc-red);
  color: #fff;
  font-weight: 500;
}

/* ------------------------------------------------------- цена по запросу */

.mdc-card__price--ask,
.mdc-page__price--ask {
  color: var(--mdc-ink-2);
  font-weight: 500;
}

/* ------------------------------------------------------------- галерея */

.mdc-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.mdc-thumb {
  width: 64px;
  height: 64px;
  padding: 2px;
  border: 1px solid var(--mdc-line);
  border-radius: 2px;
  background: #fff;
  cursor: pointer;
}

.mdc-thumb.is-on { border-color: var(--mdc-red); }

.mdc-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* =======================================================================
   Плитки разделов на витрине — по образцу каталога производителя:
   тонкая сетка без промежутков, номер, фотография представителя, стрелка.
   ======================================================================= */

.mdc-tiles {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid var(--mdc-line);
  border-right: 0;
  border-bottom: 0;
  background: var(--mdc-panel);
}

.mdc-tile {
  display: flex;
  flex-direction: column;
  min-height: 230px;
  padding: 18px 20px 14px;
  border-right: 1px solid var(--mdc-line);
  border-bottom: 1px solid var(--mdc-line);
  color: var(--mdc-ink);
  text-decoration: none;
  transition: background .15s;
}

.mdc-tile:hover,
.mdc-tile:focus { background: #fafafa; text-decoration: none; }

.mdc-tile__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.mdc-tile__title {
  font-size: 17px;
  line-height: 1.3;
  font-weight: 500;
}

.mdc-tile:hover .mdc-tile__title { color: var(--mdc-red); }

.mdc-tile__num {
  flex: 0 0 auto;
  color: var(--mdc-muted);
  font-size: 13px;
  padding-top: 2px;
}

/* картинке отдаём всё свободное место: у разных разделов пропорции разные */
.mdc-tile__img {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  padding: 12px 0;
}

.mdc-tile__img img {
  max-width: 100%;
  max-height: 130px;
  object-fit: contain;
}

.mdc-tile__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.mdc-tile__n {
  color: var(--mdc-muted);
  font-size: 13px;
}

.mdc-tile__arrow {
  color: var(--mdc-red);
  font-size: 20px;
  line-height: 1;
}

@media (max-width: 1024px) {
  .mdc-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 767px) {
  .mdc-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mdc-tile { min-height: 190px; padding: 14px 14px 12px; }
  .mdc-tile__title { font-size: 15px; }
  .mdc-tile__img img { max-height: 90px; }
}

@media (max-width: 420px) {
  .mdc-tiles { grid-template-columns: minmax(0, 1fr); }
}

/* Значения характеристик приходят от поставщика какими угодно, вплоть до
   машинных списков без пробелов: без переноса такая строка растягивает
   таблицу и ломает страницу товара. */
.mdc-specs th,
.mdc-specs td {
  overflow-wrap: anywhere;
  word-break: break-word;
}
