/* Cartlet storefront: action buttons, popups and the shared/saved cart pages. Inherits the theme. */

.cartlet-actions[hidden] {
	display: none;
}

.cartlet-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75em;
	margin-block: 1em;
}

/* A short note under the buttons, on its own line. */
.cartlet-actions__note {
	flex-basis: 100%;
	margin: 0;
	font-size: 0.875em;
}

.cartlet-share-button {
	display: inline-flex;
	align-items: center;
	gap: 0.5em;
}

.cartlet-icon {
	flex: none;
	width: 1.25em;
	height: 1.25em;
}

.cartlet-btn--icon {
	padding-inline: 0.75em;
}

/* Button presets (Settings → Display). "theme" keeps the theme's own button style. */

.cartlet-btn {
	cursor: pointer;
}

.cartlet-btn:not(.button) {
	display: inline-flex;
	align-items: center;
	gap: 0.5em;
	padding: 0.6em 1.1em;
	border: 2px solid transparent;
	border-radius: var(--cartlet-radius, 4px);
	font: inherit;
	font-weight: 600;
	line-height: 1.2;
	text-decoration: none;
	transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}

:root .cartlet-btn--solid {
	border-color: var(--cartlet-accent, #1e1e1e);
	background: var(--cartlet-accent, #1e1e1e);
	color: var(--cartlet-accent-text, #fff);
}

:root .cartlet-btn--outline {
	border-color: var(--cartlet-accent, currentColor);
	background: transparent;
	color: var(--cartlet-accent, inherit);
}

:root .cartlet-btn--soft {
	background: color-mix(in srgb, var(--cartlet-accent, currentColor) 12%, transparent);
	color: var(--cartlet-accent, inherit);
}

:root .cartlet-btn--link {
	padding-inline: 0.2em;
	border: 0;
	background: transparent;
	color: var(--cartlet-accent, inherit);
	text-decoration: underline;
	text-underline-offset: 0.2em;
}

.cartlet-btn--solid:hover,
.cartlet-btn--solid:focus-visible {
	filter: brightness(1.12);
}

.cartlet-btn--outline:hover,
.cartlet-btn--outline:focus-visible,
.cartlet-btn--soft:hover,
.cartlet-btn--soft:focus-visible {
	background: color-mix(in srgb, var(--cartlet-accent, currentColor) 20%, transparent);
}

.cartlet-btn:focus-visible {
	outline: 2px solid var(--cartlet-accent, currentColor);
	outline-offset: 2px;
}

.cartlet-btn--small {
	font-size: 0.85em;
}

.cartlet-btn--large {
	font-size: 1.15em;
}

.cartlet-actions--mini_cart {
	margin: 0.75em 0 0;
}

.cartlet-actions--mini_cart .cartlet-btn,
.cartlet-actions--checkout .cartlet-btn {
	font-size: 0.9em;
}

/* Popup */

.cartlet-dialog {
	box-sizing: border-box;
	width: min(28rem, calc(100vw - 2rem));
	max-height: calc(100dvh - 2rem);
	padding: 1.25rem;
	border: 0;
	border-radius: 12px;
	background: var(--wp--preset--color--base, #fff);
	color: var(--wp--preset--color--contrast, #1e1e1e);
	box-shadow: 0 20px 50px rgb(0 0 0 / 25%);
	overflow: auto;
}

.cartlet-dialog::backdrop {
	background: rgb(0 0 0 / 50%);
}

.cartlet-dialog *,
.cartlet-dialog *::before,
.cartlet-dialog *::after {
	box-sizing: border-box;
}

.cartlet-dialog__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	margin-block-end: 1rem;
}

.cartlet-dialog__title {
	margin: 0;
	font-size: 1.25rem;
	line-height: 1.3;
}

.cartlet-dialog__close {
	display: grid;
	place-items: center;
	width: 2.25rem;
	height: 2.25rem;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: inherit;
	font-size: 1.5rem;
	line-height: 1;
	cursor: pointer;
}

.cartlet-dialog__close:hover,
.cartlet-dialog__close:focus-visible {
	background: rgb(127 127 127 / 15%);
}

.cartlet-step[hidden],
.cartlet-dialog [hidden] {
	display: none !important;
}

.cartlet-field {
	display: grid;
	gap: 0.35rem;
	margin: 0 0 1rem;
}

.cartlet-field label {
	font-weight: 600;
}

.cartlet-field input,
.cartlet-field select,
.cartlet-field textarea {
	width: 100%;
	font: inherit;
}

.cartlet-field-row {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
	column-gap: 1rem;
}

.cartlet-field__hint {
	font-size: 0.875em;
}

.cartlet-compose__submit,
.cartlet-native {
	width: 100%;
	justify-content: center;
}

.cartlet-link {
	display: flex;
	gap: 0.5rem;
	margin-block-end: 1rem;
}

.cartlet-link__url {
	flex: 1;
	min-width: 0;
	font: inherit;
}

.cartlet-link__copy,
.cartlet-native {
	display: inline-flex;
	align-items: center;
	gap: 0.4em;
	white-space: nowrap;
}

.cartlet-native {
	margin-block-end: 1rem;
}

.cartlet-channels {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(5.25rem, 1fr));
	gap: 0.5rem;
	margin: 0 0 1rem;
	padding: 0;
	list-style: none;
}

.cartlet-channel {
	display: grid;
	justify-items: center;
	gap: 0.3rem;
	padding: 0.6rem 0.25rem;
	border-radius: 8px;
	color: inherit;
	font-size: 0.8rem;
	line-height: 1.2;
	text-align: center;
	text-decoration: none;
}

.cartlet-channel:hover,
.cartlet-channel:focus-visible {
	background: rgb(127 127 127 / 12%);
}

.cartlet-channel .cartlet-icon {
	width: 1.75rem;
	height: 1.75rem;
}

.cartlet-channel--whatsapp .cartlet-icon { color: #25d366; }
.cartlet-channel--messenger .cartlet-icon { color: #0866ff; }
.cartlet-channel--telegram .cartlet-icon { color: #26a5e4; }
.cartlet-channel--facebook .cartlet-icon { color: #0866ff; }
.cartlet-channel--pinterest .cartlet-icon { color: #bd081c; }
.cartlet-channel--linkedin .cartlet-icon { color: #0a66c2; }

.cartlet-qr,
.cartlet-email {
	margin-block-end: 0.75rem;
	border-block-start: 1px solid rgb(127 127 127 / 25%);
	padding-block-start: 0.75rem;
}

.cartlet-qr summary,
.cartlet-email summary {
	font-weight: 600;
	cursor: pointer;
}

.cartlet-qr__body {
	display: grid;
	justify-items: center;
	gap: 0.75rem;
	padding-block: 1rem 0.25rem;
}

.cartlet-qr__code {
	width: 200px;
	height: 200px;
	image-rendering: pixelated;
	background: #fff;
}

.cartlet-email__form {
	padding-block-start: 1rem;
}

/* Honeypot: off-screen, still in the form. */
.cartlet-hp {
	position: absolute;
	inset-inline-start: -9999px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

.cartlet-turnstile {
	margin-block-end: 1rem;
}

.cartlet-status {
	min-height: 1.5em;
	margin: 0.5rem 0 0;
	font-size: 0.9rem;
}

.cartlet-status.is-error {
	color: #cc1818;
	color: color-mix(in srgb, #cc1818 70%, currentColor);
}

.cartlet-dialog.is-busy .cartlet-step {
	opacity: 0.6;
	pointer-events: none;
}

/* Popup layout (Settings → Display): auto = sheet on phones, centred elsewhere. */
.cartlet-dialog--sheet {
	width: 100vw;
	max-width: 100vw;
	margin: auto 0 0;
	border-end-start-radius: 0;
	border-end-end-radius: 0;
}

/* On wider screens the sheet stays docked at the bottom, with its content centred in a column. */
@media (min-width: 601px) {
	.cartlet-dialog--sheet {
		padding-inline: max(1.25rem, calc((100vw - 40rem) / 2));
	}
}

@media (max-width: 600px) {
	.cartlet-dialog--auto {
		width: 100vw;
		max-width: 100vw;
		margin: auto 0 0;
		border-end-start-radius: 0;
		border-end-end-radius: 0;
	}
}

/* Shared cart pages */

.cartlet-page__inner {
	box-sizing: border-box;
	max-width: var(--wp--style--global--wide-size, 1100px);
	margin-inline: auto;
	padding: 2rem var(--wp--style--root--padding-right, 1.25rem) 3rem;
}

.cartlet-preview__head {
	margin-block-end: 1.5rem;
}

.cartlet-preview__title,
.cartlet-gate__title {
	margin-block: 0 0.75rem;
}

.cartlet-preview__message {
	margin: 0 0 1rem;
	padding: 0.75rem 1rem;
	border-inline-start: 3px solid currentColor;
	font-style: italic;
}

.cartlet-preview__message p:last-child {
	margin-block-end: 0;
}

.cartlet-preview__owner {
	padding: 0.5rem 0.75rem;
	border-radius: 6px;
	background: rgb(127 127 127 / 12%);
	font-size: 0.9rem;
}

.cartlet-preview__items {
	width: 100%;
}

.cartlet-preview__product {
	display: flex;
	align-items: center;
	gap: 0.75rem;
}

.cartlet-preview__thumb {
	flex: none;
}

.cartlet-preview__thumb img {
	display: block;
	width: 64px;
	height: 64px;
	object-fit: cover;
	border-radius: 6px;
}

.cartlet-preview__info {
	display: grid;
	gap: 0.15rem;
}

.cartlet-preview__name {
	font-weight: 600;
}

.cartlet-preview__variation,
.cartlet-preview__note {
	font-size: 0.875em;
}

.cartlet-preview__note {
	font-style: italic;
}

.cartlet-preview__status {
	font-size: 0.875em;
	color: #b32d2e;
	color: color-mix(in srgb, #b32d2e 70%, currentColor);
}

.cartlet-preview__row--adjusted .cartlet-preview__status {
	color: #8a6100;
	color: color-mix(in srgb, #8a6100 70%, currentColor);
}

/* Unavailable rows: fade the picture only; text keeps full contrast (WCAG 1.4.3). */
.cartlet-preview__row--missing .cartlet-preview__thumb,
.cartlet-preview__row--unavailable .cartlet-preview__thumb,
.cartlet-preview__row--out_of_stock .cartlet-preview__thumb {
	opacity: 0.45;
}

.cartlet-preview__pick {
	width: 2rem;
}

.cartlet-preview__pick input {
	width: 1.25rem;
	height: 1.25rem;
	margin: 0;
}

.cartlet-preview__items del {
	margin-inline-end: 0.35em;
	font-size: 0.9em;
}

.cartlet-preview__mode {
	display: grid;
	gap: 0.4rem;
	margin: 1.25rem 0;
	padding: 0.75rem 1rem;
	border: 1px solid rgb(127 127 127 / 30%);
	border-radius: 8px;
}

.cartlet-preview__mode legend {
	padding-inline: 0.25rem;
	font-weight: 600;
}

.cartlet-preview__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem;
	margin-block: 1.25rem;
}

.cartlet-gate {
	max-width: 32rem;
	margin-inline: auto;
	text-align: center;
}

.cartlet-gate__form {
	display: grid;
	gap: 0.75rem;
	text-align: start;
}

/*
 * Phones: each item becomes a small card – checkbox beside the product, details underneath –
 * instead of WooCommerce's responsive table, which gives the checkbox a row of its own.
 */
@media (max-width: 768px) {
	.woocommerce table.cartlet-preview__items,
	.woocommerce table.cartlet-preview__items tbody,
	.woocommerce table.cartlet-preview__items tfoot {
		display: block;
		width: 100%;
	}

	.woocommerce table.cartlet-preview__items thead {
		display: none;
	}

	.woocommerce table.cartlet-preview__items tbody tr {
		display: grid;
		grid-template-columns: 1.75rem minmax(0, 1fr);
		column-gap: 0.75rem;
		padding: 0.9rem 0.75rem;
		border-block-end: 1px solid rgb(127 127 127 / 25%);
	}

	.woocommerce table.cartlet-preview__items tbody tr td {
		display: flex;
		grid-column: 2;
		align-items: center;
		justify-content: flex-end;
		gap: 0.4rem;
		padding: 0.2rem 0 !important;
		border: 0 !important;
		background: none !important;
		text-align: end !important;
	}

	/* The label takes the free space, so a struck-out old price stays next to the new one. */
	.woocommerce table.cartlet-preview__items tbody tr td::before {
		float: none;
		margin-inline-end: auto;
		font-weight: 600;
		text-align: start;
	}

	.woocommerce table.cartlet-preview__items tbody tr td.cartlet-preview__pick {
		grid-row: 1;
		grid-column: 1;
		align-items: flex-start;
		padding-block-start: 0.35rem !important;
	}

	.woocommerce table.cartlet-preview__items tbody tr td.product-name {
		display: block;
		grid-row: 1;
		margin-block-end: 0.35rem;
		text-align: start !important;
	}

	.woocommerce table.cartlet-preview__items tbody tr td.cartlet-preview__pick::before,
	.woocommerce table.cartlet-preview__items tbody tr td.product-name::before {
		display: none;
	}

	.cartlet-preview__product {
		align-items: flex-start;
	}

	.cartlet-preview__thumb img {
		width: 56px;
		height: 56px;
	}

	.woocommerce table.cartlet-preview__items tfoot tr {
		display: flex;
		justify-content: space-between;
		padding: 0.9rem 0.75rem;
	}

	.woocommerce table.cartlet-preview__items tfoot tr > * {
		padding: 0 !important;
		border: 0 !important;
		background: none !important;
	}

	.woocommerce table.cartlet-preview__items tfoot td::before {
		display: none;
	}

	.cartlet-saved__note {
		max-width: none;
	}

	.cartlet-preview__actions .button,
	.cartlet-saved__manage .button {
		flex: 1 1 auto;
		justify-content: center;
		text-align: center;
	}

	.cartlet-saved__delete {
		margin-inline-start: 0;
	}
}

/* Saved carts */

.cartlet-save-button {
	display: inline-flex;
	align-items: center;
	gap: 0.5em;
}

.cartlet-field--check label {
	display: flex;
	align-items: flex-start;
	gap: 0.6em;
	font-weight: normal;
}

/* Checkboxes keep their size (the text-field rule above sets inputs to full width). */
.cartlet-field--check input[type="checkbox"] {
	flex: none;
	width: 1.25rem;
	height: 1.25rem;
	margin: 0.1em 0 0;
}

.cartlet-done__message {
	margin-block: 0 1rem;
	font-weight: 600;
}

.cartlet-default-submit {
	position: absolute;
	inset-inline-start: -9999px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

.cartlet-saved__meta,
.cartlet-saved__back {
	margin-block: 0 1rem;
	font-size: 0.9em;
}

.cartlet-saved__meta {
	font-style: italic;
}

.cartlet-saved__name input {
	max-width: 24rem;
}

.cartlet-saved__note {
	width: 100%;
	max-width: 18rem;
	margin-block-start: 0.25rem;
	padding: 0.25rem 0.4rem;
	font: inherit;
	font-size: 0.875em;
}

.cartlet-saved__items .product-quantity input {
	width: 4.5em;
}

.cartlet-saved__manage {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem;
	margin-block-start: 1.5rem;
	padding-block-start: 1.25rem;
	border-block-start: 1px solid rgb(127 127 127 / 25%);
}

.cartlet-saved__delete {
	margin-inline-start: auto;
}

.cartlet-saved-list__actions form {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	justify-content: flex-end;
	margin: 0;
}

/* Save for later: the per-item link/button and the list under the cart. */
.cartlet-later-link,
.cartlet-later-button {
	display: inline-block;
	padding: 0;
	border: 0;
	background: none;
	color: inherit;
	font: inherit;
	font-size: 0.875em;
	text-decoration: underline;
	cursor: pointer;
}

.cartlet-later-link {
	display: block;
	margin-block-start: 0.25rem;
}

.cartlet-later-button {
	align-self: flex-start;
	margin-block-start: 0.5rem;
	white-space: nowrap;
}

.cartlet-later-button:disabled {
	cursor: progress;
	opacity: 0.6;
}

.cartlet-later {
	margin-block: 2rem;
}

.cartlet-later__title {
	margin-block-end: 0.75rem;
	font-size: 1.25em;
}

.cartlet-later__items {
	margin: 0;
	padding: 0;
	list-style: none;
}

.cartlet-later__item {
	display: grid;
	grid-template-columns: auto 1fr auto;
	gap: 0.75rem 1rem;
	align-items: center;
	padding-block: 0.75rem;
	border-block-start: 1px solid rgb(127 127 127 / 25%);
}

.cartlet-later__item:last-child {
	border-block-end: 1px solid rgb(127 127 127 / 25%);
}

.cartlet-later__info {
	display: grid;
	gap: 0.15rem;
	min-width: 0;
}

.cartlet-later__price del {
	margin-inline-end: 0.25rem;
}

.cartlet-later__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem 1rem;
	align-items: center;
	justify-content: flex-end;
	margin: 0;
}

.cartlet-later__actions .cartlet-later__remove[type="submit"] {
	min-height: 0;
	padding: 0;
	box-shadow: none;
	border: 0;
	background: none;
	color: inherit;
	font: inherit;
	text-decoration: underline;
	cursor: pointer;
}

.cartlet-later__item.cartlet-preview__row--missing .cartlet-preview__thumb,
.cartlet-later__item.cartlet-preview__row--unavailable .cartlet-preview__thumb,
.cartlet-later__item.cartlet-preview__row--out_of_stock .cartlet-preview__thumb {
	opacity: 0.45;
}

@media (max-width: 600px) {
	.cartlet-later__item {
		grid-template-columns: auto 1fr;
	}

	.cartlet-later__actions {
		grid-column: 1 / -1;
		justify-content: flex-start;
	}
}

/* What changed since the cart was stored. */
.cartlet-changes {
	margin-block-end: 1rem;
}

/* Reorder from a past order. */
.cartlet-reorder {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem 1rem;
	align-items: center;
}

.cartlet-reorder__hint {
	font-size: 0.875em;
}

/* "Notify me when it's back" under out-of-stock items. */
.cartlet-notify {
	display: flex;
	flex-wrap: wrap;
	gap: 0.35rem 0.5rem;
	align-items: center;
	margin-block-start: 0.35rem;
	font-size: 0.875em;
}

.cartlet-notify__email {
	flex: 1 1 12rem;
	min-width: 0;
	max-width: 18rem;
	font: inherit;
}

.cartlet-notify .cartlet-notify__button[type="submit"] {
	min-height: 0;
	padding: 0;
	border: 0;
	background: none;
	box-shadow: none;
	color: inherit;
	font: inherit;
	font-weight: 600;
	text-decoration: underline;
	cursor: pointer;
}

.cartlet-notify__done {
	font-weight: 600;
}

.cartlet-notify__hint {
	flex-basis: 100%;
	font-size: 0.875em;
}

.cartlet-unsubscribe form {
	margin-block: 1rem;
}

.cartlet-dialog__intro {
	margin: 0 0 1rem;
}

@media (prefers-reduced-motion: reduce) {
	.cartlet-btn,
	.cartlet-dialog,
	.cartlet-channel {
		transition: none;
	}
}
