/*
 * Cart, checkout, mini cart, notices, my account and text pages.
 * WooCommerce blocks keep their behaviour; only the look is aligned with the theme.
 */

/* ---------- Shared form controls ---------- */

.wc-block-components-text-input input,
.wc-block-components-combobox .wc-block-components-combobox-control input,
.wc-blocks-components-select .wc-blocks-components-select__select,
.woocommerce-account input.input-text,
.woocommerce-account select,
.woocommerce-account textarea {
	border-radius: var(--primus-radius);
	border-color: var(--primus-line);
}

.wc-block-components-text-input input:focus,
.wc-blocks-components-select .wc-blocks-components-select__select:focus,
.woocommerce-account input.input-text:focus {
	border-color: var(--primus-brand);
	box-shadow: 0 0 0 1px var(--primus-brand);
}

.wc-block-components-button:not(.is-link),
.woocommerce-account .woocommerce-Button,
.woocommerce-account button.button {
	border-radius: var(--primus-radius);
	font-weight: 600;
	min-height: 48px;
}

.wc-block-components-button:not(.is-link).contained,
.wc-block-cart__submit-button,
.wc-block-components-checkout-place-order-button,
.woocommerce-account .woocommerce-Button,
.woocommerce-account button.button {
	background: var(--primus-brand);
	color: var(--wp--preset--color--surface);
	border: 1px solid var(--primus-brand);
}

.wc-block-components-button:not(.is-link).contained:hover,
.wc-block-cart__submit-button:hover,
.wc-block-components-checkout-place-order-button:hover {
	background: var(--wp--preset--color--brand-ink);
	border-color: var(--wp--preset--color--brand-ink);
	color: var(--wp--preset--color--surface);
}

.wc-block-components-button.outlined {
	border-color: var(--primus-line);
	color: var(--wp--preset--color--ink);
}

/* Radio options (shipping, payment). */
.wc-block-components-radio-control--highlight-checked .wc-block-components-radio-control__option--checked-option-highlighted,
.wc-block-components-radio-control--highlight-checked label.wc-block-components-radio-control__option--checked-option-highlighted {
	box-shadow: inset 0 0 0 1.5px var(--primus-brand);
	border-radius: var(--primus-radius);
}

.wc-block-components-radio-control .wc-block-components-radio-control__input:checked {
	border-color: var(--primus-brand);
}

.wc-block-components-radio-control .wc-block-components-radio-control__input:checked::before {
	background: var(--primus-brand);
}

/* Packeta (Zásilkovna) pickup point button: the plugin's flex row stretches the logo to the button height. */
.packetery-widget-button-wrapper .packeta-widget-button {
	align-items: center;
	gap: 0.75rem;
	margin: 0.75rem 0 0;
}

.packetery-widget-button-wrapper .packeta-widget-button img.packetery-widget-button-logo {
	flex: none;
	width: auto;
	max-width: none;
	height: 3rem;
	margin: 0;
	border-radius: var(--primus-radius);
}

.packetery-widget-button-wrapper .packeta-widget-button a.wc-block-components-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	width: auto;
	height: auto;
	min-height: 3rem;
	padding: 0.5rem 1.25rem;
	font-size: 0.9375rem;
	line-height: 1.2;
	text-decoration: none;
	cursor: pointer;
}

.packetery-widget-button-wrapper .packeta-widget-place,
.packetery-widget-button-wrapper .packeta-widget-info {
	margin: 0.5rem 0 0;
	font-size: 0.9375rem;
}

.wc-block-components-checkbox .wc-block-components-checkbox__input[type="checkbox"]:checked {
	background: var(--primus-brand);
	border-color: var(--primus-brand);
}

/* ---------- Cart ---------- */

.primus-cart .wp-block-woocommerce-cart {
	margin-bottom: var(--wp--preset--spacing--50);
}

.wc-block-cart-item__image img {
	width: auto;
	max-height: 110px;
	border-radius: 2px;
	box-shadow: var(--primus-cover-shadow);
}

.wc-block-cart-items .wc-block-cart-items__row {
	border-color: var(--primus-line);
}

