/* ЕДИНЫЙ ВИД КАРТОЧЕК ТОВАРА
   Взято за основу оформление из страницы "Избранное".
   Этот файл подключен последним почти на всех страницах, поэтому он перебивает старые разные стили. */

/* сетки на главной, в каталоге, избранном, похожих товарах */
.products,
.catalog-grid,
#catalogGrid,
#favoritesGrid,
.product-related-wrap,
.related-products,
.carousel-products {
  align-items: stretch !important;
}

.products,
.carousel-products {
  gap: 18px !important;
}

#catalogGrid,
.catalog-grid {
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  gap: 22px !important;
}

/* Избранное — размер карточек как на главной: 5 карточек в ряд */
#favoritesGrid {
  display: grid !important;
  grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
  gap: 18px !important;
}

.product-related-wrap {
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  gap: 22px !important;
}

.carousel-products .product-card,
.products .product-card {
  flex: 0 0 calc((100% - 72px) / 5) !important;
  min-width: 205px !important;
}

/* сама карточка — как в избранном */
.product-card,
.catalog-card,
.favorite-card,
.related-card,
.home-product-card,
[class$="-card"].product-card {
  position: relative !important;
  width: 100% !important;
  height: 340px !important;
  min-height: 340px !important;
  max-height: 340px !important;
  padding: 12px !important;
  display: flex !important;
  flex-direction: column !important;
  background: #fff !important;
  border: 1px solid #e8edf3 !important;
  border-radius: 14px !important;
  box-shadow: 0 12px 30px rgba(15, 23, 42, .08) !important;
  overflow: hidden !important;
  color: #111827 !important;
  transform: none !important;
}

.product-card:hover,
.catalog-card:hover,
.favorite-card:hover,
.related-card:hover,
.home-product-card:hover {
  transform: none !important;
  border-color: #e8edf3 !important;
  box-shadow: 0 14px 32px rgba(15, 23, 42, .10) !important;
}

.product-card::before,
.catalog-card::before,
.home-product-card::before { display: none !important; }

/* ссылка внутри карточки */
.product-card-link,
.catalog-card-link,
.home-product-link,
.product-link,
.catalog-link,
.home-link {
  display: flex !important;
  flex-direction: column !important;
  flex: 1 1 auto !important;
  min-height: 0 !important;
  color: inherit !important;
  text-decoration: none !important;
  overflow: hidden !important;
}

.catalog-card-body {
  display: flex !important;
  flex-direction: column !important;
  flex: 1 1 auto !important;
  min-height: 0 !important;
}

/* фото — не режется, всегда целиком */
.product-img,
.catalog-card-photo,
.product-photo,
.home-product-img,
.home-photo,
.related-img,
.product-card-img,
.product-card .image,
.home-product-card .image {
  width: 100% !important;
  height: 126px !important;
  min-height: 126px !important;
  max-height: 126px !important;
  flex: 0 0 126px !important;
  margin: 0 0 12px !important;
  padding: 0 !important;
  display: grid !important;
  place-items: center !important;
  background: #f4f6f8 !important;
  border-radius: 10px !important;
  overflow: hidden !important;
}

.product-img img,
.catalog-card-photo img,
.product-photo img,
.home-product-img img,
.home-photo img,
.related-img img,
.product-card-img img,
.product-card .image img,
.home-product-card .image img {
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  padding: 8px !important;
  object-fit: contain !important;
  transform: none !important;
  background: transparent !important;
}

.product-card:hover .product-img img,
.catalog-card:hover .catalog-card-photo img { transform: none !important; }

/* название — максимум 2 строки, одинаковая высота */
.product-title,
.catalog-card h3,
.catalog-card-title,
.product-card-title,
.home-product-title,
.product-card h3,
.product-link h3,
.catalog-link h3,
.home-link h3 {
  display: -webkit-box !important;
  -webkit-box-orient: vertical !important;
  -webkit-line-clamp: 2 !important;
  height: 40px !important;
  min-height: 40px !important;
  max-height: 40px !important;
  margin: 0 0 7px !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: normal !important;
  font-size: 15px !important;
  line-height: 20px !important;
  font-weight: 900 !important;
  color: #111827 !important;
}

