/*
 * Complianz's cookie banner in Kingtex's style (1.0.8; enqueued after
 * Complianz's own CSS — inc/assets.php — and only when Complianz is on).
 * CSS only: the texts, the categories and the position are Complianz →
 * Банер за бисквитки settings (docs/LAUNCH.md, К).
 *
 *   the card       bottom left, 380 px; on a phone across the bottom, above
 *                  the tab bar, or above „Добави в количката“ on a product
 *                  page (and on a wide screen too when that bar slides in)
 *   its buttons    „Отказвам“ and „Приемам“, the same dark pill — equal
 *                  weight — and „Настройки“, a link under them; no ×
 *   „Настройки“    the window „Настройки за бисквитки“: „Необходими“ (always
 *                  on) and „Анализ“ (a switch), Отказвам / Запази избора /
 *                  Приемам, and „Политика за бисквитки · Поверителност“
 *   the tab        Complianz's floating „Manage consent“ is hidden: the
 *                  footer's „Настройки за бисквитки“ reopens the banner
 *
 * Everything is under #cmplz-cookiebanner-container and mostly !important:
 * Complianz's CSS comes after the theme's and sets the same properties.
 */

:root {
	--kt-consent-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
}

#cmplz-cookiebanner-container .cmplz-cookiebanner {
	left: 24px !important;
	right: auto !important;
	top: auto !important;
	bottom: var(--kt-consent-bottom) !important;
	transform: none !important;
	width: 380px !important;
	min-width: 0 !important;
	max-width: calc(100vw - 32px) !important;
	height: auto !important;
	max-height: calc(100vh - var(--kt-consent-bottom) - 16px) !important;
	overflow-y: auto !important;
	overscroll-behavior: contain;
	zoom: 1 !important;
	display: flex !important;
	flex-direction: column;
	gap: 0 !important;
	padding: 20px 20px 14px !important;
	border: 0 !important;
	border-radius: 24px !important;
	background: var(--white) !important;
	box-shadow: 0 24px 60px -18px rgba(21, 19, 28, 0.45), 0 0 0 1px rgba(21, 19, 28, 0.06) !important;
	font-family: var(--font-body);
	color: var(--ink);
	transition: bottom 0.25s var(--ease);
}

#cmplz-cookiebanner-container .cmplz-cookiebanner.cmplz-hidden,
#cmplz-cookiebanner-container .cmplz-cookiebanner.cmplz-dismissed {
	display: none !important;
}

/* What the card does not need */
#cmplz-cookiebanner-container .cmplz-close,
#cmplz-cookiebanner-container .cmplz-logo,
#cmplz-cookiebanner-container .cmplz-divider,
#cmplz-cookiebanner-container .cmplz-information,
#cmplz-manage-consent {
	display: none !important;
}

/* Icon in a circle + the title */
#cmplz-cookiebanner-container .cmplz-header {
	display: flex !important;
	align-items: center;
	gap: 12px;
	max-height: none !important;
	margin: 0 0 10px !important;
}

#cmplz-cookiebanner-container .cmplz-header::before {
	content: "";
	flex: none;
	width: 40px;
	height: 40px;
	border-radius: 999px;
	background: var(--tint-sun) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2315131c' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3a9 9 0 1 0 9 9 4 4 0 0 1-4-4 4 4 0 0 1-5-5z'/%3E%3Ccircle cx='8.5' cy='11.5' r='.9' fill='%2315131c'/%3E%3Ccircle cx='12.5' cy='16' r='.9' fill='%2315131c'/%3E%3Ccircle cx='16' cy='12.5' r='.9' fill='%2315131c'/%3E%3C/svg%3E") center / 22px no-repeat;
}

#cmplz-cookiebanner-container .cmplz-title {
	display: block !important;
	margin: 0 !important;
	font: 700 16px/1.3 var(--font-display) !important;
	color: var(--ink) !important;
	text-align: left;
}

#cmplz-cookiebanner-container .cmplz-body {
	margin: 0 !important;
	max-height: none !important;
	overflow: visible !important;
	min-width: 0 !important;
}

#cmplz-cookiebanner-container .cmplz-message {
	width: auto !important;
	margin: 0 0 14px !important;
	font: 14px/1.5 var(--font-body) !important;
	color: var(--ink-2) !important;
}

#cmplz-cookiebanner-container .cmplz-message p {
	margin: 0;
}

