/*
 * OS Framework — WooCommerce compatibility layer.
 *
 * Structural safeguards only. Catalogue cards, product pages, premium account,
 * cart and checkout design belong to the optional OS WooCommerce module.
 */

.woocommerce-page .os-main--woocommerce,
.woocommerce-page .os-commerce-page,
.woocommerce-page .woocommerce,
.woocommerce-page .woocommerce > * {
	min-width: 0;
}

.woocommerce-page .os-commerce-page {
	width: 100%;
	max-width: none;
}

.woocommerce-page .woocommerce::before,
.woocommerce-page .woocommerce::after,
.woocommerce-page .cart-collaterals::before,
.woocommerce-page .cart-collaterals::after {
	display: none !important;
	content: none !important;
}

.woocommerce img,
.woocommerce-page img,
.wc-block-components-product-image img {
	max-width: 100%;
	height: auto;
}

.woocommerce table.shop_table,
.wc-block-cart-items,
.wc-block-components-order-summary {
	max-width: 100%;
}

.woocommerce form .form-row,
.woocommerce form .form-row input.input-text,
.woocommerce form .form-row textarea,
.woocommerce form .form-row select {
	max-width: 100%;
}

/* Neutralise uniquement les anciens floats sur les pages système. */
.woocommerce-account .woocommerce-MyAccount-navigation,
.woocommerce-account .woocommerce-MyAccount-content,
.woocommerce-account .woocommerce-Addresses .woocommerce-Address,
.woocommerce-account.logged-out .u-column1,
.woocommerce-account.logged-out .u-column2,
.woocommerce-cart .cart-collaterals .cart_totals,
.woocommerce-checkout #customer_details .col-1,
.woocommerce-checkout #customer_details .col-2,
.woocommerce-checkout #order_review,
.woocommerce-checkout #order_review_heading {
	float: none;
	max-width: none;
}

/* Mise en page de secours : lisible sans module OS WooCommerce. */
.woocommerce-account:not(.logged-out) .woocommerce {
	display: grid;
	grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
	gap: clamp(28px, 4vw, 52px);
	align-items: start;
}

.woocommerce-account .woocommerce-MyAccount-navigation,
.woocommerce-account .woocommerce-MyAccount-content {
	width: 100%;
	min-width: 0;
	margin: 0;
}

.woocommerce-account .woocommerce-MyAccount-navigation ul {
	margin: 0;
	padding: 0;
	list-style: none;
}

.woocommerce-account .woocommerce-MyAccount-navigation a {
	display: block;
	padding: .75rem 0;
	color: inherit;
	text-decoration: none;
	border-bottom: 1px solid var(--os-border);
}

.woocommerce-account .woocommerce-MyAccount-navigation .is-active > a {
	font-weight: 700;
}

.woocommerce-account.logged-out .u-columns,
.woocommerce-account .woocommerce-Addresses {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: clamp(24px, 4vw, 48px);
}

.woocommerce-account.logged-out :is(.u-column1, .u-column2),
.woocommerce-account .woocommerce-Address {
	width: 100%;
	margin: 0;
}

.woocommerce-cart .cart-collaterals {
	display: flex;
	justify-content: flex-end;
	width: 100%;
}

.woocommerce-cart .cart-collaterals .cart_totals {
	width: min(100%, 560px);
	margin: 0;
}

.woocommerce-checkout form.checkout {
	display: grid;
	grid-template-columns: minmax(0, 1.15fr) minmax(320px, .85fr);
	gap: clamp(30px, 5vw, 64px);
	align-items: start;
}

.woocommerce-checkout #customer_details,
.woocommerce-checkout #order_review,
.woocommerce-checkout #order_review_heading,
.woocommerce-checkout #customer_details :is(.col-1, .col-2) {
	width: 100%;
	min-width: 0;
}

.woocommerce-checkout #order_review,
.woocommerce-checkout #order_review_heading {
	grid-column: 2;
}

.wc-block-cart,
.wc-block-checkout,
.wc-block-components-sidebar-layout,
.wc-block-components-main,
.wc-block-components-sidebar {
	min-width: 0;
	max-width: 100%;
	box-sizing: border-box;
}

@media (max-width: 960px) {
	.woocommerce-account:not(.logged-out) .woocommerce,
	.woocommerce-checkout form.checkout {
		grid-template-columns: 1fr;
	}

	.woocommerce-checkout #order_review,
	.woocommerce-checkout #order_review_heading {
		grid-column: 1;
	}
}

@media (max-width: 767px) {
	.woocommerce-account.logged-out .u-columns,
	.woocommerce-account .woocommerce-Addresses {
		grid-template-columns: 1fr;
	}

	.woocommerce-cart .cart-collaterals .cart_totals {
		width: 100%;
	}

	.woocommerce table.shop_table_responsive tr,
	.woocommerce-page table.shop_table_responsive tr {
		display: block;
	}
}

/*
 * Product purchase form spacing.
 * Adds a neutral separation from the product content above without changing
 * the active client design, button styling or WooCommerce structure.
 */
.single-product div.product .summary form.cart {
	margin-top: 1.5rem;
}

@media (max-width: 767px) {
	.single-product div.product .summary form.cart {
		margin-top: 1.125rem;
	}
}

/*
 * Quantity controls on touch screens.
 * Kept visually neutral: colors, radius and typography remain inherited from
 * the active client design. Desktop keeps the theme/WooCommerce native UI.
 */
.os-qty-control {
	display: none;
}

@media (max-width: 767px) {
	.single-product form.cart .quantity {
		display: inline-flex;
		align-items: stretch;
		justify-content: center;
		width: auto;
		min-width: 108px;
		margin: 0;
		overflow: hidden;
	}

	.single-product form.cart .quantity .qty {
		flex: 0 0 42px;
		width: 42px;
		min-width: 42px;
		max-width: 42px;
		margin: 0;
		padding-inline: 4px;
		text-align: center;
		border-radius: 0;
		appearance: textfield;
		-moz-appearance: textfield;
	}

	.single-product form.cart .quantity .qty::-webkit-inner-spin-button,
	.single-product form.cart .quantity .qty::-webkit-outer-spin-button {
		margin: 0;
		-webkit-appearance: none;
	}

	.single-product form.cart .quantity .os-qty-control {
		display: inline-flex;
		flex: 0 0 33px;
		align-items: center;
		justify-content: center;
		width: 33px;
		min-width: 33px;
		min-height: 44px;
		margin: 0;
		padding: 0;
		color: inherit;
		font: inherit;
		font-size: 20px;
		font-weight: 500;
		line-height: 1;
		background: transparent;
		border: 0;
		border-radius: 0;
		box-shadow: none;
		cursor: pointer;
		touch-action: manipulation;
	}

	.single-product form.cart .quantity .os-qty-control:disabled {
		cursor: not-allowed;
		opacity: .45;
	}
}
