/**
 * Carrito editorial v1 — Tubañera
 *
 * Page layout:
 *   ≥1200px  products left + sticky summary right
 *   <1200px  single column (products → summary → made-to-order)
 * Product line:
 *   ≥768px   image | info columns
 *   <768px   stacked (DOM order = SR order)
 */

/* -------------------------------------------------------------------------
 * Page shell
 * ------------------------------------------------------------------------- */
.tb-cart-page .woocommerce-notices-wrapper,
.tb-cart-page .woocommerce-message,
.tb-cart-page .woocommerce-info,
.tb-cart-page .woocommerce-error {
	max-width: var(--container-max, 72rem);
	margin-inline: auto;
	padding-inline: var(--space-24);
}

.tb-cart-page .woocommerce-message,
.tb-cart-page .woocommerce-info,
.tb-cart-page .woocommerce-error {
	background: var(--color-surface);
	border: 1px solid var(--color-border);
	border-top: 1px solid var(--color-border);
	border-radius: var(--radius-md, 12px);
	color: var(--color-text);
	box-shadow: none;
	/* Icono tipográfico WC (fuente WooCommerce) corrompe el texto si falla la carga. */
	padding: var(--space-16) var(--space-24);
	list-style: none;
}

.tb-cart-page .woocommerce-message::before,
.tb-cart-page .woocommerce-info::before,
.tb-cart-page .woocommerce-error::before {
	content: none !important;
	display: none !important;
}

.tb-cart-page .woocommerce-message .button,
.tb-cart-page .woocommerce-message a.button {
	float: none;
	display: inline;
	background: transparent;
	color: var(--color-primary);
	border: 0;
	box-shadow: none;
	padding: 0;
	margin: 0;
	font-weight: var(--font-weight-medium);
	text-decoration: underline;
	text-underline-offset: 0.2em;
}

.tb-cart-page .woocommerce-message a.restore-item {
	display: inline;
	color: var(--color-primary);
	font-weight: var(--font-weight-medium);
	text-decoration: underline;
	text-underline-offset: 0.2em;
}

.tb-cart-page .woocommerce-message a.restore-item:hover,
.tb-cart-page .woocommerce-message a.restore-item:focus-visible {
	color: var(--color-heading);
}

.tb-cart {
	max-width: var(--container-max, 72rem);
	margin: 0 auto;
	padding: var(--space-48) var(--space-24) var(--space-96);
	min-width: 0;
	overflow-x: clip;
}

.tb-cart__intro {
	margin-bottom: var(--space-48);
	max-width: 36rem;
}

.tb-cart__eyebrow {
	margin: 0 0 var(--space-12);
	font-size: var(--font-caption);
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--color-text-muted);
	font-weight: var(--font-weight-medium);
}

.tb-cart__title {
	margin: 0 0 var(--space-16);
	font-size: clamp(var(--font-h3), 4vw, var(--font-h1));
	font-weight: var(--font-weight-medium);
	color: var(--color-heading);
	line-height: var(--line-height-heading);
}

.tb-cart__lead {
	margin: 0;
	font-size: var(--font-body);
	color: var(--color-text);
	line-height: 1.55;
}

/* -------------------------------------------------------------------------
 * Layout: single column until 1200; sticky summary only ≥1200
 * ------------------------------------------------------------------------- */
.tb-cart__layout {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: var(--space-48);
	align-items: start;
}

.tb-cart__form,
.tb-cart__summary-wrap {
	min-width: 0;
}

.tb-cart__summary-wrap {
	position: static;
	width: 100%;
}

@media (min-width: 1200px) {
	.tb-cart__layout {
		grid-template-columns: minmax(0, 1.85fr) minmax(0, 1fr);
		gap: var(--space-64);
	}

	.tb-cart__summary-wrap {
		position: sticky;
		top: var(--space-32);
	}
}

.tb-cart__lines {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: var(--space-40);
	min-width: 0;
}

/* -------------------------------------------------------------------------
 * Line — DOM order = mobile SR order
 * model → size → media → config → commerce → actions
 * ≥768: image left, info right (grid-column)
 * ------------------------------------------------------------------------- */
.tb-cart-line {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: var(--space-16);
	padding-bottom: var(--space-40);
	border-bottom: 1px solid var(--color-border);
	min-width: 0;
}

.tb-cart-line:last-child {
	border-bottom: none;
	padding-bottom: 0;
}

@media (min-width: 768px) {
	.tb-cart-line {
		grid-template-columns: minmax(0, 38%) minmax(0, 1fr);
		column-gap: var(--space-32);
		row-gap: var(--space-12);
		align-items: start;
	}

	.tb-cart-line__media {
		grid-column: 1;
		grid-row: 1 / span 6;
		align-self: start;
	}

	.tb-cart-line__model,
	.tb-cart-line__size,
	.tb-cart-line__config,
	.tb-cart-line__commerce,
	.tb-cart-line__actions {
		grid-column: 2;
		min-width: 0;
	}
}

