/* ===========================
   PI Amazon-like Shop Cards
   Safe for Nifty / BoldThemes
   =========================== */

/*
 IMPORTANT:
 We DO NOT touch generic .woocommerce ul.products
 to avoid breaking header / sidebar / layout.
 All selectors are strictly limited to content area.
*/

/* =================================================
   1) Плотная сетка ТОЛЬКО в контенте Shop
   ================================================= */

.woocommerce-page .content-area ul.products,
.woocommerce-page .site-content ul.products {
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  gap: 12px !important;                 /* Amazon-like density */
  margin: 0 !important;
  padding: 0 !important;
}

/* Responsive columns */
@media (max-width: 1280px) {
  .woocommerce-page .content-area ul.products,
  .woocommerce-page .site-content ul.products {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }
}

@media (max-width: 992px) {
  .woocommerce-page .content-area ul.products,
  .woocommerce-page .site-content ul.products {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

@media (max-width: 576px) {
  .woocommerce-page .content-area ul.products,
  .woocommerce-page .site-content ul.products {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

/* =================================================
   2) Убираем “воздух” у товаров (ТОЛЬКО внутри grid)
   ================================================= */

.woocommerce-page .content-area ul.products li.product,
.woocommerce-page .site-content ul.products li.product {
  margin: 0 !important;
  padding: 0 !important;
  width: auto !important;
  float: none !important;
}

/* =================================================
   3) Карточка продукта
   ================================================= */

.woocommerce-page ul.products li.product.pi-card {
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 10px;
  overflow: hidden;                     /* image becomes part of card */
  background: #ffffff;
}

/* Link wrapper */
.pi-card__link {
  display: block;
  color: inherit;
  text-decoration: none;
}



/* ======================================================
   4) IMAGE — Amazon-style subtle separation
   ====================================================== */

.pi-card__media {
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: #fff;
  padding: 6px /*равные отступы сверху/снизу/по бокам */
}

.pi-card__media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  margin: 0;
}

/* subtle Amazon-like overlay */
.pi-card__media::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: rgba(0,0,0,0.02);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.03);
}

/* Amazon-like hover zoom */
.pi-card__media img {
  transition: transform 0.25s ease;
  will-change: transform;
}

.pi-card:hover .pi-card__media img {
  transform: scale(1.03);
}





/* =================================================
   5) Card body (top / bottom separation)
   ================================================= */

.pi-card__body {
  display: flex;
  flex-direction: column;
  min-height: 220px;                    /* keeps CTA aligned */
  padding: 35px 10px 25px 10px;          /* minimal inner spacing */
}

/* Top content */
.pi-card__top {}

/* Bottom content always sticks to bottom */
.pi-card__bottom {
  margin-top: auto;
}

/* =================================================
   6) Sponsored label
   ================================================= */

.pi-card__sponsored {
  font-size: 12px;
  line-height: 1.1;
  color: #111111;
  margin: 0 0 6px 0;
  font-weight: 400;
}

/* =================================================
   7) Category label
   ================================================= */

.pi-card__category {
  margin: 0 0 6px 0;
  font-size: 12px;
  line-height: 1.1;
  color: #057485;                        /* PressInspection green */
  font-weight: 600;
}

/* =================================================
   8) Title / description (4 lines, dense)
   ================================================= */

.pi-card__title {
    margin: 0 0 6px 0;              /* bottom spacing under title */
    font-size: 14px;
    line-height: 1.3;
    font-weight: 400;
}

/* Title link – default state */
.pi-card__title,
.pi-card__title a {
    color: #000;
    text-decoration: none;
    transition: color 0.2s ease;
}

/* Title link – hover state */
.pi-card__title a:hover {
    color: #057689;                 /* PressInspection green */
}


/* =================================================
   9) Rating
   ================================================= */

.pi-card__rating {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  line-height: 1.1;
  margin: 0 0 10px 0;
}

.pi-card__rating a {
  color: inherit;
  text-decoration: none;
}

.pi-card__rating a:hover {
  text-decoration: underline;
}

/* =================================================
   10) Price (Amazon-like emphasis)
   ================================================= */

.pi-card__price {
  font-size: 20px;
  line-height: 1.1;
  margin: 0 0 6px 0;
}

.pi-card__price .woocommerce-Price-amount {
  font-weight: 700;
}

/* Price link – default state */
.pi-card__price,
.pi-card__price a {
    color: #000;
    text-decoration: none;
    transition: color 0.2s ease;
}

/* Title link – hover state */
.pi-card__price a:hover {
    color: #057689;                 /* PressInspection green */
}

.pi-card__price {
  font-family: Arial, Helvetica, sans-serif;
  font-weight: 700;
  letter-spacing: -0.4px;
}

.pi-card__price .woocommerce-Price-amount {
  font-size: 22px;
}

.pi-card__price .woocommerce-Price-currencySymbol {
  font-size: 0.9em;
  vertical-align: baseline;
}



/* =================================================
   11) Badges (Bookable / Country / Verified)
   ================================================= */

.pi-card__badges {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 25px 0 15px 0;
}

.pi-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  line-height: 1.1;
  color: #111111;
}