#cmplz-cookiebanner-container .cmplz-message a {
	color: var(--ink) !important;
	font-weight: 600;
	text-decoration: underline;
	text-underline-offset: 3px;
}

/* „Отказвам“ and „Приемам“: the same dark pill; „Настройки“: a link under them */
#cmplz-cookiebanner-container .cmplz-buttons {
	display: flex !important;
	flex-direction: row !important;
	flex-wrap: wrap;
	gap: 8px !important;
}

#cmplz-cookiebanner-container .cmplz-buttons .cmplz-btn {
	zoom: 1 !important;
	flex: 1 1 calc(50% - 4px);
	width: auto !important;
	height: 46px !important;
	min-height: 46px !important;
	padding: 0 16px !important;
	border: 0 !important;
	border-radius: 999px !important;
	background: var(--ink) !important;
	color: var(--white) !important;
	font: 600 15px var(--font-body) !important;
	line-height: 46px !important;
	white-space: nowrap;
}

#cmplz-cookiebanner-container .cmplz-buttons .cmplz-btn:hover {
	background: var(--ink-hover) !important;
}

#cmplz-cookiebanner-container .cmplz-buttons .cmplz-deny { order: 1; }
#cmplz-cookiebanner-container .cmplz-buttons .cmplz-accept { order: 3; }
#cmplz-cookiebanner-container .cmplz-buttons .cmplz-save-preferences { order: 2; }

#cmplz-cookiebanner-container .cmplz-buttons .cmplz-view-preferences {
	order: 4;
	flex: 1 1 100%;
	height: 32px !important;
	min-height: 32px !important;
	margin-top: 2px;
	background: none !important;
	color: var(--ink-2) !important;
	font-size: 14px !important;
	font-weight: 500 !important;
	line-height: 32px !important;
	text-decoration: underline;
	text-underline-offset: 3px;
}

#cmplz-cookiebanner-container .cmplz-buttons .cmplz-view-preferences:hover {
	background: none !important;
	color: var(--ink) !important;
}

#cmplz-cookiebanner-container .cmplz-documents {
	display: none !important;
}

/* „Настройки“ → „Настройки за бисквитки“: a window in the middle */
#cmplz-cookiebanner-container .cmplz-cookiebanner.cmplz-categories-visible {
	left: 50% !important;
	top: 50% !important;
	bottom: auto !important;
	transform: translate(-50%, -50%) !important;
	width: 520px !important;
	max-height: calc(100vh - 32px) !important;
	overflow-y: auto !important;
	padding: 24px 24px 18px !important;
	box-shadow: 0 0 0 100vmax rgba(21, 19, 28, 0.45), 0 30px 80px -20px rgba(21, 19, 28, 0.6) !important;
}

#cmplz-cookiebanner-container .cmplz-categories-visible .cmplz-header::before {
	display: none;
}

#cmplz-cookiebanner-container .cmplz-categories-visible .cmplz-title {
	font-size: 0 !important;
}

#cmplz-cookiebanner-container .cmplz-categories-visible .cmplz-title::before {
	content: "Настройки за бисквитки";
	font-size: 20px;
}

#cmplz-cookiebanner-container .cmplz-categories-visible .cmplz-message {
	display: none !important;
}

#cmplz-cookiebanner-container .cmplz-categories {
	width: auto !important;
}

#cmplz-cookiebanner-container .cmplz-categories.cmplz-fade-in {
	display: flex !important;
	flex-direction: column;
	gap: 10px;
	margin: 0 0 16px;
}

#cmplz-cookiebanner-container .cmplz-categories.cmplz-fade-in::before {
	content: "Изберете кои бисквитки да ползваме. Можете да промените избора си по всяко време от „Настройки за бисквитки“ във футъра.";
	font: 14px/1.5 var(--font-body);
	color: var(--ink-2);
	margin-bottom: 4px;
}

#cmplz-cookiebanner-container .cmplz-category {
	margin: 0 !important;
	padding: 14px 16px;
	border: 1px solid var(--line);
	border-radius: 16px;
	background: var(--white) !important;
}

#cmplz-cookiebanner-container .cmplz-category .cmplz-category-header {
	display: flex !important;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 0 !important;
}

#cmplz-cookiebanner-container .cmplz-category-title {
	font: 700 15px var(--font-body) !important;
	color: var(--ink) !important;
}

