/* UX transversal: objetivos táctiles, estados de carga, favoritos, toast, WhatsApp y avisos de Woo.
 * No cambia la apariencia de los mockups: las áreas táctiles crecen con pseudo-elementos invisibles. */

/* ---------- Objetivos táctiles ≥44px sin cambiar el tamaño visual ---------- */
.p-card__fav::after, .p-card__add::after, .pd-qty__btn::after {
	content: ''; position: absolute; left: 50%; top: 50%; width: max(100%, 44px); height: max(100%, 44px);
	transform: translate(-50%, -50%); border-radius: 50%;
}
.p-card__add, .pd-qty__btn { position: relative; }
.woocommerce-breadcrumb a, .pd-crumbs a, .breadcrumbs a, .kit-crumbs a { display: inline-block; padding-block: 11px; margin-block: -11px; }

/* ---------- Favoritos ---------- */
.p-card__fav { cursor: pointer; transition: color .2s, transform .2s var(--ease), background .2s; }
.p-card__fav:hover { color: var(--c-rosa); }
.p-card__fav svg { transition: fill .2s; }
.p-card__fav.is-pop { animation: ux-pop .45s var(--ease); }
@keyframes ux-pop { 0% { transform: scale(1); } 40% { transform: scale(1.25); } 100% { transform: scale(1); } }
.ux-fav-empty {
	max-width: 560px; margin: 0 auto 2rem; padding: 1.25rem 1.5rem; text-align: center;
	background: var(--c-surface); border-radius: var(--radius); box-shadow: var(--shadow-card); color: var(--c-text-soft);
}

/* ---------- Toast ---------- */
.ux-toast {
	position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 1100;
	display: flex; align-items: center; gap: 14px; width: max-content; max-width: calc(100vw - 32px); padding: 8px 8px 8px 20px; white-space: nowrap;
	border-radius: var(--radius-pill); background: var(--c-tinta); color: #fff; font-size: 15px; font-weight: 500;
	box-shadow: var(--shadow-pop); opacity: 0; visibility: hidden; transform: translate(-50%, 12px);
	transition: opacity .25s, transform .25s var(--ease), visibility .25s;
}
.ux-toast.is-visible { opacity: 1; visibility: visible; transform: translate(-50%, 0); }
.ux-toast a {
	display: inline-flex; align-items: center; min-height: 36px; padding: 0 14px; border-radius: var(--radius-pill);
	background: var(--c-rubor); color: var(--c-vino); font-weight: 600; white-space: nowrap;
}
.ux-toast:not(:has(a)) { padding: 12px 20px; }
body:has(.wa-fab) .ux-toast { bottom: calc(86px + env(safe-area-inset-bottom)); }
@media (max-width: 900px) {
	body.single-product .ux-toast, body.is-kit .ux-toast { bottom: calc(88px + env(safe-area-inset-bottom)); }
	body.single-product:has(.wa-fab) .ux-toast, body.is-kit:has(.wa-fab) .ux-toast { bottom: calc(150px + env(safe-area-inset-bottom)); }
}

/* ---------- Botones ocupados: spinner + deshabilitado ---------- */
.btn.ux-busy, .btn.is-loading, .pd-buy__cta.is-busy, .pd-bar__cta.is-busy { opacity: 1; position: relative; pointer-events: none; cursor: progress; color: transparent !important; }
.btn.ux-busy > *, .btn.is-loading > *, .btn.is-busy > * { visibility: hidden; }
.btn.ux-busy::after, .btn.is-loading::after, .pd-buy__cta.is-busy::after, .pd-bar__cta.is-busy::after {
	content: ''; position: absolute; left: 50%; top: 50%; width: 22px; height: 22px; margin: -11px 0 0 -11px;
	border-radius: 50%; border: 2.5px solid currentColor; border-color: rgba(255,255,255,.35) rgba(255,255,255,.35) #fff #fff;
	animation: ux-spin .7s linear infinite;
}
.btn--light.ux-busy::after, .btn--light.is-loading::after { border-color: var(--c-line) var(--c-line) var(--c-vino) var(--c-vino); }
@keyframes ux-spin { to { transform: rotate(360deg); } }
/* Subida de archivo en la ficha */
.pd-file.is-loading .pd-file__status::before {
	content: ''; display: inline-block; width: 14px; height: 14px; margin-right: 6px; vertical-align: -2px;
	border-radius: 50%; border: 2px solid var(--c-line); border-top-color: var(--c-vino); animation: ux-spin .7s linear infinite;
}
.pd-field__error:not([hidden])::before { content: '! '; font-weight: 700; }

