/* Blast Consent — banner, panel de preferencias y placeholders de embeds. */

#blast-consent,
.bc-embed {
	--bc-accent: #2563eb;
	--bc-on-accent: #ffffff;
	--bc-bg: #ffffff;
	--bc-fg: #1a1a1a;
	--bc-muted: #5b5b66;
	--bc-border: rgba(0, 0, 0, .12);
	--bc-surface: #f5f5f7;
	--bc-shadow: 0 10px 40px rgba(0, 0, 0, .18);
	--bc-radius: 14px;
	--bc-font: inherit;
}

#blast-consent.bc--theme-dark,
.bc-embed.bc--theme-dark {
	--bc-bg: #17171c;
	--bc-fg: #f2f2f5;
	--bc-muted: #a6a6b3;
	--bc-border: rgba(255, 255, 255, .14);
	--bc-surface: #22222a;
	--bc-shadow: 0 10px 40px rgba(0, 0, 0, .5);
}

@media (prefers-color-scheme: dark) {
	#blast-consent.bc--theme-auto,
	.bc-embed.bc--theme-auto {
		--bc-bg: #17171c;
		--bc-fg: #f2f2f5;
		--bc-muted: #a6a6b3;
		--bc-border: rgba(255, 255, 255, .14);
		--bc-surface: #22222a;
		--bc-shadow: 0 10px 40px rgba(0, 0, 0, .5);
	}
}

#blast-consent[hidden],
#blast-consent [hidden] { display: none !important; }

#blast-consent,
#blast-consent * { box-sizing: border-box; }

#blast-consent {
	font-family: var(--bc-font);
	font-size: 15px;
	line-height: 1.5;
	color: var(--bc-fg);
	position: relative;
	z-index: 2147483000;
}

/* ---------- Banner ---------- */

.bc-banner {
	position: fixed;
	z-index: 2147483001;
	background: var(--bc-bg);
	color: var(--bc-fg);
	box-shadow: var(--bc-shadow);
	border: 1px solid var(--bc-border);
	display: flex;
	gap: 16px 24px;
	align-items: center;
	padding: 18px 22px;
	animation: bc-in .25s ease-out;
}

.bc--layout-bar .bc-banner {
	left: 16px;
	right: 16px;
	bottom: 16px;
	border-radius: var(--bc-radius);
	max-width: 1180px;
	margin: 0 auto;
}

.bc--layout-box .bc-banner {
	left: 16px;
	bottom: 16px;
	width: min(420px, calc(100vw - 32px));
	border-radius: var(--bc-radius);
	flex-direction: column;
	align-items: stretch;
}

.bc--side-right.bc--layout-box .bc-banner {
	left: auto;
	right: 16px;
}

.bc--layout-center .bc-banner {
	left: 50%;
	top: 50%;
	transform: translate(-50%, -50%);
	width: min(520px, calc(100vw - 32px));
	border-radius: var(--bc-radius);
	flex-direction: column;
	align-items: stretch;
	animation: none;
}

.bc--layout-center.bc--open::before {
	content: "";
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, .45);
	z-index: 2147483000;
}

.bc-banner__text { flex: 1 1 auto; min-width: 0; }

.bc-title {
	margin: 0 0 4px;
	font-weight: 700;
	font-size: 1.05em;
	color: var(--bc-fg);
}

.bc-msg {
	margin: 0;
	color: var(--bc-muted);
	font-size: .93em;
}

.bc-link {
	color: var(--bc-accent);
	text-decoration: underline;
	text-underline-offset: 2px;
	white-space: nowrap;
}

.bc--theme-dark .bc-link { filter: brightness(1.25); }

.bc-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	flex: 0 0 auto;
}

.bc--layout-box .bc-actions,
.bc--layout-center .bc-actions { justify-content: flex-end; }

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

#blast-consent .bc-btn,
.bc-embed .bc-btn {
	appearance: none;
	font: inherit;
	font-size: .92em;
	font-weight: 600;
	line-height: 1.2;
	padding: 10px 16px;
	border-radius: 999px;
	border: 1.5px solid transparent;
	cursor: pointer;
	transition: filter .15s, background-color .15s, border-color .15s;
	text-transform: none;
	letter-spacing: normal;
	box-shadow: none;
	margin: 0;
	min-height: 0;
	width: auto;
}

#blast-consent .bc-btn--primary,
.bc-embed .bc-btn--primary {
	background: var(--bc-accent);
	color: var(--bc-on-accent);
	border-color: var(--bc-accent);
}

#blast-consent .bc-btn--primary:hover,
.bc-embed .bc-btn--primary:hover { filter: brightness(1.08); }

/* Rechazar con el mismo peso visual que aceptar (buena práctica: sin patrones oscuros). */
#blast-consent .bc-btn--outline {
	background: transparent;
	color: var(--bc-fg);
	border-color: var(--bc-fg);
}

#blast-consent .bc-btn--outline:hover { background: var(--bc-surface); }

#blast-consent .bc-btn--ghost {
	background: transparent;
	color: var(--bc-fg);
	text-decoration: underline;
	text-underline-offset: 3px;
	padding-left: 8px;
	padding-right: 8px;
}

#blast-consent .bc-btn:focus-visible,
#blast-consent .bc-close:focus-visible,
#blast-consent .bc-fab:focus-visible,
#blast-consent .bc-switch:focus-visible,
.bc-embed .bc-btn:focus-visible {
	outline: 3px solid var(--bc-accent);
	outline-offset: 2px;
}