.tb-cart-line__media {
	aspect-ratio: 4 / 3;
	overflow: hidden;
	background: var(--color-surface-00);
	border-radius: var(--radius-md, 12px);
	min-width: 0;
}

.tb-cart-line__media-link {
	display: block;
	height: 100%;
}

.tb-cart-line__media img,
.tb-cart-line__img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.tb-cart-line__model {
	margin: 0;
	font-size: var(--font-h4);
	font-weight: var(--font-weight-medium);
	color: var(--color-heading);
	line-height: 1.25;
	min-width: 0;
}

.tb-cart-line__model a {
	color: inherit;
	text-decoration: none;
}

.tb-cart-line__model a:hover,
.tb-cart-line__model a:focus-visible {
	color: var(--color-primary);
}

.tb-cart-line__size {
	margin: 0;
	font-size: var(--font-body);
	color: var(--color-text);
}

.tb-cart-line__config {
	display: flex;
	flex-direction: column;
	gap: var(--space-8);
	min-width: 0;
}

.tb-cart-line__finish {
	margin: 0;
	font-size: var(--font-small);
	color: var(--color-text);
}

.tb-cart-line__swatches {
	list-style: none;
	margin: var(--space-8) 0 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: var(--space-8);
}

.tb-cart-line__swatch {
	display: flex;
	align-items: center;
	gap: var(--space-12);
	font-size: var(--font-caption);
	color: var(--color-text-muted);
	min-width: 0;
}

.tb-cart-line__swatch-chip {
	width: 1.25rem;
	height: 1.25rem;
	border-radius: 999px;
	background: var(--tb-swatch, var(--color-neutral-200));
	border: 1px solid color-mix(in srgb, var(--color-neutral-900) 12%, transparent);
	flex-shrink: 0;
}

.tb-cart-line__meta {
	margin: 0;
	font-size: var(--font-caption);
	color: var(--color-text-muted);
}

/* -------------------------------------------------------------------------
 * Commerce: unit price / qty / line subtotal (qty>1 only in markup)
 * ------------------------------------------------------------------------- */
.tb-cart-line__commerce {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: var(--space-16);
	min-width: 0;
}

.tb-cart-line__price,
.tb-cart-line__qty,
.tb-cart-line__subtotal {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: var(--space-4);
	min-width: 0;
}

.tb-cart-line__concept-label {
	font-size: var(--font-caption);
	color: var(--color-text-muted);
	font-weight: var(--font-weight-regular);
	line-height: 1.3;
}

.tb-cart-line__concept-value {
	font-size: var(--font-body);
	color: var(--color-heading);
	font-weight: var(--font-weight-medium);
}

/* Desktop: compact row; labels visually quiet but present for a11y */
@media (min-width: 768px) {
	.tb-cart-line__commerce {
		flex-direction: row;
		flex-wrap: wrap;
		align-items: flex-end;
		gap: var(--space-24);
		width: 100%;
	}

	.tb-cart-line__price,
	.tb-cart-line__qty {
		flex: 0 0 auto;
	}

	.tb-cart-line__subtotal {
		margin-inline-start: auto;
		align-items: flex-end;
		text-align: end;
	}

	.tb-cart-line__concept-label {
		position: absolute;
		width: 1px;
		height: 1px;
		padding: 0;
		margin: -1px;
		overflow: hidden;
		clip: rect(0, 0, 0, 0);
		white-space: nowrap;
		border: 0;
	}

	.tb-cart-line__price,
	.tb-cart-line__qty,
	.tb-cart-line__subtotal {
		position: relative;
	}
}

.tb-cart-line__actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--space-16) var(--space-24);
	min-width: 0;
}

.tb-cart-line__edit {
	font-size: var(--font-caption);
	color: var(--color-text);
	text-decoration: underline;
	text-underline-offset: 0.2em;
}

.tb-cart-line__edit:hover,
.tb-cart-line__edit:focus-visible {
	color: var(--color-primary);
}

/*
 * WC `.woocommerce a.remove` fuerza width/height 1em (pensado para ×).
 * Con label «Eliminar» eso apila letras: override de mayor especificidad.
 */
