/* PA Cookie Consent (PrestaShop) - style pomocnicze frontendu. Kolory banera
   ustawiane są bezpośrednio jako zmienne --cc-* w PaCookieconsent::hookHeader()
   (analogicznie do modułu WordPress), z poszanowaniem trybu ciemnego. */

.pa-cc-logo {
	max-height: 32px;
	margin-bottom: 8px;
}

.pa-cc-revoke-link {
	cursor: pointer;
}

.pa-cc-categories-table {
	width: 100%;
	border-collapse: collapse;
}

.pa-cc-categories-table th,
.pa-cc-categories-table td {
	border: 1px solid #e2e2e2;
	padding: 8px 12px;
	text-align: left;
}

/*
 * Banner layouts based on the Figma file "Bannery Cookie".
 * Colors stay configurable (--cc-* set from the Appearance tab); only sizes,
 * spacing and typography come from the design. Everything is scoped to #cc-main.
 *   box   -> Figma 1 (corners) / Figma 3 (middle center)
 *   cloud -> Figma 2
 *   preferences modal -> Figma 4
 */
#cc-main {
	--cc-font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	--cc-modal-margin: 32px;
	--cc-overlay-bg: rgba( 0, 0, 0, .4 );
	--cc-btn-secondary-border-color: var( --cc-btn-secondary-color );
	--cc-btn-secondary-hover-border-color: var( --cc-btn-secondary-color );
	--cc-btn-secondary-hover-color: var( --cc-btn-secondary-color );
	--cc-toggle-readonly-bg: var( --cc-toggle-on-bg );
	--cc-toggle-readonly-knob-bg: var( --cc-toggle-on-knob-bg );
	--pa-cc-pad: 32px;
}

/* Figma "off" toggle; dark mode keeps the library palette. */
:root:not( .cc--darkmode ) #cc-main {
	--cc-toggle-off-bg: #d4d4d4;
}

/* Branding: "Cookies by" + Pageart wordmark */
#cc-main .pa-cc-branding {
	display: inline-flex;
	flex: 0 0 auto;
	align-items: center;
	gap: 6px;
	color: var( --cc-primary-color );
	text-decoration: none !important;
	cursor: pointer;
}

#cc-main .pa-cc-branding-label {
	font-size: 10px;
	line-height: 1.5;
	white-space: nowrap;
}

#cc-main .pa-cc-branding-logo {
	display: block;
	width: 68px;
	height: 8.327px;
}

.cc--darkmode #cc-main .pa-cc-branding-logo {
	filter: invert( 1 );
}

#cc-main .pa-cc-header-row {
	display: flex;
	margin-bottom: 24px;
}

#cc-main .pa-cc-site-logo {
	display: block;
	max-width: 140px;
	max-height: 22px;
}

#cc-main .pa-cc-title-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
}

/* Consent modal: shared */
#cc-main .cm.cm {
	box-sizing: border-box;
	padding: var( --pa-cc-pad );
	border-radius: var( --cc-modal-border-radius );
}

#cc-main .cm .cm__body {
	gap: 32px;
}

#cc-main .cm .cm__texts {
	gap: 24px;
	padding: 0;
	justify-content: flex-start;
}

#cc-main .cm .cm__title,
#cc-main .cm .cm__desc {
	padding: 0;
	margin: 0;
	line-height: 1.5;
}

#cc-main .cm .cm__title {
	font-size: 16px;
	font-weight: 600;
	color: var( --cc-primary-color );
}

#cc-main .cm .cm__desc {
	font-size: 14px;
	font-weight: 400;
	color: var( --cc-secondary-color );
}

#cc-main .cm .cm__btns {
	display: grid;
	grid-template-columns: repeat( 3, minmax( 0, 1fr ) );
	gap: 8px;
	padding: 0;
	border: 0;
	max-width: none;
}

#cc-main .cm .cm__btn-group {
	display: contents;
}

/* Buttons (consent + preferences) */
#cc-main .cm .cm__btns .cm__btn,
#cc-main .pm .pm__footer .pm__btn {
	display: flex;
	align-items: center;
	justify-content: center;
	min-width: 0;
	min-height: 0;
	margin: 0;
	padding: 12px 32px;
	font-size: 14px;
	font-weight: 400;
	line-height: 1.5;
	border-radius: var( --cc-btn-border-radius );
	transition: opacity .15s ease;
}

#cc-main .cm .cm__btn:hover,
#cc-main .pm .pm__btn:hover {
	opacity: .85;
}

/* Keep the outlined button on its own layer: the modal sits on a half pixel and
   promoting it only during the opacity transition shifted the 1px border. */
#cc-main .pm .pm__footer .pm__btn--secondary {
	will-change: opacity;
}

#cc-main .cm .cm__btn > span {
	white-space: nowrap;
}