#cmplz-cookiebanner-container .cmplz-category-toggle {
	display: none !important;
}

#cmplz-cookiebanner-container .cmplz-always-active {
	padding: 4px 10px;
	border-radius: 999px;
	background: var(--tint-mint);
	color: var(--success) !important;
	font: 600 12px var(--font-body) !important;
}

#cmplz-cookiebanner-container .cmplz-category .cmplz-description,
#cmplz-cookiebanner-container .cmplz-category .cmplz-description[hidden] {
	display: block !important;
	padding: 6px 0 0 !important;
	font: 13px/1.5 var(--font-body) !important;
	color: var(--muted) !important;
}

/* The switch */
#cmplz-cookiebanner-container .cmplz-banner-checkbox input.cmplz-consent-checkbox:not([data-category=cmplz_functional]) {
	position: relative !important;
	display: block !important;
	width: 44px !important;
	height: 26px !important;
	margin: 0 !important;
	border-radius: 999px;
	background: var(--line-2);
	appearance: none;
	-webkit-appearance: none;
	cursor: pointer;
	transition: background-color 0.15s;
	opacity: 1 !important;
}

#cmplz-cookiebanner-container .cmplz-banner-checkbox input.cmplz-consent-checkbox:not([data-category=cmplz_functional])::after {
	content: "";
	position: absolute;
	top: 3px;
	left: 3px;
	width: 20px;
	height: 20px;
	border-radius: 999px;
	background: var(--white);
	box-shadow: 0 1px 3px rgba(21, 19, 28, 0.3);
	transition: transform 0.15s;
}

#cmplz-cookiebanner-container .cmplz-banner-checkbox input.cmplz-consent-checkbox:checked {
	background: var(--ink);
}

#cmplz-cookiebanner-container .cmplz-banner-checkbox input.cmplz-consent-checkbox:checked::after {
	transform: translateX(18px);
}

/* The switch's label: Complianz draws its own slider on it — not here; it is
   the switch's 44 px place to tap instead (a touch screen), over the switch */
#cmplz-cookiebanner-container .cmplz-banner-checkbox {
	position: relative;
	display: inline-flex;
}

#cmplz-cookiebanner-container .cmplz-categories .cmplz-category .cmplz-banner-checkbox .cmplz-label {
	position: absolute !important;
	inset: -9px -4px;
	display: block !important;
	margin: 0 !important;
	padding: 0 !important;
	cursor: pointer;
}

#cmplz-cookiebanner-container .cmplz-categories .cmplz-category .cmplz-banner-checkbox .cmplz-label::before,
#cmplz-cookiebanner-container .cmplz-categories .cmplz-category .cmplz-banner-checkbox .cmplz-label::after {
	content: none !important;
	display: none !important;
}

#cmplz-cookiebanner-container .cmplz-functional .cmplz-label {
	display: none !important;
}

/* In the window: three buttons in a row, „Запази избора“ the outline one */
#cmplz-cookiebanner-container .cmplz-categories-visible .cmplz-buttons .cmplz-btn {
	flex: 1 1 0;
	padding: 0 10px !important;
	font-size: 14px !important;
}

#cmplz-cookiebanner-container .cmplz-categories-visible .cmplz-buttons .cmplz-save-preferences {
	background: var(--white) !important;
	color: var(--ink) !important;
	box-shadow: inset 0 0 0 1.5px var(--ink);
}

#cmplz-cookiebanner-container .cmplz-categories-visible .cmplz-documents {
	display: flex !important;
	justify-content: center;
	margin-top: 12px;
}

#cmplz-cookiebanner-container .cmplz-documents ul {
	display: flex;
	gap: 6px 14px;
	margin: 0;
	padding: 0;
	list-style: none;
}

#cmplz-cookiebanner-container .cmplz-documents li {
	display: flex;
	align-items: center;
	gap: 14px;
}

#cmplz-cookiebanner-container .cmplz-documents li + li::before {
	content: "·";
	color: var(--muted);
}

#cmplz-cookiebanner-container .cmplz-documents .impressum,
#cmplz-cookiebanner-container .cmplz-documents li:has(.impressum),
#cmplz-cookiebanner-container .cmplz-documents li:has(.cmplz-link[href="#"]) {
	display: none !important;
}

