/*
 * WIST Cookies. Mismo lenguaje que la tarjeta de caritas de Opiniones:
 * hoja abajo en el teléfono; desde 768 px, tarjeta de 380 px abajo a la
 * derecha alineada con el borde del contenedor (1140 px), sin velo.
 * «Aceptar» y «Rechazar» con el mismo peso visual (LOPDP: decisión libre).
 */

.wist-ck[hidden],
.wist-ck [hidden] {
	display: none !important;
}

.wist-ck {
	position: fixed;
	right: 0;
	bottom: 0;
	left: 0;
	z-index: 10010; /* por encima de los popups de Bricks */
	display: flex;
	flex-direction: column;
	gap: var(--wist-space-150);
	box-sizing: border-box;
	max-height: 85vh;
	overflow-y: auto;
	padding: 20px 20px calc(20px + env(safe-area-inset-bottom, 0px));
	border: 1px solid var(--wist-border-decorative);
	border-radius: 16px 16px 0 0;
	background: var(--wist-surface);
	color: var(--wist-ink-primary);
	box-shadow: 0 -8px 32px rgba(10, 10, 30, 0.16);
	font-family: Inter, system-ui, sans-serif;
	animation: wist-ck-subir 0.32s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.wist-ck:focus {
	outline: none;
}

.wist-ck:focus-visible {
	outline: 2px solid var(--wist-blue-base);
	outline-offset: -2px;
}

.wist-ck__titulo {
	margin: 0;
	color: var(--wist-ink-primary);
	font-family: Inter, system-ui, sans-serif;
	font-size: 1.0625rem;
	font-weight: 600;
	line-height: 1.4;
}

.wist-ck__texto,
.wist-ck__categoria-texto {
	margin: 0;
	color: var(--wist-ink-secondary);
	font-size: 0.875rem;
	line-height: 1.5;
}

.wist-ck__texto a {
	color: var(--wist-ink-primary);
	text-decoration: underline;
	text-underline-offset: 2px;
}

.wist-ck__texto a:focus-visible,
.wist-ck__configurar:focus-visible {
	outline: 2px solid var(--wist-blue-base);
	outline-offset: 2px;
	border-radius: 4px;
}

/* ---------- Ajustes por categoría ---------- */

.wist-ck__ajustes {
	display: flex;
	flex-direction: column;
	gap: var(--wist-space-100);
}

.wist-ck__categoria {
	display: flex;
	flex-direction: column;
	gap: 4px;
	padding: 12px 14px;
	border: 1px solid var(--wist-border-decorative);
	border-radius: var(--wist-radius-md);
}

.wist-ck__categoria-cabecera {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--wist-space-100);
	min-height: 32px;
}

label.wist-ck__categoria-cabecera {
	cursor: pointer;
}

.wist-ck__categoria-nombre {
	color: var(--wist-ink-primary);
	font-size: 0.9375rem;
	font-weight: 600;
}

.wist-ck__siempre {
	color: var(--wist-ink-secondary);
	font-size: 0.8125rem;
}

/* Interruptor tipo iOS sobre el checkbox nativo (role="switch"). El selector
   largo gana al estilo global de casillas del tema (body.bricks-is-frontend …). */
.wist-ck input.wist-ck__interruptor[type="checkbox"] {
	display: block;
	padding: 0;
	position: relative;
	flex: none;
	width: 44px;
	height: 26px;
	margin: 0;
	border: 1px solid var(--wist-border-interactive);
	border-radius: 999px;
	background: var(--wist-border-decorative);
	cursor: pointer;
	appearance: none;
	-webkit-appearance: none;
	transition: background-color 0.15s ease, border-color 0.15s ease;
}

.wist-ck input.wist-ck__interruptor[type="checkbox"]::before {
	content: "";
	position: absolute;
	top: 2px;
	left: 2px;
	width: 20px;
	height: 20px;
	border-radius: 50%;
	background: #fff;
	box-shadow: 0 1px 3px rgba(10, 10, 30, 0.3);
	transition: transform 0.15s ease;
}