.woocommerce .tb-cart-line a.remove.tb-cart-line__remove,
.tb-cart-page .tb-cart-line a.remove.tb-cart-line__remove,
.tb-cart-line__remove {
	display: inline;
	position: static;
	width: auto;
	height: auto;
	min-width: 0;
	min-height: 0;
	padding: 0;
	margin: 0;
	border: 0;
	border-radius: 0;
	background: none;
	box-shadow: none;
	font-size: var(--font-caption);
	font-weight: var(--font-weight-regular);
	line-height: 1.4;
	letter-spacing: normal;
	text-align: start;
	text-decoration: none;
	white-space: nowrap;
	word-break: normal;
	overflow-wrap: normal;
	writing-mode: horizontal-tb;
	color: var(--color-text-muted);
}

.woocommerce .tb-cart-line a.remove.tb-cart-line__remove:hover,
.tb-cart-page .tb-cart-line a.remove.tb-cart-line__remove:hover,
.tb-cart-line__remove:hover,
.woocommerce .tb-cart-line a.remove.tb-cart-line__remove:focus-visible,
.tb-cart-page .tb-cart-line a.remove.tb-cart-line__remove:focus-visible,
.tb-cart-line__remove:focus-visible {
	color: var(--color-error);
	background: none;
}

/* -------------------------------------------------------------------------
 * Qty
 * ------------------------------------------------------------------------- */
.tb-cart-qty {
	display: inline-flex;
	align-items: center;
	gap: var(--space-8);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-md, 12px);
	padding: var(--space-4);
	background: var(--color-surface);
}

.tb-cart-qty__btn {
	width: 2.25rem;
	height: 2.25rem;
	border: 0;
	background: transparent;
	color: var(--color-heading);
	font-size: var(--font-body);
	line-height: 1;
	cursor: pointer;
	border-radius: var(--radius-sm, 8px);
}

.tb-cart-qty__btn:hover,
.tb-cart-qty__btn:focus-visible {
	background: var(--color-surface-00);
}

.tb-cart-qty__btn:disabled {
	opacity: 0.4;
	cursor: not-allowed;
}

.tb-cart-qty .quantity,
.tb-cart-qty .tb-cart-qty__input,
.tb-cart-qty input.qty {
	width: 3rem;
	min-height: 2.25rem;
	margin: 0;
	border: 0;
	background: transparent;
	text-align: center;
	font-size: var(--font-small);
	color: var(--color-heading);
	box-shadow: none;
	-moz-appearance: textfield;
}

.tb-cart-qty input.qty::-webkit-outer-spin-button,
.tb-cart-qty input.qty::-webkit-inner-spin-button {
	-webkit-appearance: none;
	margin: 0;
}

/* -------------------------------------------------------------------------
 * Form actions / update (no-JS fallback visible; JS may soft-hide until dirty)
 * ------------------------------------------------------------------------- */
.tb-cart__form-actions {
	margin-top: var(--space-32);
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-16);
}

.tb-cart__update {
	appearance: none;
	border: 1px solid var(--color-border);
	background: var(--color-surface);
	color: var(--color-text);
	padding: var(--space-12) var(--space-24);
	border-radius: var(--radius-md, 12px);
	font-family: var(--font-family);
	font-size: var(--font-caption);
	cursor: pointer;
	transition: opacity var(--transition-normal, 0.3s) ease;
}

.tb-cart__update:hover,
.tb-cart__update:focus-visible {
	border-color: var(--color-text-muted);
}

