/**
 * Portal Consent — banner & modal (Lokaldo greens by default via CSS vars).
 */

@keyframes portal-consent-slide-up {
	from { opacity: 0; transform: translateY(16px); }
	to { opacity: 1; transform: translateY(0); }
}

@keyframes portal-consent-fade-in {
	from { opacity: 0; }
	to { opacity: 1; }
}

@keyframes portal-consent-pop-in {
	from { opacity: 0; transform: translateY(10px) scale(0.98); }
	to { opacity: 1; transform: translateY(0) scale(1); }
}

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

.portal-consent-banner {
	--pc-primary: #1d4d43;
	--pc-primary-dark: #163c34;
	--pc-bg: #ffffff;
	--pc-text: #1a1a1a;
	--pc-muted: rgba(26, 26, 26, 0.72);
	--pc-line: rgba(29, 77, 67, 0.14);
	position: fixed;
	bottom: 24px;
	right: 24px;
	left: auto;
	width: 400px;
	max-width: calc(100vw - 32px);
	background: var(--pc-bg);
	color: var(--pc-text);
	border: 1px solid var(--pc-line);
	border-radius: 16px;
	box-shadow:
		0 2px 6px rgba(16, 42, 36, 0.06),
		0 12px 32px rgba(16, 42, 36, 0.14),
		0 24px 64px rgba(16, 42, 36, 0.12);
	z-index: 999999;
	padding: 22px 22px 20px;
	font-family: inherit;
	overflow: hidden;
	animation: portal-consent-slide-up 0.35s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* Subtle brand accent along the top edge. */
.portal-consent-banner::before {
	content: "";
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	height: 4px;
	background: linear-gradient(90deg, var(--pc-primary) 0%, #7fa895 100%);
}

.portal-consent-banner--bottom-left {
	right: auto;
	left: 24px;
}

.portal-consent-banner--bottom-center {
	right: auto;
	left: 50%;
	transform: translateX(-50%);
}

.portal-consent-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	margin: 0 0 10px;
}

.portal-consent-title {
	display: flex;
	align-items: center;
	gap: 9px;
	margin: 0;
	flex: 1;
	font-size: 1.06rem;
	font-weight: 800;
	line-height: 1.3;
	letter-spacing: -0.01em;
	color: var(--pc-primary);
}

.portal-consent-title-icon {
	flex-shrink: 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 30px;
	height: 30px;
	border-radius: 9px;
	background: rgba(29, 77, 67, 0.09);
	color: var(--pc-primary);
}

.portal-consent-title-icon svg {
	width: 17px;
	height: 17px;
	display: block;
}

/* Reset theme/Elementor button styles on close (×). */
.portal-consent-banner .portal-consent-close,
.portal-consent-modal .portal-consent-close,
button.portal-consent-close {
	appearance: none;
	-webkit-appearance: none;
	flex-shrink: 0;
	box-sizing: border-box;
	width: 30px;
	height: 30px;
	min-width: 30px;
	min-height: 30px;
	margin: 0;
	padding: 0;
	border: none !important;
	border-radius: 50% !important;
	background: rgba(0, 0, 0, 0.045) !important;
	background-image: none !important;
	box-shadow: none !important;
	color: var(--pc-text) !important;
	font-family: inherit;
	font-size: 19px !important;
	font-weight: 400 !important;
	line-height: 1 !important;
	letter-spacing: 0 !important;
	text-transform: none !important;
	text-shadow: none !important;
	cursor: pointer;
	opacity: 0.65;
	display: inline-flex !important;
	align-items: center;
	justify-content: center;
	transition: opacity 0.15s ease, background 0.15s ease;
}

.portal-consent-banner .portal-consent-close:hover,
.portal-consent-modal .portal-consent-close:hover,
button.portal-consent-close:hover {
	opacity: 1;
	background: rgba(0, 0, 0, 0.09) !important;
	color: var(--pc-text) !important;
}

.portal-consent-text {
	margin: 0 0 6px;
	font-size: 0.875rem;
	line-height: 1.55;
	color: var(--pc-muted);
}

.portal-consent-policy-link {
	margin: 0 0 16px;
	font-size: 0.8rem;
}

.portal-consent-policy-link a {
	color: var(--pc-primary);
	font-weight: 600;
	text-decoration: underline;
	text-underline-offset: 2px;
	text-decoration-color: rgba(29, 77, 67, 0.4);
	transition: text-decoration-color 0.15s ease;
}

.portal-consent-policy-link a:hover {
	text-decoration-color: var(--pc-primary);
}

.portal-consent-encourage {
	margin: 0 0 14px;
	padding: 9px 12px;
	border-radius: 10px;
	background: rgba(29, 77, 67, 0.06);
	border: 1px dashed rgba(29, 77, 67, 0.25);
	color: var(--pc-primary);
	font-size: 0.8rem;
	font-weight: 600;
	line-height: 1.5;
}

/* Accept spans full width; the two secondary actions share a row. */
.portal-consent-buttons {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 9px;
}

.portal-consent-btn {
	display: block;
	width: 100%;
	padding: 11px 12px;
	border-radius: 10px;
	border: 1px solid rgba(29, 77, 67, 0.3);
	background: transparent;
	color: var(--pc-primary);
	font-family: inherit;
	font-size: 0.865rem;
	font-weight: 700;
	letter-spacing: 0.01em;
	cursor: pointer;
	text-align: center;
	transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease,
		box-shadow 0.15s ease, transform 0.1s ease, opacity 0.15s ease;
}

.portal-consent-btn:hover {
	background: rgba(29, 77, 67, 0.06);
	border-color: rgba(29, 77, 67, 0.5);
}

.portal-consent-btn:active {
	transform: translateY(1px);
}

.portal-consent-btn:focus-visible {
	outline: 2px solid var(--pc-primary);
	outline-offset: 2px;
}

.portal-consent-btn:disabled {
	opacity: 0.6;
	cursor: wait;
	transform: none;
}

.portal-consent-banner .portal-consent-btn-accept {
	grid-column: 1 / -1;
}

.portal-consent-btn-accept {
	background: var(--pc-primary);
	color: #fff;
	border-color: var(--pc-primary);
	box-shadow: 0 4px 14px rgba(29, 77, 67, 0.28);
}

.portal-consent-btn-accept:hover {
	background: var(--pc-primary-dark, #163c34);
	border-color: var(--pc-primary-dark, #163c34);
	color: #fff;
	box-shadow: 0 6px 18px rgba(29, 77, 67, 0.34);
}

/* Quiet reject: still one click, visually a plain text action.
   !important needed — theme/Elementor global button styles override plugin CSS. */
button.portal-consent-btn-reject {
	border-color: transparent !important;
	background: transparent !important;
	background-image: none !important;
	box-shadow: none !important;
	color: rgba(26, 26, 26, 0.55) !important;
	font-weight: 600 !important;
	font-size: 0.8rem !important;
	text-decoration: underline !important;
	text-underline-offset: 3px;
	text-decoration-color: rgba(26, 26, 26, 0.25);
	text-transform: none !important;
	letter-spacing: 0 !important;
}

button.portal-consent-btn-reject:hover {
	background: rgba(0, 0, 0, 0.04) !important;
	border-color: transparent !important;
	color: rgba(26, 26, 26, 0.8) !important;
	text-decoration-color: rgba(26, 26, 26, 0.5);
}

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

.portal-consent-modal {
	position: fixed;
	inset: 0;
	background: rgba(13, 32, 27, 0.5);
	z-index: 9999999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
	backdrop-filter: blur(4px);
	-webkit-backdrop-filter: blur(4px);
	animation: portal-consent-fade-in 0.2s ease both;
}

.portal-consent-modal-content {
	background: var(--pc-bg, #fff);
	color: var(--pc-text, #1a1a1a);
	border-radius: 16px;
	max-width: 580px;
	width: 100%;
	max-height: 88vh;
	overflow-y: auto;
	padding: 26px 26px 22px;
	box-shadow: 0 24px 70px rgba(10, 26, 22, 0.32);
	animation: portal-consent-pop-in 0.28s cubic-bezier(0.16, 1, 0.3, 1) both;
	overscroll-behavior: contain;
}

.portal-consent-modal-header {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 12px;
	margin: 0 0 6px;
	padding-bottom: 14px;
	border-bottom: 1px solid rgba(29, 77, 67, 0.12);
}

.portal-consent-modal-title {
	margin: 0;
	flex: 1;
	font-size: 1.22rem;
	font-weight: 800;
	letter-spacing: -0.01em;
	color: var(--pc-primary, #1d4d43);
	padding: 0;
	border: none;
}

.portal-consent-categories {
	padding-top: 12px;
}

.portal-consent-category {
	margin-bottom: 10px;
	padding: 14px 16px;
	border: 1px solid rgba(29, 77, 67, 0.12);
	border-radius: 12px;
	background: #fff;
	transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.portal-consent-category:hover {
	border-color: rgba(29, 77, 67, 0.3);
	box-shadow: 0 2px 10px rgba(16, 42, 36, 0.06);
}

.portal-consent-category:has(input:checked) {
	background: rgba(29, 77, 67, 0.035);
	border-color: rgba(29, 77, 67, 0.26);
}

.portal-consent-category-header {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-bottom: 5px;
}

.portal-consent-category-label {
	font-weight: 700;
	font-size: 0.92rem;
	flex: 1;
	color: var(--pc-text, #1a1a1a);
}

.portal-consent-required {
	display: inline-block;
	margin-left: 4px;
	padding: 2px 8px;
	border-radius: 999px;
	background: rgba(29, 77, 67, 0.09);
	color: var(--pc-primary, #1d4d43);
	font-weight: 700;
	font-size: 0.68rem;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	vertical-align: middle;
}

.portal-consent-category-desc {
	margin: 0;
	padding-left: 58px;
	font-size: 0.81rem;
	line-height: 1.5;
	color: var(--pc-muted, rgba(26, 26, 26, 0.68));
}

/* ---------- Switch ---------- */

.portal-consent-switch {
	position: relative;
	display: inline-block;
	width: 46px;
	height: 26px;
	flex-shrink: 0;
}

.portal-consent-switch input {
	opacity: 0;
	width: 0;
	height: 0;
}

.portal-consent-slider {
	position: absolute;
	cursor: pointer;
	inset: 0;
	background: #cdd6d2;
	border-radius: 26px;
	transition: background 0.2s ease, box-shadow 0.15s ease;
}

.portal-consent-slider:hover {
	box-shadow: 0 0 0 4px rgba(29, 77, 67, 0.08);
}

.portal-consent-slider:before {
	position: absolute;
	content: "";
	height: 20px;
	width: 20px;
	left: 3px;
	bottom: 3px;
	background: #fff;
	border-radius: 50%;
	transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

.portal-consent-switch input:checked + .portal-consent-slider {
	background: var(--pc-primary, #1d4d43);
}

.portal-consent-switch input:checked + .portal-consent-slider:before {
	transform: translateX(20px);
}

.portal-consent-switch input:focus-visible + .portal-consent-slider {
	box-shadow: 0 0 0 3px rgba(29, 77, 67, 0.35);
}

.portal-consent-switch input:disabled + .portal-consent-slider {
	opacity: 0.55;
	cursor: not-allowed;
}

.portal-consent-switch input:disabled + .portal-consent-slider:hover {
	box-shadow: none;
}

.portal-consent-modal-policy {
	margin: 14px 2px 0;
	font-size: 0.8rem;
	color: var(--pc-muted, rgba(26, 26, 26, 0.68));
}

.portal-consent-modal-policy a {
	color: var(--pc-primary, #1d4d43);
	font-weight: 600;
	text-decoration: underline;
	text-underline-offset: 2px;
	text-decoration-color: rgba(29, 77, 67, 0.4);
	transition: text-decoration-color 0.15s ease;
}

.portal-consent-modal-policy a:hover {
	text-decoration-color: var(--pc-primary, #1d4d43);
}

.portal-consent-modal-buttons {
	margin-top: 18px;
	padding-top: 16px;
	border-top: 1px solid rgba(29, 77, 67, 0.12);
}

.portal-consent-btn-save {
	background: var(--pc-primary, #1d4d43);
	color: #fff;
	border-color: var(--pc-primary, #1d4d43);
	box-shadow: 0 4px 14px rgba(29, 77, 67, 0.28);
}

.portal-consent-btn-save:hover {
	background: var(--pc-primary-dark, #163c34);
	border-color: var(--pc-primary-dark, #163c34);
	color: #fff;
}

/* ---------- Floating icon ---------- */

.portal-consent-icon {
	position: fixed;
	bottom: 20px;
	right: 20px;
	width: 48px;
	height: 48px;
	background: var(--pc-bg, #fff);
	border: 1px solid rgba(29, 77, 67, 0.25);
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	z-index: 999998;
	color: var(--pc-primary, #1d4d43);
	box-shadow: 0 4px 16px rgba(16, 42, 36, 0.16);
	transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
	animation: portal-consent-pop-in 0.25s ease both;
}

.portal-consent-icon:hover {
	transform: translateY(-2px);
	box-shadow: 0 8px 24px rgba(16, 42, 36, 0.22);
	border-color: rgba(29, 77, 67, 0.5);
}

.portal-consent-icon:focus-visible {
	outline: 2px solid var(--pc-primary, #1d4d43);
	outline-offset: 2px;
}

.portal-consent-icon svg {
	width: 22px;
	height: 22px;
	stroke: currentColor;
	fill: none;
}

a.portal-consent-open {
	cursor: pointer;
}

/* ---------- Mobile ---------- */

@media (max-width: 768px) {
	.portal-consent-banner,
	.portal-consent-banner--bottom-left,
	.portal-consent-banner--bottom-center {
		bottom: 10px;
		left: 10px;
		right: 10px;
		width: auto;
		max-width: none;
		transform: none;
		padding: 18px 18px 16px;
		border-radius: 14px;
	}

	.portal-consent-modal {
		padding: 12px;
		align-items: flex-end;
	}

	.portal-consent-modal-content {
		max-height: 84vh;
		padding: 20px 18px 16px;
		border-radius: 16px 16px 12px 12px;
	}

	.portal-consent-category-desc {
		padding-left: 0;
	}

	.portal-consent-icon {
		bottom: 14px;
		right: 14px;
		width: 44px;
		height: 44px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.portal-consent-banner,
	.portal-consent-modal,
	.portal-consent-modal-content,
	.portal-consent-icon {
		animation: none;
	}
}
