/* BOOX Consent — variables en :root (--boox-*) inyectadas desde PHP */

.boox-consent {
	--boox-shadow: 0 4px 24px rgba(0, 0, 0, 0.12);
	--boox-border: 1px solid rgba(0, 0, 0, 0.08);
	--boox-font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	--boox-z: 999990;
	font-family: var(--boox-font);
	font-size: 14px;
	line-height: 1.5;
	color: var(--boox-text);
	box-sizing: border-box;
}

.boox-consent *,
.boox-consent *::before,
.boox-consent *::after {
	box-sizing: border-box;
}

.boox-consent[hidden] {
	display: none !important;
}

.boox-consent.boox-active {
	display: block;
	position: relative;
	z-index: var(--boox-z);
}

.boox-consent .boox-banner:not([hidden]),
.boox-consent .boox-panel:not([hidden]) {
	display: block;
}

/* Tema: solo sombras/bordes; los colores vienen del admin (--boox-* en #boox-consent) */
.boox-consent.boox-theme-dark {
	--boox-shadow: 0 4px 24px rgba(0, 0, 0, 0.45);
	--boox-border: 1px solid rgba(255, 255, 255, 0.14);
}

@media (prefers-color-scheme: dark) {
	.boox-consent.boox-theme-auto:not([style*="--boox-bg"]) {
		--boox-shadow: 0 4px 24px rgba(0, 0, 0, 0.45);
	}
}

/* Overlay modal */
.boox-consent .boox-overlay {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.45);
	z-index: calc(var(--boox-z) - 1);
}

.boox-consent .boox-overlay[hidden] {
	display: none;
}

/* Banner */
.boox-consent .boox-banner,
.boox-consent .boox-panel {
	position: fixed;
	z-index: var(--boox-z);
	background: var(--boox-bg);
	color: var(--boox-text);
	border: var(--boox-border);
	box-shadow: var(--boox-shadow);
	border-radius: var(--boox-radius);
	max-width: 560px;
	width: calc(100% - 32px);
	padding: 20px 24px;
}

.boox-consent .boox-banner[hidden],
.boox-consent .boox-panel[hidden] {
	display: none;
}

.boox-consent.boox-fmt-box_bottom .boox-banner {
	bottom: 16px;
	left: 50%;
	transform: translateX(-50%);
}

.boox-consent.boox-fmt-box_top .boox-banner {
	top: 16px;
	left: 50%;
	transform: translateX(-50%);
}

.boox-consent.boox-fmt-corner_left .boox-banner {
	bottom: 16px;
	left: 16px;
	transform: none;
	max-width: 400px;
}

.boox-consent.boox-fmt-corner_right .boox-banner {
	bottom: 16px;
	right: 16px;
	left: auto;
	transform: none;
	max-width: 400px;
}

.boox-consent.boox-fmt-bar_bottom .boox-banner,
.boox-consent.boox-fmt-bar_top .boox-banner {
	left: 0;
	right: 0;
	width: 100%;
	max-width: none;
	transform: none;
	border-radius: 0;
	border-left: none;
	border-right: none;
	padding: 16px 24px;
}

.boox-consent.boox-fmt-bar_bottom .boox-banner {
	bottom: 0;
	border-bottom: none;
}

.boox-consent.boox-fmt-bar_top .boox-banner {
	top: 0;
	border-top: none;
}

.boox-consent.boox-fmt-bar_bottom .boox-banner__inner,
.boox-consent.boox-fmt-bar_top .boox-banner__inner {
	max-width: 1140px;
	margin: 0 auto;
}

@media (min-width: 768px) {
	.boox-consent.boox-fmt-bar_bottom .boox-banner__inner,
	.boox-consent.boox-fmt-bar_top .boox-banner__inner {
		display: grid;
		grid-template-columns: 1fr auto;
		gap: 16px 24px;
		align-items: center;
	}

	.boox-consent.boox-fmt-bar_bottom .boox-actions--banner,
	.boox-consent.boox-fmt-bar_top .boox-actions--banner {
		margin-bottom: 0;
		min-width: 320px;
	}
}

.boox-consent.boox-fmt-modal .boox-banner {
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	max-width: 480px;
}

