/* WooCommerce Cart & Checkout Styles */

.woocommerce-cart-wrapper,
.woocommerce-checkout-wrapper {
	max-width: 1200px;
	margin: 0 auto;
	padding: 2rem 1rem;
}

/* ===== CART PAGE ===== */

.cart-header {
	margin-bottom: 2rem;
	padding-bottom: 1.5rem;
	border-bottom: 1px solid var(--border-neutral);
}

.cart-header h1 {
	margin: 0 0 0.5rem 0;
	font-size: 2rem;
	color: var(--text-charcoal);
}

.cart-summary {
	margin: 0;
	color: var(--text-medium);
	font-size: 0.95rem;
}

/* Empty cart state */
.woocommerce-cart-wrapper--empty .cart-header {
	border-bottom: none;
	margin-bottom: 0;
}

.woocommerce-cart-empty {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 1.25rem;
	padding: 4rem 2rem;
	text-align: center;
	background: var(--light-bg);
	border: 1px dashed var(--border-light);
	border-radius: 5px;
}

.woocommerce-cart-empty .cart-empty-icon {
	display: flex;
	color: var(--primary-color);
	opacity: 0.6;
}

.woocommerce-cart-empty .cart-empty-icon svg {
	width: 56px;
	height: 56px;
}

.woocommerce-cart-empty .cart-empty-message {
	margin: 0;
	color: var(--text-medium);
	font-size: 1.1rem;
}

.woocommerce-cart-empty .cart-empty-button {
	display: inline-block;
	padding: 0.65rem 1.5rem;
	background: var(--heading-dark);
	color: var(--white);
	border-radius: 5px;
	font-size: 0.95rem;
	font-weight: 600;
	text-decoration: none;
	transition: background 0.2s;
}

.woocommerce-cart-empty .cart-empty-button:hover {
	background: var(--heading-darker);
	color: var(--white);
}

.cart-content {
	display: grid;
	grid-template-columns: 1fr 350px;
	gap: 2rem;
	margin-bottom: 2rem;
}

.cart-items {
	display: flex;
	flex-direction: column;
	gap: 1rem;
}

.cart-item {
	display: grid;
	grid-template-columns: 64px 1fr;
	gap: 0.9rem;
	padding: 1rem 0;
	border-bottom: 1px solid var(--border-light);
}

.cart-item:last-child {
	border-bottom: none;
}

.cart-item-image {
	grid-column: 1;
	grid-row: 1 / span 2;
	width: 64px;
	height: 64px;
	border-radius: 5px;
	overflow: hidden;
	background: var(--white);
	border: 1px solid var(--border-light);
}

/* Checkout order-review item card (checkout/review-order.php) - a
   self-contained bordered card per line item (image, name, remove +
   delivery estimate top-right, attributes/SKU, unit price, then a
   quantity + line-subtotal row along the bottom), replacing the plain
   .cart-item-details/.cart-item-footer layout above for this context. */
.woocommerce-checkout-review-order-items {
	display: flex;
	flex-direction: column;
	gap: 1rem;
	margin-bottom: 1.5rem;
}

.woocommerce-checkout-review-order-items .cart-item {
	position: relative;
	display: flex;
	flex-direction: column;
	gap: 0.85rem;
	padding: 1rem 1rem 1rem 3rem;
	border: 1px solid var(--border-light);
	border-radius: 5px;
	background: var(--white);
}

.checkout-cart-item-main {
	display: flex;
	align-items: flex-start;
	gap: .5rem;
}

/* Vertically centered against the *whole* card (both the item row and the
   qty/subtotal footer row below it), not just the row it visually sits
   next to - taken out of flex flow and pinned to the card's own padding
   box instead. */
.woocommerce-checkout-review-order-items .cart-item-remove {
	position: absolute;
	top: 50%;
	left: .75rem;
	transform: translateY( -50% );
}

.checkout-cart-item-main .cart-item-image {
	grid-column: unset;
	grid-row: unset;
	width: 80px;
	height: 80px;
	flex-shrink: 0;
}