.tb-cart__form.is-tb-enhanced .tb-cart__update:not(.is-visible) {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.tb-cart__form.is-loading {
	pointer-events: none;
	opacity: 0.72;
}

/* -------------------------------------------------------------------------
 * Summary
 * ------------------------------------------------------------------------- */
.tb-cart-summary {
	padding: var(--space-32) 0 0;
	border-top: 1px solid var(--color-border);
	min-width: 0;
}

/*
 * WC clássico: `.cart-collaterals .cart_totals { float:right; width:48% }`.
 * En layout editorial el resumen ya tiene columna propia → forzar 100%.
 */
.tb-cart-page .cart-collaterals,
.tb-cart-page .tb-cart__collaterals,
.tb-cart-page .cart-collaterals .cart_totals,
.tb-cart-page .tb-cart-summary {
	float: none;
	width: 100%;
	max-width: 100%;
	box-sizing: border-box;
}

@media (min-width: 1200px) {
	.tb-cart-summary {
		padding: var(--space-32);
		border: 1px solid var(--color-border);
		border-radius: var(--radius-lg, 18px);
		background: var(--color-surface);
	}
}

.tb-cart-summary__title {
	margin: 0 0 var(--space-24);
	font-size: var(--font-h4);
	font-weight: var(--font-weight-medium);
	color: var(--color-heading);
}

.tb-cart-summary__rows {
	display: flex;
	flex-direction: column;
	gap: var(--space-16);
	margin-bottom: var(--space-32);
}

.tb-cart-summary__row {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	flex-wrap: wrap;
	gap: var(--space-8) var(--space-16);
	font-size: var(--font-small);
	min-width: 0;
}

.tb-cart-summary__label {
	color: var(--color-text-muted);
	flex: 0 0 auto;
}

.tb-cart-summary__value {
	color: var(--color-heading);
	text-align: end;
	min-width: 0;
	flex: 1 1 auto;
}

.tb-cart-summary__value--muted {
	color: var(--color-text-muted);
	font-size: var(--font-caption);
	max-width: none;
	line-height: 1.45;
	overflow-wrap: anywhere;
}

/* Entrega: en estrecho, etiqueta + valor en dos líneas legibles */
@media (max-width: 767px) {
	.tb-cart-summary__row.shipping {
		flex-direction: column;
		align-items: flex-start;
		gap: var(--space-4);
	}

	.tb-cart-summary__row.shipping .tb-cart-summary__value {
		text-align: start;
		max-width: 100%;
	}
}

.tb-cart-summary__row--total {
	padding-top: var(--space-16);
	border-top: 1px solid var(--color-border);
	font-size: var(--font-body);
}

.tb-cart-summary__row--total .tb-cart-summary__label,
.tb-cart-summary__row--total .tb-cart-summary__value {
	color: var(--color-heading);
	font-weight: var(--font-weight-semibold);
}

.tb-cart-summary__cta {
	width: 100%;
	min-width: 0;
}

.tb-cart-summary__cta .tubanera-button,
.tb-cart-summary__cta .checkout-button,
.tb-cart-summary__cta .button.alt {
	display: inline-flex;
	width: 100%;
	max-width: 100%;
	box-sizing: border-box;
	justify-content: center;
	align-items: center;
	background: var(--color-primary) !important;
	color: var(--color-white) !important;
	border-color: var(--color-primary) !important;
	border-radius: var(--radius-md, 12px);
	box-shadow: none !important;
	white-space: normal;
	overflow: visible;
	text-overflow: clip;
	hyphens: none;
	text-align: center;
	line-height: 1.25;
	font-size: var(--font-body);
}

.tb-cart-summary__cta .tubanera-button .tubanera-button__content,
.tb-cart-summary__cta .tubanera-button .tubanera-button__label {
	white-space: normal;
	overflow: visible;
	text-align: center;
	max-width: 100%;
}

.tb-cart-summary__cta .tubanera-button:hover,
.tb-cart-summary__cta .tubanera-button:focus-visible {
	filter: brightness(0.96);
}

.tb-cart-summary__cta .tubanera-button:disabled,
.tb-cart-summary__cta .tubanera-button.is-disabled,
.tb-cart-summary__cta .tubanera-button[aria-disabled="true"] {
	opacity: var(--opacity-50);
	cursor: not-allowed;
	pointer-events: none;
}

/* Kill purple WC checkout button if still injected */
.tb-cart-page .wc-proceed-to-checkout .checkout-button {
	background-color: var(--color-primary) !important;
	color: var(--color-white) !important;
}

/* Hide coupon blocks if any plugin re-injects */
.tb-cart .coupon,
.tb-cart-page .woocommerce-form-coupon-toggle,
.tb-cart-page form.checkout_coupon {
	display: none !important;
}

/* -------------------------------------------------------------------------
 * Made-to-order / help / explore
 * ------------------------------------------------------------------------- */
.tb-cart__made-to-order {
	margin-top: var(--space-64);
	padding-top: var(--space-32);
	border-top: 1px solid var(--color-border);
	max-width: 36rem;
}

.tb-cart__mto-title {
	margin: 0 0 var(--space-12);
	font-size: var(--font-small);
	font-weight: var(--font-weight-medium);
	color: var(--color-heading);
}

.tb-cart__mto-copy {
	margin: 0;
	font-size: var(--font-caption);
	color: var(--color-text-muted);
	line-height: 1.55;
}

.tb-cart__help {
	margin: var(--space-24) 0 0;
	font-size: var(--font-caption);
}

.tb-cart__help a {
	color: var(--color-text);
	text-decoration: underline;
	text-underline-offset: 0.2em;
}

.tb-cart__explore {
	margin: var(--space-32) 0 0;
}

/* -------------------------------------------------------------------------
 * Empty — sin cambios de diseño en este pulido
 * ------------------------------------------------------------------------- */
.tb-cart--empty {
	padding-block: var(--space-64) var(--space-96);
}

.tb-cart-empty__actions {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-16);
	margin-top: var(--space-32);
}

/* Hide default WC empty message when our empty shell is present */
.tb-cart-page .tb-cart--empty ~ .return-to-shop,
.woocommerce-cart .cart-empty.woocommerce-info {
	display: none;
}

.tb-cart-page .cart-empty.woocommerce-info {
	display: none;
}
