/* Restyle default WooCommerce markup with tabooks tokens - no template rewrite needed for cart/checkout logic to keep gateway plugins (Stripe/Przelewy24) working out of the box. */

.tb-woo-main { max-width: var(--container); margin: 0 auto; padding: 40px 32px 72px; }

/* buttons */
.woocommerce a.button, .woocommerce button.button, .woocommerce input.button,
.woocommerce #respond input#submit, .woocommerce-Button,
.woocommerce .checkout-button, .woocommerce a.checkout-button {
	font-family: var(--font-body); font-weight: 700; border: none; border-radius: var(--radius-pill);
	background: var(--brand); color: var(--paper-raised) !important; box-shadow: var(--shadow-lift), var(--shadow-sm);
	height: 46px; padding: 0 24px; display: inline-flex; align-items: center; justify-content: center;
	transition: transform .12s ease, box-shadow .12s ease, background .12s ease; text-decoration: none;
}
.woocommerce a.button:hover, .woocommerce button.button:hover, .woocommerce input.button:hover {
	background: var(--brand-strong); transform: translateY(-1px); box-shadow: var(--shadow-lift), var(--shadow-md);
}
.woocommerce a.button.alt, .woocommerce button.button.alt { background: var(--brand); }

/* price */
.woocommerce .price, .woocommerce-Price-amount { font-family: var(--font-body); font-weight: 700; color: var(--text-body); }
.woocommerce del .woocommerce-Price-amount { color: var(--text-muted); font-weight: 400; text-decoration: line-through; }
.woocommerce ins { text-decoration: none; }

/* shop archive header: result count + sorting on one line */
.woocommerce-products-header { margin: 0 0 6px; }
.woocommerce-products-header__title { font-size: var(--text-3xl); margin: 0; }
.woocommerce .woocommerce-result-count { font-size: var(--text-sm); color: var(--text-muted); margin: 0; }
.woocommerce .woocommerce-ordering { position: relative; display: inline-block; margin: 0 0 28px; }
/* appearance:none strips the native arrow, so draw the same chevron the .tb-select uses */
.woocommerce .woocommerce-ordering::after {
	content: ""; position: absolute; right: 15px; top: 50%; margin-top: -3px; pointer-events: none;
	border-left: 5px solid transparent; border-right: 5px solid transparent; border-top: 6px solid var(--ink-mute);
}
.woocommerce .woocommerce-ordering select.orderby {
	appearance: none; height: 40px; padding: 0 38px 0 14px; border: 1px solid var(--border-subtle);
	border-radius: var(--radius-md); background: var(--surface-card); font: 600 var(--text-sm) var(--font-body);
	color: var(--text-body); cursor: pointer;
}

/* shop archive grid */
.woocommerce ul.products { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 24px; list-style: none; margin: 0; padding: 0; }
/* WooCommerce's legacy float clearfix - as a grid container these pseudo-elements become real
   grid items and ate the first cell, pushing the only product into column two. */
.woocommerce ul.products::before, .woocommerce ul.products::after { content: none; display: none; }
/* WooCommerce's own stylesheet still sets `width: 22.05%; float: left` on the list items. On a
   grid container the float is inert but the percentage width is not - it collapsed every card
   into a ~55px vertical sliver with the title and button spilling out. */
.woocommerce ul.products li.product { width: auto; float: none; margin: 0; background: var(--surface-card); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); padding: 20px; text-align: left; display: flex; flex-direction: column; gap: 10px; }
.woocommerce ul.products li.product img { border-radius: var(--radius-md); margin: 0; }
.woocommerce ul.products li.product .tb-cover { width: 100%; font-size: clamp(19px, 2vw, 27px); }
.woocommerce ul.products li.product a.woocommerce-loop-product__link { display: block; text-decoration: none; color: inherit; }
.woocommerce ul.products li.product h2, .woocommerce ul.products li.product .woocommerce-loop-product__title {
	font-family: var(--font-display); font-weight: var(--weight-display); font-size: 21px; line-height: var(--leading-snug);
	color: var(--text-body); margin: 12px 0 0; padding: 0;
}
.woocommerce ul.products li.product .price { font-size: var(--text-lg); color: var(--text-body); margin: 0; }
/* WooCommerce's own `li.product .button` rule outranks our generic `.woocommerce a.button` and
   resets display to inline-block, which killed the flex centring - hence text-align too. */
