/* HC WP Consent Banner. Colours and sizes come from CSS custom properties set in the admin. */

.hccb,
.hccb-placeholder {
	--hccb-font: var(--hccb-font-family, inherit);
	font-family: var(--hccb-font);
	font-size: var(--hccb-font-size, 14px);
	line-height: 1.5;
	box-sizing: border-box;
}

.hccb *,
.hccb *::before,
.hccb *::after {
	box-sizing: inherit;
}

.hccb [hidden] {
	display: none !important;
}

.hccb p {
	margin: 0;
	font-size: inherit;
	line-height: inherit;
}

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

.hccb-banner {
	position: fixed;
	z-index: 999999;
	background: var(--hccb-banner-bg, #fff);
	color: var(--hccb-banner-text, #212121);
	border: 1px solid var(--hccb-banner-border, #f4f4f4);
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
	padding: 24px;
}

.hccb-title {
	color: var(--hccb-banner-title, #212121);
	font-size: 1.15em !important;
	font-weight: 600;
	margin-bottom: 10px !important;
}

.hccb-message a,
.hccb-link,
.hccb-modal a {
	color: var(--hccb-link, #1863dc);
	text-decoration: underline;
}

.hccb-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 16px;
}

/* The main choices: one grid row, every button the width of the widest. */
.hccb-choices {
	display: grid;
	grid-auto-flow: column;
	grid-auto-columns: 1fr;
	gap: 8px;
}

.hccb-layout-box-left .hccb-choices,
.hccb-layout-box-right .hccb-choices,
.hccb-layout-popup .hccb-choices {
	flex: 1 1 100%;
}

.hccb-actions .hccb-btn-link {
	align-self: center;
}

/* Box layouts */
.hccb-layout-box-left .hccb-banner,
.hccb-layout-box-right .hccb-banner {
	bottom: 24px;
	width: 440px;
	max-width: calc(100vw - 32px);
	border-radius: var(--hccb-banner-radius, 6px);
}

.hccb-layout-box-left .hccb-banner { left: 24px; }
.hccb-layout-box-right .hccb-banner { right: 24px; }

/* Bar layouts */
.hccb-layout-bar-bottom .hccb-banner,
.hccb-layout-bar-top .hccb-banner {
	left: 0;
	right: 0;
	border-width: 1px 0;
	padding: 20px 32px;
}

.hccb-layout-bar-bottom .hccb-banner { bottom: 0; }
.hccb-layout-bar-top .hccb-banner { top: 0; }

.hccb-layout-bar-bottom .hccb-banner-inner,
.hccb-layout-bar-top .hccb-banner-inner {
	display: flex;
	align-items: center;
	gap: 24px;
	max-width: 1280px;
	margin: 0 auto;
}

.hccb-layout-bar-bottom .hccb-banner-text,
.hccb-layout-bar-top .hccb-banner-text {
	flex: 1 1 auto;
}

.hccb-layout-bar-bottom .hccb-actions,
.hccb-layout-bar-top .hccb-actions {
	margin-top: 0;
	flex: 0 0 auto;
	flex-wrap: nowrap;
}

/* Popup layout */
.hccb-layout-popup .hccb-banner {
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	width: 560px;
	max-width: calc(100vw - 32px);
	max-height: calc(100vh - 32px);
	overflow-y: auto;
	border-radius: var(--hccb-banner-radius, 6px);
}

/* ---------- Buttons ---------- */

.hccb-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	margin: 0;
	padding: 9px 16px;
	min-height: 40px;
	border: 2px solid transparent;
	border-radius: var(--hccb-button-radius, 4px);
	font-family: inherit;
	font-size: inherit;
	font-weight: 500;
	line-height: 1.2;
	text-align: center;
	text-transform: none;
	letter-spacing: normal;
	cursor: pointer;
	box-shadow: none;
	transition: opacity 0.15s ease;
}

.hccb-btn:hover { opacity: 0.85; }

.hccb-btn:focus-visible,
.hccb-close:focus-visible,
.hccb-revisit:focus-visible,
.hccb-switch input:focus-visible + .hccb-slider,
.hccb-cookies summary:focus-visible {
	outline: 2px solid var(--hccb-link, #1863dc);
	outline-offset: 2px;
}

.hccb-btn-accept {
	background: var(--hccb-accept-bg, #1863dc);
	color: var(--hccb-accept-text, #fff);
	border-color: var(--hccb-accept-border, #1863dc);
}

.hccb-btn-reject {
	background: var(--hccb-reject-bg, #fff);
	color: var(--hccb-reject-text, #1863dc);
	border-color: var(--hccb-reject-border, #1863dc);
}

.hccb-btn-customise {
	background: var(--hccb-customise-bg, #fff);
	color: var(--hccb-customise-text, #1863dc);
	border-color: var(--hccb-customise-border, #1863dc);
}

.hccb-btn-save {
	background: var(--hccb-save-bg, #fff);
	color: var(--hccb-save-text, #1863dc);
	border-color: var(--hccb-save-border, #1863dc);
}

/* "Manage preferences" as a small text link, after the two main choices. */
.hccb-actions .hccb-btn-link {
	order: 10;
	flex: 0 0 auto;
	min-height: 0;
	padding: 4px 2px;
	background: transparent;
	border-color: transparent;
	font-weight: 500;
	text-decoration: underline;
	text-underline-offset: 3px;
}

.hccb-layout-box-left .hccb-actions .hccb-btn-link,
.hccb-layout-box-right .hccb-actions .hccb-btn-link,
.hccb-layout-popup .hccb-actions .hccb-btn-link {
	flex: 1 0 100%;
	margin-top: 4px;
}

.hccb-close {
	position: absolute;
	top: 10px;
	right: 10px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	padding: 0;
	margin: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: inherit;
	cursor: pointer;
}

/* ---------- Overlay and preference centre ---------- */

/* The banner steps aside while the preference centre is open. */
.hccb-modal-open .hccb-banner {
	visibility: hidden;
}

.hccb-overlay {
	position: fixed;
	inset: 0;
	z-index: 999998;
	background: var(--hccb-overlay, #000);
	opacity: var(--hccb-overlay-opacity, 0.4);
}

.hccb-modal {
	position: fixed;
	z-index: 1000000;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	display: flex;
	flex-direction: column;
	width: 720px;
	max-width: calc(100vw - 32px);
	max-height: calc(100vh - 48px);
	background: var(--hccb-modal-bg, #fff);
	color: var(--hccb-modal-text, #212121);
	border-radius: var(--hccb-banner-radius, 6px);
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
	outline: none;
}

.hccb-modal-header {
	position: relative;
	padding: 20px 56px 16px 24px;
	border-bottom: 1px solid var(--hccb-modal-border, #ebebeb);
}

.hccb-modal-title {
	font-size: 1.2em !important;
	font-weight: 600;
}

.hccb-modal-close { top: 14px; right: 14px; }

.hccb-modal-body {
	overflow-y: auto;
	padding: 8px 24px 16px;
}

.hccb-intro {
	padding: 12px 0 8px;
}

.hccb-category {
	padding: 16px 0;
	border-bottom: 1px solid var(--hccb-modal-border, #ebebeb);
}

.hccb-category:last-child { border-bottom: 0; }

.hccb-category-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	margin-bottom: 6px;
}

.hccb-category-name { font-weight: 600; }

.hccb-always-active {
	color: var(--hccb-always-active, #008000);
	font-weight: 600;
	font-size: 0.9em;
	white-space: nowrap;
}

.hccb-category-description { opacity: 0.9; }

.hccb-cookies { margin-top: 8px; }

.hccb-cookies summary {
	cursor: pointer;
	color: var(--hccb-link, #1863dc);
	font-size: 0.9em;
	font-weight: 500;
}

.hccb-cookie-table {
	width: 100%;
	margin-top: 8px;
	border-collapse: collapse;
	font-size: 0.9em;
}

.hccb-cookie-table th,
.hccb-cookie-table td {
	padding: 6px 8px;
	border: 1px solid var(--hccb-modal-border, #ebebeb);
	text-align: left;
	vertical-align: top;
	word-break: break-word;
}

.hccb-no-cookies {
	margin-top: 8px !important;
	font-size: 0.9em !important;
	opacity: 0.75;
}

.hccb-modal-footer {
	display: grid;
	grid-auto-flow: column;
	grid-auto-columns: 1fr;
	gap: 8px;
	padding: 16px 24px;
	border-top: 1px solid var(--hccb-modal-border, #ebebeb);
}

/* Toggle switch */
.hccb-switch {
	position: relative;
	display: inline-block;
	flex: 0 0 auto;
	width: 44px;
	height: 24px;
	margin: 0;
}

.hccb-switch input {
	position: absolute;
	opacity: 0;
	width: 100%;
	height: 100%;
	margin: 0;
	cursor: pointer;
	z-index: 1;
}

.hccb-slider {
	position: absolute;
	inset: 0;
	border-radius: 24px;
	background: var(--hccb-toggle-off, #d0d5d2);
	transition: background 0.2s ease;
}

.hccb-slider::before {
	content: "";
	position: absolute;
	top: 3px;
	left: 3px;
	width: 18px;
	height: 18px;
	border-radius: 50%;
	background: #fff;
	transition: transform 0.2s ease;
}

.hccb-switch input:checked + .hccb-slider { background: var(--hccb-toggle-on, #1863dc); }
.hccb-switch input:checked + .hccb-slider::before { transform: translateX(20px); }

/* ---------- Revisit button ---------- */

.hccb-revisit {
	position: fixed;
	z-index: 999997;
	bottom: 16px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 48px;
	height: 48px;
	padding: 0;
	margin: 0;
	border: 0;
	border-radius: 50%;
	background: var(--hccb-revisit-bg, #0056a7);
	color: var(--hccb-revisit-icon, #fff);
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
	cursor: pointer;
}

.hccb-revisit-left { left: 16px; }
.hccb-revisit-right { right: 16px; }

/* ---------- Blocked embed placeholder ---------- */

.hccb-placeholder {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 12px;
	width: 100%;
	padding: 24px;
	background: var(--hccb-banner-bg, #fff);
	color: var(--hccb-banner-text, #212121);
	border: 1px solid var(--hccb-banner-border, #ddd);
	border-radius: var(--hccb-banner-radius, 6px);
	text-align: center;
}

.hccb-placeholder p { margin: 0; }

/* ---------- Small screens ---------- */

@media (max-width: 680px) {
	.hccb-layout-box-left .hccb-banner,
	.hccb-layout-box-right .hccb-banner {
		left: 16px;
		right: 16px;
		bottom: 16px;
		width: auto;
		max-width: none;
	}

	.hccb-layout-bar-bottom .hccb-banner-inner,
	.hccb-layout-bar-top .hccb-banner-inner {
		flex-direction: column;
		align-items: stretch;
		gap: 16px;
	}

	.hccb-layout-bar-bottom .hccb-banner,
	.hccb-layout-bar-top .hccb-banner {
		padding: 20px;
	}

	.hccb-actions,
	.hccb-layout-bar-bottom .hccb-actions,
	.hccb-layout-bar-top .hccb-actions,
	.hccb-modal-footer {
		flex-direction: column;
		flex-wrap: nowrap;
	}

	.hccb-choices,
	.hccb-modal-footer {
		grid-auto-flow: row;
	}

	.hccb-layout-box-left .hccb-actions .hccb-btn-link,
	.hccb-layout-box-right .hccb-actions .hccb-btn-link,
	.hccb-layout-popup .hccb-actions .hccb-btn-link,
	.hccb-actions .hccb-btn-link {
		flex: 0 0 auto;
		align-self: center;
	}

	.hccb-banner {
		max-height: 80vh;
		overflow-y: auto;
	}
}

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

/* ---------- Admin preview: show everything in place, nothing fixed ---------- */

.hccb-preview .hccb-banner,
.hccb-preview .hccb-modal,
.hccb-preview .hccb-revisit {
	position: relative;
	inset: auto;
	transform: none;
	z-index: auto;
	max-height: none;
}

.hccb-preview .hccb-modal {
	margin-top: 24px;
	width: 100%;
	max-width: 720px;
}

.hccb-preview .hccb-revisit {
	margin-top: 24px;
}

.hccb-preview.hccb-layout-box-left .hccb-banner,
.hccb-preview.hccb-layout-box-right .hccb-banner,
.hccb-preview.hccb-layout-popup .hccb-banner {
	max-width: 100%;
}