/* The approved words, whatever the pages are called: „Политика за бисквитки · Поверителност“ */
#cmplz-cookiebanner-container .cmplz-documents .cmplz-link {
	display: inline-flex;
	align-items: center;
	min-height: 32px;
	font: 13px var(--font-body);
	font-size: 0 !important;
	color: var(--ink-2);
	text-decoration: underline;
	text-underline-offset: 3px;
}

#cmplz-cookiebanner-container .cmplz-documents .cmplz-link::after {
	font-size: 13px;
}

#cmplz-cookiebanner-container .cmplz-documents .cookie-statement::after {
	content: "Политика за бисквитки";
}

#cmplz-cookiebanner-container .cmplz-documents .privacy-statement::after {
	content: "Поверителност";
}

#cmplz-cookiebanner-container .cmplz-documents .cmplz-link:hover {
	color: var(--ink);
}

/* Focus: as everywhere on the site */
#cmplz-cookiebanner-container :is(.cmplz-btn, .cmplz-link, .cmplz-message a, input):focus-visible {
	outline: 3px solid var(--focus) !important;
	outline-offset: 2px;
}

/* A wide screen: the add-to-cart bar slides in at the bottom (84 px) */
html:has([data-buybar].is-visible) {
	--kt-consent-bottom: calc(108px + env(safe-area-inset-bottom, 0px));
}

/* Phones: a card across the bottom, above the tab bar and the add-to-cart bar */
@media (max-width: 700px) {
	:root {
		--kt-consent-bottom: calc(96px + env(safe-area-inset-bottom, 0px));
	}

	/* the product page: no tab bar, the add-to-cart bar always there (83 px) */
	body.has-buybar {
		--kt-consent-bottom: calc(95px + env(safe-area-inset-bottom, 0px));
	}

	#cmplz-cookiebanner-container .cmplz-cookiebanner {
		left: 12px !important;
		right: 12px !important;
		width: auto !important;
		max-width: none !important;
		padding: 16px 16px 10px !important;
		border-radius: 22px !important;
	}

	#cmplz-cookiebanner-container .cmplz-cookiebanner.cmplz-categories-visible {
		left: 0 !important;
		right: 0 !important;
		top: auto !important;
		bottom: 0 !important;
		transform: none !important;
		width: auto !important;
		max-height: 88vh !important;
		padding: 22px 16px calc(14px + env(safe-area-inset-bottom, 0px)) !important;
		border-radius: 24px 24px 0 0 !important;
	}

	/* a page with no tab bar (the checkout) */
	:root:not(:has(.tabbar)) {
		--kt-consent-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
	}
}

/* A narrow phone: in the window „Отказвам“ and „Приемам“ side by side, „Запази избора“ under them */
@media (max-width: 400px) {
	#cmplz-cookiebanner-container .cmplz-categories-visible .cmplz-buttons .cmplz-btn {
		flex: 1 1 calc(50% - 4px);
	}

	#cmplz-cookiebanner-container .cmplz-categories-visible .cmplz-buttons .cmplz-save-preferences {
		flex-basis: 100%;
		order: 4;
	}
}

/* Touch screens: „Настройки“ and the links under the window's buttons are 44 px to tap */
@media (pointer: coarse) {
	#cmplz-cookiebanner-container .cmplz-documents .cmplz-link {
		min-height: 44px;
	}

	#cmplz-cookiebanner-container .cmplz-buttons .cmplz-view-preferences {
		height: 44px !important;
		min-height: 44px !important;
		margin-top: 0;
		line-height: 44px !important;
	}
}

/* A phone on its side (≤ 400 px high): Complianz shrinks its banner to 60 %
   (zoom) — unreadable, too small to tap. At full size the card fits; the
   window scrolls inside. */
@media (max-height: 400px) {
	#cmplz-cookiebanner-container .cmplz-cookiebanner,
	#cmplz-cookiebanner-container .cmplz-cookiebanner :is(.cmplz-header, .cmplz-body, .cmplz-close, .cmplz-documents, .cmplz-information, .cmplz-buttons, .cmplz-btn) {
		zoom: 1 !important;
	}

	#cmplz-cookiebanner-container .cmplz-cookiebanner {
		padding: 14px 18px 10px !important;
	}

	#cmplz-cookiebanner-container .cmplz-cookiebanner.cmplz-categories-visible {
		max-height: calc(100vh - 16px) !important;
	}
}
