/*----------------------------------------*/
/*  Рекомендації на картці товару (.fw-reco):
    - «Схожі напої / продукти» — цінові яруси (Вигідніше · Схоже · Рівень вище)
    - «Пасує до» / «Що відкрити до цього» — крос-продаж
    Підключається лише у view_drink.tpl / view_product.tpl (як reviews.css).
    Свої класи: без .single-grid-product / .mainProducts / .product-content
    (їхні hover/line-through правила зі style.css сюди не потрапляють).
/*----------------------------------------*/
.fw-reco {
  /* дублюємо .section теми (float:left;width:100%) + clear — блок завжди під основною секцією, а не обтікає її */
  float: left;
  clear: both;
  width: 100%;
  padding: 10px 0 30px;
  font-family: "Montserrat", sans-serif;
}

.fw-reco-head {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: baseline;
  -ms-flex-align: baseline;
  align-items: baseline;
  -ms-flex-wrap: wrap;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin: 0 0 18px;
}

.fw-reco-title {
  margin: 0;
  color: #151515;
  font-size: 22px;
  font-weight: 600;
  line-height: 1.2;
}

.fw-reco-sub {
  -webkit-box-flex: 1;
  -ms-flex: 1 1 auto;
  flex: 1 1 auto;
  margin: 0;
  color: #888;
  font-size: 13px;
  line-height: 1.4;
}

.fw-reco-all {
  color: #555;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  -webkit-transition: color 0.3s ease 0s;
  -o-transition: color 0.3s ease 0s;
  transition: color 0.3s ease 0s;
}

.fw-reco-all:hover {
  color: #E0A886;
}

.fw-reco-all .fa {
  font-size: 12px;
  margin-left: 2px;
}

/* Сітка: 6 карток «схожих», 4 — крос-продаж */
.fw-reco-track {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 20px;
}

.fw-reco--pairs .fw-reco-track {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

/* Картка */
.fw-reco-card {
  position: relative;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
  -ms-flex-direction: column;
  flex-direction: column;
  min-width: 0;
  padding: 14px 14px 16px;
  border: 1px solid #ececec;
  border-radius: 6px;
  background: #ffffff;
  -webkit-transition: border-color 0.3s ease 0s, box-shadow 0.3s ease 0s;
  -o-transition: border-color 0.3s ease 0s, box-shadow 0.3s ease 0s;
  transition: border-color 0.3s ease 0s, box-shadow 0.3s ease 0s;
}

.fw-reco-card:hover {
  border-color: #E0A886;
  -webkit-box-shadow: 0 6px 18px rgba(0, 0, 0, 0.06);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.06);
}

.fw-reco-img {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center;
  -webkit-box-pack: center;
  -ms-flex-pack: center;
  justify-content: center;
  height: 170px;
  margin: 0 0 12px;
  overflow: hidden;
}

.fw-reco-img a {
  display: block;
  line-height: 0;
}

.fw-reco-img img {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 170px;
  -webkit-transition: -webkit-transform 0.4s ease 0s;
  transition: -webkit-transform 0.4s ease 0s;
  -o-transition: transform 0.4s ease 0s;
  transition: transform 0.4s ease 0s;
  transition: transform 0.4s ease 0s, -webkit-transform 0.4s ease 0s;
}

.fw-reco-card:hover .fw-reco-img img {
  -webkit-transform: scale(1.03);
  transform: scale(1.03);
}

/* Чипи ярусів / груп і бейдж знижки */
.fw-reco-tag {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
  padding: 5px 8px;
  border-radius: 12px;
  background: #f3f3f3;
  color: #555;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}

.fw-reco-tag--cheaper {
  background: #EAF4EC;
  color: #2f6b3a;
}

.fw-reco-tag--higher {
  background: #FBEFE6;
  color: #b0693f;
}

.fw-reco-tag--pair {
  background: #f7f4ef;
  color: #6b6560;
}

.fw-reco-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  padding: 5px 7px;
  border-radius: 12px;
  background: #fb5d5d;
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}

/* Тіло картки */
.fw-reco-body {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
  -ms-flex-direction: column;
  flex-direction: column;
  -webkit-box-flex: 1;
  -ms-flex: 1 1 auto;
  flex: 1 1 auto;
  min-width: 0;
}

.fw-reco-name {
  min-height: 38px;
  margin: 0 0 6px;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.35;
}

.fw-reco-name a {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: #151515;
  -webkit-transition: color 0.3s ease 0s;
  -o-transition: color 0.3s ease 0s;
  transition: color 0.3s ease 0s;
}

