/**
 * Comparador de productos — estilos.
 *
 * Variables en :root para que el tema pueda re-tematizar sin tocar este archivo.
 */

/*
 * Las variables van en :root a propósito. El botón de comparar vive dentro de
 * las tarjetas del catálogo, fuera de cualquier contenedor del comparador: si
 * las variables se definieran solo en esos contenedores, el botón heredaría
 * color del tema y el icono podría quedar invisible.
 */
:root {
	--tkc-acento: #2e7d32;
	--tkc-acento-oscuro: #1b5e20;
	--tkc-borde: #e5e5e5;
	--tkc-borde-suave: #f0f0f0;
	--tkc-texto: #1f2421;
	--tkc-texto-suave: #6b7280;
	--tkc-fondo: #ffffff;
	--tkc-fondo-alt: #fafafa;
	--tkc-radio: 10px;
	--tkc-col: 220px;
}

/* --------------------------------------------------------------------------
   Botón de añadir al comparador
   -------------------------------------------------------------------------- */

/*
 * Todos los colores del botón llevan valor de reserva: aunque el tema o un
 * page builder aísle el contexto de las variables, el icono sigue teniendo un
 * color propio y nunca desaparece.
 */
.tkc-toggle {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	padding: 7px 14px;
	border: 1px solid var(--tkc-borde, #e5e5e5);
	border-radius: var(--tkc-radio, 10px);
	background: var(--tkc-fondo, #ffffff);
	color: var(--tkc-texto, #1f2421);
	font-size: 14px;
	font-weight: 600;
	line-height: 1.2;
	cursor: pointer;
	transition: border-color 0.18s ease, color 0.18s ease, background-color 0.18s ease;
}

.tkc-toggle:hover {
	border-color: var(--tkc-acento, #2e7d32);
	color: var(--tkc-acento, #2e7d32);
	background: var(--tkc-fondo, #ffffff);
}

.tkc-toggle:focus-visible {
	outline: 2px solid var(--tkc-acento, #2e7d32);
	outline-offset: 2px;
}

/* Estado activo: cambia el fondo, nunca la presencia del icono. */
.tkc-toggle[aria-pressed="true"] {
	background: var(--tkc-acento, #2e7d32);
	border-color: var(--tkc-acento, #2e7d32);
	color: #ffffff;
}

.tkc-toggle[aria-pressed="true"]:hover {
	background: var(--tkc-acento-oscuro, #1b5e20);
	border-color: var(--tkc-acento-oscuro, #1b5e20);
	color: #ffffff;
}

.tkc-toggle--icono {
	width: 38px;
	height: 38px;
	padding: 0;
	border-radius: 50%;
}

.tkc-toggle--icono .tkc-toggle-texto {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	clip-path: inset(50%);
	white-space: nowrap;
}

.tkc-toggle-icono {
	display: inline-flex;
	flex: 0 0 auto;
	align-items: center;
	justify-content: center;
	color: inherit;
}

/*
 * El SVG hereda el color del botón mediante currentColor y lleva medidas fijas:
 * ni el tema ni el estado activo pueden encogerlo ni ocultarlo.
 */
.tkc-toggle-icono svg {
	display: block;
	width: 18px;
	height: 18px;
	min-width: 18px;
	min-height: 18px;
	stroke: currentColor;
	fill: none;
	opacity: 1;
	visibility: visible;
}

/* --------------------------------------------------------------------------
   Cabecera del comparador
   -------------------------------------------------------------------------- */

.tkc-barra-superior {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 14px;
}

.tkc-resumen {
	margin: 0;
	font-size: 15px;
	font-weight: 600;
	color: var(--tkc-texto);
}

.tkc-acciones {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px;
}

.tkc-switch {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	font-size: 14px;
	color: var(--tkc-texto-suave);
	cursor: pointer;
	user-select: none;
}

.tkc-switch input {
	width: 16px;
	height: 16px;
	accent-color: var(--tkc-acento);
	cursor: pointer;
}

.tkc-accion {
	padding: 6px 12px;
	border: 1px solid var(--tkc-borde);
	border-radius: 8px;
	background: var(--tkc-fondo);
	color: var(--tkc-texto-suave);
	font-size: 13px;
	cursor: pointer;
	transition: border-color 0.18s ease, color 0.18s ease;
}

.tkc-accion:hover {
	border-color: var(--tkc-acento);
	color: var(--tkc-acento);
}

.tkc-accion:focus-visible {
	outline: 2px solid var(--tkc-acento);
	outline-offset: 2px;
}

/* --------------------------------------------------------------------------
   Tabla
   -------------------------------------------------------------------------- */

.tkc-scroll {
	overflow-x: auto;
	border: 1px solid var(--tkc-borde);
	border-radius: var(--tkc-radio);
	background: var(--tkc-fondo);
	-webkit-overflow-scrolling: touch;
}

.tkc-scroll:focus-visible {
	outline: 2px solid var(--tkc-acento);
	outline-offset: 2px;
}

.tkc-tabla {
	width: 100%;
	border-collapse: collapse;
	font-size: 14px;
	color: var(--tkc-texto);
}

.tkc-tabla th,
.tkc-tabla td {
	padding: 14px 16px;
	text-align: left;
	vertical-align: top;
	border-bottom: 1px solid var(--tkc-borde-suave);
}

/* Columna de etiquetas: se queda fija al desplazar en horizontal. */
.tkc-col-etiqueta {
	position: sticky;
	left: 0;
	z-index: 2;
	min-width: 150px;
	width: 150px;
	background: var(--tkc-fondo-alt);
	font-weight: 600;
	color: var(--tkc-texto-suave);
	border-right: 1px solid var(--tkc-borde);
}

.tkc-col-producto,
.tkc-celda {
	min-width: var(--tkc-col);
	width: var(--tkc-col);
}

.tkc-tabla thead th {
	position: sticky;
	top: 0;
	z-index: 3;
	background: var(--tkc-fondo);
	border-bottom: 1px solid var(--tkc-borde);
}

.tkc-tabla thead .tkc-col-etiqueta {
	z-index: 4;
	background: var(--tkc-fondo-alt);
}

/* Cabecera de producto */

.tkc-cabecera {
	position: relative;
	display: flex;
	flex-direction: column;
	gap: 8px;
	padding-right: 22px;
}

.tkc-cabecera .tkc-imagen {
	width: 100%;
	max-width: 150px;
	height: auto;
	border-radius: 8px;
}

.tkc-cabecera-titulo .tkc-enlace {
	font-size: 15px;
	font-weight: 700;
	line-height: 1.3;
	color: var(--tkc-texto);
	text-decoration: none;
}

.tkc-cabecera-titulo .tkc-enlace:hover {
	color: var(--tkc-acento);
	text-decoration: underline;
}

.tkc-quitar {
	position: absolute;
	top: -4px;
	right: -4px;
	width: 26px;
	height: 26px;
	padding: 0;
	border: 1px solid var(--tkc-borde);
	border-radius: 50%;
	background: var(--tkc-fondo);
	color: var(--tkc-texto-suave);
	font-size: 17px;
	line-height: 1;
	cursor: pointer;
	transition: border-color 0.18s ease, color 0.18s ease;
}

.tkc-quitar:hover {
	border-color: #d32f2f;
	color: #d32f2f;
}

.tkc-quitar:focus-visible {
	outline: 2px solid var(--tkc-acento);
	outline-offset: 2px;
}

/* --------------------------------------------------------------------------
   Diferencias: el detalle que hace útil la tabla
   -------------------------------------------------------------------------- */

.tkc-fila--distinta .tkc-col-etiqueta {
	box-shadow: inset 3px 0 0 var(--tkc-acento);
	color: var(--tkc-texto);
}

.tkc-comparador.is-solo-diferencias .tkc-fila--igual,
.tkc-comparador.is-solo-diferencias .tkc-fila--sin-comparar {
	display: none;
}

/* --------------------------------------------------------------------------
   Contenidos de celda
   -------------------------------------------------------------------------- */

.tkc-badges,
.tkc-lista {
	margin: 0;
	padding: 0;
	list-style: none;
}

.tkc-badges {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}

.tkc-badge {
	padding: 3px 10px;
	border: 1px solid var(--tkc-borde);
	border-radius: 999px;
	background: var(--tkc-fondo-alt);
	font-size: 12px;
	font-weight: 600;
	color: var(--tkc-texto-suave);
	white-space: nowrap;
}

.tkc-badge a {
	color: inherit;
	text-decoration: none;
}

.tkc-badge a:hover {
	color: var(--tkc-acento);
}

.tkc-lista li {
	margin-bottom: 4px;
	line-height: 1.4;
}

.tkc-botones {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.tkc-boton {
	display: inline-block;
	padding: 9px 16px;
	border-radius: 8px;
	background: var(--tkc-acento);
	color: #fff;
	font-size: 13px;
	font-weight: 600;
	line-height: 1.3;
	text-align: center;
	text-decoration: none;
	transition: background-color 0.18s ease;
}

.tkc-boton:hover,
.tkc-boton:focus {
	background: var(--tkc-acento-oscuro);
	color: #fff;
}

.tkc-boton:focus-visible {
	outline: 2px solid var(--tkc-acento-oscuro);
	outline-offset: 2px;
}

.tkc-boton-nota {
	display: block;
	margin-top: -4px;
	font-size: 11px;
	color: var(--tkc-texto-suave);
}

.tkc-bool--si {
	color: var(--tkc-acento);
	font-weight: 600;
}

.tkc-bool--no {
	color: var(--tkc-texto-suave);
}

.tkc-vacio {
	color: #9ca3af;
	font-style: italic;
}

.tkc-aviso-afiliacion {
	margin: 12px 0 0;
	font-size: 12px;
	line-height: 1.5;
	color: var(--tkc-texto-suave);
}

/* --------------------------------------------------------------------------
   Estado vacío
   -------------------------------------------------------------------------- */

.tkc-comparador--vacio {
	padding: 48px 24px;
	border: 1px dashed var(--tkc-borde);
	border-radius: var(--tkc-radio);
	text-align: center;
	background: var(--tkc-fondo-alt);
}

.tkc-vacio-titulo {
	margin: 0 0 6px;
	font-size: 17px;
	font-weight: 700;
	color: var(--tkc-texto);
}

.tkc-vacio-texto {
	margin: 0 0 18px;
	color: var(--tkc-texto-suave);
}

/*
 * Animación de carga: cuatro columnas que suben y bajan, como las columnas de
 * la tabla comparativa llenándose. Solo CSS, sin imágenes ni peticiones extra.
 */

.tkc-cargando {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 14px;
	padding: 48px 24px;
	text-align: center;
	color: var(--tkc-texto-suave, #6b7280);
}

.tkc-cargando-barras {
	display: flex;
	align-items: flex-end;
	gap: 5px;
	height: 34px;
}

.tkc-cargando-barras span {
	display: block;
	width: 7px;
	height: 100%;
	border-radius: 3px;
	background: var(--tkc-acento, #2e7d32);
	transform: scaleY(0.28);
	transform-origin: bottom;
	animation: tkc-subir 1.1s ease-in-out infinite;
}

.tkc-cargando-barras span:nth-child(2) {
	background: #43a047;
	animation-delay: 0.13s;
}

.tkc-cargando-barras span:nth-child(3) {
	animation-delay: 0.26s;
}

.tkc-cargando-barras span:nth-child(4) {
	background: #66bb6a;
	animation-delay: 0.39s;
}

@keyframes tkc-subir {
	0%,
	100% {
		transform: scaleY(0.28);
	}
	45% {
		transform: scaleY(1);
	}
}

.tkc-cargando-texto {
	font-size: 14px;
}

/* Sin movimiento: las columnas se quedan quietas a distintas alturas. */
@media (prefers-reduced-motion: reduce) {
	.tkc-cargando-barras span {
		animation: none;
	}

	.tkc-cargando-barras span:nth-child(1) {
		transform: scaleY(0.45);
	}

	.tkc-cargando-barras span:nth-child(2) {
		transform: scaleY(0.8);
	}

	.tkc-cargando-barras span:nth-child(3) {
		transform: scaleY(0.6);
	}

	.tkc-cargando-barras span:nth-child(4) {
		transform: scaleY(1);
	}
}

/* --------------------------------------------------------------------------
   Barra flotante
   -------------------------------------------------------------------------- */

.tkc-barra-flotante {
	position: fixed;
	right: 16px;
	bottom: 16px;
	left: 16px;
	z-index: 9990;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	max-width: 450px;
	margin: 0 auto;
	padding: 10px 14px;
	border: 1px solid var(--tkc-borde);
	border-radius: var(--tkc-radio);
	background: var(--tkc-fondo);
	box-shadow: 0 8px 28px rgba(0, 0, 0, 0.14);
	transform: translateY(140%);
	transition: transform 0.25s ease;
}

.tkc-barra-flotante.is-visible {
	transform: translateY(0);
}

.tkc-barra-miniaturas {
	position: relative;
	display: flex;
	width: 44px;
	height: 44px;
	align-items: center;
	gap: 0;
	padding-right: 14px;
	min-width: 0;
}

.tkc-mini {
	position: absolute;
	flex: 0 0 auto;
	border: 2px solid #fff;
	border-radius: 9px;
	background: var(--tkc-fondo-alt, #fafafa);
	box-shadow: 0 2px 6px rgba(0, 0, 0, .14);
	transition: transform .22s cubic-bezier(.34, 1.3, .64, 1), margin-left .22s ease;
	top: 0;
    left: 0px;
    bottom: 0;
}

.tkc-mini img {
	width: 100%;
	height: 100%;
	object-fit: contain;
	border-radius: 7px;
}

/* Globo con el total, sobre la primera miniatura. */
.tkc-mini-globo {
	position: absolute;
	top: -6px;
	right: -6px;
	z-index: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	min-width: 19px;
	height: 19px;
	padding: 0 5px;
	border-radius: 999px;
	background: var(--tkc-acento, #2e7d32);
	color: #fff;
	font-size: 11px;
	font-weight: 700;
	line-height: 1;
	font-variant-numeric: tabular-nums;
	/* Anillo blanco: separa el globo de la imagen que tiene debajo. */
	box-shadow: 0 0 0 2px #fff;
}

.tkc-barra-acciones {
	display: flex;
	align-items: center;
	gap: 8px;
	flex: 0 0 auto;
}

.tkc-barra-miniaturas:hover .tkc-mini {
	transform: rotate(12deg);
}


/* La carta bajo el cursor se levanta */


.tkc-mazo-globo {
	position: absolute;
	top: -7px;
	right: 0;
	z-index: 30;
	display: flex;
	align-items: center;
	justify-content: center;
	min-width: 20px;
	height: 20px;
	padding: 0 6px;
	border-radius: 999px;
	background: var(--tkc-acento, #2e7d32);
	color: #fff;
	font-size: 11px;
	font-weight: 700;
	line-height: 1;
	font-variant-numeric: tabular-nums;
	box-shadow: 0 0 0 2px #fff;
	pointer-events: none;
}


/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 782px) {
	.tkc-comparador {
		--tkc-col: 190px;
	}

	.tkc-col-etiqueta {
		min-width: 116px;
		width: 116px;
		font-size: 13px;
	}

	.tkc-tabla th,
	.tkc-tabla td {
		padding: 12px;
	}

	.tkc-barra-superior {
		align-items: flex-start;
		flex-direction: column;
	}
}

@media (max-width: 480px) {
	.tkc-comparador {
		--tkc-col: 165px;
	}

	.tkc-col-etiqueta {
		min-width: 104px;
		width: 104px;
	}

	.tkc-barra-flotante {
		right: 10px;
		bottom: 10px;
		left: 10px;
	}

	.tkc-mini {
		width: 36px;
		height: 36px;
	}
}

/* Accesibilidad */

.tkc-sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

@media (prefers-reduced-motion: reduce) {
	.tkc-toggle,
	.tkc-accion,
	.tkc-boton,
	.tkc-quitar,
	.tkc-barra-flotante {
		transition: none;
	}
}