.woocommerce ul.products li.product .button { display: inline-flex; align-items: center; justify-content: center; text-align: center; margin: auto 0 0; width: 100%; }

/* forms / inputs (checkout, cart) */
.woocommerce form .form-row input.input-text, .woocommerce form .form-row textarea,
.woocommerce table.shop_table td.actions .coupon input, .select2-container .select2-selection--single,
.woocommerce-checkout select {
	border: 1px solid var(--border-subtle); border-radius: var(--radius-md); background: var(--surface-card);
	font-family: var(--font-body); font-size: var(--text-base); height: 46px; padding: 0 16px; width: 100%;
}
.woocommerce form .form-row textarea { height: auto; padding: 12px 16px; }
.woocommerce form .form-row label { font-weight: 700; font-size: var(--text-sm); font-family: var(--font-body); }

/* notices */
.woocommerce-message, .woocommerce-info { border-top-color: var(--brand); background: var(--brand-tint); }
.woocommerce-error { border-top-color: var(--danger); }
.woocommerce-message::before, .woocommerce-info::before { color: var(--brand-press); }

/* cart table */
.woocommerce table.shop_table { border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); border-collapse: separate; overflow: hidden; }
.woocommerce table.shop_table th { background: var(--surface-dim); font-family: var(--font-body); font-weight: 700; }
.woocommerce table.shop_table td, .woocommerce table.shop_table th { border-top: 1px solid var(--border-subtle); }

/* checkout payment box - matches the dim-block + SSL-note pattern from the Checkout mockup */
.woocommerce-checkout #payment { background: var(--surface-dim); border-radius: 14px; padding: 16px 18px; }
.woocommerce-checkout #payment ul.payment_methods { border: none; padding: 0; margin: 0 0 12px; }
.woocommerce-checkout #payment div.payment_box { background: var(--surface-card); border-radius: var(--radius-md); font-size: var(--text-sm); }
.woocommerce-checkout #payment div.payment_box::before { border-bottom-color: var(--surface-card); }
.woocommerce-checkout .woocommerce-terms-and-conditions-wrapper { margin: 16px 0; }
.woocommerce-checkout #order_review { background: var(--surface-card); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); box-shadow: var(--shadow-md); padding: 24px; }
.woocommerce-checkout #order_review_heading { font-family: var(--font-display); font-size: var(--text-xl); }

/* single product fallback (used until content-single-product.php override is refined further) */
.woocommerce div.product .price { font-size: var(--text-2xl); }
.woocommerce div.product form.cart { display: flex; gap: 12px; align-items: center; }
/* Ebooks are sold_individually, so WooCommerce renders the qty field as a hidden input inside
   an otherwise empty wrapper - it still consumed a flex gap. Hidden inputs are submitted
   normally with display:none, so quantity=1 keeps reaching the cart. */
.woocommerce div.product form.cart .quantity { display: none; }

/* product tabs → tb-tabs look */
.woocommerce-tabs.wc-tabs-wrapper { margin-top: 0; }
.woocommerce-tabs ul.tabs.wc-tabs { display: flex; gap: 24px; border-bottom: 1px solid var(--border-subtle); font-family: var(--font-body); list-style: none; margin: 0; padding: 0; }
.woocommerce-tabs ul.tabs.wc-tabs li { margin: 0 0 -1px; padding: 0; border: none; background: none; }
.woocommerce-tabs ul.tabs.wc-tabs li a { padding: 12px 2px; display: block; font: 700 16px var(--font-body); color: var(--text-muted); text-decoration: none; border-bottom: 2.5px solid transparent; }
.woocommerce-tabs ul.tabs.wc-tabs li.active a { color: var(--text-body); border-bottom-color: var(--brand); }
.woocommerce-tabs .woocommerce-Tabs-panel { padding: 24px 4px; font-size: 16px; line-height: var(--leading-body); }
.woocommerce-tabs .woocommerce-Tabs-panel h2 { font-size: 24px; margin-bottom: 12px; }
.woocommerce-Tabs-panel--description > h2:first-child { display: none; } /* redundant with the tab nav label ("Opis") */
#reviews .comment-form-rating label, #reviews label { font-family: var(--font-body); font-weight: 700; }
#reviews #respond textarea { border: 1px solid var(--border-subtle); border-radius: var(--radius-md); }
#reviews .star-rating { color: var(--warning); }
#reviews .comment_container img.avatar { border-radius: 50%; }