/* Order: manage, reject, accept (Figma 1) */
#cc-main .cm [data-role="show"] { order: 1; }
#cc-main .cm [data-role="necessary"] { order: 2; }
#cc-main .cm [data-role="all"] { order: 3; }

/* Box in a corner / edge (Figma 1) */
#cc-main .cm--box {
	width: 631px;
	max-width: calc( 100vw - 2 * var( --cc-modal-margin ) );
}

/* Box in the middle (Figma 3): manage full width, then reject + accept */
#cc-main .cm--box.cm--middle {
	width: 518px;
}

#cc-main .cm--box.cm--middle .cm__btns,
#cc-main .cm--cloud .cm__btns {
	grid-template-columns: repeat( 2, minmax( 0, 1fr ) );
}

#cc-main .cm--box.cm--middle [data-role="show"] {
	grid-column: 1 / -1;
}

/* Visual-only backdrop for the centered box; page stays interactive. */
.show--consent #cc-main .cm-wrapper:has( .cm--middle )::before {
	content: "";
	position: fixed;
	inset: 0;
	z-index: 0;
	background: var( --cc-overlay-bg );
	-webkit-backdrop-filter: blur( 12px );
	backdrop-filter: blur( 12px );
	pointer-events: none;
}

/* Cloud (Figma 2): text left, branding + buttons right */
#cc-main .cm--cloud {
	width: auto;
	max-width: calc( 100vw - 2 * var( --cc-modal-margin ) );
}

#cc-main .cm--cloud .cm__body {
	flex-direction: row;
	align-items: stretch;
}

#cc-main .cm--cloud .cm__texts {
	flex: 0 1 379px;
	min-width: 0;
}

#cc-main .cm--cloud .cm__desc {
	max-height: none;
}

#cc-main .cm--cloud .cm__btns {
	flex: 0 0 338px;
	align-content: end;
	border: 0;
}

#cc-main .cm--cloud .pa-cc-branding {
	grid-column: 1 / -1;
	justify-self: end;
	align-self: start;
	order: 0;
}

#cc-main .cm--cloud [data-role="necessary"] { order: 1; }
#cc-main .cm--cloud [data-role="all"] { order: 2; }

#cc-main .cm--cloud [data-role="show"] {
	order: 3;
	grid-column: 1 / -1;
}

/* Bar: accept + reject on top, manage full width below; column fits the labels. */
#cc-main .cm.cm--bar .cm__btns {
	flex: 0 0 auto;
	max-width: none;
	grid-template-columns: repeat( 2, minmax( max-content, 1fr ) );
	align-content: center; /* rows keep button height; no stretch to the text column */
}

/* Bar below 900px: text above, buttons full width below (text column gets too narrow). */
@media screen and ( max-width: 900px ) {
	#cc-main .cm.cm--bar .cm__body {
		flex-direction: column;
	}

	#cc-main .cm.cm--bar .cm__btns {
		grid-template-columns: repeat( 2, minmax( 0, 1fr ) );
	}
}

/* Very narrow phones: one per row, so labels never wrap and heights stay equal. */
@media screen and ( max-width: 360px ) {
	#cc-main .cm.cm--bar .cm__btns {
		grid-template-columns: minmax( 0, 1fr );
	}
}

#cc-main .cm.cm--bar [data-role="all"] { order: 1; }
#cc-main .cm.cm--bar [data-role="necessary"] { order: 2; }

#cc-main .cm.cm--bar [data-role="show"] {
	order: 3;
	grid-column: 1 / -1;
}

/* Footer links (not in Figma) */
#cc-main .cm .cm__footer {
	margin-top: 24px;
	padding: 0;
	background: none;
	border: 0;
}

#cc-main .cm .cm__links {
	padding: 0;
}

#cc-main .cm .cm__link-group {
	font-size: 12px;
}

/* Preferences modal (Figma 4) */
#cc-main .pm--box {
	box-sizing: border-box;
	width: 518px;
	max-width: calc( 100vw - 2 * var( --cc-modal-margin ) );
	height: auto;
	max-height: calc( 100% - 2 * var( --cc-modal-margin ) );
	padding: var( --pa-cc-pad );
	border-radius: var( --cc-modal-border-radius );
}

#cc-main .pm .pm__header,
#cc-main .pm .pm__body,
#cc-main .pm .pm__footer {
	padding: 0;
	border: 0;
}

#cc-main .pm .pm__header {
	gap: 16px;
	margin-bottom: 24px;
}

#cc-main .pm .pm__title {
	margin: 0;
	font-size: 16px;
	font-weight: 600;
	line-height: 1.5;
	color: var( --cc-primary-color );
}

#cc-main .pm .pm__close-btn {
	flex: 0 0 auto;
	width: 24px;
	height: 24px;
	margin-right: -4px;
	background: none;
	border: 0;
}

