/**
 * wptms — Aviso de cookies. Toma colores y radios del tema (theme.json) con valores de
 * reserva. Los tres botones tienen el mismo aspecto: aceptar y rechazar deben ser
 * igual de visibles (guía de la AEPD).
 */

.wptms-cc,
.wptms-cc-modal__box {
	--wptms-cc-bg: var(--wp--preset--color--base, #fff);
	--wptms-cc-text: var(--wp--preset--color--contrast, #1c2030);
	--wptms-cc-muted: var(--wp--preset--color--text-muted, #5b6170);
	--wptms-cc-border: var(--wp--preset--color--border, #dfe3eb);
	--wptms-cc-btn: var(--wp--preset--color--contrast, #1c2030);
	--wptms-cc-btn-text: var(--wp--preset--color--base, #fff);
	--wptms-cc-radius: var(--wp--custom--radius--medium, 10px);
	box-sizing: border-box;
	color: var(--wptms-cc-text);
	font-size: 15px;
	line-height: 1.5;
}

.wptms-cc *,
.wptms-cc-modal * {
	box-sizing: border-box;
}

.wptms-cc[hidden],
.wptms-cc-modal[hidden],
.wptms-cc-reopen[hidden] {
	display: none !important;
}

.wptms-cc {
	position: fixed;
	z-index: 100000;
	display: flex;
	gap: 16px;
	padding: 20px;
	border: 1px solid var(--wptms-cc-border);
	background: var(--wptms-cc-bg);
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.18);
}

.wptms-cc--box {
	left: 20px;
	bottom: 20px;
	flex-direction: column;
	width: min(420px, calc(100vw - 40px));
	border-radius: calc(var(--wptms-cc-radius) * 1.4);
}

.wptms-cc--bar {
	left: 0;
	right: 0;
	bottom: 0;
	align-items: center;
	justify-content: center;
	border-width: 1px 0 0;
}

.wptms-cc--bar .wptms-cc__body {
	max-width: 760px;
}

.wptms-cc__title {
	margin: 0 0 4px;
	font-size: 1.05em;
	font-weight: 700;
}

.wptms-cc__text {
	margin: 0;
	color: var(--wptms-cc-muted);
	font-size: 0.93em;
}

.wptms-cc__text a {
	color: inherit;
	text-decoration: underline;
}

.wptms-cc__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.wptms-cc__btn {
	flex: 1 1 auto;
	min-height: 42px;
	padding: 8px 16px;
	border: 1px solid var(--wptms-cc-btn);
	border-radius: var(--wptms-cc-radius);
	background: var(--wptms-cc-btn);
	color: var(--wptms-cc-btn-text);
	font: inherit;
	font-size: 0.93em;
	font-weight: 600;
	cursor: pointer;
}

.wptms-cc__btn:hover {
	opacity: 0.88;
}

.wptms-cc__btn:focus-visible,
.wptms-cc-modal__close:focus-visible,
.wptms-cc-reopen:focus-visible,
.wptms-cc-switch:focus-visible {
	outline: 2px solid var(--wp--preset--color--primary, #1d4ed8);
	outline-offset: 2px;
}

/* Ventana de configuración */

.wptms-cc-modal {
	position: fixed;
	inset: 0;
	z-index: 100001;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
	background: rgba(10, 12, 20, 0.55);
}

.wptms-cc-modal__box {
	width: min(560px, 100%);
	max-height: calc(100vh - 32px);
	overflow: auto;
	padding: 24px;
	border-radius: calc(var(--wptms-cc-radius) * 1.4);
	background: var(--wptms-cc-bg);
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
	outline: none;
}

.wptms-cc-modal__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 6px;
}

.wptms-cc-modal__close {
	width: 36px;
	height: 36px;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: inherit;
	font-size: 24px;
	line-height: 1;
	cursor: pointer;
}

.wptms-cc-cats {
	margin: 18px 0;
	padding: 0;
	list-style: none;
}

.wptms-cc-cat {
	padding: 14px 0;
	border-top: 1px solid var(--wptms-cc-border);
}

.wptms-cc-cat p {
	margin: 4px 0 0;
	color: var(--wptms-cc-muted);
	font-size: 0.88em;
}

.wptms-cc-cat__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	font-weight: 600;
	cursor: pointer;
}

.wptms-cc-cat__always {
	color: var(--wptms-cc-muted);
	font-size: 0.85em;
	font-weight: 500;
}

/* Interruptor accesible sobre un checkbox nativo */
.wptms-cc-switch {
	appearance: none;
	position: relative;
	flex-shrink: 0;
	width: 44px;
	height: 26px;
	margin: 0;
	border-radius: 999px;
	background: var(--wptms-cc-border);
	cursor: pointer;
	transition: background 0.15s ease;
}

.wptms-cc-switch::after {
	content: "";
	position: absolute;
	top: 3px;
	left: 3px;
	width: 20px;
	height: 20px;
	border-radius: 50%;
	background: #fff;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
	transition: transform 0.15s ease;
}

.wptms-cc-switch:checked {
	background: var(--wp--preset--color--primary, #1d4ed8);
}

.wptms-cc-switch:checked::after {
	transform: translateX(18px);
}

html.wptms-cc-open {
	overflow: hidden;
}

/* Botón para volver a abrir la configuración */

.wptms-cc-reopen {
	position: fixed;
	left: 16px;
	bottom: 16px;
	z-index: 99980;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	padding: 0;
	border: 1px solid var(--wp--preset--color--border, #dfe3eb);
	border-radius: 50%;
	background: var(--wp--preset--color--base, #fff);
	color: var(--wp--preset--color--contrast, #1c2030);
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.14);
	opacity: 0.85;
	cursor: pointer;
}

.wptms-cc-reopen:hover {
	opacity: 1;
}

@media (max-width: 600px) {
	.wptms-cc--box,
	.wptms-cc--bar {
		left: 0;
		right: 0;
		bottom: 0;
		width: 100%;
		border-width: 1px 0 0;
		border-radius: 16px 16px 0 0;
	}

	.wptms-cc--bar {
		flex-direction: column;
		align-items: stretch;
	}

	.wptms-cc__btn {
		flex-basis: 100%;
	}
}

@media (prefers-reduced-motion: reduce) {
	.wptms-cc-switch,
	.wptms-cc-switch::after {
		transition: none;
	}
}

@media print {
	.wptms-cc,
	.wptms-cc-modal,
	.wptms-cc-reopen {
		display: none !important;
	}
}

.wptms-cookie-policy table code {
	white-space: normal;
	word-break: break-word;
}