.checkout-cart-item-info {
	flex: 1;
	display: flex;
	flex-direction: column;
	gap: 0.35rem;
	min-width: 0;
}

.checkout-cart-item-header {
	display: flex;
	justify-content: space-between;
	align-items: flex-start;
	gap: 1rem;
}

.checkout-cart-item-delivery {
	color: var( --success-color, var(--success-color) );
	font-size: 0.8rem;
	font-weight: 600;
	flex-shrink: 0;
	white-space: nowrap;
}

.checkout-cart-item-meta {
	display: flex;
	flex-direction: column;
	gap: 0.1rem;
}

.checkout-cart-item-meta-line {
	color: var(--text-muted);
	font-size: 0.8rem;
	line-height: 1.4;
}

.checkout-cart-item-unit-price {
	color: var(--text-gray);
	font-size: 0.9rem;
	white-space: nowrap;
}

.checkout-cart-item-subtotal {
	font-weight: 700;
	color: var(--text-dark);
	font-size: 1rem;
	white-space: nowrap;
}

.woocommerce-checkout-review-order-items .cart-item-footer {
	margin-top: 0;
}

.cart-item-image img,
.cart-item-image .category-tile-placeholder {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.cart-item-details {
	display: flex;
	flex-direction: column;
	gap: 0.25rem;
	min-width: 0;
}

.cart-item-name {
	margin: 0 !important;
	font-size: 0.95rem;
	font-weight: 600;
	color: var(--text-dark);
}

.cart-item-name a {
	color: var(--text-dark);
	text-decoration: none;
}

.cart-item-name a:hover {
	color: var(--primary-color);
	text-decoration: underline;
}

.cart-item-attributes {
	margin: 0;
	color: var(--text-muted);
	font-size: 0.8rem;
	line-height: 1.5;
}

/* The plain price (per unit) is redundant next to the line subtotal
   shown in the footer row below - hide it to keep the card compact. */
.cart-item-price {
	display: none;
}

.cart-item-footer {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem;
	margin-top: 0.6rem;
	min-width: 0;
}

.quantity {
	display: flex;
	align-items: center;
	width: fit-content;
	border: 1px solid var(--border-light);
	border-radius: 5px;
	overflow: hidden;
	background: var(--white);
}

.quantity input[type="number"] {
	width: 32px;
	flex: none;
	border: none;
	text-align: center;
	padding: 0.4rem 0;
	font-size: 0.9rem;
	color: var(--text-dark);
}

.quantity input[type="number"]:focus {
	outline: none;
}

/* Fixed (non-editable) quantity - only 1 left in stock, so there's no
   actual choice to make (see assets/js/checkout-cart.js). */
.quantity-fixed-value {
	display: block;
	min-width: 32px;
	padding: 0.4rem 0.5rem;
	text-align: center;
	font-size: 0.9rem;
	color: var(--text-dark);
}

.quantity button {
	width: 28px;
	height: 28px;
	border: none;
	background: var(--light-bg);
	color: var(--text-dark);
	cursor: pointer;
	font-size: 1rem;
	transition: background 0.2s;
}

.quantity button:hover {
	background: var(--bg-cream-hover);
}

.cart-item-subtotal {
	margin-left: auto;
	font-weight: 600;
	color: var(--text-dark);
	font-size: 0.9rem;
	white-space: nowrap;
}

.cart-item-remove {
	flex-shrink: 0;
}

/* A small red circular "x" button in front of the image, instead of an
   "Odstranit" text link under the price. This is actually close to what
   WooCommerce's own `.woocommerce a.remove` (woocommerce.css) already
   renders by default (1em circle, red, single glyph) - it only looked
   broken earlier when it had to fit the full "Odstranit" text label. A
   more specific selector still wins regardless of stylesheet load order. */
.woocommerce-checkout-review-order-items .cart-item-remove a.remove {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 26px;
	height: 26px;
	border-radius: 50%;
	background: var(--error-bg-light);
	color: var( --error-color, var(--error-color) ) !important;
	font-size: 1.2rem;
	font-weight: 700;
	line-height: 1;
	text-decoration: none;
	transition: background 0.2s, color 0.2s;
}

.woocommerce-checkout-review-order-items .cart-item-remove a.remove:hover {
	background: var( --error-color, var(--error-color) );
	color: var(--white) !important;
}

.cart-actions {
	display: flex;
	gap: 1rem;
	margin-top: 2rem;
}

.button {
	padding: 0.75rem 1.5rem;
	border: none;
	border-radius: 5px;
	cursor: pointer;
	font-size: 0.95rem;
	font-weight: 600;
	transition: all 0.2s;
	text-decoration: none;
	display: inline-block;
	text-align: center;
}

.button-primary {
	background: var(--primary-color);
	color: var(--white);
}

.button-primary:hover {
	background: var(--secondary-color);
	text-decoration: none;
}

.button-secondary {
	background: var(--bg-neutral-light);
	color: var(--text-charcoal);
	border: 1px solid var(--border-gray);
}

.button-secondary:hover {
	background: var(--border-neutral);
	text-decoration: none;
}

/* Cart Sidebar */
.cart-sidebar {
	padding: 1.5rem;
	background: var(--bg-neutral-light);
	border-radius: 5px;
	border: 1px solid var(--border-neutral);
	height: fit-content;
	position: sticky;
	top: 1rem;
}

.cart-totals {
	display: flex;
	flex-direction: column;
	gap: 1.5rem;
}

.cart-totals h2 {
	margin: 0;
	font-size: 1.2rem;
	color: var(--text-charcoal);
}

.totals-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.95rem;
}