#cc-main .pm .pm__section {
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: none;
}

#cc-main .pm .pm__section:first-child .pm__section-desc {
	font-size: 14px;
	line-height: 1.5;
	color: var( --cc-primary-color );
}

#cc-main .pm .pm__section-toggles {
	display: block;
}

#cc-main .pm .pm__section + .pm__section-toggles,
#cc-main .pm .pm__section-toggles + .pm__section {
	margin-top: 32px;
}

#cc-main .pm .pm__section--toggle {
	margin: 0 0 6px;
	border-top: 1px solid var( --cc-separator-border-color );
	border-radius: 0;
	background: none;
}

#cc-main .pm .pm__section--toggle:last-child {
	margin-bottom: 0;
	border-bottom: 1px solid var( --cc-separator-border-color );
}

#cc-main .pm .pm__section--toggle .pm__section-title {
	min-height: 0;
	padding: 16px 52px 16px 34px;
	font-size: 14px;
	font-weight: 600;
	line-height: 1.5;
	color: var( --cc-primary-color );
	background: none;
	border: 0;
	border-radius: 0;
}

#cc-main .pm .pm__section--expandable .pm__section-arrow {
	left: 0;
	width: 24px;
	height: 24px;
	background: none;
	align-items: center;
}

#cc-main .pm .pm__section--expandable .pm__section-arrow svg {
	stroke: var( --cc-primary-color );
	stroke-width: 3;
	transform: scale( .6 );
	transition: transform var( --pa-cc-accordion ) ease-in-out;
}

#cc-main .pm .pm__section--toggle.is-expanded .pm__section-arrow svg {
	transform: scale( .6 ) rotate( 180deg );
}

/*
 * Accordion: the library swaps display none/flex (not animatable), so the wrapper
 * stays a grid and animates its single row 0fr -> 1fr. Visibility keeps collapsed
 * text out of the tab order and accessibility tree.
 */
#cc-main {
	--pa-cc-accordion: .25s;
}

#cc-main .pm .pm__section--toggle .pm__section-desc-wrapper {
	display: grid;
	grid-template-rows: 0fr;
	margin-top: 0 !important;
	padding: 0 52px 0 34px;
	border: 0;
	color: var( --cc-primary-color );
	visibility: hidden;
	transition:
		grid-template-rows var( --pa-cc-accordion ) ease-in-out,
		margin-top var( --pa-cc-accordion ) ease-in-out,
		padding-bottom var( --pa-cc-accordion ) ease-in-out,
		visibility 0s linear var( --pa-cc-accordion );
}

/* Title keeps its padding so the toggle does not move; -6px gives the 10px gap. */
#cc-main .pm .pm__section--toggle.is-expanded .pm__section-desc-wrapper {
	grid-template-rows: 1fr;
	margin-top: -6px !important;
	padding-bottom: 16px;
	visibility: visible;
	transition-delay: 0s;
}

@media ( prefers-reduced-motion: reduce ) {
	#cc-main {
		--pa-cc-accordion: 0s;
	}
}

#cc-main .pm .pm__section--toggle .pm__section-desc {
	min-height: 0;
	overflow: hidden;
	padding: 0;
	font-size: 12px;
	font-weight: 300;
	line-height: 1.5;
}

/* Toggle: 42x20, 14px knob */
#cc-main .pm .section__toggle-wrapper {
	right: 0;
}

#cc-main .pm .section__toggle,
#cc-main .pm .section__toggle-wrapper,
#cc-main .pm .toggle__icon,
#cc-main .pm .toggle__label {
	width: 42px;
	height: 20px;
}

#cc-main .pm .toggle__icon {
	box-shadow: none !important;
}

#cc-main .pm .toggle__icon-circle {
	top: 3px;
	left: 3px;
	width: 14px;
	height: 14px;
	box-shadow: none !important;
}

#cc-main .pm .section__toggle:checked ~ .toggle__icon .toggle__icon-circle {
	transform: translateX( 22px );
}

#cc-main .pm .toggle__icon-on,
#cc-main .pm .toggle__icon-off {
	display: none;
}

#cc-main .pm .pm__footer {
	display: grid;
	grid-template-columns: repeat( 2, minmax( 0, 1fr ) );
	gap: 8px;
	margin-top: 32px;
}

#cc-main .pm .pm__btn-group {
	display: contents;
}

#cc-main .pm [data-role="necessary"] { order: 1; }
#cc-main .pm [data-role="all"] { order: 2; }

#cc-main .pm [data-role="save"] {
	order: 3;
	grid-column: 1 / -1;
}

/* Preferences overlay blur (Figma 3/4) */
#cc-main .pm-overlay {
	-webkit-backdrop-filter: blur( 12px );
	backdrop-filter: blur( 12px );
}

