/*
 * Impulsa Estepona - cookie banner (assets/js/consent.js).
 * Tokens come from impulsa.css (--ie-*) when it is loaded; every var() carries
 * its own fallback, so this file also works alone on pages without it.
 * Contrast: primary button text 7.95:1, link/text button 6.14:1, muted text 5.45:1.
 */
.ie-consent {
	--ie-consent-ink: var(--ie-ink, #14243a);
	--ie-consent-muted: var(--ie-muted, #5b6b7f);
	--ie-consent-line: var(--ie-line, #e3eaf2);
	--ie-consent-focus: var(--ie-blue, #1c7bc4);
	--ie-consent-link: #16669d;
	position: fixed;
	right: 0;
	bottom: 0;
	left: 0;
	z-index: 10000;
	font-family: var(--ie-font, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif);
	color: var(--ie-consent-ink);
	opacity: 0;
	transform: translateY(24px);
	transition: transform 200ms ease, opacity 200ms ease;
}
.ie-consent.is-open {
	opacity: 1;
	transform: none;
}
.ie-consent[hidden],
.ie-consent [hidden] {
	display: none !important;
}
.ie-consent *,
.ie-consent *::before,
.ie-consent *::after {
	box-sizing: border-box;
}

/* Mobile: bottom sheet */
.ie-consent__card {
	max-height: calc(100vh - 16px);
	max-height: calc(100dvh - 16px);
	overflow-y: auto;
	overscroll-behavior: contain;
	padding: 20px 16px max(16px, env(safe-area-inset-bottom));
	border-radius: 20px 20px 0 0;
	background: #fff;
	box-shadow: 0 -6px 28px rgba(13, 43, 74, 0.18), 0 0 0 1px var(--ie-consent-line);
}
.ie-consent__card h2 {
	margin: 0 0 8px;
	font-size: 1.05rem;
	font-weight: 700;
	line-height: 1.3;
	color: var(--ie-consent-ink);
}
.ie-consent__card p {
	margin: 0 0 16px;
	font-size: 0.95rem;
	line-height: 1.5;
	color: var(--ie-consent-muted);
}
.ie-consent__card p a {
	color: var(--ie-consent-link);
	text-decoration: underline;
	text-underline-offset: 2px;
}

/* Preferences */
.ie-consent__prefs {
	display: grid;
	gap: 8px;
	margin: 0 0 16px;
}
.ie-consent__row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	min-height: 56px;
	padding: 8px 14px;
	border: 1px solid var(--ie-consent-line);
	border-radius: 14px;
	cursor: pointer;
}
.ie-consent__row strong {
	display: block;
	font-size: 0.95rem;
	font-weight: 600;
}
.ie-consent__row small {
	display: block;
	font-size: 0.85rem;
	line-height: 1.35;
	color: var(--ie-consent-muted);
}
.ie-consent__row input {
	flex: none;
	width: 22px;
	height: 22px;
	margin: 0;
	accent-color: var(--ie-green-2, #4ea836);
}
.ie-consent__row input:disabled {
	opacity: 0.6;
	cursor: not-allowed;
}
.ie-consent__row input:focus-visible {
	outline: 3px solid var(--ie-consent-focus);
	outline-offset: 2px;
}

/* Buttons: stacked and full width on mobile */
.ie-consent__actions {
	display: flex;
	flex-direction: column;
	gap: 8px;
}
.ie-consent__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 44px;
	padding: 0 20px;
	border: 1px solid transparent;
	border-radius: 999px;
	font: inherit;
	font-size: 0.95rem;
	font-weight: 600;
	line-height: 1.2;
	cursor: pointer;
	transition: background 150ms ease, border-color 150ms ease;
}
.ie-consent__btn:focus-visible {
	outline: 3px solid var(--ie-consent-focus);
	outline-offset: 2px;
}
.ie-consent__btn--primary {
	background: var(--ie-green, #6cc04a);
	color: #051b09;
}
.ie-consent__btn--primary:hover {
	background: #7fd05b;
}
.ie-consent__btn--secondary {
	/* Same weight as Aceptar (AEPD: rejecting must be as easy as accepting): solid, not a faint outline. */
	border-color: #dbe5ef;
	background: #dbe5ef;
	color: var(--ie-consent-ink);
}
.ie-consent__btn--secondary:hover {
	border-color: #c9d6e4;
	background: #c9d6e4;
}
.ie-consent__btn--text {
	background: transparent;
	color: var(--ie-consent-link);
}
.ie-consent__btn--text:hover {
	text-decoration: underline;
}

/* Desktop: card in the bottom-right corner */
@media (min-width: 768px) {
	.ie-consent {
		right: 24px;
		bottom: 24px;
		left: auto;
		width: calc(100% - 48px);
		max-width: 420px;
	}
	.ie-consent__card {
		padding: 24px;
		border-radius: 20px;
		box-shadow: 0 10px 40px rgba(13, 43, 74, 0.22), 0 0 0 1px var(--ie-consent-line);
	}
	.ie-consent__actions {
		flex-flow: row wrap;
		align-items: center;
	}
}

@media (prefers-reduced-motion: reduce) {
	.ie-consent {
		opacity: 1;
		transform: none;
		transition: none;
	}
	.ie-consent__btn {
		transition: none;
	}
}

@media print {
	.ie-consent {
		display: none !important;
	}
}
