/* TV Variaciones en tarjetas 0.3.1 — todo bajo body.tvf-ficha (fichas nuevas de tv-ficha). */
body.tvf-ficha {
	--tvvt-grad: linear-gradient(135deg, #a20ae2 0%, #b04af5 50%, #e24fd6 100%);
	--tvvt-lima: #dcf166;
	--tvvt-negro: #000;
	--tvvt-fondo-tarjeta: #fff; /* 0.2.1: fondo blanco detrás de la foto */
}

/* ---------- Tarjetas ---------- */
body.tvf-ficha .tvvt { margin: 0; min-width: 0; max-width: 100%; }
body.tvf-ficha .tvvt[hidden] { display: none !important; }
body.tvf-ficha .tvvt .tvvt__fila { display: flex; flex-wrap: wrap; gap: 12px; margin: 0; padding: 4px 2px; }

/* Solo la foto, con borde en gradiente violeta (mismo truco que los contadores de tv-campana). */
body.tvf-ficha .tvvt .tvvt__card {
	position: relative; display: block; flex: 0 0 auto; box-sizing: border-box; width: 108px; height: 108px; margin: 0; padding: 0;
	border: 2px solid transparent !important; border-radius: 16px !important;
	background: linear-gradient(var(--tvvt-fondo-tarjeta), var(--tvvt-fondo-tarjeta)) padding-box, var(--tvvt-grad) border-box !important;
	color: inherit; box-shadow: none; font: inherit; line-height: 0; text-align: center; white-space: normal;
	cursor: pointer; transition: box-shadow .15s ease, border-width .15s ease; -webkit-tap-highlight-color: transparent;
}
body.tvf-ficha .tvvt .tvvt__card:hover,
body.tvf-ficha .tvvt .tvvt__card:focus { background: linear-gradient(var(--tvvt-fondo-tarjeta), var(--tvvt-fondo-tarjeta)) padding-box, var(--tvvt-grad) border-box !important; color: inherit; }
body.tvf-ficha .tvvt .tvvt__card:hover { box-shadow: 0 0 10px rgba(176, 74, 245, .45); }
body.tvf-ficha .tvvt .tvvt__card:focus-visible { outline: 3px solid var(--tvvt-lima); outline-offset: 3px; }

body.tvf-ficha .tvvt .tvvt__media { display: block; width: 100%; height: 100%; overflow: hidden; border-radius: 13px; background: var(--tvvt-fondo-tarjeta); }
body.tvf-ficha .tvvt .tvvt__media img.tvvt__foto {
	display: block; width: 104px !important; height: 104px !important; max-width: none !important; min-width: 0;
	margin: 0; padding: 0; border: 0; border-radius: 0; box-shadow: none; object-fit: cover; opacity: 1;
}

/* 0.3.0: sin imagen o imagen repetida entre opciones: el nombre adentro, sobre blanco, mismo borde. */
body.tvf-ficha .tvvt .tvvt__card--texto .tvvt__media { display: flex; align-items: center; justify-content: center; padding: 6px; box-sizing: border-box; }
body.tvf-ficha .tvvt .tvvt__texto {
	display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 4; overflow: hidden; max-width: 100%;
	color: var(--tvvt-texto-tarjeta, #111); font-size: 13px; font-weight: 800; line-height: 1.15; letter-spacing: .01em;
	text-transform: uppercase; text-align: center; overflow-wrap: anywhere; hyphens: auto;
}

/* Elegida: borde más grueso y brillo violeta, con tilde lima. */
body.tvf-ficha .tvvt .tvvt__card.is-elegida {
	border-width: 4px !important;
	box-shadow: 0 0 0 2px rgba(226, 79, 214, .35), 0 0 18px rgba(176, 74, 245, .85);
}
body.tvf-ficha .tvvt .tvvt__card.is-elegida .tvvt__media { border-radius: 11px; }
body.tvf-ficha .tvvt .tvvt__card.is-elegida::after {
	content: ""; position: absolute; top: 4px; right: 4px; width: 20px; height: 20px; border-radius: 50%;
	background: var(--tvvt-lima) no-repeat center / 12px 12px url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12'%3E%3Cpath d='M2 6.2l2.6 2.6L10 3.4' fill='none' stroke='%23000' stroke-width='2.2'/%3E%3C/svg%3E");
	box-shadow: 0 0 0 2px var(--tvvt-negro);
}

/* Sin stock: apagada, raya en diagonal y no seleccionable. No combina con otro atributo: apagada sin raya. */
body.tvf-ficha .tvvt .tvvt__card--agotado,
body.tvf-ficha .tvvt .tvvt__card.is-no-combina {
	cursor: not-allowed; box-shadow: none;
	background: linear-gradient(var(--tvvt-fondo-tarjeta), var(--tvvt-fondo-tarjeta)) padding-box, linear-gradient(#4a4a4a, #4a4a4a) border-box !important;
}
body.tvf-ficha .tvvt .tvvt__card--agotado .tvvt__media,
body.tvf-ficha .tvvt .tvvt__card.is-no-combina .tvvt__media { filter: grayscale(1); opacity: .35; }
body.tvf-ficha .tvvt .tvvt__card--agotado::before {
	content: ""; position: absolute; inset: 0; border-radius: 13px; pointer-events: none;
	background: linear-gradient(to top right, transparent calc(50% - 1.5px), #9a9a9a calc(50% - 1.5px), #9a9a9a calc(50% + 1.5px), transparent calc(50% + 1.5px));
}
body.tvf-ficha .tvvt .tvvt__card--agotado:hover,
body.tvf-ficha .tvvt .tvvt__card.is-no-combina:hover { box-shadow: none; }

/* Nombre de la elegida, debajo de la fila; vacío = no ocupa lugar. */
body.tvf-ficha .tvvt .tvvt__elegido { margin: 8px 0 0; padding: 0; color: var(--tvvt-lima); font-size: 16px; font-weight: 800; line-height: 1.2; letter-spacing: .02em; text-transform: uppercase; overflow-wrap: anywhere; }
body.tvf-ficha .tvvt .tvvt__elegido:empty { display: none; }

/* Selector nativo: oculto solo a la vista (lectores de pantalla y teclado siguen llegando). */
.tvvt-oculto-visual {
	position: absolute !important; width: 1px !important; height: 1px !important; margin: -1px !important; padding: 0 !important;
	overflow: hidden !important; clip: rect(0 0 0 0) !important; clip-path: inset(50%) !important; white-space: nowrap !important; border: 0 !important;
}

/* ---------- Bloque de compra oscuro y continuo ----------
   Para tv-ficha: todo lo del contenedor se puede pisar con variables (en body.tvf-ficha o en .tvf-variaciones),
   sin pelear con !important: --tvvt-bloque-fondo, --tvvt-bloque-pad, --tvvt-bloque-pad-movil, --tvvt-bloque-mt,
   --tvvt-bloque-mb, --tvvt-bloque-radio, --tvvt-bloque-sombra, --tvvt-bloque-mt-grid-movil,
   --tvvt-bloque-radio-grid, --tvvt-bloque-pad-grid, --tvvt-bloque-sombra-grid. */
body.tvf-ficha .tvf-variaciones {
	box-sizing: border-box; background: var(--tvvt-bloque-fondo, var(--tvvt-negro)); color: #fff; padding: var(--tvvt-bloque-pad, 8px 16px 12px) !important; margin-top: var(--tvvt-bloque-mt, 0) !important; margin-bottom: var(--tvvt-bloque-mb, 0) !important; border-radius: var(--tvvt-bloque-radio, 0); box-shadow: var(--tvvt-bloque-sombra, none); width: 100%; max-width: 100%; min-width: 0; flex: 0 0 100%;
}
/* Plantilla actual (sin tvf-grid): texto, variaciones y compra ya van pegados; el negro los une. */
body.tvf-ficha .tvf-variaciones + .elementor-widget-woocommerce-product-add-to-cart > .elementor-widget-container { border-top-left-radius: 0 !important; border-top-right-radius: 0 !important; }
/* Celular y tablet (una columna): precio + texto + variaciones + compra = una sola tarjeta negra. */
@media (max-width: 1023px) {
	body.tvf-ficha .tvf-variaciones { padding: var(--tvvt-bloque-pad-movil, 2px 6px 8px) !important; }
	body.tvf-ficha .elementor-section.tvf-grid .tvf-variaciones { margin-top: var(--tvvt-bloque-mt-grid-movil, -10px) !important; }
	body.tvf-ficha .elementor-section.tvf-grid .tvf-variaciones + .elementor-widget-woocommerce-product-add-to-cart { margin-top: -10px !important; }
	body.tvf-ficha .elementor-section.tvf-grid .tvf-variaciones + .elementor-widget-woocommerce-product-add-to-cart > .elementor-widget-container { border-top-left-radius: 0 !important; border-top-right-radius: 0 !important; padding-top: 6px !important; }
	body.tvf-ficha:has(.tvf-variaciones) .elementor-section.tvf-grid .elementor-widget-text-editor > .elementor-widget-container { border-bottom-left-radius: 0 !important; border-bottom-right-radius: 0 !important; }
	body.tvf-ficha .tvvt .tvvt__fila { flex-wrap: nowrap; gap: 10px; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; padding: 10px 10px 12px; margin: 0; max-width: 100%; scrollbar-width: none; scroll-padding-left: 10px; }
	body.tvf-ficha .tvvt .tvvt__fila::-webkit-scrollbar { display: none; }
	body.tvf-ficha .tvvt .tvvt__card { width: 88px; height: 88px; scroll-snap-align: start; }
	body.tvf-ficha .tvvt .tvvt__media img.tvvt__foto { width: 84px !important; height: 84px !important; }
	body.tvf-ficha .tvvt .tvvt__card.is-elegida::after { width: 18px; height: 18px; background-size: 11px 11px; }
	body.tvf-ficha .tvvt .tvvt__elegido { margin-top: 0; padding: 0 10px; font-size: 15px; }
	body.tvf-ficha .tvvt .tvvt__texto { font-size: 12px; }
}
/* Escritorio: variaciones + compra (las dos a todo el ancho) = una tarjeta negra. */
@media (min-width: 1024px) {
	body.tvf-ficha .elementor-section.tvf-grid .tvf-variaciones { border-radius: var(--tvvt-bloque-radio-grid, 24px 24px 0 0); padding: var(--tvvt-bloque-pad-grid, 18px 20px 8px) !important; box-shadow: var(--tvvt-bloque-sombra-grid, 0 0 10px rgba(0, 0, 0, .5)); }
	body.tvf-ficha .elementor-section.tvf-grid .tvf-variaciones + .elementor-widget-woocommerce-product-add-to-cart { margin-top: 0 !important; }
	body.tvf-ficha .elementor-section.tvf-grid .tvf-variaciones + .elementor-widget-woocommerce-product-add-to-cart > .elementor-widget-container { border-top-left-radius: 0 !important; border-top-right-radius: 0 !important; padding-top: 8px !important; }
}

/* Sin hueco debajo del botón: el "comprados juntos" (woobt) vacío deja 35 px de margen. */
body.tvf-ficha .elementor-widget-woocommerce-product-add-to-cart .woobt-wrap:not(:has(.woobt-product)) { margin: 0 !important; padding: 0 !important; }
/* "Solo quedan X disponibles": chico, arriba del botón. */
body.tvf-ficha .elementor-widget-woocommerce-product-add-to-cart .woocommerce-variation-availability p.stock,
body.tvf-ficha .elementor-widget-woocommerce-product-add-to-cart .elementor-add-to-cart > p.stock { margin: 0 0 6px !important; font-size: 13px !important; line-height: 1.3; }
body.tvf-ficha .elementor-widget-woocommerce-product-add-to-cart .single_variation_wrap .woocommerce-variation { margin: 0 !important; }

/* 0.3.0: selector nativo (nicotina, ohm, coil...) legible sobre el bloque negro: el valor elegido que
   agrega woo-variation-swatches venía en #333 y el "Limpiar" en rosa. */
body.tvf-ficha .elementor-widget-woocommerce-product-add-to-cart table.variations .woo-selected-variation-item-name { color: var(--tvvt-lima) !important; font-weight: 700; }
body.tvf-ficha .elementor-widget-woocommerce-product-add-to-cart table.variations .reset_variations { color: #cfcfcf !important; text-decoration: underline; }

/* ---------- Botón "Añadir al carrito" (ficha y barra fija) en gradiente violeta ---------- */
body.tvf-ficha .elementor-widget-woocommerce-product-add-to-cart .single_add_to_cart_button,
body.tvf-ficha #tvbc .tvbc-btn:not(.is-off) {
	background: var(--tvvt-grad) !important; background-color: #a20ae2 !important; color: #fff !important;
	border: 0 !important; box-shadow: 0 4px 14px rgba(162, 10, 226, .35) !important; opacity: 1 !important;
}
body.tvf-ficha .elementor-widget-woocommerce-product-add-to-cart .single_add_to_cart_button:hover:not(.disabled):not(:disabled) { filter: brightness(1.08); }
body.tvf-ficha .elementor-widget-woocommerce-product-add-to-cart .single_add_to_cart_button.disabled,
body.tvf-ficha .elementor-widget-woocommerce-product-add-to-cart .single_add_to_cart_button:disabled,
body.tvf-ficha .elementor-widget-woocommerce-product-add-to-cart .single_add_to_cart_button.wc-variation-selection-needed,
body.tvf-ficha .elementor-widget-woocommerce-product-add-to-cart .single_add_to_cart_button.wc-variation-is-unavailable,
body.tvf-ficha .elementor-widget-woocommerce-product-add-to-cart .single_add_to_cart_button.woosb-disabled {
	background: #2a2a2a !important; color: #8c8c8c !important; box-shadow: none !important; cursor: not-allowed; filter: none;
}