.totals-table tr {
	border-bottom: 1px solid var(--border-neutral);
}

.totals-table td {
	padding: 0.75rem 0;
	color: var(--text-dim);
}

.totals-table td:last-child {
	text-align: right;
	font-weight: 600;
	color: var(--text-charcoal);
}

.totals-table tr.order-total {
	border-top: 2px solid var(--text-charcoal);
	border-bottom: 2px solid var(--text-charcoal);
	font-weight: 600;
	font-size: 1.1rem;
}

.totals-table tr.order-total td:last-child {
	color: var(--text-dark);
}

.checkout-button {
	width: 100%;
	padding: 1rem;
	background: var(--primary-color);
	color: var(--white);
	border: none;
	border-radius: 5px;
	font-size: 1rem;
	font-weight: 600;
	cursor: pointer;
	transition: background 0.2s;
	text-decoration: none;
}

.checkout-button:hover {
	background: var(--secondary-color);
	text-decoration: none;
}

/* ===== CHECKOUT PAGE ===== */

.checkout-wrapper {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 2rem;
	margin-top: 2rem;
}

.checkout-main {
	display: flex;
	flex-direction: column;
	gap: 2rem;
}

.checkout-section-title {
	margin: 0 0 1.5rem 0;
	font-size: 1.3rem;
	color: var(--text-dark);
	border-bottom: 2px solid var(--border-light);
	padding-bottom: 1rem;
}

/* Checkout Form Fields
   -------------------------------------------------------------------
   WooCommerce's woocommerce_form_field() renders each field as its own
   <p class="form-row form-row-first|form-row-last|form-row-wide">
   sibling (NOT a wrapper with child rows), each containing
   <span class="woocommerce-input-wrapper"><input class="input-text">.
   So the *parent* container (.billing-form / .shipping_address) needs
   to be the grid, with form-row-first/last placed in the two columns
   and every other field (plain form-row, or form-row-wide) spanning
   both - confirmed against the actual rendered markup. */
.woocommerce-form-group {
	margin-bottom: 1.25rem;
}

.billing-form,
.shipping_address {
	display: grid;
	grid-template-columns: 1fr 1fr;
	column-gap: 1.25rem;
}

.form-row {
	grid-column: 1 / -1;
	margin-bottom: 1.25rem;
	width: 100%;
	min-width: 0;
}

.form-row-first {
	grid-column: 1;
}

.form-row-last {
	grid-column: 2;
}

.form-row-wide {
	grid-column: 1 / -1;
}