.wc-block-components-product-name {
	font-family: var(--primus-display);
	font-weight: 600;
	font-size: 1.0625rem;
	color: var(--wp--preset--color--ink);
	text-decoration: none;
}

.wc-block-components-product-name:hover {
	color: var(--primus-brand);
}

.wc-block-components-quantity-selector {
	border-radius: var(--primus-radius);
}

.wc-block-components-quantity-selector::after {
	border-color: var(--primus-line);
	border-radius: var(--primus-radius);
}

.wp-block-woocommerce-cart-order-summary-block,
.wc-block-components-sidebar .wc-block-components-panel,
.wp-block-woocommerce-checkout-order-summary-block {
	border-radius: var(--primus-radius-l);
}

.wc-block-components-totals-footer-item .wc-block-components-totals-item__value,
.wc-block-components-totals-footer-item .wc-block-components-totals-item__label {
	font-size: 1.25rem;
	font-weight: 650;
}

/* Empty cart: centered and friendly. */
.wp-block-woocommerce-empty-cart-block {
	text-align: center;
}

.wp-block-woocommerce-empty-cart-block .wc-block-cart__empty-cart__title {
	font-family: var(--primus-display);
	font-size: var(--wp--preset--font-size--x-large);
}

.wp-block-woocommerce-empty-cart-block .wc-block-cart__empty-cart__title::before {
	display: none;
}

/* ---------- Checkout ---------- */

.primus-checkout {
	padding-top: var(--wp--preset--spacing--40);
}

.wc-block-components-checkout-step__title {
	font-family: var(--primus-display);
	font-weight: 600;
	font-size: 1.25rem;
}

.wc-block-components-checkout-step__heading-content,
.wc-block-components-checkout-step__description {
	color: var(--primus-muted);
}

.wc-block-components-checkout-return-to-cart-button {
	color: var(--wp--preset--color--ink);
	font-weight: 600;
	text-decoration: none;
}

.wc-block-components-order-summary-item__image img {
	width: auto;
	max-height: 64px;
	box-shadow: var(--primus-cover-shadow);
}

.wc-block-components-order-summary-item__quantity {
	background: var(--wp--preset--color--ink);
	color: var(--wp--preset--color--surface);
	border: 0;
	box-shadow: none;
}

/* ---------- Mini cart drawer ---------- */

.wc-block-mini-cart__drawer .wc-block-mini-cart__title {
	font-family: var(--primus-display);
	font-size: 1.375rem;
}

.wc-block-mini-cart__drawer .wc-block-cart-item__image img {
	max-height: 80px;
}

.wc-block-mini-cart__footer-actions .wc-block-components-button {
	flex: 1;
}

/* ---------- Notices ---------- */

.wc-block-components-notice-banner {
	border-radius: var(--primus-radius);
	font-size: 0.9375rem;
	align-items: center;
}

.wc-block-components-notice-banner.is-success {
	background: #EEF5EF;
	border-color: var(--wp--preset--color--success);
}

.wc-block-components-notice-banner.is-success > svg {
	background: var(--wp--preset--color--success);
}

.wc-block-components-notice-banner .wc-forward {
	color: var(--primus-brand);
	font-weight: 600;
	opacity: 1;
}

/* ---------- My account ---------- */

/* WooCommerce limits the account to 1000px, but the page content is only 720px wide. */
.woocommerce-account .primus-page > .wp-block-post-content {
	max-width: 1000px;
}

.woocommerce-account .woocommerce {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: var(--wp--preset--spacing--40);
}

/* The clearfix pseudo-elements would take up grid cells and push the content aside. */
.woocommerce-account .woocommerce::before,
.woocommerce-account .woocommerce::after {
	content: none;
}

.woocommerce-account .woocommerce-MyAccount-navigation,
.woocommerce-account .woocommerce-MyAccount-content {
	float: none;
	width: auto;
	min-width: 0;
}

@media (min-width: 900px) {
	.woocommerce-account .woocommerce:has(> .woocommerce-MyAccount-navigation) {
		grid-template-columns: 14rem minmax(0, 1fr);
		align-items: start;
	}
}

.woocommerce-MyAccount-navigation ul {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 0.125rem;
}

