/**
 * Aviso de consentimiento de cookies.
 *
 * Hereda la estética del tema activo: los colores, enlaces, botones y tipografía de
 * encabezados llegan como variables desde los estilos globales del tema
 * (includes/class-theme-style.php) y los botones usan la clase `wp-element-button`.
 * Las reglas con :where() solo actúan si el tema no define esos estilos.
 *
 * @package Cumplimiento_Ley_21719
 */

/* ── Variables (valores de respaldo; el tema las sobrescribe) ── */

.ley21719-cmp,
.ley21719-cmp-reopen,
.ley21719-cmp-embed-placeholder {
	--ley21719-cmp-bg: #fff;
	--ley21719-cmp-text: #1f2a37;
	--ley21719-cmp-accent: #1d4ed8;
	--ley21719-cmp-button-bg: var(--ley21719-cmp-accent);
	--ley21719-cmp-button-text: #fff;
	--ley21719-cmp-radius: .5rem;
	--ley21719-cmp-heading-font: inherit;
	--ley21719-cmp-line: rgba(0, 0, 0, .12);
	--ley21719-cmp-tint: rgba(0, 0, 0, .04);
}

@supports (color: color-mix(in srgb, red, blue)) {

	.ley21719-cmp,
	.ley21719-cmp-reopen,
	.ley21719-cmp-embed-placeholder {
		--ley21719-cmp-line: color-mix(in srgb, var(--ley21719-cmp-text) 15%, transparent);
		--ley21719-cmp-tint: color-mix(in srgb, var(--ley21719-cmp-text) 5%, transparent);
	}
}

/* ── Franja al 100 % del ancho ──────────────────────────────── */

.ley21719-cmp {
	position: fixed;
	right: 0;
	bottom: 0;
	left: 0;
	z-index: 99999;
	box-sizing: border-box;
	width: 100%;
	background: var(--ley21719-cmp-bg);
	color: var(--ley21719-cmp-text);
	border-top: 1px solid var(--ley21719-cmp-line);
	box-shadow: 0 -8px 24px rgba(0, 0, 0, .12);
	font-family: inherit;
	font-size: var(--wp--preset--font-size--s, .9rem);
	line-height: 1.5;
}

.ley21719-cmp[hidden] {
	display: none !important;
}

/* ── Dos columnas: texto y enlaces | opciones ───────────────── */

.ley21719-cmp__inner {
	box-sizing: border-box;
	display: grid;
	grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
	gap: 1.25rem 3rem;
	align-items: start;
	width: 100%;
	max-width: var(--wp--style--global--content-size, 1280px);
	max-height: 85vh;
	margin: 0 auto;
	padding: 1.5rem var(--wp--custom--spacing--container-padding, 1.5rem);
	overflow-y: auto;
}

.ley21719-cmp__inner p {
	margin: 0 0 .65rem;
}

.ley21719-cmp__text,
.ley21719-cmp__options {
	min-width: 0;
}

.ley21719-cmp__links {
	display: flex;
	flex-direction: column;
	gap: .35rem;
	margin: .85rem 0 0;
	padding: 0;
	list-style: none;
}

:where(.ley21719-cmp a) {
	color: var(--ley21719-cmp-accent);
	text-decoration: underline;
	text-underline-offset: 2px;
}

/* ── Pestañas ───────────────────────────────────────────────── */

.ley21719-cmp__tabs {
	display: flex;
	gap: 0;
	margin: 0 0 .85rem;
	border-bottom: 2px solid var(--ley21719-cmp-line);
}

.ley21719-cmp__tab {
	flex: 1;
	margin-bottom: -2px;
	padding: .6rem .75rem;
	border: 0;
	border-bottom: 2px solid transparent;
	background: transparent;
	color: inherit;
	font-family: var(--ley21719-cmp-heading-font);
	font-size: inherit;
	font-weight: 600;
	cursor: pointer;
	opacity: .6;
	transition: opacity .2s, color .2s, border-color .2s;
}

.ley21719-cmp__tab:hover {
	opacity: .85;
}

.ley21719-cmp__tab.is-active {
	color: var(--ley21719-cmp-accent);
	border-bottom-color: var(--ley21719-cmp-accent);
	opacity: 1;
}

.ley21719-cmp__tabpanel[hidden] {
	display: none !important;
}