.form-row-first,
.form-row-last {
	width: 100% !important;
	max-width: 100% !important;
	min-width: 0 !important;
}

.form-row-first .woocommerce-input-wrapper,
.form-row-last .woocommerce-input-wrapper,
.form-row-first input.input-text,
.form-row-last input.input-text {
	width: 100% !important;
	max-width: 100% !important;
	box-sizing: border-box !important;
}

.woocommerce-input-wrapper {
	display: block;
	width: 100%;
}

/* Form Fields - WooCommerce's own woocommerce_form_field() renders text
   inputs/textareas with class "input-text" (NOT ".woocommerce-Input",
   which is only used by the block-based checkout, not this classic one)
   - matching that exact class is why fields weren't stretching to a
   consistent width before, each was sized by its native default instead. */
.woocommerce-Input,
input.input-text,
textarea.input-text,
.form-control,
select,
textarea {
	width: 100%;
	box-sizing: border-box;
	padding: 0.7rem 0.9rem;
	border: 1px solid var(--border-light);
	border-radius: 5px;
	font-size: 0.95rem;
	font-family: inherit;
	color: var(--text-dark);
	background: var(--white);
	transition: border-color 0.2s, box-shadow 0.2s;
}

.woocommerce-Input::placeholder,
input.input-text::placeholder,
textarea.input-text::placeholder,
.form-control::placeholder,
textarea::placeholder {
	color: var(--placeholder-color);
}

.woocommerce-Input:focus,
input.input-text:focus,
textarea.input-text:focus,
.form-control:focus,
select:focus,
textarea:focus {
	outline: none;
	border-color: var(--primary-color);
	box-shadow: 0 0 0 2px rgba(var(--primary-color-rgb), 0.15);
}

/* Select2 (used for the Country/State dropdowns) calculates its own
   width from the hidden native <select> at init time and applies it as
   an inline style - !important guarantees it stays full-width to match
   every other field regardless of that timing. */
.select2-container {
	width: 100% !important;
}

.select2-container .select2-selection--single {
	height: auto;
	padding: 0.7rem 0.9rem;
	border: 1px solid var(--border-light);
	border-radius: 5px;
}

.select2-container .select2-selection__rendered {
	padding: 0;
	line-height: normal;
	color: var(--text-dark);
}

.select2-container .select2-selection__arrow {
	height: 100%;
}

label {
	display: block;
	margin-bottom: 0.4rem;
	color: var(--text-dark);
	font-weight: 600;
	font-size: 0.9rem;
}

.required {
	color: var(--error-terracotta);
	margin-left: 0.2rem;
	text-decoration: none;
}

/* Checkout Sidebar */
.checkout-sidebar {
	display: flex;
	flex-direction: column;
	gap: 2rem;
	height: fit-content;
	position: sticky;
	top: 1rem;
}

.order-review-section {
	background: var(--light-bg);
	padding: 1.5rem;
	border-radius: 5px;
	border: 1px solid var(--border-light);
}

.checkout-secure-badge {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	justify-content: center;
	margin: 0;
	color: var(--text-gray);
	font-size: 0.9rem;
}

.checkout-secure-badge .dashicons {
	width: 18px;
	height: 18px;
	font-size: 18px;
}

.cart-item.is-updating {
	opacity: 0.5;
	pointer-events: none;
	transition: opacity 0.15s ease;
}

/* Order Totals */
.woocommerce-checkout-totals {
	width: 100%;
	border-collapse: collapse;
}

.woocommerce-checkout-totals th {
	text-align: left;
	font-weight: 600;
	color: var(--text-dark);
	padding: 0.75rem 0;
}

.woocommerce-checkout-totals td {
	text-align: right;
	padding: 0.75rem 0;
	color: var(--text-gray);
}

.woocommerce-checkout-totals tr {
	border-bottom: 1px solid var(--border-light);
}

.woocommerce-checkout-totals .order-total {
	font-size: 1.1rem;
	font-weight: 600;
	border-top: 2px solid var(--text-dark);
	border-bottom: none;
}