/* группа/категория — одна строка */
.product-group,
.product-cat,
.catalog-card-category,
.home-product-category,
.home-cat,
.catalog-cat,
.muted.product-group {
  display: block !important;
  height: 18px !important;
  min-height: 18px !important;
  max-height: 18px !important;
  margin: 0 0 10px !important;
  overflow: hidden !important;
  white-space: nowrap !important;
  text-overflow: ellipsis !important;
  color: #667085 !important;
  font-size: 13px !important;
  line-height: 18px !important;
  font-weight: 500 !important;
}

/* низ карточки прижат вниз — цена и кнопка на одном уровне */
.product-card-price-area,
.catalog-card-price-area,
.home-product-price-area,
.price-area {
  margin-top: auto !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: flex-end !important;
  min-height: 34px !important;
  height: auto !important;
  gap: 0 !important;
}

.price-row-card,
.price-row,
.catalog-card-price-row,
.home-price-row {
  height: 28px !important;
  min-height: 28px !important;
  max-height: 28px !important;
  margin: 0 !important;
  display: flex !important;
  align-items: baseline !important;
  gap: 8px !important;
  overflow: hidden !important;
}

.price,
.price-current,
.catalog-card-price,
.home-product-price,
.home-price,
.catalog-price {
  font-size: 24px !important;
  line-height: 28px !important;
  font-weight: 950 !important;
  color: #05070d !important;
}

.old-price,
.price-old {
  font-size: 14px !important;
  line-height: 18px !important;
  color: #9aa3af !important;
  text-decoration: line-through !important;
}

/* служебные строки не должны раздувать карточку */
.product-badges,
.installment-badge,
.catalog-installment-badge,
.catalog-card-stock,
.stock-zero,
.stock,
.product-meta-spacer,
.card-spacer,
.product-spacer {
  display: none !important;
  height: 0 !important;
  min-height: 0 !important;
  max-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
}

/* кнопка */
.product-card .cart,
.product-card .cart-btn,
.product-card button.cart,
.catalog-cart-btn,
.home-product-card button,
.home-product-card .cart,
.home-product-card .cart-btn,
.related-cart,
.cart-button {
  width: 100% !important;
  height: 38px !important;
  min-height: 38px !important;
  max-height: 38px !important;
  flex: 0 0 38px !important;
  margin: 10px 0 0 !important;
  padding: 0 12px !important;
  border: 0 !important;
  border-radius: 10px !important;
  background: #05070d !important;
  color: #fff !important;
  font-size: 14px !important;
  line-height: 38px !important;
  font-weight: 900 !important;
  text-align: center !important;
  cursor: pointer !important;
}

.product-card .cart:disabled,
.catalog-cart-btn:disabled,
.related-cart:disabled { opacity: .55 !important; cursor: not-allowed !important; }

/* сердечко как в избранном */
.fav-btn,
.related-fav {
  position: absolute !important;
  top: 12px !important;
  right: 12px !important;
  z-index: 3 !important;
  width: 34px !important;
  height: 34px !important;
  min-width: 34px !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 50% !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  background: #fff !important;
  color: #16bf0a !important;
  box-shadow: 0 8px 18px rgba(15, 23, 42, .12) !important;
  font-size: 18px !important;
  line-height: 1 !important;
}

.fav-btn.active,
.related-fav.active { background: #eaffea !important; color: #16bf0a !important; }

.discount-badge {
  position: absolute !important;
  top: 18px !important;
  left: 18px !important;
  z-index: 3 !important;
}

/* корзина: рекомендованные/быстрые товары тоже в такой же карточке */
.quick-product-card,
.cart-product-card {
  height: 340px !important;
  min-height: 340px !important;
  max-height: 340px !important;
  padding: 12px !important;
  border-radius: 14px !important;
  background: #fff !important;
  border: 1px solid #e8edf3 !important;
  box-shadow: 0 12px 30px rgba(15, 23, 42, .08) !important;
  overflow: hidden !important;
}

.quick-product-img,
.cart-product-img {
  height: 126px !important;
  min-height: 126px !important;
  max-height: 126px !important;
  background: #f4f6f8 !important;
  border-radius: 10px !important;
  display: grid !important;
  place-items: center !important;
  overflow: hidden !important;
}

.quick-product-img img,
.cart-product-img img { width: 100% !important; height: 100% !important; object-fit: contain !important; padding: 8px !important; }

/* адаптив */
@media (max-width: 1180px) {
  #catalogGrid, .catalog-grid, .product-related-wrap { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
  #favoritesGrid { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; gap: 18px !important; }
  .carousel-products .product-card, .products .product-card { flex-basis: calc((100% - 54px) / 4) !important; }
  #relatedProducts .related-card.product-card,
  .product-page #relatedProducts .related-card.product-card {
    flex-basis: calc((100% - 54px) / 4) !important;
    width: calc((100% - 54px) / 4) !important;
  }
}