.boox-consent .boox-panel {
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	max-width: 520px;
	max-height: calc(100vh - 32px);
	overflow-y: auto;
}

.boox-logo {
	display: block;
	max-height: 40px;
	width: auto;
	margin-bottom: 12px;
}

.boox-title {
	margin: 0 0 8px;
	font-size: 1.15rem;
	font-weight: 600;
	line-height: 1.3;
	color: var(--boox-text);
}

.boox-desc {
	margin: 0 0 16px;
	font-size: 0.9rem;
	opacity: 0.9;
}

.boox-desc a {
	color: var(--boox-primary);
}

/* Tres acciones con igual prominencia (AEPD) */
.boox-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-bottom: 12px;
}

.boox-btn {
	flex: 1 1 0;
	min-width: 110px;
	padding: 10px 14px;
	font-family: inherit;
	font-size: 0.875rem;
	font-weight: 600;
	line-height: 1.2;
	text-align: center;
	border-radius: var(--boox-radius);
	border: 2px solid transparent;
	cursor: pointer;
	transition: opacity 0.15s ease;
}

.boox-btn:hover,
.boox-btn:focus-visible {
	opacity: 0.88;
	outline: 2px solid var(--boox-primary);
	outline-offset: 2px;
}

.boox-btn--accept {
	background: var(--boox-accept-bg);
	color: var(--boox-accept-text);
	border-color: var(--boox-accept-bg);
}

.boox-btn--reject {
	background: var(--boox-reject-bg);
	color: var(--boox-reject-text);
	border-color: var(--boox-reject-text);
}

.boox-btn--configure {
	background: var(--boox-configure-bg);
	color: var(--boox-configure-text);
	border-color: var(--boox-configure-text);
}

.boox-btn--primary {
	background: var(--boox-primary);
	color: #fff;
	border-color: var(--boox-primary);
}

/* Crédito agencia — discreto, bajo los botones */
.boox-credit {
	margin: 8px 0 0;
	padding-top: 8px;
	border-top: 1px solid rgba(128, 128, 128, 0.2);
	font-size: 0.7rem;
	opacity: 0.65;
	color: var(--boox-text);
	text-align: center;
}

.boox-credit a {
	color: inherit;
	text-decoration: underline;
}

/* Categorías del panel */
.boox-categories {
	margin-bottom: 16px;
}

.boox-category {
	padding: 12px 0;
	border-bottom: 1px solid rgba(128, 128, 128, 0.15);
}

.boox-category:last-child {
	border-bottom: none;
}

.boox-category__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
}

.boox-category__label {
	font-weight: 600;
	font-size: 0.9rem;
}

.boox-category__badge {
	font-size: 0.75rem;
	opacity: 0.7;
	padding: 2px 8px;
	border-radius: 999px;
	background: rgba(128, 128, 128, 0.15);
}

.boox-category__desc {
	margin: 4px 0 0;
	font-size: 0.8rem;
	opacity: 0.8;
}

/* Toggle */
.boox-toggle {
	position: relative;
	display: inline-flex;
	cursor: pointer;
}

.boox-toggle__input {
	position: absolute;
	opacity: 0;
	width: 0;
	height: 0;
}

.boox-toggle__track {
	display: block;
	width: 44px;
	height: 24px;
	background: var(--boox-toggle-off);
	border-radius: 999px;
	transition: background 0.2s ease;
}