/* ── Categorías ─────────────────────────────────────────────── */

.ley21719-cmp__details {
	margin: 0 0 .75rem;
}

.ley21719-cmp__details fieldset {
	display: flex;
	flex-direction: column;
	gap: .5rem;
	margin: 0;
	padding: 0;
	border: 0;
}

.ley21719-cmp__category {
	overflow: hidden;
	background: var(--ley21719-cmp-tint);
	border: 1px solid var(--ley21719-cmp-line);
	border-radius: var(--ley21719-cmp-radius);
}

.ley21719-cmp__category-header {
	display: flex;
	align-items: center;
	gap: .5rem;
	padding: .65rem .75rem;
}

.ley21719-cmp__expand {
	display: flex;
	flex: 1;
	align-items: flex-start;
	gap: .55rem;
	padding: 0;
	border: 0;
	background: transparent;
	color: inherit;
	font: inherit;
	text-align: left;
	cursor: pointer;
}

.ley21719-cmp__chevron {
	flex-shrink: 0;
	margin-top: .25rem;
	transition: transform .2s;
}

.ley21719-cmp__expand[aria-expanded="true"] .ley21719-cmp__chevron {
	transform: rotate(180deg);
}

.ley21719-cmp__category-title {
	display: flex;
	flex-direction: column;
	gap: .15rem;
}

.ley21719-cmp__category-title strong {
	font-family: var(--ley21719-cmp-heading-font);
}

.ley21719-cmp__category-title small {
	font-size: .9em;
	line-height: 1.35;
	opacity: .75;
}

.ley21719-cmp__category-body {
	padding: 0 .9rem .85rem 2.1rem;
	border-top: 1px solid var(--ley21719-cmp-line);
}

.ley21719-cmp__category-body[hidden] {
	display: none !important;
}

.ley21719-cmp__service-list,
.ley21719-cmp__cookie-list,
.ley21719-cmp__history-list {
	margin: 0;
	padding: 0;
	list-style: none;
}

.ley21719-cmp__service {
	padding: .55rem 0;
	border-bottom: 1px dashed var(--ley21719-cmp-line);
}

.ley21719-cmp__service:last-child {
	padding-bottom: 0;
	border-bottom: 0;
}

.ley21719-cmp__service-name {
	display: block;
	margin-bottom: .3rem;
}

.ley21719-cmp__cookie-list li {
	display: grid;
	grid-template-columns: minmax(7rem, auto) 1fr auto;
	gap: .4rem .65rem;
	align-items: baseline;
	padding: .2rem 0;
	font-size: .9em;
}

.ley21719-cmp__cookie-list code {
	padding: .1rem .35rem;
	background: var(--ley21719-cmp-tint);
	border-radius: 3px;
	font-size: .95em;
}

.ley21719-cmp__cookie-list em {
	font-style: normal;
	white-space: nowrap;
	opacity: .65;
}

.ley21719-cmp__service-empty,
.ley21719-cmp__service-note {
	margin: .55rem 0 0 !important;
	font-size: .9em;
	opacity: .7;
}

/* ── Interruptor ────────────────────────────────────────────── */

.ley21719-cmp__switch {
	position: relative;
	display: inline-flex;
	flex-shrink: 0;
	align-items: center;
	cursor: pointer;
}

.ley21719-cmp__switch input {
	position: absolute;
	width: 0;
	height: 0;
	opacity: 0;
}

.ley21719-cmp__switch-track {
	position: relative;
	width: 42px;
	height: 24px;
	background: var(--ley21719-cmp-line);
	border-radius: 999px;
	transition: background .2s;
}

.ley21719-cmp__switch-track::after {
	content: '';
	position: absolute;
	top: 3px;
	left: 3px;
	width: 18px;
	height: 18px;
	background: var(--ley21719-cmp-bg);
	border-radius: 50%;
	box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
	transition: transform .2s;
}

.ley21719-cmp__switch input:checked + .ley21719-cmp__switch-track {
	background: var(--ley21719-cmp-accent);
}

.ley21719-cmp__switch input:checked + .ley21719-cmp__switch-track::after {
	transform: translateX(18px);
}

.ley21719-cmp__switch input:disabled + .ley21719-cmp__switch-track {
	cursor: not-allowed;
	opacity: .55;
}