.woocommerce-account .woocommerce-MyAccount-navigation li {
	padding: 0;
}

.woocommerce-MyAccount-navigation a {
	display: block;
	padding: 0.55rem 0.75rem;
	border-radius: var(--primus-radius);
	color: var(--wp--preset--color--ink);
	text-decoration: none;
}

.woocommerce-MyAccount-navigation a:hover {
	background: var(--primus-plinth);
}

.woocommerce-MyAccount-navigation .is-active a {
	background: var(--wp--preset--color--ink);
	color: var(--wp--preset--color--surface);
}

@media (max-width: 899px) {
	.woocommerce-MyAccount-navigation ul {
		flex-direction: row;
		overflow-x: auto;
		gap: 0.375rem;
		scrollbar-width: none;
	}

	.woocommerce-MyAccount-navigation a {
		white-space: nowrap;
		border: 1px solid var(--primus-line);
		border-radius: var(--wp--custom--radius--pill);
		padding: 0.4rem 0.8rem;
		font-size: 0.875rem;
	}
}

.primus-account-cards {
	list-style: none;
	margin: 0 0 1.5rem;
	padding: 0;
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr));
	gap: 0.75rem;
}

.primus-account-cards a {
	display: grid;
	gap: 0.25rem;
	height: 100%;
	padding: 1.125rem;
	border: 1px solid var(--primus-line);
	border-radius: var(--primus-radius-l);
	background: var(--wp--preset--color--surface);
	color: var(--wp--preset--color--ink);
	text-decoration: none;
}

.primus-account-cards a:hover {
	border-color: var(--primus-brand);
}

.primus-account-cards strong {
	font-family: var(--primus-display);
	font-size: 1.125rem;
}

.primus-account-cards span {
	font-size: 0.875rem;
	color: var(--primus-muted);
}

.woocommerce-orders-table,
.woocommerce-table--order-details,
.woocommerce-account table.shop_table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.9375rem;
}

.woocommerce-orders-table th,
.woocommerce-orders-table td,
.woocommerce-account table.shop_table th,
.woocommerce-account table.shop_table td {
	text-align: left;
	padding: 0.75rem 0.5rem 0.75rem 0;
	border-bottom: 1px solid var(--primus-line);
}

.woocommerce-orders-table .button,
.woocommerce-account .woocommerce-orders-table__cell-order-actions a {
	display: inline-block;
	padding: 0.35rem 0.75rem;
	border: 1px solid var(--primus-line);
	border-radius: var(--primus-radius);
	color: var(--wp--preset--color--ink);
	text-decoration: none;
	font-size: 0.875rem;
}

.woocommerce-account table.shop_table {
	border: 0;
	border-radius: 0;
}

.woocommerce-account .woocommerce-orders-table__cell-order-actions .button {
	min-height: 0;
	margin: 0 0.25rem 0.25rem 0;
	background: transparent;
	color: var(--wp--preset--color--ink);
	border: 1px solid var(--primus-line);
	font-weight: 600;
}

.woocommerce-account .woocommerce-orders-table__cell-order-actions .button:hover {
	border-color: var(--primus-brand);
	color: var(--primus-brand);
}

/* On small screens WooCommerce hides row headers, which are the order numbers here. */
@media (max-width: 768px) {
	.woocommerce-account table.shop_table_responsive tbody th {
		display: block;
		text-align: right;
	}

	.woocommerce-account table.shop_table_responsive tbody th::before {
		content: attr(data-title) ": ";
		float: left;
		font-weight: 700;
		color: var(--wp--preset--color--ink);
	}

	.woocommerce-account table.shop_table_responsive tr {
		display: block;
		padding-block: 0.5rem;
		border-bottom: 1px solid var(--primus-line);
	}

	.woocommerce-account table.shop_table_responsive tbody td,
	.woocommerce-account table.shop_table_responsive tbody th {
		border-bottom: 0;
		padding-block: 0.35rem;
	}
}

.woocommerce-account .woocommerce-notices-wrapper:empty {
	display: none;
}