/* Mobile: full width, reject + accept row, manage below */
@media screen and ( max-width: 640px ) {
	#cc-main {
		--cc-modal-margin: 16px;
		--pa-cc-pad: 24px;
	}

	#cc-main .cm.cm {
		width: auto !important;
		max-width: none !important;
	}

	#cc-main .cm .cm__body {
		flex-direction: column !important;
	}

	#cc-main .cm .cm__title,
	#cc-main .cm .cm__desc,
	#cc-main .cm .cm__links {
		padding-left: 0 !important;
		padding-right: 0 !important;
	}

	#cc-main .cm .cm__btns {
		display: grid !important;
		grid-template-columns: repeat( 2, minmax( 0, 1fr ) );
		padding: 0 !important;
		border: 0 !important;
	}

	#cc-main .cm .cm__btn-group {
		display: contents !important;
	}

	#cc-main .cm .cm__btns .cm__btn {
		margin: 0 !important;
		padding: 12px 8px;
	}

	#cc-main .cm .cm__btn > span {
		white-space: normal;
	}

	#cc-main .cm [data-role="necessary"] { order: 1; }
	#cc-main .cm [data-role="all"] { order: 2; }

	#cc-main .cm [data-role="show"] {
		order: 3;
		grid-column: 1 / -1;
	}

	#cc-main .cm--cloud .cm__btns {
		flex: none;
	}
	#cc-main .cm--cloud .pa-cc-branding {
		display: none;
	}

	#cc-main .cm--cloud .cm__texts {
		flex: none;
	}

	#cc-main .pa-cc-title-row {
		flex-wrap: wrap;
		gap: 8px;
	}

	/* Preferences: full-screen sheet (library behaviour), Figma spacing */
	#cc-main .pm--box {
		width: auto;
		max-height: 100%;
		border-radius: 0;
	}

	#cc-main .pm .pm__header,
	#cc-main .pm .pm__body,
	#cc-main .pm .pm__footer {
		padding: 0 !important;
	}

	#cc-main .pm .pm__footer {
		flex-direction: row !important;
	}

	#cc-main .pm .pm__btn-group {
		display: contents !important;
	}

	#cc-main .pm .pm__footer .pm__btn {
		margin: 0 !important;
		padding: 12px 8px;
	}
}

/* Narrow phones: one button per row */
@media screen and ( max-width: 400px ) {
	#cc-main .cm .cm__btns,
	#cc-main .pm .pm__footer {
		grid-template-columns: minmax( 0, 1fr );
	}
}

/*
 * Pływający przycisk cookies (views/js/front.js, buildFloatButton).
 * Rozmiar, kolory i odstępy pochodzą ze zmiennych --pa-cc-float-* ustawianych w <head>.
 */
.pa-cc-float {
	position: fixed;
	z-index: 2147483000;
	box-sizing: border-box;
	display: flex;
	align-items: center;
	justify-content: center;
	width: var( --pa-cc-float-size, 56px );
	height: var( --pa-cc-float-size, 56px );
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: var( --pa-cc-float-bg, #000000 );
	color: var( --pa-cc-float-icon, #ffffff );
	box-shadow: 0 4px 14px rgba( 0, 0, 0, .25 );
	cursor: pointer;
	transition: transform .15s ease, opacity .15s ease, visibility .15s;
}

.pa-cc-float svg {
	display: block;
	width: 55%;
	height: 55%;
	fill: none;
	stroke: currentColor;
	stroke-width: 2;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.pa-cc-float:hover {
	transform: scale( 1.08 );
}

.pa-cc-float:focus-visible {
	outline: 3px solid var( --pa-cc-float-bg, #000000 );
	outline-offset: 3px;
}

.pa-cc-float--hidden {
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transform: scale( .8 );
}

.pa-cc-float--bottom-left { left: var( --pa-cc-float-x, 20px ); bottom: var( --pa-cc-float-y, 20px ); }
.pa-cc-float--bottom-right { right: var( --pa-cc-float-x, 20px ); bottom: var( --pa-cc-float-y, 20px ); }
.pa-cc-float--top-left { left: var( --pa-cc-float-x, 20px ); top: var( --pa-cc-float-y, 20px ); }
.pa-cc-float--top-right { right: var( --pa-cc-float-x, 20px ); top: var( --pa-cc-float-y, 20px ); }
.pa-cc-float--middle-left { left: var( --pa-cc-float-x, 20px ); top: 50%; margin-top: calc( var( --pa-cc-float-size, 56px ) / -2 ); }
.pa-cc-float--middle-right { right: var( --pa-cc-float-x, 20px ); top: 50%; margin-top: calc( var( --pa-cc-float-size, 56px ) / -2 ); }

@media ( max-width: 768px ) {
	.pa-cc-float--hide-mobile {
		display: none;
	}
}