@media (max-width: 920px) {
  #catalogGrid, #favoritesGrid, .catalog-grid, .product-related-wrap { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 14px !important; }
  .carousel-products .product-card, .products .product-card { flex-basis: calc((100% - 18px) / 2) !important; min-width: 190px !important; }
}

@media (max-width: 560px) {
  .product-card,
  .catalog-card,
  .favorite-card,
  .related-card,
  .home-product-card,
  .quick-product-card,
  .cart-product-card {
    height: 318px !important;
    min-height: 318px !important;
    max-height: 318px !important;
    padding: 10px !important;
    border-radius: 13px !important;
  }
  .product-img,
  .catalog-card-photo,
  .product-photo,
  .home-product-img,
  .home-photo,
  .related-img,
  .product-card-img,
  .quick-product-img,
  .cart-product-img {
    height: 116px !important;
    min-height: 116px !important;
    max-height: 116px !important;
    flex-basis: 116px !important;
  }
  .product-title,
  .catalog-card h3,
  .product-card h3 { font-size: 14px !important; line-height: 18px !important; height: 36px !important; min-height: 36px !important; max-height: 36px !important; }
  .price, .price-current, .catalog-card-price, .home-product-price { font-size: 21px !important; line-height: 26px !important; }
  .product-card .cart, .catalog-cart-btn, .related-cart { height: 36px !important; min-height: 36px !important; max-height: 36px !important; line-height: 36px !important; }
}

/* FIX: product.html — блок "Похожие товары" не должен становиться сеткой из 4 колонок.
   Раньше #relatedProducts имел класс product-related-wrap, и общее правило делало сам контейнер grid,
   из-за чего вся секция с похожими товарами сжималась в одну карточку. */
#relatedProducts.product-related-wrap,
.product-page #relatedProducts.product-related-wrap {
  display: block !important;
  grid-template-columns: none !important;
  grid-column: 1 / -1 !important;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  gap: 0 !important;
  align-items: stretch !important;
}

#relatedProducts .related-section,
.product-page #relatedProducts .related-section {
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
  margin: 24px 0 0 !important;
  padding: 24px !important;
  border-radius: 30px !important;
  background: #fff !important;
  overflow: visible !important;
}

#relatedProducts .related-head,
.product-page #relatedProducts .related-head {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 16px !important;
  margin: 0 0 18px !important;
}

#relatedProducts .related-carousel-wrap,
.product-page #relatedProducts .related-carousel-wrap {
  position: relative !important;
  width: 100% !important;
  max-width: 100% !important;
  overflow: visible !important;
}

#relatedProducts .related-carousel,
.product-page #relatedProducts .related-carousel {
  display: flex !important;
  grid-template-columns: none !important;
  gap: 22px !important;
  width: 100% !important;
  max-width: 100% !important;
  overflow-x: auto !important;
  overflow-y: visible !important;
  scroll-snap-type: x mandatory !important;
  scroll-behavior: smooth !important;
  padding: 2px 4px 14px !important;
  scrollbar-width: none !important;
  align-items: stretch !important;
}

#relatedProducts .related-carousel::-webkit-scrollbar,
.product-page #relatedProducts .related-carousel::-webkit-scrollbar { display: none !important; }

/* В product.html карточки похожих товаров теперь такие же, как в избранном */
#relatedProducts .related-card.product-card,
.product-page #relatedProducts .related-card.product-card {
  /* Похожие товары — тот же размер, что карточки на главной: 5 карточек в ряд */
  flex: 0 0 calc((100% - 72px) / 5) !important;
  width: calc((100% - 72px) / 5) !important;
  min-width: 205px !important;
  max-width: none !important;
  height: 340px !important;
  min-height: 340px !important;
  max-height: 340px !important;
  scroll-snap-align: start !important;
}

#relatedProducts .related-card .product-card-link,
.product-page #relatedProducts .related-card .product-card-link {
  display: flex !important;
  flex-direction: column !important;
  flex: 1 1 auto !important;
  min-height: 0 !important;
}

