/* ==========================================================================
   Tema CBS — loja (WooCommerce em modo catálogo + orçamento YITH)
   Carregado só nas páginas da loja e em páginas com o widget de produtos.
   ========================================================================== */

/* ---------- Grade de produtos ---------- */
ul.products {
	--cols: 3;
	display: grid;
	grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
	gap: 20px;
	margin: 0 0 30px;
	padding: 0;
	list-style: none;
}
ul.products.columns-2 { --cols: 2; }
ul.products.columns-3 { --cols: 3; }
ul.products.columns-4 { --cols: 4; }
ul.products.columns-5 { --cols: 5; }
ul.products.columns-6 { --cols: 6; }
.cbs-cols-2 ul.products { --cols: 2; }
.cbs-cols-3 ul.products { --cols: 3; }
.cbs-cols-4 ul.products { --cols: 4; }
ul.products::before, ul.products::after { display: none; }

ul.products li.product {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	margin: 0;
	padding: 0;
	text-align: center;
}
ul.products li.product > a.woocommerce-LoopProduct-link { display: flex; flex-direction: column; align-items: center; width: 100%; color: inherit; }
.cbs-product__media { display: block; width: 100%; margin-bottom: 10px; aspect-ratio: 1 / 1; overflow: hidden; }
.cbs-product__media img { width: 100%; height: 100%; object-fit: contain; transition: transform .4s ease; }
li.product:hover .cbs-product__media img { transform: scale(1.03); }
.cbs-product__title { margin: 0 0 5px; font-size: 14px; font-weight: 500; line-height: 1.4; color: #000; }
li.product:hover .cbs-product__title { color: rgba(51, 51, 51, .65); }
.cbs-product__cat { display: block; margin-bottom: 5px; font-size: 13.3px; line-height: 1.6; color: var(--c-soft); }
.cbs-product__sku { display: block; margin-bottom: 11px; font-size: 13.3px; line-height: 1.6; color: var(--c-soft); }
.cbs-product__sku strong { color: #000; font-weight: 700; }

/* Botão "Cotar" (YITH) — mesmo visual do Woodmart; as cores do YITH prevalecem quando ele as define */
.yith-ywraq-add-to-quote { margin-top: auto; }
.add-request-quote-button.button,
a.add-request-quote-button,
.yith_ywraq_add_item_browse_message a {
	--btn-c: var(--c-primary);
	--btn-t: #fff;
	padding: 10px 14px;
	font-size: 16.8px;
	line-height: 16px;
	box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .15);
}
.single-product .add-request-quote-button.button { padding: 12px 20px; }
.yith_ywraq_add_item_response_message, .yith_ywraq_add_item_browse_message { font-size: 13px; margin-top: 6px; }
.yith-ywraq-add-to-quote .ajax-loading { display: none; }
li.product .yith-ywraq-add-to-quote { display: flex; flex-direction: column; align-items: center; }

/* Coração de favoritos no cartão: aparece ao passar o mouse (sempre visível no celular) */
.cbs-fav--icon { position: absolute; top: 10px; right: 10px; z-index: 3; justify-content: center; width: 34px; height: 34px; border-radius: 50%; background: #fff; box-shadow: 0 0 4px rgba(0, 0, 0, .12); opacity: 0; transition: opacity .2s, color .2s; }
.cbs-fav--icon .cbs-fav__label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(1px, 1px, 1px, 1px); white-space: nowrap; }
li.product:hover .cbs-fav--icon, .cbs-fav--icon.is-on, .cbs-fav--icon:focus-visible { opacity: 1; }
@media (hover: none), (max-width: 1024px) { .cbs-fav--icon { opacity: 1; } }

/* Carregar mais (widget de produtos) */
.cbs-loadmore { text-align: center; margin-top: 10px; }
.cbs-loadmore__btn {
	padding: 12px 25px;
	border: 2px solid #e9e9e9;
	border-radius: 35px;
	background: none;
	font-size: 13px;
	font-weight: 900;
	line-height: 18px;
	text-transform: uppercase;
	color: #333;
}
.cbs-loadmore__btn:hover { border-color: #d5d5d5; }
.cbs-loadmore__btn[aria-busy="true"] { opacity: .5; pointer-events: none; }

/* ---------- Barra de ferramentas da loja ---------- */
.cbs-shop-toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 15px; margin-bottom: 25px; }
.cbs-shop-toolbar .cbs-crumbs a:last-child, .cbs-shop-toolbar .cbs-crumbs { font-weight: 400; }
.cbs-shop-toolbar__right { display: flex; align-items: center; gap: 20px; }
.cbs-perpage { display: flex; align-items: center; gap: 5px; font-size: 14px; color: var(--c-soft); }
.cbs-perpage strong { color: #333; margin-right: 4px; }
.cbs-perpage a { color: var(--c-soft); }
.cbs-perpage a.is-active, .cbs-perpage a:hover { color: #333; font-weight: 700; }
.cbs-perpage .sep { color: var(--c-soft); }
.cbs-cols { display: flex; gap: 4px; }
.cbs-cols button { display: inline-flex; padding: 4px; border: 0; background: none; opacity: .35; }
.cbs-cols button.is-active, .cbs-cols button:hover { opacity: 1; }
.cbs-cols__ico { display: block; width: 16px; height: 16px; background: currentColor; color: #333; -webkit-mask: var(--m) center / contain no-repeat; mask: var(--m) center / contain no-repeat; }
.cbs-cols__ico--2 { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Crect width='7' height='7'/%3E%3Crect x='9' width='7' height='7'/%3E%3Crect y='9' width='7' height='7'/%3E%3Crect x='9' y='9' width='7' height='7'/%3E%3C/svg%3E"); }
.cbs-cols__ico--3 { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cg%3E%3Crect width='4' height='4'/%3E%3Crect x='6' width='4' height='4'/%3E%3Crect x='12' width='4' height='4'/%3E%3Crect y='6' width='4' height='4'/%3E%3Crect x='6' y='6' width='4' height='4'/%3E%3Crect x='12' y='6' width='4' height='4'/%3E%3Crect y='12' width='4' height='4'/%3E%3Crect x='6' y='12' width='4' height='4'/%3E%3Crect x='12' y='12' width='4' height='4'/%3E%3C/g%3E%3C/svg%3E"); }
.cbs-cols__ico--4 { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cg%3E%3Crect width='3' height='3'/%3E%3Crect x='4.3' width='3' height='3'/%3E%3Crect x='8.6' width='3' height='3'/%3E%3Crect x='13' width='3' height='3'/%3E%3Crect y='4.3' width='3' height='3'/%3E%3Crect x='4.3' y='4.3' width='3' height='3'/%3E%3Crect x='8.6' y='4.3' width='3' height='3'/%3E%3Crect x='13' y='4.3' width='3' height='3'/%3E%3Crect y='8.6' width='3' height='3'/%3E%3Crect x='4.3' y='8.6' width='3' height='3'/%3E%3Crect x='8.6' y='8.6' width='3' height='3'/%3E%3Crect x='13' y='8.6' width='3' height='3'/%3E%3Crect y='13' width='3' height='3'/%3E%3Crect x='4.3' y='13' width='3' height='3'/%3E%3Crect x='8.6' y='13' width='3' height='3'/%3E%3Crect x='13' y='13' width='3' height='3'/%3E%3C/g%3E%3C/svg%3E"); }
.cbs-shop-filters-btn { display: none; align-items: center; gap: 6px; padding: 6px 0; border: 0; background: none; font-weight: 700; text-transform: uppercase; font-size: 13px; color: #333; }
.cbs-shop-sidebar__close { display: none; }
.woocommerce-products-header, .woocommerce-result-count, .woocommerce-ordering { display: none; }
.term-description { margin-bottom: 25px; }
.woocommerce-info, .woocommerce-message, .woocommerce-error { margin: 0 0 25px; padding: 15px 20px; list-style: none; background: var(--c-bg-soft); border-left: 3px solid var(--c-primary); }
.woocommerce-error { border-color: #e01020; }

/* Barra lateral da loja */
.cbs-shop-sidebar .widget_product_categories li { position: relative; padding-right: 28px; }
.cbs-shop-sidebar .widget_product_categories .children { display: none; padding-left: 14px; margin-top: 4px; }
.cbs-shop-sidebar .widget_product_categories li.is-open > .children,
.cbs-shop-sidebar .widget_product_categories li.current-cat > .children,
.cbs-shop-sidebar .widget_product_categories li.current-cat-parent > .children,
.cbs-shop-sidebar .widget_product_categories li.current-cat-ancestor > .children { display: block; }
.cbs-cat-toggle { position: absolute; top: 4px; right: 0; display: flex; align-items: center; justify-content: center; width: 24px; height: 24px; padding: 0; border: 0; background: none; color: #999; transition: transform .2s; }
.cbs-cat-toggle:hover { color: #333; }
li.is-open > .cbs-cat-toggle, li.current-cat-parent > .cbs-cat-toggle, li.current-cat-ancestor > .cbs-cat-toggle, li.current-cat > .cbs-cat-toggle { transform: rotate(180deg); }
.cbs-shop-sidebar .count { color: var(--c-soft); font-size: 12px; }
.cbs-shop-sidebar .cat-item.current-cat > a { color: var(--c-primary); font-weight: 700; }
.cbs-shop-sidebar .woocommerce-widget-layered-nav-list__item--chosen a { color: var(--c-primary); font-weight: 700; }

/* ---------- Página do produto ---------- */
.cbs-single-product { padding-bottom: 20px; }
.cbs-single-product div.product { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 30px 40px; align-items: start; }
.cbs-single-product div.product > .woocommerce-product-gallery { grid-column: 1; }
.cbs-single-product div.product > .summary { grid-column: 2; }
.cbs-single-product div.product > .woocommerce-tabs,
.cbs-single-product div.product > .related,
.cbs-single-product div.product > .up-sells,
.cbs-single-product div.product > section { grid-column: 1 / -1; }

.woocommerce-product-gallery { position: relative; }
.woocommerce-product-gallery__wrapper { margin: 0; }
.woocommerce-product-gallery__image img { width: 100%; height: auto; }
.woocommerce-product-gallery .flex-control-thumbs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 10px 0 0; padding: 0; list-style: none; }
.woocommerce-product-gallery .flex-control-thumbs img { cursor: pointer; opacity: .6; transition: opacity .2s; }
.woocommerce-product-gallery .flex-control-thumbs img.flex-active, .woocommerce-product-gallery .flex-control-thumbs img:hover { opacity: 1; }
.woocommerce-product-gallery__trigger {
	position: absolute;
	left: 15px;
	bottom: 15px;
	top: auto !important;
	right: auto !important;
	z-index: 9;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	border-radius: 50%;
	background: #fff;
	box-shadow: 0 0 5px rgba(0, 0, 0, .12);
	font-size: 0;
	color: #333;
}
.woocommerce-product-gallery__trigger::before { content: ""; width: 16px; height: 16px; background: currentColor; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M4 9V4h5M20 9V4h-5M4 15v5h5M20 15v5h-5'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M4 9V4h5M20 9V4h-5M4 15v5h5M20 15v5h-5'/%3E%3C/svg%3E") center / contain no-repeat; }
.woocommerce-product-gallery__trigger img { display: none !important; }

.cbs-product-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 15px; margin-bottom: 15px; }
.cbs-product-top .cbs-crumbs { font-size: 12px; text-transform: uppercase; }
.cbs-product-top .cbs-crumbs a { color: var(--c-muted); }
.cbs-product-nav { display: flex; align-items: center; gap: 6px; flex: none; }
.cbs-product-nav a { display: inline-flex; color: #333; opacity: .7; }
.cbs-product-nav a:hover { opacity: 1; }
.product_title { margin-bottom: 20px; font-size: 34px; font-weight: 500; line-height: 1.2; color: #000; }
.cbs-product-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 20px; margin-bottom: 25px; padding-bottom: 25px; border-bottom: 1px solid var(--c-border); }
.cbs-product-actions .yith-ywraq-add-to-quote { margin: 0; }
.cbs-product-actions .add-request-quote-button.button { font-size: 16.8px; padding: 12px 20px; height: 44px; }
.product_meta { display: flex; flex-direction: column; gap: 4px; margin-bottom: 15px; font-size: 14px; }
.product_meta > span { display: block; }
.product_meta .sku_wrapper, .product_meta .posted_in, .product_meta .tagged_as { color: #000; font-weight: 400; }
.product_meta .sku, .product_meta a { font-weight: 400; color: var(--c-muted); }
.cbs-share { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 14px; }
.cbs-share a { display: inline-flex; color: #333; }
.cbs-share a:hover { color: var(--c-primary); }

/* Abas */
.woocommerce-tabs { margin-top: 30px; padding-bottom: 20px; border-top: 1px solid var(--c-border); border-bottom: 1px solid var(--c-border); }
.woocommerce-tabs ul.tabs { display: flex; justify-content: center; gap: 30px; margin: 0 0 30px; padding: 0; list-style: none; }
.woocommerce-tabs ul.tabs::before, .woocommerce-tabs ul.tabs::after { display: none; }
.woocommerce-tabs ul.tabs li { margin: 0; padding: 0; border: 0; background: none; }
.woocommerce-tabs ul.tabs li a { position: relative; display: block; padding: 20px 0; font-size: 16px; font-weight: 700; text-transform: uppercase; color: #333; opacity: .7; }
.woocommerce-tabs ul.tabs li.active a { opacity: 1; }
.woocommerce-tabs ul.tabs li.active a::before { content: ""; position: absolute; top: -1px; left: 0; right: 0; height: 2px; background: var(--c-primary); }
.woocommerce-tabs .panel > h2:first-child { display: none; }
.woocommerce-Tabs-panel { margin-bottom: 20px; }

/* Relacionados */
.related > h2, .up-sells > h2 { position: relative; margin: 20px 0 30px; padding-bottom: 12px; font-size: 22px; font-weight: 700; text-transform: uppercase; }
.related > h2::after, .up-sells > h2::after { content: ""; position: absolute; left: 0; bottom: 0; width: 30px; height: 2px; background: var(--c-primary); }

/* ---------- Página de orçamento (YITH) e conta ---------- */
#yith-ywraq-form table { width: 100%; border-collapse: collapse; }
#yith-ywraq-form th, #yith-ywraq-form td { padding: 12px 10px; border-bottom: 1px solid var(--c-border); }
#yith-ywraq-form .product-subtotal, #yith-ywraq-form .product-quantity, #yith-ywraq-form .product-price { text-align: center; }
.woocommerce-account .woocommerce { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 40px; }
.woocommerce-MyAccount-navigation ul { list-style: none; margin: 0; padding: 0; border: 1px solid var(--c-border); }
.woocommerce-MyAccount-navigation li a { display: block; padding: 12px 18px; border-bottom: 1px solid var(--c-border); color: #333; font-weight: 600; }
.woocommerce-MyAccount-navigation li.is-active a { color: var(--c-primary); background: var(--c-bg-soft); }
.woocommerce-account:not(.logged-in) .woocommerce { display: block; max-width: 900px; margin: 0 auto; }
.u-columns.col2-set { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; }
.woocommerce form .form-row { margin: 0 0 15px; }
.woocommerce form .form-row label .required { color: #e01020; text-decoration: none; }
.woocommerce-form-login__rememberme { display: inline-flex; align-items: center; gap: 6px; margin-right: 15px; }
.woocommerce-LostPassword { margin-top: 10px; }

/* ---------- Responsivo ---------- */
@media (max-width: 1024px) {
	ul.products { --cols: 3 !important; }
	.cbs-products-widget ul.products { --cols: var(--cols-t, 3) !important; }
	.cbs-cols { display: none; }
	.cbs-shop-filters-btn { display: inline-flex; }
	.cbs-shop-sidebar { position: fixed; inset: 0 auto 0 0; z-index: 480; width: min(320px, 86vw); padding: 50px 20px 20px; overflow-y: auto; background: #fff; box-shadow: 0 0 30px rgba(0, 0, 0, .25); transform: translateX(-105%); transition: transform .25s ease; }
	.cbs-shop-sidebar.is-open { transform: none; }
	.cbs-shop-sidebar__close { display: inline-flex; position: absolute; top: 8px; right: 8px; }
}
@media (max-width: 767px) {
	ul.products, .cbs-products-widget ul.products { --cols: var(--cols-m, 2) !important; gap: 15px 10px; }
	.cbs-product__title { font-size: 13px; }
	.add-request-quote-button.button, a.add-request-quote-button { font-size: 14px; padding: 8px 12px; }
	.cbs-perpage { display: none; }
	.cbs-single-product div.product { grid-template-columns: minmax(0, 1fr); }
	.cbs-single-product div.product > .summary, .cbs-single-product div.product > .woocommerce-product-gallery { grid-column: 1; }
	.product_title { font-size: 24px; }
	.woocommerce-account .woocommerce, .u-columns.col2-set { grid-template-columns: minmax(0, 1fr); }
}

/* No Woodmart, a grade de produtos das páginas não herdava a cor do YITH: botão na cor principal.
   O YITH usa !important com variáveis, então redefinimos as variáveis dentro do widget. */
.cbs-products-widget {
	--ywraq_layout_button_bg_color: var(--c-primary);
	--ywraq_layout_button_bg_color_hover: #2a2170;
	--ywraq_layout_button_border_color: transparent;
	--ywraq_layout_button_border_color_hover: transparent;
	--ywraq_layout_button_color: #fff;
	--ywraq_layout_button_color_hover: #fff;
}

.cbs-products-widget .woocommerce .add-request-quote-button.button { padding: 9px 13px; }
