/* ============ Раздел «Запасные части» ============ */

.sp-page #main .heading { margin-bottom: 15px; }

/* Вступление */
.sp-intro {
  margin: 25px 0 35px;
  font-size: 20px;
  line-height: 1.4;
  max-width: 1000px;
}
@media screen and (max-width: 1024px) {
  .sp-intro { font-size: 16px; margin: 15px 0 25px; }
}

/* Сетка карточек: 4 в ряд */
.sp-grid {
  display: flex;
  flex-wrap: wrap;
  margin: 0 -12px 60px;
}
@media screen and (max-width: 479px) {
  .sp-grid { margin: 0 -6px 40px; }
}

/* Карточка */
.sp-card {
  display: block;
  width: 25%;
  padding: 0 12px 30px;
  box-sizing: border-box;
  text-decoration: none;
  color: #303030;
}
@media screen and (max-width: 1024px) {
  .sp-card { width: 50%; }
}
@media screen and (max-width: 479px) {
  .sp-card { width: 100%; padding: 0 6px 20px; }
}
.sp-card:hover { text-decoration: none; }

/* Картинка-квадрат */
.sp-card__img {
  position: relative;
  width: 100%;
  padding-bottom: 100%;     /* квадрат */
  overflow: hidden;
  background: #ebeded;
}
.sp-card__img img {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .35s ease;
}
.sp-card:hover .sp-card__img img {
  transform: scale(1.04);
}
/* Зигзаг снизу — как в теме */
.sp-card__img:after {
  content: "";
  display: block;
  width: 100%;
  height: 4px;
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: url("/sites/all/themes/basic/img/zigzag.png") 50% 0 repeat-x;
  margin-top: -4px;
  z-index: 1;
}

/* Подпись */
.sp-card__title {
  font-size: 18px;
  font-weight: 500;
  line-height: 1.25;
  padding: 12px 4px 0;
  text-align: center;
  min-height: 48px;
}
@media screen and (max-width: 1024px) {
  .sp-card__title { font-size: 16px; }
}
.sp-card:hover .sp-card__title {
  text-decoration: underline;
}



#block-onedrive-ser_uri { display: none; }

/* ============ Страница категории ============ */

.sp-breadcrumb {
  font-size: 16px;
  margin: 20px 0 15px;
  color: #777;
}
.sp-breadcrumb a {
  border-bottom: 1px solid #d8d8d8;
}
.sp-breadcrumb a:hover {
  text-decoration: none;
  border-bottom: 1px solid #a8a8a8;
}

/* Таблица */
.sp-table-wrap {
  overflow-x: auto;
  margin: 20px 0 40px;
}
.sp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 16px;
  line-height: 1.35;
}
.sp-table thead th {
  text-align: left;
  font-weight: bold;
  padding: 12px 15px;
  background: #ebeded;
  border-bottom: 2px solid #d6d6d6;
  white-space: nowrap;
}
.sp-table tbody td {
  padding: 12px 15px;
  border-bottom: 1px solid #e4e4e4;
  vertical-align: top;
}
.sp-table tbody tr:hover {
  background: #fafafa;
}
.sp-col-num     { width: 50px; text-align: center; }
.sp-col-machine { width: 18%; }
.sp-col-name    { }
.sp-col-photo   { width: 90px; text-align: center; }
.sp-col-art     { width: 160px; white-space: nowrap; font-weight: 500; }

.sp-photo img {
  max-width: 70px;
  height: auto;
  display: block;
  margin: 0 auto;
}
.sp-photo-empty {
  color: #c4c4c4;
}

.sp-empty {
  padding: 30px 0;
  color: #777;
  font-size: 18px;
}

.sp-back {
  margin: 30px 0 50px;
}
.sp-back a {
  font-size: 18px;
  border-bottom: 1px solid #d8d8d8;
}
.sp-back a:hover {
  text-decoration: none;
  border-bottom: 1px solid #a8a8a8;
}

@media screen and (max-width: 1024px) {
  .sp-table { font-size: 14px; }
  .sp-table thead th,
  .sp-table tbody td { padding: 8px 10px; }
  .sp-col-machine { width: auto; }
  .sp-col-photo   { width: 60px; }
  .sp-photo img   { max-width: 50px; }
  .sp-col-art     { width: auto; }
}


/* ============ Поиск + фильтр ============ */
.sp-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 20px 0 25px;
  gap: 15px;
  flex-wrap: wrap;
}
.sp-controls__left {
  display: flex;
  gap: 12px;
  flex: 1 1 auto;
  min-width: 0;
}
.sp-controls__right {
  display: flex;
  gap: 4px;
}