.fw-reco-name a:hover {
  color: #E0A886;
}

.fw-reco-meta {
  margin: 0 0 8px;
  color: #888;
  font-size: 12px;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  -o-text-overflow: ellipsis;
  text-overflow: ellipsis;
}

.fw-reco-flag {
  display: inline-block;
  width: 16px;
  height: 11px;
  margin: -2px 5px 0 0;
  vertical-align: middle;
  border-radius: 1px;
}

.fw-reco-price {
  margin: auto 0 10px;
  font-size: 15px;
  line-height: 1.3;
  font-variant-numeric: tabular-nums;
}

.fw-reco-price .discounted-price {
  color: #E0A886;
  font-weight: 600;
}

.fw-reco-price .discounted-price.colorRed {
  color: #fb5d5d;
}

.fw-reco-old {
  margin-right: 6px;
  color: #acacac;
  font-size: 12px;
  text-decoration: line-through;
}

/* Кнопка-пілюля «В кошик» (той самий обробник .productAddCart, іконка стає спінером) */
.fw-reco-btn {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center;
  -webkit-box-pack: center;
  -ms-flex-pack: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 9px 10px;
  border: 1px solid #E0A886;
  border-radius: 999px;
  background: #ffffff;
  color: #151515;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  -webkit-transition: background-color 0.25s ease 0s, color 0.25s ease 0s;
  -o-transition: background-color 0.25s ease 0s, color 0.25s ease 0s;
  transition: background-color 0.25s ease 0s, color 0.25s ease 0s;
}

.fw-reco-btn:hover,
.fw-reco-btn:focus {
  background: #E0A886;
  color: #ffffff;
  text-decoration: none;
}

.fw-reco-btn .fa {
  font-size: 14px;
  line-height: 1;
}

/* Text-first картки (продукти без фото): картинка лишається в DOM для cart.js, але прихована */
.fw-reco-card--text {
  padding-top: 12px;
  border-top: 3px solid #E0A886;
}

.fw-reco-card--text .fw-reco-img {
  display: none;
}

.fw-reco-card--text .fw-reco-tag {
  position: static;
  display: inline-block;
  -ms-flex-item-align: start;
  align-self: flex-start;
  max-width: calc(100% - 52px);
  margin: 0 0 10px;
  overflow: hidden;
  -o-text-overflow: ellipsis;
  text-overflow: ellipsis;
}

.fw-reco-card--text .fw-reco-badge {
  top: 12px;
}

.fw-reco-card--text .fw-reco-name {
  min-height: 0;
}

.fw-reco-card--text .fw-reco-name a {
  -webkit-line-clamp: 3;
}

.fw-reco-card--text .fw-reco-meta {
  white-space: normal;
}

/* Адаптив */
@media only screen and (max-width: 1199px) {
  .fw-reco-track,
  .fw-reco--pairs .fw-reco-track {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media only screen and (max-width: 991px) {
  .fw-reco-track,
  .fw-reco--pairs .fw-reco-track {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
  }

  .fw-reco-img {
    height: 150px;
  }

  .fw-reco-img img {
    max-height: 150px;
  }
}

/* Мобайл: горизонтальний скрол зі snap — той самий патерн, що .fw-cats-chips */
@media only screen and (max-width: 767px) {
  .fw-reco {
    padding-bottom: 20px;
  }

  .fw-reco-title {
    font-size: 18px;
  }

  .fw-reco-sub {
    -ms-flex-preferred-size: 100%;
    flex-basis: 100%;
  }

  .fw-reco-track,
  .fw-reco--pairs .fw-reco-track {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -ms-flex-wrap: nowrap;
    flex-wrap: nowrap;
    gap: 12px;
    margin: 0 -15px;
    padding: 2px 15px 10px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    -ms-scroll-snap-type: x mandatory;
    scroll-snap-type: x mandatory;
    scroll-padding-left: 15px;
    scrollbar-width: none;
  }

  .fw-reco-track::-webkit-scrollbar {
    display: none;
  }

  .fw-reco-card {
    -webkit-box-flex: 0;
    -ms-flex: 0 0 46%;
    flex: 0 0 46%;
    min-width: 160px;
    scroll-snap-align: start;
  }

  .fw-reco-img {
    height: 140px;
  }

  .fw-reco-img img {
    max-height: 140px;
  }
}

@media only screen and (max-width: 420px) {
  .fw-reco-card {
    -ms-flex-preferred-size: 68%;
    flex-basis: 68%;
  }
}