/* ── Historial ──────────────────────────────────────────────── */

.ley21719-cmp__history {
	padding: .15rem 0 .25rem;
}

.ley21719-cmp__history-empty {
	margin: .35rem 0 0 !important;
	opacity: .7;
}

.ley21719-cmp__history-list[hidden] {
	display: none !important;
}

.ley21719-cmp__history-item {
	display: grid;
	gap: .15rem;
	padding: .65rem 0;
	border-bottom: 1px dashed var(--ley21719-cmp-line);
	font-size: .9em;
}

.ley21719-cmp__history-item:last-child {
	border-bottom: 0;
}

.ley21719-cmp__history-item time,
.ley21719-cmp__history-item em {
	font-style: normal;
	opacity: .65;
}

/* ── Botones (estilo del tema vía wp-element-button) ────────── */

.ley21719-cmp__actions {
	display: flex;
	flex-wrap: wrap;
	gap: .5rem;
	margin-top: 1rem;
}

:where(.ley21719-cmp__btn, .ley21719-cmp-embed-placeholder__btn) {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: .55rem 1.15rem;
	background: var(--ley21719-cmp-button-bg);
	color: var(--ley21719-cmp-button-text);
	border: 0;
	border-radius: var(--ley21719-cmp-radius);
	font: inherit;
	font-weight: 600;
	text-decoration: none;
	cursor: pointer;
}

.ley21719-cmp .ley21719-cmp__btn--reject,
.ley21719-cmp .ley21719-cmp__btn--save {
	background: transparent;
	color: var(--ley21719-cmp-text);
	box-shadow: inset 0 0 0 1px currentColor;
}

.ley21719-cmp .ley21719-cmp__btn--reject:hover,
.ley21719-cmp .ley21719-cmp__btn--save:hover {
	background: var(--ley21719-cmp-tint);
}

.ley21719-cmp :focus-visible,
.ley21719-cmp-reopen:focus-visible,
.ley21719-cmp-embed-placeholder :focus-visible,
.ley21719-cmp__switch input:focus-visible + .ley21719-cmp__switch-track {
	outline: 2px solid var(--ley21719-cmp-accent);
	outline-offset: 2px;
}

/* ── Botón flotante para reabrir ────────────────────────────── */

.ley21719-cmp-reopen {
	position: fixed;
	bottom: 1rem;
	left: 1rem;
	z-index: 99998;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 42px;
	height: 42px;
	background: var(--ley21719-cmp-text);
	color: var(--ley21719-cmp-bg);
	border: none;
	border-radius: 50%;
	box-shadow: 0 2px 10px rgba(0, 0, 0, .3);
	cursor: pointer;
	transition: transform .2s, background .2s;
}

.ley21719-cmp-reopen:hover {
	background: var(--ley21719-cmp-accent);
	transform: scale(1.1);
}

.ley21719-cmp-reopen[hidden] {
	display: none !important;
}

/* ── Solo lectores de pantalla ──────────────────────────────── */

.screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(1px, 1px, 1px, 1px);
	word-wrap: normal;
}

/* ── Aviso en lugar de un video bloqueado ───────────────────── */

.ley21719-cmp-embed-placeholder {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: .75em;
	box-sizing: border-box;
	width: 100%;
	height: 100%;
	min-height: 12em;
	padding: 1em;
	background: var(--ley21719-cmp-text);
	color: var(--ley21719-cmp-bg);
	border-radius: var(--ley21719-cmp-radius);
	font-family: inherit;
	text-align: center;
}

.ley21719-cmp-embed-placeholder p {
	margin: 0;
}

/* ── Pantallas angostas: una columna ────────────────────────── */

@media (max-width: 900px) {

	.ley21719-cmp__inner {
		grid-template-columns: minmax(0, 1fr);
		gap: 1rem;
		max-height: 80vh;
		padding: 1.15rem 1rem;
	}

	.ley21719-cmp__links {
		flex-direction: row;
		flex-wrap: wrap;
		gap: .35rem 1rem;
	}
}

@media (max-width: 560px) {

	.ley21719-cmp__cookie-list li {
		grid-template-columns: 1fr;
		gap: .1rem;
	}

	.ley21719-cmp__actions {
		flex-direction: column;
	}

	.ley21719-cmp__btn {
		width: 100%;
	}
}