/* Bookable */
.pi-badge--bookable {
  color: #057485;
  font-weight: 600;
}

/* Verified */
.pi-badge--verified {
  color: #111111;
  font-weight: 600;
}

/* =================================================
   12) CTA button
   ================================================= */

.pi-card__cta .pi-btn,
.pi-card__cta .button.pi-btn {
  width: 100%;
  border-radius: 999px;
  padding: 10px 12px;
  font-size: 14px;
  line-height: 1.1;
  text-align: center;

  background: #f7c948 !important;        /* Amazon yellow */
  border: 1px solid rgba(0, 0, 0, 0.15) !important;
  color: #111111 !important;
  font-weight: 700;

}

.pi-card__cta .pi-btn:hover,
.pi-card__cta .button.pi-btn:hover {
  filter: brightness(0.97);
}

/* ==========================================================
   CTA button hover – Amazon-like (black background)
   ========================================================== */

.pi-card .button,
.pi-card a.button {
  transition: 
    background-color 0.2s ease,
    color 0.2s ease,
    border-color 0.2s ease;
}

/* hover */
.pi-card .button:hover,
.pi-card a.button:hover {
  background-color: #000 !important;
  color: #fff !important;
  border-color: #000 !important;
}

/* safety: remove theme shadows / filters on hover */
.pi-card .button:hover {
  box-shadow: none !important;
  filter: none !important;
}


/* =================================================
   FIX: BoldThemes product width conflict
   ================================================= */

/* Сбрасываем ограничения ширины карточек темы */
.woocommerce-page .content-area ul.products li.product,
.woocommerce-page .site-content ul.products li.product {
  width: 100% !important;
  max-width: 100% !important;
  flex: none !important;
}

/* Убираем возможные внутренние колонки BoldThemes */
.woocommerce-page .content-area ul.products,
.woocommerce-page .site-content ul.products {
  box-sizing: border-box;
}

/* Защита от inline-стилей темы */
.woocommerce-page ul.products li.product[style] {
  width: 100% !important;
}

/* =================================================
   HARD OVERRIDE: disable BoldThemes width logic
   ================================================= */

body.woocommerce ul.products li.product,
body.woocommerce-page ul.products li.product {
  width: auto !important;
  max-width: none !important;
  float: none !important;
}

/* Ignore column-based widths injected by css-override.php */
body.woocommerce ul.products.columns-2 li.product,
body.woocommerce ul.products.columns-3 li.product,
body.woocommerce ul.products.columns-4 li.product,
body.woocommerce ul.products.columns-5 li.product {
  width: auto !important;
}


/* ===============================
   PI Chat – Write to seller button on SINGLE PRODUCT page
   =============================== */

/* Обёртка */
.pi-write-to-seller-wrap {
  display: block;
  width: 100%;
  margin-top: 10px;
}