.boox-toggle__track::after {
	content: "";
	position: absolute;
	top: 3px;
	left: 3px;
	width: 18px;
	height: 18px;
	background: #fff;
	border-radius: 50%;
	transition: transform 0.2s ease;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.boox-toggle__input:checked + .boox-toggle__track {
	background: var(--boox-toggle-on);
}

.boox-toggle__input:checked + .boox-toggle__track::after {
	transform: translateX(20px);
}

.boox-toggle__input:focus-visible + .boox-toggle__track {
	outline: 2px solid var(--boox-primary);
	outline-offset: 2px;
}

/* Retirar consentimiento */
.boox-withdraw {
	display: block;
	width: 100%;
	margin-top: 4px;
	padding: 8px;
	background: none;
	border: none;
	font-family: inherit;
	font-size: 0.8rem;
	color: var(--boox-text);
	opacity: 0.75;
	text-decoration: underline;
	cursor: pointer;
	text-align: center;
}

.boox-withdraw:hover,
.boox-withdraw:focus-visible {
	opacity: 1;
	outline: 2px solid var(--boox-primary);
	outline-offset: 2px;
}

/* Galleta flotante minimizada — solo icono redondo */
.boox-consent .boox-float {
	position: fixed;
	bottom: 14px;
	left: 14px;
	z-index: calc(var(--boox-z) - 2);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: auto;
	height: auto;
	padding: 0;
	margin: 0;
	background: transparent;
	border: none;
	border-radius: 50%;
	box-shadow: none;
	cursor: pointer;
	opacity: 0.72;
	transition: opacity 0.2s ease, transform 0.2s ease;
}

.boox-consent .boox-float[hidden] {
	display: none;
}

.boox-consent .boox-float:hover,
.boox-consent .boox-float:focus-visible {
	opacity: 1;
	transform: scale(1.06);
	outline: none;
}

.boox-consent .boox-float:focus-visible .boox-float__cookie {
	filter: drop-shadow(0 0 0 2px var(--boox-primary));
}

.boox-float__cookie {
	display: block;
	width: 44px;
	height: 44px;
	border-radius: 50%;
}

.boox-float__cookie-body {
	fill: var(--boox-primary);
}

.boox-float__chip {
	fill: var(--boox-accept-text);
	opacity: 0.85;
}

.screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* Previsualización en admin (miniaturas de formatos) */
.boox-consent.boox-is-preview {
	position: relative !important;
	display: block !important;
	width: 100%;
	height: 100%;
	min-height: 0;
	font-size: 9px;
	line-height: 1.35;
	z-index: auto;
	pointer-events: none;
}

.boox-consent.boox-is-preview .boox-banner,
.boox-consent.boox-is-preview .boox-panel {
	position: absolute !important;
	width: calc(100% - 16px);
	max-width: 92%;
	padding: 8px 10px;
}

.boox-consent.boox-is-preview.boox-fmt-bar_bottom .boox-banner,
.boox-consent.boox-is-preview.boox-fmt-bar_top .boox-banner {
	width: 100%;
	max-width: none;
	padding: 6px 8px;
}

.boox-consent.boox-is-preview.boox-fmt-corner_left .boox-banner,
.boox-consent.boox-is-preview.boox-fmt-corner_right .boox-banner {
	max-width: 78%;
}

.boox-consent.boox-is-preview .boox-overlay {
	position: absolute;
	inset: 0;
}

.boox-consent.boox-is-preview .boox-title {
	font-size: 10px;
	margin: 0 0 4px;
}

.boox-consent.boox-is-preview .boox-desc {
	margin: 0 0 6px;
	font-size: 8px;
}

.boox-consent.boox-is-preview .boox-actions--banner {
	display: flex;
	flex-wrap: wrap;
	gap: 3px;
	margin: 0;
}

.boox-consent.boox-is-preview .boox-btn {
	display: inline-block;
	font-size: 7px;
	padding: 3px 5px;
	min-height: 0;
	line-height: 1.2;
}

.boox-consent.boox-is-preview .boox-banner__inner {
	max-width: none;
}

/* Placeholder iframes bloqueados */
.boox-iframe-ph {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 180px;
	padding: 24px;
	background: rgba(128, 128, 128, 0.08);
	border: 1px dashed rgba(128, 128, 128, 0.3);
	border-radius: var(--boox-radius);
	color: var(--boox-text);
	font-size: 0.85rem;
	text-align: center;
}

/* Visibilidad activa del root */
.boox-consent.boox-active[aria-hidden="false"] {
	display: block;
}

@media (prefers-reduced-motion: reduce) {
	.boox-consent .boox-float,
	.boox-consent .boox-btn,
	.boox-consent .boox-toggle__track,
	.boox-consent .boox-toggle__track::after {
		transition: none;
	}
}

@media (max-width: 480px) {
	.boox-actions {
		flex-direction: column;
	}

	.boox-btn {
		flex: none;
		width: 100%;
	}
}