/* ---------- Modal ---------- */

.bc-modal {
	position: fixed;
	inset: 0;
	z-index: 2147483002;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
}

.bc-modal__overlay {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, .5);
}

.bc-modal__box {
	position: relative;
	background: var(--bc-bg);
	color: var(--bc-fg);
	border-radius: var(--bc-radius);
	box-shadow: var(--bc-shadow);
	width: min(560px, 100%);
	max-height: calc(100vh - 32px);
	display: flex;
	flex-direction: column;
	animation: bc-in .2s ease-out;
}

.bc-modal__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 18px 22px 8px;
}

.bc-modal__head .bc-title { margin: 0; font-size: 1.15em; }

#blast-consent .bc-close {
	appearance: none;
	background: transparent;
	border: 0;
	color: var(--bc-muted);
	font-size: 28px;
	line-height: 1;
	cursor: pointer;
	padding: 4px 8px;
	border-radius: 8px;
}

.bc-modal__body {
	padding: 4px 22px 12px;
	overflow-y: auto;
}

.bc-modal__body > .bc-msg { margin-bottom: 12px; }

.bc-cat {
	border: 1px solid var(--bc-border);
	border-radius: 10px;
	padding: 12px 14px;
	margin-bottom: 10px;
	background: var(--bc-surface);
}

.bc-cat__head {
	display: flex;
	align-items: center;
	gap: 10px;
}

.bc-cat__label {
	font-weight: 600;
	flex: 1 1 auto;
	cursor: pointer;
	color: var(--bc-fg);
}

.bc-badge {
	font-size: .75em;
	color: var(--bc-muted);
	white-space: nowrap;
}

.bc-cat__desc,
.bc-cat__ex {
	margin: 6px 0 0;
	font-size: .88em;
	color: var(--bc-muted);
}

.bc-cat__ex { font-size: .8em; opacity: .85; }

.bc-modal__foot {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	justify-content: flex-end;
	padding: 12px 22px 18px;
	border-top: 1px solid var(--bc-border);
}

/* Interruptor accesible basado en checkbox. */
#blast-consent .bc-switch {
	appearance: none;
	-webkit-appearance: none;
	width: 42px;
	height: 24px;
	border-radius: 999px;
	background: var(--bc-border);
	position: relative;
	cursor: pointer;
	flex: 0 0 auto;
	margin: 0;
	border: 0;
	transition: background-color .15s;
}

#blast-consent .bc-switch::after {
	content: "";
	position: absolute;
	top: 3px;
	left: 3px;
	width: 18px;
	height: 18px;
	border-radius: 50%;
	background: #fff;
	box-shadow: 0 1px 3px rgba(0, 0, 0, .3);
	transition: transform .15s;
}

#blast-consent .bc-switch:checked { background: var(--bc-accent); }
#blast-consent .bc-switch:checked::after { transform: translateX(18px); }
#blast-consent .bc-switch:disabled { opacity: .6; cursor: not-allowed; }

/* ---------- Botón flotante ---------- */

#blast-consent .bc-fab {
	position: fixed;
	left: 16px;
	bottom: 16px;
	z-index: 2147483000;
	width: 44px;
	height: 44px;
	border-radius: 50%;
	border: 1px solid var(--bc-border);
	background: var(--bc-bg);
	color: var(--bc-accent);
	box-shadow: var(--bc-shadow);
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	padding: 0;
	opacity: .85;
	transition: opacity .15s, transform .15s;
}

#blast-consent .bc-fab:hover { opacity: 1; transform: scale(1.06); }

#blast-consent.bc--side-right .bc-fab {
	left: auto;
	right: 16px;
}

/* ---------- Placeholder de embeds bloqueados ---------- */

.bc-embed {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 12px;
	text-align: center;
	padding: 24px;
	min-height: 200px;
	width: 100%;
	background: var(--bc-surface);
	color: var(--bc-fg);
	border: 1px dashed var(--bc-border);
	border-radius: 12px;
	font-size: 14px;
	line-height: 1.5;
}

.bc-embed p { margin: 0; max-width: 46ch; color: var(--bc-muted); }

/* ---------- Varios ---------- */

html.bc-lock { overflow: hidden; }

@keyframes bc-in {
	from { opacity: 0; transform: translateY(12px); }
	to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
	.bc-banner,
	.bc-modal__box { animation: none; }
}

@media (max-width: 720px) {
	.bc--layout-bar .bc-banner {
		flex-direction: column;
		align-items: stretch;
		left: 8px;
		right: 8px;
		bottom: 8px;
		padding: 16px;
	}
	.bc-actions { justify-content: stretch; }
	#blast-consent .bc-actions .bc-btn { flex: 1 1 auto; }
	.bc-modal__foot .bc-btn { flex: 1 1 100%; }
}

/* ---------- Vista previa en el panel ---------- */

#blast-consent.bc--preview { z-index: auto; }
#blast-consent.bc--preview .bc-banner {
	position: relative;
	inset: auto;
	transform: none;
	margin: 0;
	width: 100%;
	max-width: none;
	animation: none;
}
#blast-consent.bc--preview .bc-fab,
#blast-consent.bc--preview .bc-modal { display: none !important; }