.sp-search {
  flex: 1 1 auto;
  min-width: 200px;
  max-width: 480px;
  height: 46px;
  border: 2px solid #d6d6d6;
  border-radius: 23px;
  padding: 10px 20px;
  font-size: 16px;
  font-family: "GothamPro";
}
.sp-search:focus { border-color: #9c0000; }

.sp-machine {
  height: 46px;
  border: 2px solid #d6d6d6;
  border-radius: 23px;
  padding: 0 40px 0 20px;
  font-size: 16px;
  font-family: "GothamPro";
  background: #fff url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M0 0l5 6 5-6z' fill='%23666'/></svg>") no-repeat right 18px center;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  max-width: 260px;
}
.sp-machine:focus { border-color: #9c0000; outline: none; }

/* Кнопки переключения вида */
.sp-view-btn {
  width: 40px;
  height: 40px;
  border: 2px solid #d6d6d6;
  background: #fff;
  border-radius: 20px;
  cursor: pointer;
  color: #999;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all .15s;
}
.sp-view-btn:hover { color: #303030; border-color: #aaa; }
.sp-view-btn.is-active {
  color: #fff;
  background: #9c0000;
  border-color: #9c0000;
}

/* ============ Карточки запчастей (5 в ряд) ============ */
.sp-cards {
  display: flex;
  flex-wrap: wrap;
  margin: 0 -10px 40px;
}

.sp-item.sp-card {
  width: 20%;
  padding: 0 10px 25px;
  box-sizing: border-box;
  text-decoration: none;
  color: #303030;
  display: block;
}
@media screen and (max-width: 1199px) { .sp-item.sp-card { width: 25%; } }
@media screen and (max-width: 1024px) { .sp-item.sp-card { width: 33.3333%; } }
@media screen and (max-width: 767px)  { .sp-item.sp-card { width: 50%; } }
@media screen and (max-width: 479px)  { .sp-item.sp-card { width: 100%; } }

.sp-item.sp-card .sp-card__img {
  position: relative;
  width: 100%;
  padding-bottom: 80%;     /* 5:4 */
  overflow: hidden;
  background: #ebeded;
}
.sp-item.sp-card .sp-card__img img {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  object-fit: contain;
  background: #fff;
}
.sp-card__img-placeholder {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f4f4f4;
}

.sp-card__machine {
  font-size: 13px;
  color: #888;
  margin: 8px 0 4px;
  line-height: 1.2;
  min-height: 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sp-card__name {
  font-size: 15px;
  font-weight: 500;
  line-height: 1.25;
  margin-bottom: 8px;
  min-height: 56px;
}
.sp-card__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding-top: 8px;
  border-top: 1px solid #e4e4e4;
}

/* Артикул и кнопка копирования */
.sp-article {
  font-family: "GothamPro";
  font-weight: 500;
  font-size: 14px;
  color: #303030;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sp-article:hover { color: #9c0000; }

.sp-copy-btn {
  border: none;
  background: transparent;
  color: #999;
  cursor: pointer;
  padding: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: color .15s;
}
.sp-copy-btn:hover { color: #9c0000; }

/* Переключение вида: карточки / таблица */
.sp-list[data-view="cards"] .sp-table-wrap { display: none; }
.sp-list[data-view="table"] .sp-cards      { display: none; }

/* Подсветка позиции из поиска (#art-XXX) */
.sp-item--highlight {
  background: #fff8d6 !important;
  transition: background .3s;
}

/* Тост */
.sp-toast {
  position: absolute;
  background: #303030;
  color: #fff;
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 4px;
  pointer-events: none;
  opacity: 0;
  transition: opacity .18s;
  z-index: 9999;
  white-space: nowrap;
}
.sp-toast--show { opacity: 1; }

/* Выпадашка глобального поиска */
.sp-suggest {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  max-width: 700px;
  background: #fff;
  border: 1px solid #d6d6d6;
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0,0,0,.08);
  max-height: 420px;
  overflow-y: auto;
  z-index: 100;
  margin-top: 4px;
}
.sp-suggest__item {
  display: block;
  padding: 10px 16px;
  border-bottom: 1px solid #f0f0f0;
  text-decoration: none;
  color: #303030;
}
.sp-suggest__item:last-child { border-bottom: none; }
.sp-suggest__item:hover { background: #f7f7f7; text-decoration: none; }
.sp-suggest__name { font-size: 14px; line-height: 1.3; }
.sp-suggest__meta { font-size: 12px; color: #888; margin-top: 2px; }
.sp-suggest__art  { color: #9c0000; font-weight: 500; }
.sp-suggest__empty {
  padding: 14px 16px;
  color: #888;
  font-size: 14px;
}






/* ==================================================
   Главная: «Машина → все запчасти»
   ================================================== */

.sp-machine-title {
  font-size: 20px;
  font-weight: 500;
  color: #303030;
  margin: 10px 0 30px;
}
@media screen and (max-width: 1024px) {
  .sp-machine-title { font-size: 16px; }
}

.sp-machine-group {
  margin-bottom: 40px;
}

.sp-machine-group__title {
  font-size: 22px;
  font-weight: 500;
  color: #303030;
  margin: 0 0 18px;
  line-height: 1.2;
}
@media screen and (max-width: 1024px) {
  .sp-machine-group__title { font-size: 18px; }
}

.sp-machine-group__count {
  font-size: 16px;
  color: #888;
  font-weight: normal;
}
@media screen and (max-width: 1024px) {
  .sp-machine-group__count { font-size: 14px; }
}

/* Карточка-ссылка в блоке машины — без подчёркивания */
.sp-item--link {
  text-decoration: none;
  color: #303030;
}
.sp-item--link:hover {
  text-decoration: none;
}
.sp-item--link:hover .sp-card__name {
  text-decoration: underline;
}

/* Загрузка */
.sp-loading {
  padding: 40px 20px;
  text-align: center;
  color: #888;
  font-size: 16px;
}
/* Фикс: атрибут hidden должен побеждать display: flex */
#sp-categories[hidden],
#sp-machine-products[hidden] {
  display: none !important;
}