/*
 * Adalo Cookie Bar — the bar and the modal (SPEC §6.2, §6.3, screenshots 1-3).
 *
 * Every colour and every type setting is a CSS custom property printed into <head>
 * by Frontend\InlineStyles (SPEC §11). Each var() carries a fallback so the bar
 * still looks sane if that style block goes missing — an aggressive HTML optimizer
 * on the client's site is enough for that to happen.
 *
 * Specificity: every rule is anchored in .adalo-cb-root, which is enough for normal
 * themes without forcing priority. The `all: revert` reset on the container is
 * deliberately not used: for inherited properties it behaves like `inherit`, so it
 * would prevent nothing these rules do not already set explicitly, and it would
 * break the "inherit the theme font" option.
 */

.adalo-cb-root {
	box-sizing: border-box;
	margin: 0;
	font-family: var(--adalo-cb-font-family, inherit);
	font-size: var(--adalo-cb-font-size, 14px);
	line-height: 1.5;
	color: var(--adalo-cb-text, #212121);
	text-align: left;
}

.adalo-cb-root *,
.adalo-cb-root *::before,
.adalo-cb-root *::after {
	box-sizing: inherit;
}

.adalo-cb-root p {
	margin: 0 0 0.75em;
	padding: 0;
	color: inherit;
	font-size: inherit;
	line-height: inherit;
}

.adalo-cb-root p:last-child {
	margin-bottom: 0;
}

/* Screen readers only — visually hidden, but not display:none. */
.adalo-cb-sr {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	border: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	clip-path: inset(50%);
	white-space: nowrap;
}

/* --- Buttons --- */

.adalo-cb-btn {
	display: inline-block;
	min-width: 150px;
	margin: 0;
	padding: 11px 18px;
	border: 1px solid var(--adalo-cb-primary, #1863dc);
	border-radius: var(--adalo-cb-radius, 4px);
	background: transparent;
	font-family: inherit;
	font-size: inherit;
	line-height: 1.2;
	text-align: center;
	text-decoration: none;
	cursor: pointer;
	transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.adalo-cb-btn-outline {
	color: var(--adalo-cb-primary, #1863dc);
}

.adalo-cb-btn-outline:hover,
.adalo-cb-btn-outline:focus {
	border-color: var(--adalo-cb-primary-hover, #134eae);
	color: var(--adalo-cb-primary-hover, #134eae);
}

.adalo-cb-btn-solid {
	background: var(--adalo-cb-primary, #1863dc);
	color: var(--adalo-cb-primary-text, #ffffff);
}

.adalo-cb-btn-solid:hover,
.adalo-cb-btn-solid:focus {
	border-color: var(--adalo-cb-primary-hover, #134eae);
	background: var(--adalo-cb-primary-hover, #134eae);
}

.adalo-cb-btn:focus-visible,
.adalo-cb-close:focus-visible,
.adalo-cb-link:focus-visible,
.adalo-cb-category-toggle:focus-visible {
	outline: 2px solid var(--adalo-cb-primary, #1863dc);
	outline-offset: 2px;
}

.adalo-cb-link {
	display: inline-block;
	margin: 0;
	padding: 0;
	border: 0;
	background: none;
	color: var(--adalo-cb-primary, #1863dc);
	font-family: inherit;
	font-size: inherit;
	text-decoration: none;
	cursor: pointer;
}

.adalo-cb-link:hover {
	color: var(--adalo-cb-primary-hover, #134eae);
	text-decoration: underline;
}

/*
 * --- The bar and the popup (screenshot 1, screenshot 4) ---
 *
 * Both layouts share one piece of markup and differ only in the class the template
 * prints on the root (Frontend\BannerRenderer::LAYOUT_CLASSES). .adalo-cb-bar therefore
 * holds only what every layout has — surface, stacking, scrolling — and the geometry
 * lives in .adalo-cb-bar-bottom and .adalo-cb-popup.
 *
 * The popup deliberately dims nothing and blocks nothing: a backdrop without a focus
 * trap is a trap for screen readers, and a backdrop with one is a cookie wall the brief
 * does not want. Closing without a choice is still not consent (SPEC §6.2) — there is
 * nothing to close, the card stays until the visitor decides.
 */

.adalo-cb-bar {
	position: fixed;
	z-index: var(--adalo-cb-z-index, 9999);
	overflow-y: auto;
	background: var(--adalo-cb-surface, #ffffff);
}

/* The bar at the bottom edge — the layout every site had before phase 10. */
.adalo-cb-bar-bottom {
	right: 0;
	bottom: 0;
	left: 0;
	max-height: 50vh;
	padding: 16px 20px;
	border-top: 1px solid var(--adalo-cb-border, rgba(33, 33, 33, 0.16));
	box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.08);
}

/* The popup: one card, three positions (screenshot 4). */
.adalo-cb-popup {
	width: calc(100% - 40px);
	max-width: 440px;
	max-height: calc(100vh - 40px);
	padding: 24px;
	border: 1px solid var(--adalo-cb-border, rgba(33, 33, 33, 0.16));
	border-radius: 10px;
	box-shadow: 0 6px 28px rgba(0, 0, 0, 0.18);
}

.adalo-cb-popup-center {
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
}

.adalo-cb-popup-bottom-left {
	bottom: 20px;
	left: 20px;
}

.adalo-cb-popup-bottom-right {
	right: 20px;
	bottom: 20px;
}

.adalo-cb-popup .adalo-cb-bar-inner {
	display: block;
}

.adalo-cb-popup .adalo-cb-bar-copy {
	margin-bottom: 20px;
}

.adalo-cb-popup .adalo-cb-bar-actions {
	gap: 10px;
}

/*
 * Three buttons in one row inside a 440px card, so the 150px minimum of the bar has to
 * go: they share whatever the card has and the label decides nothing about the width.
 */
.adalo-cb-popup .adalo-cb-btn {
	flex: 1 1 0;
	min-width: 0;
	padding-right: 8px;
	padding-left: 8px;
}

.adalo-cb-bar-inner {
	display: flex;
	align-items: center;
	gap: 28px;
	max-width: 1440px;
	margin: 0 auto;
}

.adalo-cb-bar-copy {
	flex: 1 1 auto;
	min-width: 0;
}

.adalo-cb-bar-heading {
	margin: 0 0 6px;
	font-size: var(--adalo-cb-heading-size, 17px);
	font-weight: var(--adalo-cb-heading-weight, 700);
	line-height: 1.3;
}

.adalo-cb-bar-actions {
	display: flex;
	flex: 0 0 auto;
	gap: 12px;
}

/* --- The modal (screenshots 2 and 3) --- */

.adalo-cb-overlay {
	position: fixed;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	/* One above the bar, so the modal covers it too. */
	z-index: calc(var(--adalo-cb-z-index, 9999) + 1);
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
	background: var(--adalo-cb-overlay, rgba(0, 0, 0, 0.5));
}

.adalo-cb-modal {
	display: flex;
	flex-direction: column;
	width: 100%;
	max-width: 880px;
	max-height: 90vh;
	background: var(--adalo-cb-surface, #ffffff);
	border-radius: 6px;
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
	overflow: hidden;
}

.adalo-cb-modal-head {
	display: flex;
	flex: 0 0 auto;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding: 16px 24px;
	border-bottom: 1px solid var(--adalo-cb-border, rgba(33, 33, 33, 0.16));
}

.adalo-cb-modal-title {
	margin: 0;
	font-size: calc(var(--adalo-cb-heading-size, 17px) + 2px);
	font-weight: var(--adalo-cb-heading-weight, 700);
	line-height: 1.3;
	color: inherit;
}

.adalo-cb-close {
	flex: 0 0 auto;
	width: 32px;
	height: 32px;
	padding: 0;
	border: 0;
	border-radius: 4px;
	background: none;
	color: var(--adalo-cb-text-muted, #6d6d6d);
	font-size: 24px;
	line-height: 1;
	cursor: pointer;
}

.adalo-cb-close:hover {
	color: var(--adalo-cb-text, #212121);
}

.adalo-cb-modal-body {
	flex: 1 1 auto;
	padding: 18px 24px;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
}

.adalo-cb-intro-text {
	margin: 0 0 1em;
}

.adalo-cb-intro-more {
	margin: 0;
}

/* --- Category accordion --- */

.adalo-cb-categories {
	margin: 18px 0 0;
	padding: 0;
	list-style: none;
}

.adalo-cb-category {
	margin: 0;
	padding: 14px 0;
	border-top: 1px solid var(--adalo-cb-border, rgba(33, 33, 33, 0.16));
	list-style: none;
}

.adalo-cb-category-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
}

.adalo-cb-category-toggle {
	display: flex;
	flex: 1 1 auto;
	align-items: center;
	gap: 10px;
	margin: 0;
	padding: 0;
	border: 0;
	background: none;
	color: inherit;
	font-family: inherit;
	font-size: inherit;
	text-align: left;
	cursor: pointer;
}

.adalo-cb-category-name {
	font-weight: 700;
}

.adalo-cb-caret {
	display: block;
	width: 7px;
	height: 7px;
	border-right: 1.5px solid var(--adalo-cb-text, #212121);
	border-bottom: 1.5px solid var(--adalo-cb-text, #212121);
	transform: rotate(-45deg);
	transition: transform 0.15s ease;
}

.adalo-cb-category-toggle[aria-expanded="true"] .adalo-cb-caret {
	transform: rotate(45deg);
}

.adalo-cb-category-desc {
	margin: 10px 0 0;
	color: var(--adalo-cb-text, #212121);
}

.adalo-cb-category-text {
	margin: 0 0 0.75em;
}

.adalo-cb-always {
	flex: 0 0 auto;
	color: var(--adalo-cb-active, #15803d);
	font-weight: 700;
}

.adalo-cb-cookies {
	margin: 12px 0 0;
	padding: 14px 16px;
	background: var(--adalo-cb-surface-alt, #f5f5f5);
	border: 1px solid var(--adalo-cb-border, rgba(33, 33, 33, 0.16));
	border-radius: 4px;
}

.adalo-cb-cookies-empty {
	margin: 0;
	color: var(--adalo-cb-text-muted, #6d6d6d);
}

/* --- The toggle: a real checkbox that looks like a switch (SPEC §6.3) --- */

.adalo-cb-switch {
	position: relative;
	display: inline-flex;
	flex: 0 0 auto;
	align-items: center;
	cursor: pointer;
}

.adalo-cb-switch-input {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	margin: 0;
	opacity: 0;
	cursor: pointer;
}

.adalo-cb-switch-track {
	display: block;
	width: 44px;
	height: 24px;
	border-radius: 12px;
	background: var(--adalo-cb-border-strong, rgba(33, 33, 33, 0.32));
	transition: background-color 0.15s ease;
}

.adalo-cb-switch-knob {
	display: block;
	width: 18px;
	height: 18px;
	margin: 3px;
	border-radius: 50%;
	background: #ffffff;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
	transition: transform 0.15s ease;
}

.adalo-cb-switch-input:checked + .adalo-cb-switch-track {
	background: var(--adalo-cb-primary, #1863dc);
}

.adalo-cb-switch-input:checked + .adalo-cb-switch-track .adalo-cb-switch-knob {
	transform: translateX(20px);
}

.adalo-cb-switch-input:focus-visible + .adalo-cb-switch-track {
	outline: 2px solid var(--adalo-cb-primary, #1863dc);
	outline-offset: 2px;
}

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

.adalo-cb-modal-foot {
	display: flex;
	flex: 0 0 auto;
	gap: 12px;
	padding: 16px 24px;
	border-top: 1px solid var(--adalo-cb-border, rgba(33, 33, 33, 0.16));
	background: var(--adalo-cb-surface, #ffffff);
}

.adalo-cb-modal-foot .adalo-cb-btn {
	flex: 1 1 0;
	min-width: 0;
}

/* --- Floating button for withdrawing consent (SPEC §6.4) --- */

.adalo-cb-float {
	position: fixed;
	bottom: 20px;
	z-index: var(--adalo-cb-z-index, 9999);
	display: flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 1px solid var(--adalo-cb-border, rgba(33, 33, 33, 0.16));
	border-radius: 50%;
	background: var(--adalo-cb-surface, #ffffff);
	color: var(--adalo-cb-primary, #1863dc);
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
	cursor: pointer;
}

.adalo-cb-float-bottom-left {
	left: 20px;
}

.adalo-cb-float-bottom-right {
	right: 20px;
}

.adalo-cb-float:focus-visible {
	outline: 2px solid var(--adalo-cb-primary, #1863dc);
	outline-offset: 2px;
}

.adalo-cb-float svg {
	display: block;
	width: 24px;
	height: 24px;
	fill: currentColor;
}

/* --- Mobile (SPEC §6.2: text above the buttons, accept-all first) --- */

@media (max-width: 781px) {
	.adalo-cb-bar {
		padding: 14px 16px;
	}

	/*
	 * On a phone every layout is the bar at the bottom edge: a card in the middle of a
	 * 375px screen is the same full-width block anyway, only with corners and a shadow
	 * nobody asked for. The inner classes do not change between layouts, so the rules
	 * below this one (stacked buttons, "Přijmout vše" first) already apply to the card.
	 */
	.adalo-cb-popup {
		top: auto;
		right: 0;
		bottom: 0;
		left: 0;
		width: 100%;
		max-width: none;
		max-height: 50vh;
		transform: none;
		border: 0;
		border-top: 1px solid var(--adalo-cb-border, rgba(33, 33, 33, 0.16));
		border-radius: 0;
		box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.08);
	}

	.adalo-cb-popup .adalo-cb-bar-copy {
		margin-bottom: 0;
	}

	/*
	 * Back to the bar's own buttons: the row becomes a column here, and "flex: 1 1 0"
	 * would size them along the wrong axis.
	 */
	.adalo-cb-popup .adalo-cb-btn {
		flex: 0 0 auto;
		padding-right: 18px;
		padding-left: 18px;
	}

	.adalo-cb-bar-inner {
		display: block;
	}

	.adalo-cb-bar-actions {
		/*
		 * column-reverse rather than order: the DOM order stays "Přizpůsobit,
		 * Odmítnout, Přijmout vše", so Tab still walks the buttons the way it does on
		 * the desktop, while "Přijmout vše" is visually first as SPEC §6.2 asks.
		 */
		flex-direction: column-reverse;
		margin-top: 14px;
	}

	.adalo-cb-btn {
		width: 100%;
		min-width: 0;
	}

	.adalo-cb-overlay {
		padding: 0;
	}

	.adalo-cb-modal {
		max-height: 100vh;
		border-radius: 0;
	}

	.adalo-cb-modal-foot {
		flex-direction: column-reverse;
	}

	.adalo-cb-category-head {
		align-items: flex-start;
	}
}

/* --- The visitor asked for no animation --- */

@media (prefers-reduced-motion: reduce) {
	.adalo-cb-root *,
	.adalo-cb-root *::before,
	.adalo-cb-root *::after {
		transition-duration: 0.01ms;
		animation-duration: 0.01ms;
	}
}

/* --- The cookie table inside a category (screenshot 3) --- */

.adalo-cb-cookie-table {
	width: 100%;
	border-collapse: collapse;
	font-size: calc(var(--adalo-cb-font-size, 14px) - 1px);
	text-align: left;
}

.adalo-cb-cookie-table th {
	padding: 6px 10px 6px 0;
	font-weight: 600;
	color: var(--adalo-cb-text, #212121);
	white-space: nowrap;
	border-bottom: 1px solid var(--adalo-cb-border, rgba(33, 33, 33, 0.16));
}

/* The description gets whatever is left: it is the only column that needs the room. */
.adalo-cb-cookie-table th:first-child {
	width: 22%;
}

.adalo-cb-cookie-table th:nth-child(2) {
	width: 20%;
}

.adalo-cb-cookie-table td {
	padding: 8px 10px 8px 0;
	vertical-align: top;
	color: var(--adalo-cb-text-muted, #6d6d6d);
	border-bottom: 1px solid var(--adalo-cb-border, rgba(33, 33, 33, 0.16));
}

.adalo-cb-cookie-table tr:last-child td {
	border-bottom: 0;
}

.adalo-cb-cookie-name {
	font-family: var(--adalo-cb-font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
	color: var(--adalo-cb-text, #212121);
	word-break: break-all;
}

@media (max-width: 782px) {
	/* The table flips into one block per cookie, the same way the bar flips (SPEC §5). */
	.adalo-cb-cookie-table thead {
		display: none;
	}

	.adalo-cb-cookie-table tr {
		display: block;
		padding: 8px 0;
		border-bottom: 1px solid var(--adalo-cb-border, rgba(33, 33, 33, 0.16));
	}

	.adalo-cb-cookie-table td {
		display: block;
		padding: 2px 0;
		border-bottom: 0;
	}

	.adalo-cb-cookie-table td::before {
		content: attr(data-adalo-cb-label) ": ";
		font-weight: 600;
		color: var(--adalo-cb-text, #212121);
	}
}

/* --- The same table inside a page, via [adalo_cb_cookie_table] (SPEC §5) --- */

.adalo-cb-cookie-policy .adalo-cb-cookie-group + .adalo-cb-cookie-group {
	margin-top: 28px;
}

.adalo-cb-cookie-group-title {
	margin: 0 0 8px;
	font-family: var(--adalo-cb-font-family, inherit);
	font-size: var(--adalo-cb-heading-font-size, 17px);
	font-weight: var(--adalo-cb-heading-font-weight, 700);
	color: var(--adalo-cb-text, #212121);
}

.adalo-cb-cookie-policy .adalo-cb-cookie-table {
	font-size: var(--adalo-cb-font-size, 14px);
}

/* --- Placeholder instead of a blocked embed (SPEC §7 point 3) --- */

.adalo-cb-embed {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	min-height: 180px;
	padding: 24px;
	border: 1px solid var(--adalo-cb-border, rgba(33, 33, 33, 0.16));
	border-radius: var(--adalo-cb-radius, 4px);
	background: var(--adalo-cb-surface-alt, #f6f7f9);
	text-align: center;
}

.adalo-cb-embed-inner {
	max-width: 420px;
}

.adalo-cb-embed-text {
	margin: 0 0 12px;
	color: var(--adalo-cb-text, #212121);
}

.adalo-cb-embed-vendor {
	margin: 10px 0 0;
	color: var(--adalo-cb-text-muted, #5c5c5c);
	font-size: 0.85em;
}

/* The rebuilt frame keeps the width the content author gave it. */
.adalo-cb-embed-frame {
	max-width: 100%;
	border: 0;
}

/* --- "Reloading the page" message after a withdrawal (SPEC §8.5 B) --- */

.adalo-cb-reload {
	position: fixed;
	right: 16px;
	bottom: 16px;
	z-index: var(--adalo-cb-z-index, 9999);
	max-width: 320px;
	padding: 12px 16px;
	border-radius: var(--adalo-cb-radius, 4px);
	background: var(--adalo-cb-text, #212121);
	color: var(--adalo-cb-surface, #ffffff);
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}
