/* ==========================================================================
   Mascotas: ficha de producto.
   ========================================================================== */

/* Estructura: galería | resumen; lo demás a todo el ancho. ----------------- */
.single-product .shop-layout { padding-block: 20px 64px; }

.woocommerce div.product {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
	gap: 0 48px;
	align-items: start;
}

.woocommerce div.product > * { grid-column: 1 / -1; }

/* WooCommerce fija un 48 % con «.woocommerce #content div.product div.images»
   (y el tema tiene #content): se anula con !important. */
.woocommerce div.product div.images,
.woocommerce div.product .woocommerce-product-gallery,
.woocommerce div.product .ed-image-wrap--single {
	grid-column: 1;
	width: 100% !important;
	float: none !important;
	margin: 0 !important;
}

.woocommerce div.product div.summary {
	grid-column: 2;
	width: 100% !important;
	float: none !important;
	margin: 0 !important;
}

.woocommerce div.product span.onsale { top: 12px; left: 12px; z-index: 5; }

/* Galería: foto principal + miniaturas en UNA fila deslizable. ------------- */
.woocommerce div.product div.images .flex-viewport,
.woocommerce div.product div.images .woocommerce-product-gallery__image:first-child {
	overflow: hidden;
	background: var(--color-bg);
	border: 1px solid var(--color-border);
	border-radius: 16px;
}

.woocommerce div.product div.images img { border-radius: 0; }

.woocommerce div.product div.images .flex-control-thumbs {
	display: flex;
	gap: 8px;
	margin: 12px 0 0;
	padding: 0 0 6px;
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	scrollbar-width: thin;
	list-style: none;
}

.woocommerce div.product div.images .flex-control-thumbs li {
	flex: 0 0 calc((100% - 32px) / 4.5); /* Cuatro y media: se intuye que desliza. */
	width: auto;
	margin: 0;
	float: none;
	scroll-snap-align: start;
}

.woocommerce div.product div.images .flex-control-thumbs li img {
	display: block;
	width: 100%;
	aspect-ratio: 1;
	object-fit: contain;
	background: var(--color-bg);
	border: 2px solid var(--color-border);
	border-radius: 10px;
	opacity: .7;
	transition: opacity .15s ease, border-color .15s ease;
}

.woocommerce div.product div.images .flex-control-thumbs li img:hover,
.woocommerce div.product div.images .flex-control-thumbs li img.flex-active {
	border-color: var(--color-primary);
	opacity: 1;
}

.woocommerce div.product div.images .woocommerce-product-gallery__trigger { top: 12px; right: 12px; z-index: 6; }

/* Resumen ----------------------------------------------------------------- */
.woocommerce div.product .product_title {
	margin: 0 0 8px;
	font-size: clamp(1.4rem, 3vw, 1.9rem);
	font-weight: 700;
	line-height: 1.25;
}

.single-rating {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px;
	margin-bottom: 18px;
}