#relatedProducts .related-card .product-img,
#relatedProducts .related-card .related-img,
.product-page #relatedProducts .related-card .product-img,
.product-page #relatedProducts .related-card .related-img {
  height: 126px !important;
  min-height: 126px !important;
  max-height: 126px !important;
  flex: 0 0 126px !important;
  background: #f4f6f8 !important;
  border-radius: 10px !important;
}

#relatedProducts .related-card .product-img img,
#relatedProducts .related-card .related-img img,
.product-page #relatedProducts .related-card .product-img img,
.product-page #relatedProducts .related-card .related-img img {
  width: 100% !important;
  height: 100% !important;
  object-fit: contain !important;
  padding: 8px !important;
}

#relatedProducts .related-nav,
.product-page #relatedProducts .related-nav {
  top: 50% !important;
  transform: translateY(-50%) !important;
  z-index: 20 !important;
}

#relatedProducts .related-prev,
.product-page #relatedProducts .related-prev { left: -22px !important; }
#relatedProducts .related-next,
.product-page #relatedProducts .related-next { right: -22px !important; }

@media (max-width: 920px) {
  #relatedProducts .related-card.product-card,
  .product-page #relatedProducts .related-card.product-card {
    flex-basis: calc((100% - 18px) / 2) !important;
    width: calc((100% - 18px) / 2) !important;
    min-width: 190px !important;
    max-width: none !important;
  }
}

@media (max-width: 560px) {
  #relatedProducts .related-section,
  .product-page #relatedProducts .related-section { padding: 16px !important; border-radius: 22px !important; }
  #relatedProducts .related-card.product-card,
  .product-page #relatedProducts .related-card.product-card {
    flex-basis: 82vw !important;
    width: 82vw !important;
    min-width: 82vw !important;
    max-width: 82vw !important;
    height: 318px !important;
    min-height: 318px !important;
    max-height: 318px !important;
  }
  #relatedProducts .related-nav,
  .product-page #relatedProducts .related-nav { display: none !important; }
}

/* === FIX: Favorites cards must have the same desktop size as main-page cards === */
@media (min-width: 921px) {
  #favoritesGrid.catalog-grid,
  .favorites-page #favoritesGrid.catalog-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, 205px) !important;
    justify-content: start !important;
    align-items: start !important;
    gap: 18px !important;
    grid-auto-rows: 340px !important;
  }

  #favoritesGrid .catalog-card.favorite-card,
  .favorites-page #favoritesGrid .catalog-card.favorite-card,
  #favoritesGrid .catalog-card {
    width: 205px !important;
    min-width: 205px !important;
    max-width: 205px !important;
    height: 340px !important;
    min-height: 340px !important;
    max-height: 340px !important;
    padding: 12px !important;
    box-sizing: border-box !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
  }

  #favoritesGrid .catalog-card-link,
  .favorites-page #favoritesGrid .catalog-card-link {
    display: flex !important;
    flex-direction: column !important;
    flex: 1 1 auto !important;
    min-height: 0 !important;
  }

  #favoritesGrid .catalog-card-photo,
  .favorites-page #favoritesGrid .catalog-card-photo {
    width: 100% !important;
    height: 126px !important;
    min-height: 126px !important;
    max-height: 126px !important;
    flex: 0 0 126px !important;
    aspect-ratio: auto !important;
    margin: 0 0 10px !important;
    border-radius: 10px !important;
    background: #f4f6f8 !important;
    display: grid !important;
    place-items: center !important;
    overflow: hidden !important;
  }

  #favoritesGrid .catalog-card-photo img,
  .favorites-page #favoritesGrid .catalog-card-photo img {
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: contain !important;
    padding: 8px !important;
  }

  #favoritesGrid .catalog-card-body,
  .favorites-page #favoritesGrid .catalog-card-body {
    display: flex !important;
    flex-direction: column !important;
    flex: 1 1 auto !important;
    min-height: 0 !important;
    padding: 0 2px !important;
  }

  #favoritesGrid .catalog-card h3,
  .favorites-page #favoritesGrid .catalog-card h3 {
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
    min-height: 36px !important;
    max-height: 36px !important;
    height: 36px !important;
    margin: 0 0 6px !important;
    font-size: 14px !important;
    line-height: 1.28 !important;
    font-weight: 950 !important;
  }

  #favoritesGrid .catalog-card-category,
  .favorites-page #favoritesGrid .catalog-card-category {
    display: -webkit-box !important;
    -webkit-line-clamp: 1 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
    min-height: 17px !important;
    max-height: 17px !important;
    height: 17px !important;
    margin: 0 0 8px !important;
    font-size: 12px !important;
    line-height: 1.2 !important;
  }

  #favoritesGrid .catalog-card-price-area,
  .favorites-page #favoritesGrid .catalog-card-price-area {
    margin-top: auto !important;
    min-height: 58px !important;
    max-height: 58px !important;
    gap: 4px !important;
    justify-content: flex-end !important;
  }

  #favoritesGrid .catalog-card-price,
  .favorites-page #favoritesGrid .catalog-card-price {
    font-size: 23px !important;
    line-height: 1 !important;
    font-weight: 1000 !important;
  }

  #favoritesGrid .catalog-installment-badge,
  #favoritesGrid .catalog-card-stock,
  .favorites-page #favoritesGrid .catalog-installment-badge,
  .favorites-page #favoritesGrid .catalog-card-stock {
    display: none !important;
    min-height: 0 !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
  }

  #favoritesGrid .catalog-cart-btn,
  .favorites-page #favoritesGrid .catalog-cart-btn {
    width: 100% !important;
    height: 42px !important;
    min-height: 42px !important;
    max-height: 42px !important;
    margin-top: 10px !important;
    border-radius: 13px !important;
    flex: 0 0 42px !important;
  }
}