/* Сама кнопка */
.pi-write-to-seller {
  display: flex !important;
  justify-content: center;
  align-items: center;

  width: 100%;
  min-height: 48px;

  background: #ffffff;
  color: #000000;

  border: 2px solid #000000;
  border-radius: 999px;

  font-weight: 600;
  font-size: 15px;
  text-decoration: none;

  transition: all .2s ease;
}

/* Hover */
.pi-write-to-seller:hover {
  background: #000000;
  color: #ffffff;
}

/* Active / click */
.pi-write-to-seller:active {
  transform: translateY(1px);
}

/* Немного воздуха между кнопками */
.single-product .cart {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* =========================================================
   SINGLE PRODUCT — Buttons styling (Add to cart + Write to seller)
   Uses correct selectors for PI Chat snippet: .pi-write-to-seller
   ========================================================= */

.single-product .summary form.cart {
  display: flex;
  flex-direction: column;
  gap: 14px; /* расстояние между qty, CTA и вторичной кнопкой */
}

.single-product .summary form.cart .quantity {
  margin: 0 0 6px 0;
}

/* Common button base */
.single-product .summary form.cart button.single_add_to_cart_button,
.single-product .summary .pi-write-to-seller-wrap .pi-write-to-seller {
  width: 100% !important;
  box-sizing: border-box;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  min-height: 56px;
  padding: 0 22px;
  border-radius: 999px;
  font-weight: 700;
  line-height: 1;
  text-decoration: none !important;
  transition: background-color .15s ease, color .15s ease, border-color .15s ease, transform .15s ease;
}

/* PRIMARY: Add to cart — yellow CTA */
.single-product .summary form.cart button.single_add_to_cart_button {
  background: #f4c542 !important;
  color: #111 !important;
  border: 1px solid #d6aa25 !important;
}

/* PRIMARY hover: black + white text (as you asked) */
.single-product .summary form.cart button.single_add_to_cart_button:hover {
  background: #111 !important;
  color: #fff !important;
  border-color: #111 !important;
}

/* SECONDARY: Write to seller — white with black outline */
.single-product .summary .pi-write-to-seller-wrap .pi-write-to-seller {
  background: #fff !important;
  color: #111 !important;
  border: 2px solid #111 !important;
}

/* SECONDARY hover + active: black + white text */
.single-product .summary .pi-write-to-seller-wrap .pi-write-to-seller:hover,
.single-product .summary .pi-write-to-seller-wrap .pi-write-to-seller:active,
.single-product .summary .pi-write-to-seller-wrap .pi-write-to-seller:focus {
  background: #111 !important;
  color: #fff !important;
  border-color: #111 !important;
}

/* Nice focus ring (optional, but useful) */
.single-product .summary form.cart button.single_add_to_cart_button:focus-visible,
.single-product .summary .pi-write-to-seller-wrap .pi-write-to-seller:focus-visible {
  outline: 3px solid rgba(5, 118, 137, 0.35);
  outline-offset: 2px;
}

/* If theme forces the chat link to be inline or small */
.single-product .summary .pi-write-to-seller-wrap {
  width: 100%;
}



/* ===============================
   SINGLE PRODUCT – BUTTON BASE
================================ */

body.single-product .summary .button {
    border-radius: 999px;
    font-weight: 600;
    transition: 
        background-color 0.2s ease,
        color 0.2s ease,
        border-color 0.2s ease;
}

/* CTA – Add to cart */

body.single-product .summary .single_add_to_cart_button {
    background-color: #f6c94c;
    color: #000;
    border: 1px solid #e0b63f;
}

/* hover */
body.single-product .summary .single_add_to_cart_button:hover {
    background-color: #000 !important;
    color: #fff !important;
    border-color: #000 !important;
}

/* Secondary – Write to seller */

body.single-product .summary .pi-write-to-seller {
    background-color: #fff;
    color: #000;
    border: 1px solid #000;
}

/* hover */
body.single-product .summary .pi-write-to-seller:hover {
    background-color: #000 !important;
    color: #fff !important;
    border-color: #000 !important;
}

/* Kill theme hover (green accent) */

body.single-product .summary .button:hover {
    box-shadow: none !important;
    filter: none !important;
}