.single-rating__stars { display: inline-flex; gap: 2px; color: #f5a623; }
.single-rating__link { font-size: .9rem; color: var(--color-primary); }

/* Variaciones: tabla nativa en bloques y botones sobre el <select>. */
.woocommerce div.product form.cart table.variations,
.woocommerce div.product form.cart table.variations tbody,
.woocommerce div.product form.cart table.variations tr,
.woocommerce div.product form.cart table.variations th,
.woocommerce div.product form.cart table.variations td {
	display: block;
	width: 100%;
	margin: 0;
	padding: 0;
	border: 0;
	line-height: 1.4;
	text-align: left;
}

.woocommerce div.product form.cart table.variations { margin-bottom: 8px; }
.woocommerce div.product form.cart table.variations tr { margin-bottom: 14px; }
/* !important: los estilos de Variation Swatches (si sigue activo) ocultan la etiqueta. */
.woocommerce div.product form.cart table.variations th.label { display: block !important; margin-bottom: 8px; font-weight: 700; }

/* El select sigue en el formulario pero solo se manejan los botones. */
.variation-select select {
	position: absolute !important;
	width: 1px !important;
	height: 1px !important;
	overflow: hidden;
	clip: rect(0 0 0 0);
	opacity: 0;
}

.woocommerce div.product form.cart .reset_variations { display: none !important; }

.variation-buttons { display: flex; flex-wrap: wrap; gap: 8px; }

.variation-button {
	min-width: 56px;
	padding: 10px 16px;
	font-size: .95rem;
	font-weight: 500;
	line-height: 1.2;
	color: var(--color-text);
	background: var(--color-bg);
	border: 1px solid var(--color-border);
	border-radius: 10px;
}

.variation-button:hover:not(:disabled) { color: var(--color-primary); background: var(--color-bg); border-color: var(--color-primary); }

.variation-button[aria-pressed="true"] {
	font-weight: 700;
	color: var(--color-primary);
	background: #e1edf9;
	border-color: var(--color-primary);
}

.variation-button:disabled,
.variation-button.is-unavailable {
	color: var(--color-muted);
	text-decoration: line-through;
	opacity: .45;
	cursor: not-allowed;
}

/* Disponibilidad de la variación (el precio va en la fila de compra). */
.woocommerce div.product .woocommerce-variation-price { display: none; }
.woocommerce div.product .woocommerce-variation-availability p { margin: 0 0 10px; font-size: .9rem; }
.woocommerce div.product .woocommerce-variation-description p { margin: 0 0 10px; }

/* Fila precio | cantidad, y botón debajo. */
.woocommerce div.product form.cart,
.woocommerce div.product form.cart .woocommerce-variation-add-to-cart {
	display: flex;
	flex-direction: column;
	gap: 14px;
	margin-bottom: 20px;
}

.woocommerce div.product form.cart .woocommerce-variation-add-to-cart { margin: 0; }
.woocommerce div.product form.cart::before,
.woocommerce div.product form.cart::after { display: none; }

.single-buy-row {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 12px 20px;
}

.woocommerce div.product .single-buy-row__price {
	margin: 0;
	font-size: 2rem;
	font-weight: 800;
	line-height: 1.1;
	color: var(--color-primary);
}

/* El HTML del precio de la variación trae su propio span.price (WooCommerce lo pinta en verde oliva). */
.woocommerce div.product .single-buy-row__price .price,
.woocommerce div.product .single-buy-row__price span.price {
	margin: 0;
	font-size: inherit;
	color: inherit;
}

.single-buy-row__price del { display: block; font-size: 1rem; font-weight: 400; color: var(--color-muted); }
.single-buy-row__price ins { text-decoration: none; }

/* Selector de cantidad con − / + (también en el carrito). */
.quantity {
	display: inline-flex;
	align-items: center;
	overflow: hidden;
	border: 1px solid var(--color-border);
	border-radius: 10px;
}

.woocommerce div.product form.cart div.quantity { float: none; margin: 0; }

.qty-btn {
	width: 42px;
	height: 48px;
	padding: 0;
	font-size: 1.3rem;
	font-weight: 700;
	line-height: 1;
	color: var(--color-primary);
	background: transparent;
	border-radius: 0;
}

.qty-btn {
	touch-action: manipulation; /* Sin zoom por doble toque en móvil. */
	user-select: none;
}

.qty-btn:hover:not(:disabled) { color: var(--color-primary-dark); background: var(--color-bg-alt); }
.qty-btn:disabled { color: var(--color-border); background: transparent; cursor: not-allowed; }

.quantity input.qty {
	width: 52px;
	height: 48px;
	padding: 0;
	font-weight: 600;
	text-align: center;
	background: transparent;
	border: 0;
	border-radius: 0;
	-moz-appearance: textfield;
}

.quantity input.qty::-webkit-outer-spin-button,
.quantity input.qty::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.woocommerce div.product form.cart .single_add_to_cart_button,
.woocommerce div.product form.cart .button.single_add_to_cart_button {
	width: 100%;
	min-height: 54px;
	margin: 0;
	font-size: 1.05rem;
	font-weight: 800;
	text-transform: uppercase;
	color: #fff;
	background: var(--color-accent);
	border-radius: 12px;
	float: none;
}

.woocommerce div.product form.cart .single_add_to_cart_button:hover { background: #b80c0c; }
.woocommerce div.product form.cart .single_add_to_cart_button.disabled { opacity: .5; }
.woocommerce div.product form.cart .single_add_to_cart_button.is-loading { opacity: .7; cursor: progress; }
.woocommerce div.product form.cart .single_add_to_cart_button.is-added { background: #1a9a4b; }

.single-cart-message { margin: 0; font-size: .9rem; color: var(--color-sale); }
.single-cart-message:empty { display: none; }

/* Textos recortables con «Ver más» (descripción corta y larga). */
.single-clamp--excerpt { margin-bottom: 20px; }

.single-clamp__text {
	max-height: var(--clamp-height, 7.5em);
	overflow: hidden;
	color: #333;
	-webkit-mask-image: linear-gradient(#000 60%, transparent);
	mask-image: linear-gradient(#000 60%, transparent);
}

.single-clamp--excerpt { --clamp-height: 7.5em; }       /* ~ 5 líneas. */
.single-clamp--description { --clamp-height: 18em; }   /* ~ 12 líneas. */

.single-clamp__text > :last-child { margin-bottom: 0; }

.single-clamp.is-short .single-clamp__text,
.single-clamp.is-expanded .single-clamp__text {
	max-height: none;
	-webkit-mask-image: none;
	mask-image: none;
}

.single-clamp__more {
	display: block;
	margin: 6px auto 0; /* Centrado. */
	padding: 4px 12px;
	font-weight: 700;
	color: var(--color-primary);
	background: transparent;
}

.single-clamp__more:hover { color: var(--color-primary-dark); background: transparent; text-decoration: underline; }

/* Textos pegados desde Google traen <mark> resaltado: sin resaltado. */
.single-clamp__text mark,
.woocommerce-Tabs-panel mark { color: inherit; background: none; }

/* Etiqueta de categoría: encima del título, a todo el ancho de la columna
   del resumen (la mitad de la página en escritorio; todo el ancho en móvil).
   Margen izquierdo para el círculo del icono, que sobresale. */
.woocommerce div.product .single-label {
	display: flex;
	justify-content: center;
	width: calc(100% - 4px);
	min-height: 40px;
	margin: 0 0 16px 4px;
	padding: 6px 48px; /* Simétrico: el texto queda centrado pese al icono. */
	font-size: 1.05rem;
}

.woocommerce div.product .single-label .product-card__label-icon { width: 46px; height: 46px; }

/* Medios de pago. */
.single-payments {
	padding: 16px 18px;
	background: var(--color-bg-alt);
	border: 1px solid var(--color-border);
	border-radius: 14px;
}

.single-payments__title {
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 0 0 4px;
	font-weight: 700;
}

.single-payments__title svg { color: #1a9a4b; }
.single-payments__text { margin: 0 0 12px; font-size: .9rem; color: var(--color-muted); }
.single-payments .payment-logos { gap: 18px; }
.single-payments .payment-logos svg { height: 24px; }
.single-payments__logos img { display: block; max-height: 32px; width: auto; }

/* Carruseles -------------------------------------------------------------- */
.product-carousel { margin-top: 48px; }

.product-carousel__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	margin-bottom: 16px;
}

.product-carousel__title { margin: 0; font-size: clamp(1.2rem, 2.5vw, 1.6rem); font-weight: 800; }

.product-carousel__nav { display: none; gap: 8px; }
.product-carousel.has-overflow .product-carousel__nav { display: flex; }

.product-carousel__arrow {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	padding: 0;
	color: #fff;
	background: var(--color-primary);
	border-radius: 50%;
}

.product-carousel__arrow:disabled { opacity: .35; cursor: default; }
.product-carousel__arrow[data-dir="-1"] svg { transform: rotate(90deg); }
.product-carousel__arrow[data-dir="1"] svg { transform: rotate(-90deg); }

ul.products.product-carousel__track {
	/* Contenedor de lo posicionado dentro de las tarjetas: sin esto, lo que
	   tiene position:absolute en tarjetas fuera de vista ensancha la página. */
	position: relative;
	display: flex;
	gap: 16px;
	margin: 0;
	padding: 2px 2px 10px;
	list-style: none;
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	scroll-behavior: smooth;
	scrollbar-width: thin;
}

/* Ancho fijo e idéntico para todas: sin min-width:0 una tarjeta con
   contenido largo se ensancha. */
ul.products.product-carousel__track li.product {
	--carousel-card: calc((100% - 48px) / 4);
	flex: 0 0 var(--carousel-card);
	width: var(--carousel-card);
	min-width: 0;
	max-width: var(--carousel-card);
	scroll-snap-align: start;
}

/* En los carruseles no se muestra la etiqueta de categoría. */
.product-carousel .product-card__label { display: none; }

/* Pestañas (descripción, información, reseñas). */
.woocommerce div.product .woocommerce-tabs { margin-top: 48px; }

/* Interruptor segmentado a todo el ancho: opciones del mismo tamaño y
   centradas, la activa resaltada. */
.woocommerce div.product .woocommerce-tabs ul.tabs {
	display: flex;
	gap: 4px;
	width: 100%;
	margin: 0 0 24px;
	padding: 4px;
	overflow-x: auto;
	background: var(--color-bg-alt);
	border: 1px solid var(--color-border);
	border-radius: 14px;
	scrollbar-width: none;
}

.woocommerce div.product .woocommerce-tabs ul.tabs::before,
.woocommerce div.product .woocommerce-tabs ul.tabs li::before,
.woocommerce div.product .woocommerce-tabs ul.tabs li::after { display: none; }

.woocommerce div.product .woocommerce-tabs ul.tabs li {
	flex: 1 1 0;
	text-align: center;
	margin: 0;
	padding: 0;
	background: transparent;
	border: 0;
	border-radius: 0;
}

.woocommerce div.product .woocommerce-tabs ul.tabs li a {
	display: block;
	padding: 10px 14px;
	font-weight: 600;
	text-align: center;
	white-space: nowrap;
	color: var(--color-muted);
	border-radius: 10px;
	transition: background-color .15s ease, color .15s ease;
}

.woocommerce div.product .woocommerce-tabs ul.tabs li a:hover { color: var(--color-primary); }

.woocommerce div.product .woocommerce-tabs ul.tabs li.active a {
	color: #fff;
	background: var(--color-primary);
	box-shadow: 0 2px 6px rgba(18, 88, 165, .3);
}

@media (max-width: 640px) {
	.woocommerce div.product .woocommerce-tabs ul.tabs li a { padding: 10px 8px; font-size: .9rem; }
}

.woocommerce div.product .woocommerce-tabs .panel > h2:first-child { display: none; }

/* Móvil ------------------------------------------------------------------- */
@media (max-width: 900px) {
	.woocommerce div.product { grid-template-columns: minmax(0, 1fr); }

	.woocommerce div.product div.images,
	.woocommerce div.product .woocommerce-product-gallery,
	.woocommerce div.product .ed-image-wrap--single,
	.woocommerce div.product div.summary { grid-column: 1; }

	.woocommerce div.product div.summary { margin-top: 20px !important; }
}

@media (max-width: 640px) {
	/* Dos tarjetas completas y la tercera asomando: indica que se desliza. */
	ul.products.product-carousel__track { gap: 12px; }
	ul.products.product-carousel__track li.product { --carousel-card: calc((100% - 24px) / 2.35); }

	.product-carousel { margin-top: 36px; }
	.product-carousel.has-overflow .product-carousel__nav { display: none; }
}

/* Barra fija inferior: título, precio y Comprar. ---------------------------- */
.sticky-buy {
	position: fixed;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 900; /* Bajo los paneles y la notificación del carrito. */
	padding: 10px 0 calc(10px + env(safe-area-inset-bottom));
	background: var(--color-bg);
	border-top: 1px solid var(--color-border);
	box-shadow: 0 -6px 20px rgba(0, 0, 0, .1);
	transform: translateY(110%);
	visibility: hidden;
	transition: transform .25s ease, visibility 0s linear .25s;
}

.sticky-buy.is-visible {
	visibility: visible;
	transform: none;
	transition-delay: 0s;
}

.sticky-buy__inner {
	display: flex;
	align-items: center;
	gap: 16px;
}

.sticky-buy__info { flex: 1; min-width: 0; }

.sticky-buy__title {
	margin: 0;
	overflow: hidden;
	font-weight: 700;
	line-height: 1.3;
	white-space: nowrap;
	text-overflow: ellipsis;
}

.woocommerce .sticky-buy__price,
.sticky-buy__price {
	margin: 2px 0 0;
	font-size: 1.15rem;
	font-weight: 800;
	line-height: 1.2;
	color: var(--color-primary);
}

.sticky-buy__price .price { margin: 0; font-size: inherit; color: inherit; }
.sticky-buy__price del { display: none; }
.sticky-buy__price ins { text-decoration: none; }

#sticky-buy .sticky-buy__btn,
#sticky-buy .button.sticky-buy__btn {
	flex-shrink: 0;
	min-width: 180px;
	min-height: 48px;
	font-size: 1rem;
	font-weight: 800;
	text-transform: uppercase;
	color: #fff;
	background: var(--color-accent);
	border-radius: 12px;
}

#sticky-buy .sticky-buy__btn:hover { color: #fff; background: #b80c0c; }
#sticky-buy .sticky-buy__btn.is-loading { opacity: .7; cursor: progress; }
#sticky-buy .sticky-buy__btn.is-added { background: #1a9a4b; }

/* Espacio para que la barra no tape el final de la página. */
body.has-sticky-buy .site-footer { padding-bottom: 76px; }

@media (max-width: 640px) {
	.sticky-buy__inner { gap: 12px; }
	.sticky-buy__title { font-size: .85rem; }
	.sticky-buy__price { font-size: 1.05rem; }
	#sticky-buy .sticky-buy__btn,
	#sticky-buy .button.sticky-buy__btn { min-width: 0; padding: 0 22px; }
}

@media (prefers-reduced-motion: reduce) {
	.sticky-buy { transition: none; }
}