@media (max-width: 920px) {
  #favoritesGrid.catalog-grid,
  .favorites-page #favoritesGrid.catalog-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 14px !important;
  }
}

/* === FIX: Catalog cards only — same size as main page/favorites/related ===
   Touches only catalog.html (#catalogGrid). Главная, избранное и похожие товары не меняются. */
@media (min-width: 921px) {
  .catalog-page #catalogGrid.catalog-grid,
  .catalog-page #catalogGrid {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, 205px) !important;
    justify-content: start !important;
    align-items: start !important;
    gap: 18px !important;
    grid-auto-rows: 340px !important;
  }

  .catalog-page #catalogGrid .catalog-card {
    width: 205px !important;
    min-width: 205px !important;
    max-width: 205px !important;
    height: 340px !important;
    min-height: 340px !important;
    max-height: 340px !important;
    padding: 12px !important;
    box-sizing: border-box !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    border-radius: 14px !important;
  }

  .catalog-page #catalogGrid .catalog-card-link {
    display: flex !important;
    flex-direction: column !important;
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow: hidden !important;
  }

  .catalog-page #catalogGrid .catalog-card-photo {
    width: 100% !important;
    height: 126px !important;
    min-height: 126px !important;
    max-height: 126px !important;
    flex: 0 0 126px !important;
    aspect-ratio: auto !important;
    margin: 0 0 10px !important;
    border-radius: 10px !important;
    background: #f4f6f8 !important;
    display: grid !important;
    place-items: center !important;
    overflow: hidden !important;
  }

  .catalog-page #catalogGrid .catalog-card-photo img {
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: contain !important;
    padding: 8px !important;
    display: block !important;
  }

  .catalog-page #catalogGrid .catalog-card-body {
    display: flex !important;
    flex-direction: column !important;
    flex: 1 1 auto !important;
    min-height: 0 !important;
    padding: 0 2px !important;
  }

  .catalog-page #catalogGrid .catalog-card h3 {
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
    min-height: 36px !important;
    max-height: 36px !important;
    height: 36px !important;
    margin: 0 0 6px !important;
    font-size: 14px !important;
    line-height: 1.28 !important;
    font-weight: 950 !important;
  }

  .catalog-page #catalogGrid .catalog-card-category {
    display: -webkit-box !important;
    -webkit-line-clamp: 1 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
    min-height: 17px !important;
    max-height: 17px !important;
    height: 17px !important;
    margin: 0 0 8px !important;
    font-size: 12px !important;
    line-height: 1.2 !important;
  }

  .catalog-page #catalogGrid .catalog-card-price-area {
    margin-top: auto !important;
    min-height: 58px !important;
    max-height: 58px !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-end !important;
    gap: 4px !important;
  }

  .catalog-page #catalogGrid .catalog-card-price {
    font-size: 23px !important;
    line-height: 1 !important;
    font-weight: 1000 !important;
  }

  .catalog-page #catalogGrid .catalog-installment-badge,
  .catalog-page #catalogGrid .catalog-card-stock {
    display: none !important;
    min-height: 0 !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
  }

  .catalog-page #catalogGrid .catalog-cart-btn {
    width: 100% !important;
    height: 42px !important;
    min-height: 42px !important;
    max-height: 42px !important;
    margin-top: 10px !important;
    border-radius: 13px !important;
    flex: 0 0 42px !important;
  }
}