.woocommerce-account .wc-block-components-notice-banner .button {
	float: none;
	display: block;
	width: fit-content;
	margin: 0 0 0.35rem;
	padding: 0;
	background: none;
	border: 0;
	min-height: 0;
	color: var(--primus-brand);
}

/* Address overview and order detail: title with the edit link, plain address text. */
.woocommerce-account .woocommerce-Addresses,
.woocommerce-account .woocommerce-columns--addresses {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
	gap: 1.5rem;
}

.woocommerce-account .woocommerce-Addresses::before,
.woocommerce-account .woocommerce-Addresses::after,
.woocommerce-account .woocommerce-columns--addresses::before,
.woocommerce-account .woocommerce-columns--addresses::after {
	content: none;
}

.woocommerce-account .woocommerce-Addresses .woocommerce-Address,
.woocommerce-account .woocommerce-columns--addresses .woocommerce-column {
	float: none;
	width: auto;
	max-width: none;
}

.woocommerce-account .woocommerce-Address-title {
	display: grid;
	justify-items: start;
	gap: 0.25rem;
	margin-bottom: 0.75rem;
}

.woocommerce-account .woocommerce-Address-title::before,
.woocommerce-account .woocommerce-Address-title::after {
	content: none;
}

.woocommerce-account .primus-page .woocommerce-Address-title h2 {
	margin: 0;
	font-size: 1.375rem;
}

.woocommerce-account .woocommerce-Address-title .edit {
	float: none;
	font-size: 0.875rem;
}

.woocommerce-account address {
	font-style: normal;
}

.woocommerce-account .woocommerce-EditAccountForm fieldset {
	margin: 0.5rem 0 1rem;
	padding: 1rem 1.125rem 0.25rem;
	border: 1px solid var(--primus-line);
	border-radius: var(--primus-radius-l);
}

.woocommerce-account .woocommerce-EditAccountForm legend {
	padding: 0 0.375rem;
	font-weight: 600;
}

.primus-invoice {
	margin-top: 1rem;
}

.woocommerce-account .woocommerce-form-login,
.woocommerce-account .woocommerce-form-register,
.woocommerce-account .woocommerce-ResetPassword {
	max-width: 28rem;
	padding: 1.5rem;
	border: 1px solid var(--primus-line);
	border-radius: var(--primus-radius-l);
	background: var(--wp--preset--color--surface);
}

/* Logged-out view: heading sits right above the form; login and registration side by side. */
.woocommerce-account .primus-page .woocommerce > h2,
.woocommerce-account .primus-page .u-columns h2 {
	margin: 0 0 1rem;
}

.woocommerce-account .u-columns {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr));
	gap: var(--wp--preset--spacing--40);
}

.woocommerce-account .u-columns::before,
.woocommerce-account .u-columns::after {
	content: none;
}

.woocommerce-account .u-columns .u-column1,
.woocommerce-account .u-columns .u-column2 {
	float: none;
	width: auto;
}

.woocommerce-account .woocommerce-form-login .form-row,
.woocommerce-account .woocommerce-form-register .form-row,
.woocommerce-account .woocommerce-ResetPassword .form-row {
	float: none;
	width: auto;
	padding: 0;
}

.woocommerce-account .woocommerce-form-login__submit {
	width: 100%;
	margin: 0.5rem 0 0;
}

.woocommerce-account .woocommerce-form-login__rememberme {
	display: flex;
	align-items: center;
	gap: 0.5rem;
}

.woocommerce-account .woocommerce-LostPassword {
	margin: 0.75rem 0 0;
}

.woocommerce-account .form-row {
	display: grid;
	gap: 0.35rem;
	margin: 0 0 1rem;
}

.woocommerce-account form .form-row label {
	margin: 0;
	line-height: 1.4;
}

.woocommerce-account input.input-text {
	padding: 0.7rem 0.8rem;
	border: 1px solid var(--primus-line);
	font: inherit;
}

/* ---------- Text pages (terms, privacy) ---------- */

.primus-page .wp-block-post-content {
	font-size: 1.0313rem;
	line-height: 1.72;
}

.primus-page .wp-block-post-content h2 {
	margin-top: 2.5rem;
}

.primus-page .wp-block-post-content h3 {
	margin-top: 2rem;
}