.wist-ck input.wist-ck__interruptor[type="checkbox"]:checked {
	border-color: var(--wist-blue-base);
	background: var(--wist-blue-base);
}

.wist-ck input.wist-ck__interruptor[type="checkbox"]:checked::before {
	transform: translateX(18px);
}

.wist-ck input.wist-ck__interruptor[type="checkbox"]:focus-visible {
	outline: 2px solid var(--wist-blue-base);
	outline-offset: 2px;
}

/* ---------- Botones ---------- */

.wist-ck__acciones {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: var(--wist-space-100);
}

.wist-ck__boton {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 48px;
	padding: 12px 16px;
	border: 1px solid var(--wist-border-interactive);
	border-radius: var(--wist-radius-lg);
	background: var(--wist-surface);
	color: var(--wist-ink-primary);
	font-family: Inter, system-ui, sans-serif;
	font-size: 1rem;
	font-weight: 500;
	line-height: 1.2;
	text-align: center;
	cursor: pointer;
	transition: border-color 0.15s ease, color 0.15s ease, background-color 0.15s ease;
}

.wist-ck__boton:hover {
	border-color: var(--wist-blue-base);
	color: var(--wist-blue-base);
}

.wist-ck__boton:focus-visible {
	outline: 2px solid var(--wist-blue-base);
	outline-offset: 2px;
}

/* «Guardar preferencias» ocupa la fila completa bajo Rechazar / Aceptar. */
.wist-ck__boton--principal {
	grid-column: 1 / -1;
	border-color: var(--wist-blue-base);
	background: var(--wist-blue-base);
	color: var(--wist-blue-on);
}

.wist-ck__boton--principal:hover {
	background: var(--wist-blue-base-hover);
	color: var(--wist-blue-on);
}

.wist-ck__configurar {
	align-self: center;
	min-height: 32px;
	padding: 4px 8px;
	border: 0;
	background: transparent;
	color: var(--wist-ink-secondary);
	font-family: Inter, system-ui, sans-serif;
	font-size: 0.875rem;
	text-decoration: underline;
	text-underline-offset: 2px;
	cursor: pointer;
}

.wist-ck__configurar:hover {
	color: var(--wist-ink-primary);
}

@keyframes wist-ck-subir {
	from {
		transform: translateY(100%);
	}
	to {
		transform: translateY(0);
	}
}

/* ---------- Escritorio: tarjeta flotante ---------- */
@media (min-width: 768px) {

	.wist-ck {
		right: max(48px, calc((100% - 1140px) / 2));
		bottom: 24px;
		left: auto;
		width: 380px;
		max-width: calc(100% - 48px);
		max-height: calc(100vh - 48px);
		padding: 20px;
		border-radius: 16px;
		box-shadow: 0 12px 40px rgba(10, 10, 30, 0.22);
		animation-name: wist-ck-aparecer;
		animation-duration: 0.28s;
	}
}

@media (min-width: 768px) and (max-width: 991px) {

	.wist-ck {
		right: 32px;
	}
}

@keyframes wist-ck-aparecer {
	from {
		opacity: 0;
		transform: translateY(16px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

@media (prefers-reduced-motion: reduce) {

	.wist-ck {
		animation: none;
	}

	.wist-ck input.wist-ck__interruptor[type="checkbox"],
	.wist-ck input.wist-ck__interruptor[type="checkbox"]::before,
	.wist-ck__boton {
		transition: none;
	}
}

/* ---------- Tabla de cookies en la Política de Privacidad ---------- */

.wist-ck-tabla-envoltura {
	overflow-x: auto;
	margin: 1em 0;
}

.wist-ck-tabla {
	width: 100%;
	min-width: 640px;
	border-collapse: collapse;
	font-size: inherit;
}

.wist-ck-tabla th,
.wist-ck-tabla td {
	padding: 8px 10px;
	border: 1px solid var(--wist-border-decorative);
	text-align: left;
	vertical-align: top;
}

.wist-ck-tabla th {
	color: var(--wist-ink-primary);
	font-weight: 600;
}

.wist-ck-tabla code {
	font-size: 0.95em;
	white-space: nowrap;
}