/* ===== FIX 2026-06-08: catalog overlay must stay BEHIND catalog window ===== */
.catalog-overlay,
.page-dim {
  position: fixed !important;
  inset: 0 !important;
  z-index: 8000 !important;
  background: rgba(0, 0, 0, .46) !important;
  backdrop-filter: blur(4px) !important;
  -webkit-backdrop-filter: blur(4px) !important;
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

.catalog-overlay.active,
.page-dim.active,
body.catalog-open .catalog-overlay,
body.catalog-open .page-dim {
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
}

.catalog-popup,
.catalog-popup.mega-catalog,
.mega-catalog,
.catalog-dropdown {
  position: fixed !important;
  top: 92px !important;
  left: 50% !important;
  right: auto !important;
  bottom: auto !important;
  transform: translateX(-50%) !important;
  z-index: 2147483000 !important;
  background: #fff !important;
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
  filter: none !important;
  -webkit-filter: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

.catalog-popup.active,
.catalog-popup.mega-catalog.active,
.mega-catalog.active,
.catalog-dropdown.active {
  display: grid !important;
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
  filter: none !important;
  -webkit-filter: none !important;
}

.catalog-popup.active *,
.catalog-popup.mega-catalog.active *,
.mega-catalog.active *,
.catalog-dropdown.active * {
  filter: none !important;
  -webkit-filter: none !important;
  opacity: 1 !important;
}

.topbar,
header.topbar {
  z-index: 9000 !important;
}

/* === AS CATALOG DESKTOP PHOTO FIT ONLY ===
   Только catalog.html на большой версии: фото как на главной, без влияния на корзину и мобильную. */
@media (min-width: 981px){
  .catalog-page #catalogGrid.catalog-grid .catalog-card .catalog-card-photo{
    width: 100% !important;
    height: 170px !important;
    min-height: 170px !important;
    max-height: 170px !important;
    flex: 0 0 170px !important;
    aspect-ratio: auto !important;
    margin: 0 0 12px !important;
    padding: 0 !important;
    border-radius: 18px !important;
    background: #fff !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    overflow: hidden !important;
  }

  .catalog-page #catalogGrid.catalog-grid .catalog-card .catalog-card-photo img{
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: contain !important;
    object-position: center center !important;
    padding: 4px !important;
    box-sizing: border-box !important;
    display: block !important;
    background: #fff !important;
    transform: none !important;
    mix-blend-mode: normal !important;
  }

  .catalog-page #catalogGrid.catalog-grid .catalog-card .catalog-card-photo span{
    background: #f4f6f8 !important;
    color: #667085 !important;
  }
}

/* === FIX 2026-07-08: вернуть цену в десктопном каталоге, ничего кроме каталога не трогаем === */
@media (min-width: 921px) {
  .catalog-page #catalogGrid.catalog-grid,
  .catalog-page #catalogGrid {
    grid-auto-rows: 360px !important;
  }

  .catalog-page #catalogGrid .catalog-card {
    height: 360px !important;
    min-height: 360px !important;
    max-height: 360px !important;
  }

  .catalog-page #catalogGrid .catalog-card-link,
  .catalog-page #catalogGrid .catalog-card-body {
    overflow: visible !important;
  }

  .catalog-page #catalogGrid .catalog-card-price-area {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    flex: 0 0 auto !important;
    min-height: 34px !important;
    max-height: none !important;
    height: auto !important;
    margin-top: 8px !important;
    gap: 0 !important;
  }

  .catalog-page #catalogGrid .price-row-card {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    min-height: 28px !important;
    height: 28px !important;
    align-items: center !important;
  }

  .catalog-page #catalogGrid .catalog-card-price {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    color: #070a10 !important;
    font-size: 22px !important;
    line-height: 1 !important;
    font-weight: 1000 !important;
    white-space: nowrap !important;
  }
}
