/* ==========================================================================
   Каталог продукции и корзина (WooCommerce) в оформлении сайта.
   Поверх штатных стилей WooCommerce: карточки товаров, лента «Каталог» на
   страницах «Термодерево», страница товара, корзина, оформление заявки,
   счетчик корзины в шапке.
   ========================================================================== */

.te-shop, .td-catalog {
  --sh-yellow: #ffd888;
  --sh-yellow-dark: #f5c96a;
  --sh-brown: #69470c;
  --sh-text: #383838;
  --sh-line: #e6e6e6;
  --sh-red: #c8102e;
}

/* ---------- Счетчик корзины в шапке ---------- */
.te-cart-link {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 42px; height: 42px; margin-left: 8px; border-radius: 9999px; color: hsl(var(--foreground));
  transition: background-color .2s;
}
.te-cart-link:hover { background: hsl(var(--muted)); }
.te-cart-link.is-empty { display: none; }
.woocommerce-cart .te-cart-link, .woocommerce-checkout .te-cart-link { display: none; }
.te-cart-link__count {
  position: absolute; top: 2px; right: 0; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9999px;
  background: #ffd888; color: #69470c; font-size: 11px; font-weight: 800; line-height: 18px; text-align: center;
}

/* ---------- Карточка товара (лента, категория, похожие товары) ---------- */
.woocommerce ul.products li.product, .woocommerce-page ul.products li.product { text-align: left; }
.woocommerce ul.products li.product a img { aspect-ratio: 1 / 1; object-fit: cover; border-radius: 8px; margin: 0 0 14px; background: #f6f6f6; }
.woocommerce ul.products li.product .woocommerce-loop-product__title {
  padding: 0; margin: 0 0 8px; font-size: 15px; font-weight: 500; line-height: 1.35; color: var(--sh-text);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.7em;
}
/* Цена: новая цена первой, старая зачеркнутая следом, затем единица. */
.woocommerce ul.products li.product .price { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; margin: 0 0 14px; color: var(--sh-text); font-size: 16px; font-weight: 700; }
.woocommerce ul.products li.product .price del { order: 2; color: #9a9a9a; font-weight: 400; font-size: 14px; opacity: 1; }
.woocommerce ul.products li.product .price ins { order: 1; text-decoration: none; color: var(--sh-red); }
.woocommerce ul.products li.product .price .te-price-unit { order: 3; }
.woocommerce ul.products li.product .price .screen-reader-text { position: absolute; }
.te-price-unit { font-size: .8em; font-weight: 400; color: #777; white-space: nowrap; }
.woocommerce span.onsale {
  min-width: 0; min-height: 0; padding: 4px 8px; border-radius: 6px; line-height: 1.2;
  background: var(--sh-red, #c8102e); color: #fff; font-size: 13px; font-weight: 700;
}
.woocommerce ul.products li.product .onsale { top: 10px; left: 10px; right: auto; margin: 0; }
.woocommerce ul.products li.product .button,
.woocommerce a.button, .woocommerce button.button, .woocommerce input.button,
.woocommerce #respond input#submit, .woocommerce a.button.alt, .woocommerce button.button.alt {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 22px; border-radius: 8px;
  background: var(--sh-yellow, #ffd888); color: var(--sh-brown, #69470c); font-size: 13px; font-weight: 800; letter-spacing: .04em; line-height: 1.2;
  transition: background-color .2s;
}
.woocommerce ul.products li.product .button:hover,
.woocommerce a.button:hover, .woocommerce button.button:hover, .woocommerce a.button.alt:hover, .woocommerce button.button.alt:hover {
  background: var(--sh-yellow-dark, #f5c96a); color: var(--sh-brown, #69470c);
}
.woocommerce a.button.added::after { margin-left: .4em; }
.woocommerce a.added_to_cart { display: inline-block; margin-left: 10px; padding-top: 0; font-size: 13px; color: var(--sh-brown, #69470c); text-decoration: underline; }

/* ---------- Блок «Каталог» на страницах «Термодерево» ---------- */
.td-catalog__box { display: grid; grid-template-columns: 240px minmax(0, 1fr); border: 1px solid var(--sh-line); }
.td-catalog__head { display: flex; flex-direction: column; align-items: flex-start; padding: 32px 28px; border-right: 1px solid var(--sh-line); }
.td-catalog__title { margin: 0 0 12px; font-size: 28px; line-height: 1.2; font-weight: 400; color: var(--sh-text); }
.td-catalog__title strong, .td-catalog__title b { font-weight: 800; }
.td-catalog__more { font-size: 15px; color: var(--sh-text); text-decoration: underline; text-underline-offset: 3px; }
.td-catalog__more:hover { color: var(--sh-brown); }
.td-catalog__head .td-arrows { margin-top: auto; padding-top: 32px; }
.woocommerce .td-catalog__track.products { display: flex; margin: 0; padding: 0; gap: 0; }
.woocommerce .td-catalog__track.products::before, .woocommerce .td-catalog__track.products::after { content: none; }
.woocommerce .td-catalog__track.products li.product {
  float: none; width: 240px; margin: 0; padding: 24px 22px; border-right: 1px solid var(--sh-line); display: flex; flex-direction: column;
}
.woocommerce .td-catalog__track.products li.product .button { margin-top: auto; align-self: flex-start; }

/* ---------- Страницы магазина: крошки, заголовки ---------- */
.te-shop { color: var(--sh-text); }
.te-shop-crumbs { margin: 0 0 24px; font-size: 14px; color: #777; }
.te-shop-crumbs a { color: #777; text-decoration: none; }
.te-shop-crumbs a:hover { color: var(--sh-brown); text-decoration: underline; }
.te-shop-crumbs__sep { margin: 0 .5em; color: #bbb; }
.te-shop .woocommerce-products-header__title, .te-shop .product_title {
  margin: 0 0 20px; font-size: clamp(24px, 2.6vw, 34px); line-height: 1.25; font-weight: 700; color: hsl(var(--foreground));
}
.te-shop .woocommerce-result-count, .te-shop .woocommerce-ordering { margin-bottom: 24px; font-size: 14px; }
.te-shop .woocommerce-ordering select { padding: 8px 10px; border: 1px solid var(--sh-line); border-radius: 8px; background: #fff; }
.te-shop ul.products li.product { padding: 0 0 8px; }

/* ---------- Страница товара ---------- */
.woocommerce.single-product div.product, .te-shop div.product { margin-bottom: 0; }
.te-shop div.product div.images { margin-bottom: 32px; }
.te-shop div.product div.images img { border-radius: 10px; }
.te-shop div.product div.images .flex-control-thumbs { margin-top: 10px; display: flex; gap: 10px; }
.te-shop div.product div.images .flex-control-thumbs li { width: 80px; float: none; }
.te-shop div.product div.images .flex-control-thumbs li img { border-radius: 6px; }
.te-shop div.product span.onsale { top: 12px; left: 12px; }
.te-shop div.product p.price, .te-shop div.product span.price { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin: 0 0 20px; font-size: 28px; font-weight: 800; color: var(--sh-text); }
.te-shop div.product p.price del { order: 2; font-size: 18px; font-weight: 400; color: #9a9a9a; opacity: 1; }
.te-shop div.product p.price ins { order: 1; text-decoration: none; color: var(--sh-red); }
.te-shop div.product p.price .te-price-unit { order: 3; }
.te-shop div.product p.price .te-price-label { order: 0; font-size: 18px; font-weight: 500; color: #777; }
.te-shop div.product p.price .screen-reader-text { position: absolute; }
.te-shop div.product p.price .te-price-unit { font-size: 16px; }
.te-shop-specs { margin: 0 0 24px; padding: 0; list-style: none; font-size: 15px; line-height: 1.5; }
.te-shop-specs li { padding: 6px 0; border-bottom: 1px dashed var(--sh-line); }
.te-shop-specs li span { display: inline-block; min-width: 9em; color: #777; }
.te-shop div.product form.cart { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 0 0 28px; }
.te-shop div.product form.cart div.quantity { display: inline-flex; align-items: center; gap: 8px; float: none; margin: 0; }
.te-shop .quantity .qty { width: 84px; height: 48px; padding: 0 8px; border: 1px solid #cfcfcf; border-radius: 8px; font-size: 16px; text-align: center; }
.te-qty-unit { font-size: 15px; color: #777; }
.te-shop div.product form.cart .button { min-height: 48px; padding: 0 36px; float: none; }
.te-shop div.product .woocommerce-tabs { clear: both; padding-top: 24px; }
.te-shop div.product .woocommerce-tabs ul.tabs { margin: 0 0 20px; padding: 0; border-bottom: 1px solid var(--sh-line); }
.te-shop div.product .woocommerce-tabs ul.tabs::before { display: none; }
.te-shop div.product .woocommerce-tabs ul.tabs li { margin: 0 24px 0 0; padding: 0; border: 0; border-radius: 0; background: none; }
.te-shop div.product .woocommerce-tabs ul.tabs li::before, .te-shop div.product .woocommerce-tabs ul.tabs li::after { display: none; }
.te-shop div.product .woocommerce-tabs ul.tabs li a { padding: 12px 0; font-weight: 600; color: #777; border-bottom: 3px solid transparent; }
.te-shop div.product .woocommerce-tabs ul.tabs li.active a { color: var(--sh-text); border-bottom-color: var(--sh-yellow); }
.te-shop table.shop_attributes { border-top: 1px solid var(--sh-line); }
.te-shop table.shop_attributes th, .te-shop table.shop_attributes td { padding: 10px 12px; border-bottom: 1px solid var(--sh-line); font-style: normal; text-align: left; }
.te-shop table.shop_attributes th { width: 220px; font-weight: 500; color: #777; }
.te-shop table.shop_attributes td p { padding: 0; }
.te-shop table.shop_attributes tr:nth-child(even) th, .te-shop table.shop_attributes tr:nth-child(even) td { background: #fafafa; }
.te-shop .related.products { clear: both; padding-top: 40px; }
.te-shop .related.products > h2 { margin: 0 0 24px; font-size: 24px; font-weight: 700; }

/* ---------- Корзина и оформление заявки ---------- */
.te-shop table.shop_table { border-radius: 10px; border-color: var(--sh-line); }
.te-shop table.shop_table th, .te-shop table.shop_table td { padding: 14px 12px; border-color: var(--sh-line); }
.te-shop table.cart img { width: 72px; border-radius: 6px; }
.te-shop table.cart td.actions .coupon { display: none; }
.te-shop .cart-collaterals .cart_totals h2, .te-shop #order_review_heading, .te-shop .woocommerce-billing-fields h3 { font-size: 22px; font-weight: 700; margin: 0 0 16px; }
.te-shop .wc-proceed-to-checkout a.checkout-button { min-height: 56px; font-size: 15px; }
.te-shop form .form-row label { font-weight: 500; margin-bottom: 4px; }
.te-shop form .form-row input.input-text, .te-shop form .form-row textarea {
  padding: 12px 14px; border: 1px solid #cfcfcf; border-radius: 8px; font-size: 16px; line-height: 1.4; background: #fff;
}
.te-shop form .form-row textarea { min-height: 110px; }
.te-shop #payment { border-radius: 10px; background: #f7f7f7; }
.te-shop #payment div.payment_box { background: #fff; color: var(--sh-text); }
.te-shop #payment div.payment_box::before { border-bottom-color: #fff; }
.te-shop #payment #place_order { width: 100%; min-height: 56px; font-size: 15px; }
.te-shop .woocommerce-message, .te-shop .woocommerce-info, .te-shop .woocommerce-error { border-top-color: var(--sh-yellow-dark); }
.te-shop .woocommerce-message::before, .te-shop .woocommerce-info::before { color: var(--sh-brown); }
.te-shop .te-smartcaptcha-note { clear: both; margin: 8px 0 0; font-size: 12px; color: #888; }

/* ---------- «Купить в 1 клик» ---------- */
.te-shop div.product form.cart .te-oneclick-btn { background: #fff; border: 1px solid var(--sh-text, #383838); color: var(--sh-text, #383838); }
.te-shop div.product form.cart .te-oneclick-btn:hover { background: var(--sh-text, #383838); color: #fff; }
.te-oneclick { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 16px; }
.te-oneclick[hidden] { display: none; }
.te-oneclick__overlay { position: absolute; inset: 0; background: rgba(0, 0, 0, .55); }
.te-oneclick__dialog { position: relative; width: 100%; max-width: 440px; max-height: calc(100vh - 32px); overflow: auto; padding: 32px 28px 24px; border-radius: 14px; background: #fff; box-shadow: 0 20px 60px rgba(0, 0, 0, .25); }
.te-oneclick__close { position: absolute; top: 8px; right: 12px; width: 36px; height: 36px; border: 0; background: none; font-size: 28px; line-height: 1; color: #777; cursor: pointer; }
.te-oneclick__title { margin: 0 0 8px; font-size: 22px; font-weight: 700; }
.te-oneclick__product { margin: 0 0 18px; font-size: 14px; color: #777; }
.te-oneclick__form .form-row { margin: 0 0 14px; padding: 0; }
.te-oneclick__form label { display: block; margin-bottom: 4px; font-weight: 500; }
.te-oneclick__form .input-text { width: 100%; }
.te-oneclick__submit { width: 100%; min-height: 52px; margin-top: 4px; }
.te-oneclick__msg { margin: 0 0 12px; padding: 10px 12px; border-radius: 8px; font-size: 14px; }
.te-oneclick__msg.is-ok { background: #edf7ee; color: #1e6b2a; }
.te-oneclick__msg.is-error { background: #fdecee; color: #a1122a; }
.te-oneclick__note { margin: 12px 0 0; font-size: 12px; line-height: 1.5; color: #888; }
.te-oneclick__note a { color: inherit; text-decoration: underline; }

@media (max-width: 767px) {
  .td-catalog__box { grid-template-columns: minmax(0, 1fr); }
  .td-catalog__head { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 20px; border-right: 0; border-bottom: 1px solid var(--sh-line); }
  .td-catalog__title { flex: 1 1 100%; margin: 0; font-size: 24px; }
  .td-catalog__head .td-arrows { margin: 0 0 0 auto; padding: 0; }
  .woocommerce .td-catalog__track.products li.product { width: 70vw; max-width: 260px; padding: 18px 16px; }
  .te-shop div.product form.cart .button { flex: 1 1 100%; }
  .te-shop table.shop_attributes th { width: 45%; }
}