.woocommerce-checkout-totals .order-total th,
.woocommerce-checkout-totals .order-total td {
	color: var(--text-dark);
	padding: 1rem 0;
}

/* Shipping method list (wc_cart_totals_shipping_html() output) */
#shipping_method {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
}

#shipping_method li {
	list-style: none;
}

#shipping_method input[type="radio"],
#shipping_method input[type="hidden"] + label {
	cursor: pointer;
}

#shipping_method input[type="radio"] {
	accent-color: var(--primary-color);
	margin-right: 0.5rem;
}

#shipping_method label {
	display: inline;
	font-weight: 400;
	color: var(--text-gray);
	cursor: pointer;
}

/* Generic fallback for third-party shipping widget buttons (e.g. the
   Zásilkovna/Packeta pickup-point picker) whose exact markup/classes we
   don't control, so at least they look consistent with the rest of the
   order summary instead of a bare unstyled browser button. */
#shipping_method button,
#shipping_method input[type="button"],
.woocommerce-checkout-review-order-items button:not(.quantity-button):not(.quantity button) {
	padding: 0.5rem 1rem;
	background: var(--white);
	border: 1px solid var(--border-light);
	border-radius: 5px;
	color: var(--text-dark);
	font-size: 0.85rem;
	cursor: pointer;
	transition: border-color 0.2s;
}

#shipping_method button:hover,
#shipping_method input[type="button"]:hover {
	border-color: var(--primary-color);
}

/* Toret Zásilkovna (Packeta) pickup-point rows - the plugin appends its own
   <tr>s to the totals table (logo + "Vybrat výdejní místo" button, then the
   selected-branch name) right after the shipping method row, but only when
   the currently chosen shipping method is the pickup-point one. */
.zasikovna-ico img {
	max-width: 100px;
	height: auto;
	vertical-align: middle;
}

.zas-tlac,
.zas-tlac2 {
	display: inline-block;
	padding: 0.5rem 1rem;
	background: var(--white);
	border: 1px solid var(--border-light);
	border-radius: 5px;
	color: var(--text-dark);
	font-size: 0.85rem;
	text-decoration: none;
	cursor: pointer;
	transition: border-color 0.2s;
}

.zas-tlac:hover,
.zas-tlac2:hover {
	border-color: var(--primary-color);
}

.zasilkovna-zvolena-pobocka {
	vertical-align: top;
}

.packeta-selector-branch-name {
	font-size: 0.85rem;
	color: var(--text-gray);
}

.packeta-selector-branch-name:empty {
	display: none;
}

/* Wrap the whole payment section (methods, terms checkbox, place-order
   button) in its own white bordered card, same treatment as a product
   card in the order review above. */
.woocommerce-checkout .woocommerce-checkout-payment {
	margin-top: 1.5rem;
	background: var(--white) !important;
	border: 1px solid var(--border-light);
	border-radius: 5px;
	padding: 1.25rem;
}

/* Payment Methods - real WooCommerce markup classes
   (checkout/payment.php): ul.wc_payment_methods > li.wc_payment_method,
   with the gateway's description in .payment_box. */
.wc_payment_methods {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
}

.wc_payment_method {
	list-style: none;
	border: 1px solid var(--border-light);
	border-radius: 5px;
	padding: 0.9rem 1rem;
	transition: border-color 0.2s;
}

.wc_payment_method:has( input:checked ) {
	border-color: var(--primary-color);
}

.wc_payment_method input.input-radio {
	cursor: pointer;
	width: 18px;
	height: 18px;
	accent-color: var(--primary-color);
	margin-right: 0.5rem;
	vertical-align: middle;
}

.wc_payment_method label {
	display: inline;
	margin: 0;
	cursor: pointer;
	font-weight: 600;
	color: var(--text-dark);
}

.wc_payment_method img {
	max-height: 20px;
	vertical-align: middle;
	margin-left: 0.4rem;
}

