/* SMC Cookie Consent – banner público
 *
 * Tamaño estándar (no editable):
 *   - Banner: tarjeta de 680 px de ancho máximo, 24 px de relleno, título 20 px, texto 15 px.
 *   - Panel de configuración: 760 px de ancho máximo.
 *   - Botones: mismo tamaño y color, 46 px de alto, en fila (ordenador y tablet) o apilados (móvil).
 * Puntos de corte: ordenador > 1024 px · tablet 641–1024 px · móvil ≤ 640 px · horizontal de poca altura ≤ 520 px.
 */

.smcc-root,
.smcc-root *,
.smcc-root *::before,
.smcc-root *::after,
.smcc-float,
.smcc-float * { box-sizing: border-box; }

.smcc-root [hidden],
.smcc-float[hidden] { display: none !important; }

.smcc-root {
	font-family: var(--smcc-font, inherit);
	font-size: 15px;
	line-height: 1.5;
	color: var(--smcc-text, #1f2937);
	-webkit-text-size-adjust: 100%;
	text-size-adjust: 100%;
}

.smcc-overlay {
	position: fixed;
	inset: 0;
	background: var(--smcc-overlay, rgba(0,0,0,.5));
	z-index: 2147483000;
}

/* =====================================================================
 * Primera capa: banner
 * =================================================================== */
.smcc-banner {
	position: fixed;
	z-index: 2147483001;
	width: min(680px, calc(100vw - 32px));
	max-height: calc(100vh - 32px);
	max-height: calc(100dvh - 32px);
	overflow-y: auto;
	overscroll-behavior: contain;
	-webkit-overflow-scrolling: touch;
	background: var(--smcc-bg, #fff);
	color: var(--smcc-text, #1f2937);
	border-radius: var(--smcc-radius, 12px);
	box-shadow: var(--smcc-shadow, 0 20px 60px rgba(0,0,0,.3));
	outline: none;
}
.smcc-banner-inner { padding: 24px; }

/* Posiciones */
.smcc-pos-center .smcc-banner {
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
}
.smcc-pos-bottom-right .smcc-banner {
	right: 16px;
	bottom: calc(16px + env(safe-area-inset-bottom, 0px));
}
.smcc-pos-bottom-left .smcc-banner {
	left: 16px;
	bottom: calc(16px + env(safe-area-inset-bottom, 0px));
}

/* Cabecera, texto y enlaces */
.smcc-head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.smcc-logo {
	width: var(--smcc-logo-size, 40px);
	height: var(--smcc-logo-size, 40px);
	max-width: 30%;
	object-fit: contain;
	flex: 0 0 auto;
	border-radius: 6px;
	margin: 0;
}
.smcc-root .smcc-title {
	margin: 0;
	padding: 0;
	font-family: inherit;
	font-size: 20px;
	font-weight: 700;
	line-height: 1.3;
	color: var(--smcc-title, #111827);
	letter-spacing: normal;
	text-transform: none;
	overflow-wrap: anywhere;
}
.smcc-text { margin: 0 0 8px; overflow-wrap: break-word; }
.smcc-text p { margin: 0 0 6px; }
.smcc-root a,
.smcc-root .smcc-link {
	color: var(--smcc-link, #0b57d0);
	text-decoration: underline;
	text-underline-offset: 2px;
}
.smcc-links { display: flex; flex-wrap: wrap; gap: 4px 18px; margin: 0; }
.smcc-links a { display: inline-block; padding: 4px 0; }

/* Botones: idénticos en tamaño y color (requisito de la AEPD) */
.smcc-actions,
.smcc-prefs-actions {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 10px;
}
.smcc-actions { margin-top: 16px; }
.smcc-root .smcc-btn {
	appearance: none;
	-webkit-appearance: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 46px;
	width: 100%;
	margin: 0;
	padding: 10px 14px;
	font: inherit;
	font-size: 15px;
	font-weight: 600;
	line-height: 1.2;
	text-align: center;
	text-transform: none;
	letter-spacing: normal;
	white-space: normal;
	cursor: pointer;
	touch-action: manipulation;
	color: var(--smcc-btn-text, #fff);
	background: var(--smcc-btn-bg, #1f2937);
	border: 2px solid var(--smcc-btn-border, #1f2937);
	border-radius: var(--smcc-btn-radius, 8px);
	box-shadow: none;
	transition: background-color .15s, color .15s;
}
.smcc-root .smcc-btn:hover {
	color: var(--smcc-btn-hover-text, #fff);
	background: var(--smcc-btn-hover-bg, #374151);
}
.smcc-root .smcc-btn:focus-visible,
.smcc-root .smcc-close:focus-visible,
.smcc-switch input:focus-visible + .smcc-slider,
.smcc-float:focus-visible,
.smcc-root a:focus-visible,
.smcc-cookie-list summary:focus-visible {
	outline: 3px solid var(--smcc-link, #0b57d0);
	outline-offset: 2px;
}

/* =====================================================================
 * Segunda capa: panel de configuración (siempre centrado)
 * =================================================================== */
.smcc-prefs {
	position: fixed;
	z-index: 2147483002;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	width: min(760px, calc(100vw - 32px));
	max-height: calc(100vh - 32px);
	max-height: calc(100dvh - 32px);
	display: flex;
	background: var(--smcc-bg, #fff);
	color: var(--smcc-text, #1f2937);
	border-radius: var(--smcc-radius, 12px);
	box-shadow: 0 20px 60px rgba(0,0,0,.35);
	outline: none;
}
.smcc-prefs-inner { display: flex; flex-direction: column; width: 100%; max-height: inherit; min-height: 0; }
.smcc-prefs-head {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 16px 24px 14px;
	border-bottom: 1px solid rgba(127,127,127,.25);
	flex: 0 0 auto;
}
.smcc-prefs-head .smcc-title { flex: 1; min-width: 0; }
.smcc-root .smcc-close {
	appearance: none;
	background: transparent;
	border: 0;
	color: var(--smcc-title, #111827);
	font-size: 28px;
	line-height: 1;
	width: 44px;
	height: 44px;
	flex: 0 0 44px;
	padding: 0;
	cursor: pointer;
	border-radius: 50%;
}
.smcc-root .smcc-close:hover { background: rgba(127,127,127,.15); }
.smcc-prefs-body {
	padding: 16px 24px;
	overflow-y: auto;
	overscroll-behavior: contain;
	-webkit-overflow-scrolling: touch;
	flex: 1 1 auto;
	min-height: 0;
}
.smcc-prefs-actions { padding: 16px 24px; border-top: 1px solid rgba(127,127,127,.25); flex: 0 0 auto; }
.smcc-consent-id { margin: 0; padding: 0 24px 14px; font-size: 12px; opacity: .75; overflow-wrap: anywhere; }
.smcc-consent-id code { font-size: inherit; background: none; padding: 0; color: inherit; }

.smcc-cat {
	border: 1px solid rgba(127,127,127,.25);
	border-radius: 8px;
	padding: 14px 16px;
	margin: 12px 0;
}
.smcc-cat-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.smcc-root .smcc-cat-title { margin: 0; padding: 0; font-family: inherit; font-size: 16px; font-weight: 700; line-height: 1.3; color: var(--smcc-title, #111827); text-transform: none; }
.smcc-cat-desc { margin: 6px 0 0; font-size: 14px; }
.smcc-always { font-size: 13px; font-weight: 700; color: var(--smcc-toggle-on, #0b57d0); white-space: nowrap; }

/* Interruptor */
.smcc-switch { position: relative; display: inline-block; width: 48px; height: 28px; flex: 0 0 auto; margin: 0; cursor: pointer; }
.smcc-switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.smcc-slider {
	position: absolute;
	inset: 0;
	background: var(--smcc-toggle-off, #9ca3af);
	border-radius: 28px;
	transition: background-color .2s;
}
.smcc-slider::before {
	content: "";
	position: absolute;
	width: 22px;
	height: 22px;
	left: 3px;
	top: 3px;
	background: #fff;
	border-radius: 50%;
	transition: transform .2s;
	box-shadow: 0 1px 3px rgba(0,0,0,.3);
}
.smcc-switch input:checked + .smcc-slider { background: var(--smcc-toggle-on, #0b57d0); }
.smcc-switch input:checked + .smcc-slider::before { transform: translateX(20px); }

/* Lista de cookies */
.smcc-cookie-list { margin-top: 8px; font-size: 13px; }
.smcc-cookie-list summary { cursor: pointer; color: var(--smcc-link, #0b57d0); font-weight: 600; padding: 4px 0; }
.smcc-table-wrap { overflow-x: auto; margin-top: 8px; -webkit-overflow-scrolling: touch; }
.smcc-table { width: 100%; border-collapse: collapse; font-size: .95em; }
.smcc-table th,
.smcc-table td { text-align: left; vertical-align: top; padding: 6px 8px; border-bottom: 1px solid rgba(127,127,127,.25); }
.smcc-table th { font-weight: 700; }
.smcc-table code { font-size: .95em; word-break: break-all; }

/* =====================================================================
 * Elemento minimizado (botón flotante)
 * =================================================================== */
.smcc-float {
	position: fixed;
	bottom: calc(16px + env(safe-area-inset-bottom, 0px));
	z-index: 2147482999;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	min-height: 40px;
	min-width: 40px;
	margin: 0;
	padding: 8px 14px 8px 10px;
	border: 2px solid var(--smcc-btn-border, #1f2937);
	border-radius: 999px;
	background: var(--smcc-btn-bg, #1f2937);
	color: var(--smcc-btn-text, #fff);
	font-family: var(--smcc-font, inherit);
	font-size: 14px;
	font-weight: 600;
	line-height: 1;
	box-shadow: 0 4px 14px rgba(0,0,0,.25);
	cursor: pointer;
	touch-action: manipulation;
}
.smcc-float svg { width: 20px; height: 20px; flex: 0 0 20px; }
.smcc-float:not(:has(.smcc-float-label)) { padding: 8px; }
.smcc-float:hover { background: var(--smcc-btn-hover-bg, #374151); color: var(--smcc-btn-hover-text, #fff); }
.smcc-float-bottom-left { left: 16px; }
.smcc-float-bottom-right { right: 16px; }
.smcc-float-center { left: 50%; transform: translateX(-50%); }

/* =====================================================================
 * Contenido bloqueado y política
 * =================================================================== */
.smcc-iframe-ph {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 12px;
	text-align: center;
	padding: 24px;
	background: #f3f4f6;
	color: #1f2937;
	border: 1px dashed #9ca3af;
	border-radius: 8px;
	min-height: 180px;
	max-width: 100%;
	font-size: 15px;
	line-height: 1.5;
}
.smcc-iframe-ph p { margin: 0; max-width: 520px; }
.smcc-sc-btn,
.smcc-iframe-ph button {
	appearance: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 46px;
	padding: 10px 18px;
	font: inherit;
	font-weight: 600;
	cursor: pointer;
	color: var(--smcc-btn-text, #fff);
	background: var(--smcc-btn-bg, #1f2937);
	border: 2px solid var(--smcc-btn-border, #1f2937);
	border-radius: var(--smcc-btn-radius, 8px);
}
.smcc-sc-btn:hover,
.smcc-iframe-ph button:hover { background: var(--smcc-btn-hover-bg, #374151); color: var(--smcc-btn-hover-text, #fff); }

.smcc-status { padding: 12px 16px; border-left: 4px solid var(--smcc-toggle-on, #0b57d0); background: rgba(127,127,127,.08); margin: 12px 0; }
.smcc-status:empty { display: none; }
.smcc-policy-tables { container-type: inline-size; }
.smcc-policy-tables, .smcc-policy-tables * { box-sizing: border-box; }
.smcc-policy-tables .smcc-table-wrap { margin-top: 0; }
.smcc-policy-tables .smcc-table { margin-bottom: 24px; font-size: 14px; }
.smcc-policy-tables .smcc-table code { white-space: nowrap; word-break: normal; }
.smcc-policy-tables .smcc-table th { white-space: nowrap; }
.smcc-table-empty { font-style: italic; opacity: .8; }

/* Política: si el contenedor es estrecho (columna del tema, móvil), cada cookie se muestra como ficha */
@container (max-width: 720px) {
	.smcc-policy-tables .smcc-table thead { display: none; }
	.smcc-policy-tables .smcc-table,
	.smcc-policy-tables .smcc-table tbody,
	.smcc-policy-tables .smcc-table tr,
	.smcc-policy-tables .smcc-table td { display: block; width: 100%; }
	.smcc-policy-tables .smcc-table tr { border: 1px solid rgba(127,127,127,.3); border-radius: 8px; padding: 10px 14px; margin-bottom: 12px; }
	.smcc-policy-tables .smcc-table td { border: 0; padding: 3px 0; }
	.smcc-policy-tables .smcc-table td::before { content: attr(data-label) ": "; font-weight: 700; }
	.smcc-policy-tables .smcc-table td:first-child { font-size: 15px; padding-bottom: 6px; }
	.smcc-policy-tables .smcc-table td:first-child::before { content: none; }
	.smcc-policy-tables .smcc-table td small { display: inline; }
	.smcc-policy-tables .smcc-table td small::before { content: " · "; }
	.smcc-policy-tables .smcc-table td br { display: none; }
}
.smcc-policy-tables .smcc-table th { background: rgba(127,127,127,.1); }
.smcc-policy-tables .smcc-table td small { opacity: .75; }

html.smcc-locked,
body.smcc-locked { overflow: hidden !important; }

/* =====================================================================
 * Tablet (641–1024 px): misma tarjeta; las esquinas se separan menos del borde
 * =================================================================== */
@media (min-width: 641px) and (max-width: 1024px) {
	.smcc-pos-bottom-right .smcc-banner { right: 12px; }
	.smcc-pos-bottom-left .smcc-banner { left: 12px; }
	.smcc-banner { width: min(680px, calc(100vw - 24px)); }
}

/* =====================================================================
 * Móvil (≤ 640 px)
 * =================================================================== */
@media (max-width: 640px) {
	.smcc-root { font-size: 14px; }
	.smcc-banner { width: calc(100vw - 16px); max-height: calc(100vh - 16px); max-height: calc(100dvh - 16px); }
	.smcc-banner-inner { padding: 18px; }
	/* En las esquinas el banner pasa a ocupar todo el ancho, anclado abajo */
	.smcc-pos-bottom-right .smcc-banner,
	.smcc-pos-bottom-left .smcc-banner {
		left: 8px;
		right: 8px;
		bottom: calc(8px + env(safe-area-inset-bottom, 0px));
		width: auto;
	}
	.smcc-root .smcc-title { font-size: 17px; }
	.smcc-actions,
	.smcc-prefs-actions { grid-template-columns: 1fr; gap: 8px; }
	.smcc-actions { margin-top: 12px; }
	.smcc-root .smcc-btn { min-height: 46px; font-size: 15px; }

	/* El panel ocupa la pantalla completa */
	.smcc-prefs {
		top: 0;
		left: 0;
		transform: none;
		width: 100%;
		height: 100vh;
		height: 100dvh;
		max-height: none;
		border-radius: 0;
	}
	.smcc-prefs-head,
	.smcc-prefs-body,
	.smcc-prefs-actions { padding-left: 16px; padding-right: 16px; }
	.smcc-prefs-actions { padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }
	.smcc-consent-id { padding-left: 16px; padding-right: 16px; }

	.smcc-float { bottom: calc(12px + env(safe-area-inset-bottom, 0px)); }
	.smcc-float-bottom-left { left: 12px; }
	.smcc-float-bottom-right { right: 12px; }

	.smcc-policy-tables .smcc-table thead,
	.smcc-cookie-list .smcc-table thead { display: none; }
	.smcc-policy-tables .smcc-table tr,
	.smcc-cookie-list .smcc-table tr { display: block; border-bottom: 1px solid rgba(127,127,127,.35); padding: 6px 0; }
	.smcc-policy-tables .smcc-table td,
	.smcc-cookie-list .smcc-table td { display: block; border: 0; padding: 3px 0; }
	.smcc-policy-tables .smcc-table td::before,
	.smcc-cookie-list .smcc-table td::before { content: attr(data-label) ": "; font-weight: 700; }
}

/* =====================================================================
 * Móvil en horizontal o pantallas de poca altura (≤ 520 px de alto)
 * =================================================================== */
@media (max-height: 520px) and (min-width: 641px) {
	.smcc-banner-inner { padding: 16px 20px; }
	.smcc-actions { margin-top: 10px; }
	.smcc-root .smcc-btn { min-height: 42px; }
	.smcc-prefs { width: min(760px, calc(100vw - 16px)); max-height: calc(100vh - 16px); max-height: calc(100dvh - 16px); }
	.smcc-prefs-head { padding-top: 10px; padding-bottom: 10px; }
	.smcc-prefs-actions { padding-top: 10px; padding-bottom: 10px; }
}

@media (prefers-reduced-motion: reduce) {
	.smcc-root *, .smcc-float { transition: none !important; }
}

@media print {
	.smcc-root, .smcc-float { display: none !important; }
}