/* ---------- Avisos de WooCommerce con estilo de marca (donde el módulo no los estiliza) ---------- */
.woocommerce-notices-wrapper:empty { display: none; }
:is(.woocommerce-message, .woocommerce-error, .woocommerce-info):not(.kit-notices *, .bl-shop-flow *, .account-page *) {
	position: relative; display: block; max-width: calc(var(--container) - 2 * var(--gutter)); margin: 18px auto;
	padding: 14px 18px 14px 50px; list-style: none; border-radius: var(--radius); background: var(--c-surface);
	border: 1px solid var(--c-line); border-left: 4px solid var(--c-oro); box-shadow: var(--shadow-card);
	color: var(--c-tinta); font-size: 15.5px; line-height: 1.5;
}
:is(.woocommerce-message, .woocommerce-error, .woocommerce-info):not(.kit-notices *, .bl-shop-flow *, .account-page *)::before {
	position: absolute; left: 16px; top: 13px; display: grid; place-items: center; width: 22px; height: 22px;
	border-radius: 50%; font-size: 13px; font-weight: 700; color: #fff; background: var(--c-oro); content: 'i';
}
.woocommerce-message:not(.kit-notices *, .bl-shop-flow *, .account-page *) { border-left-color: var(--c-success); }
.woocommerce-message:not(.kit-notices *, .bl-shop-flow *, .account-page *)::before { background: var(--c-success); content: '✓'; }
.woocommerce-error:not(.kit-notices *, .bl-shop-flow *, .account-page *) { border-left-color: var(--c-rosa); }
.woocommerce-error:not(.kit-notices *, .bl-shop-flow *, .account-page *)::before { background: var(--c-rosa); content: '!'; }
.woocommerce-error li + li { margin-top: 4px; }
:is(.woocommerce-message, .woocommerce-info):not(.kit-notices *, .bl-shop-flow *, .account-page *) :is(.button, a.restore-item) {
	float: right; margin-left: 12px; font-weight: 600; color: var(--c-vino); text-decoration: underline; text-underline-offset: 3px;
}
.woocommerce-error:focus { outline: none; }
.woocommerce-notices-wrapper:not(.kit-notices *, .bl-shop-flow *, .account-page *) { padding-inline: var(--gutter); }

/* ---------- Botón flotante de WhatsApp ---------- */
.wa-fab {
	position: fixed; right: 18px; bottom: calc(18px + env(safe-area-inset-bottom)); z-index: 45;
	display: flex; align-items: center; gap: 10px; height: 54px; padding: 0 14px; border-radius: var(--radius-pill);
	background: var(--c-vino); color: #fff; box-shadow: 0 10px 28px rgba(var(--rgb-cacao), .25);
	transition: transform .25s var(--ease), background .2s, bottom .3s var(--ease);
}
.wa-fab:hover { background: var(--c-vino-700); transform: translateY(-2px); }
.wa-fab__label { max-width: 0; overflow: hidden; white-space: nowrap; font-size: 15px; font-weight: 600; transition: max-width .3s var(--ease); }
.wa-fab:hover .wa-fab__label, .wa-fab:focus-visible .wa-fab__label { max-width: 200px; }
@media (max-width: 900px) {
	.wa-fab { right: 14px; height: 50px; padding: 0 12px; }
	/* Encima de la barra inferior de compra (producto y kits) */
	body.single-product .wa-fab, body.is-kit .wa-fab { bottom: calc(84px + env(safe-area-inset-bottom)); }
}
html[style*="overflow: hidden"] .wa-fab { display: none; } /* menú móvil o carrito abiertos */

/* ---------- Accesibilidad general ---------- */
.screen-reader-text:focus {
	clip: auto !important; width: auto; height: auto; margin: 0; padding: 12px 18px; left: 12px; top: 12px; z-index: 1200;
	background: var(--c-surface); color: var(--c-vino); border-radius: var(--radius-sm); box-shadow: var(--shadow-pop); font-weight: 600;
}
@media (max-width: 600px) {
	input[type=text], input[type=email], input[type=tel], input[type=search], input[type=password], input[type=number], input[type=date], select, textarea { font-size: max(16px, 1em); } /* evita el zoom de iOS al enfocar */
}

@media (prefers-reduced-motion: reduce) {
	.p-card__fav.is-pop, .btn.ux-busy::after, .btn.is-loading::after { animation-duration: 1.5s; }
	.p-card__fav.is-pop { animation: none; }
	.ux-toast, .wa-fab, .wa-fab__label { transition: none; }
}