.payment_box {
	margin-top: 0.75rem;
	padding: 0.9rem;
	background: var(--light-bg);
	border: 1px solid var(--border-light);
	border-radius: 5px;
	color: var(--text-gray);
	font-size: 0.85rem;
	line-height: 1.6;
}

.payment_box p:last-child {
	margin-bottom: 0;
}

/* Terms + place order */
.woocommerce-terms-and-conditions-wrapper {
	margin: 1.5rem 0;
	font-size: 0.85rem;
	color: var(--text-gray);
}

.woocommerce-form__label-for-checkbox {
	display: flex;
	align-items: flex-start;
	gap: 0.5rem;
}

.woocommerce-form__input-checkbox {
	margin-top: 0.2rem;
	accent-color: var(--primary-color);
}

/* "Ship to a different address?" is an <h4> in WooCommerce's own markup,
   but it's a checkbox row, not a section heading - normalize it back
   down to body-text size instead of inheriting the site's h4 styling. */
#ship-to-different-address {
	margin: 0 0 1rem;
	font-size: 0.95rem;
	font-weight: 400;
}

#ship-to-different-address .woocommerce-form__label-for-checkbox span {
	font-weight: 600;
	color: var(--text-dark);
}

#place_order {
	width: 100%;
	padding: 1rem;
	background: var(--primary-color) !important;
	color: var(--white) !important;
	border: none;
	border-radius: 5px;
	font-size: 1.05rem;
	font-weight: 600;
	cursor: pointer;
	transition: background 0.2s;
}

#place_order:hover {
	background: var(--primary-hover) !important;
}

/* Responsive */
@media (max-width: 1024px) {
	.cart-content {
		grid-template-columns: 1fr;
	}

	.checkout-wrapper {
		grid-template-columns: 1fr;
	}

	.cart-sidebar,
	.checkout-sidebar {
		position: static;
	}

	/* Mobile order: products, then billing/shipping details, then
	   shipping-method+payment - instead of the desktop billing-column /
	   order-review-column split. The order review's products, totals
	   (shipping method included) and payment box are normally one
	   continuous block (#order_review, kept together so our AJAX qty
	   refresh and WooCommerce's own update_checkout redraw all of it
	   consistently) - display:contents dissolves each wrapper's own box
	   without touching the PHP/JS, promoting its children up to be direct
	   items of .checkout-wrapper's grid so they can be reordered
	   independently of the billing form sitting between them. */
	.checkout-main,
	.checkout-sidebar,
	.order-review-section,
	#order_review,
	.woocommerce-checkout-review-order-table {
		display: contents;
	}

	.order-review-section > .checkout-section-title {
		order: 1;
	}

	.woocommerce-checkout-review-order-items {
		order: 2;
	}

	#customer_details {
		order: 3;
	}

	#shipping_details {
		order: 4;
	}

	.additional-info {
		order: 5;
	}

	.woocommerce-checkout-totals {
		order: 6;
	}

	.woocommerce-checkout-payment {
		order: 7;
	}

	.checkout-secure-badge {
		order: 8;
	}
}

@media (max-width: 768px) {
	.woocommerce-cart-wrapper,
	.woocommerce-checkout-wrapper {
		padding: 1rem;
	}

	.cart-item {
		grid-template-columns: 56px 1fr;
		gap: 0.75rem;
	}

	.cart-item-image {
		width: 56px;
		height: 56px;
	}

	.cart-item-footer {
		flex-wrap: wrap;
	}

	.checkout-cart-item-header {
		flex-direction: column;
		gap: 0.4rem;
	}

	.checkout-cart-item-badges {
		gap: 0.75rem;
	}

	.checkout-section-title {
		font-size: 1.1rem;
	}

	.billing-form,
	.shipping_address {
		grid-template-columns: 1fr;
	}

	.form-row-first,
	.form-row-last {
		grid-column: 1;
	}
}

@media (max-width: 480px) {
	.cart-header h1 {
		font-size: 1.5rem;
	}

	.checkout-section-title {
		font-size: 1rem;
	}

	.wc_payment_method {
		text-align: center;
	}

	.button,
	.checkout-button {
		width: 100%;
	}
}
