/**
 * Cookies AS — front-end consent banner.
 *
 * Colours are driven by CSS custom properties set inline on #cas-banner from
 * the plugin settings. In the default "symmetric" mode the accept and reject
 * controls share the .cas-btn--equal rule so they look identical (CNIL
 * anti-dark-pattern). The opt-in .cas-banner--discreet mode renders the
 * refusal as a low-key text link.
 */

.cas-banner,
.cas-banner *,
.cas-reopen,
.cas-reopen * {
	box-sizing: border-box;
}

.cas-banner[hidden],
.cas-reopen[hidden],
.cas-banner__view[hidden] {
	display: none;
}

/* --- Positioning per style --------------------------------------------- */

.cas-banner {
	--cas-bg: #ffffff;
	--cas-text: #1a1a1a;
	--cas-accent: #2271b1;
	--cas-accent-text: #ffffff;
	position: fixed;
	z-index: 99990;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	font-size: 15px;
	line-height: 1.5;
	color: var(--cas-text);
}

.cas-banner--bottom_bar {
	left: 0;
	right: 0;
	bottom: 0;
}

.cas-banner--top_bar {
	left: 0;
	right: 0;
	top: 0;
}

.cas-banner--popup {
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
	background: rgba(15, 18, 22, 0.55);
	backdrop-filter: blur(2px);
}

/*
 * Card variants — pinned floating card, Axeptio-style. Caps width at
 * 380px and tucks the card into a corner of the viewport. On narrow
 * screens we collapse to a bottom-anchored full-width card so the
 * action buttons stay reachable on mobile.
 */
.cas-banner--card_bottom_left,
.cas-banner--card_bottom_right {
	bottom: 20px;
	width: auto;
	max-width: calc(100% - 24px);
}

.cas-banner--card_bottom_left {
	left: 20px;
	right: auto;
}

.cas-banner--card_bottom_right {
	right: 20px;
	left: auto;
}

@media (max-width: 600px) {
	.cas-banner--card_bottom_left,
	.cas-banner--card_bottom_right {
		left: 12px;
		right: 12px;
		bottom: 12px;
	}
}

/* --- Box --------------------------------------------------------------- */

.cas-banner__box {
	background: var(--cas-bg);
	color: var(--cas-text);
}

.cas-banner--bottom_bar .cas-banner__box,
.cas-banner--top_bar .cas-banner__box {
	width: 100%;
	padding: 22px 24px;
	max-height: 85vh;
	overflow-y: auto;
}

.cas-banner--bottom_bar .cas-banner__box {
	border-top: 3px solid var(--cas-accent);
	box-shadow: 0 -8px 36px -10px rgba(15, 18, 22, 0.28);
}

.cas-banner--top_bar .cas-banner__box {
	border-bottom: 3px solid var(--cas-accent);
	box-shadow: 0 8px 36px -10px rgba(15, 18, 22, 0.28);
}

.cas-banner--popup .cas-banner__box {
	width: 100%;
	max-width: 470px;
	max-height: 85vh;
	overflow-y: auto;
	padding: 28px;
	border-radius: 16px;
	box-shadow: 0 18px 56px -12px rgba(15, 18, 22, 0.45);
}

.cas-banner--card_bottom_left .cas-banner__box,
.cas-banner--card_bottom_right .cas-banner__box {
	width: 380px;
	max-width: 100%;
	max-height: 80vh;
	overflow-y: auto;
	padding: 20px 22px;
	border-radius: 14px;
	border: 1px solid rgba(15, 18, 22, 0.08);
	box-shadow: 0 18px 56px -16px rgba(15, 18, 22, 0.35);
}

.cas-banner--card_bottom_left .cas-banner__box,
.cas-banner--card_bottom_right .cas-banner__box {
	animation: cas-rise 0.24s ease both;
}

/* Card variant text scales down a notch to match the compact format. */
.cas-banner--card_bottom_left .cas-banner__title,
.cas-banner--card_bottom_right .cas-banner__title {
	font-size: 17px;
}

.cas-banner--card_bottom_left .cas-banner__text,
.cas-banner--card_bottom_right .cas-banner__text {
	font-size: 14px;
	line-height: 1.45;
}

/* Buttons stack rather than splitting across the card width — Axeptio
   pattern. Keeps tap targets large on a 380px container. */
.cas-banner--card_bottom_left .cas-banner__actions,
.cas-banner--card_bottom_right .cas-banner__actions {
	flex-direction: column;
	gap: 8px;
}

.cas-banner--card_bottom_left .cas-banner__actions .cas-btn,
.cas-banner--card_bottom_right .cas-banner__actions .cas-btn {
	width: 100%;
	min-width: 0;
}

.cas-banner__view {
	display: flex;
	flex-direction: column;
	gap: 16px;
}

.cas-banner--bottom_bar .cas-banner__view,
.cas-banner--top_bar .cas-banner__view {
	max-width: 1080px;
	margin: 0 auto;
}

/* --- Entrance animation ------------------------------------------------ */

@keyframes cas-rise {
	from {
		opacity: 0;
		transform: translateY(14px);
	}

	to {
		opacity: 1;
		transform: translateY(0);
	}
}

@keyframes cas-pop {
	from {
		opacity: 0;
		transform: scale(0.96);
	}

	to {
		opacity: 1;
		transform: scale(1);
	}
}

.cas-banner--bottom_bar .cas-banner__box,
.cas-banner--top_bar .cas-banner__box {
	animation: cas-rise 0.24s ease both;
}

.cas-banner--popup .cas-banner__box {
	animation: cas-pop 0.24s ease both;
}

/* --- Text -------------------------------------------------------------- */

.cas-banner__title {
	margin: 0;
	font-size: 19px;
	font-weight: 700;
	letter-spacing: -0.011em;
	color: var(--cas-text);
}

.cas-banner__text {
	margin: 0;
	font-size: 14px;
	color: var(--cas-text);
}

.cas-banner__link {
	color: var(--cas-accent);
	font-weight: 600;
	text-decoration: underline;
}

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

.cas-banner__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
}

/*
 * Theme reset. Hello Elementor (and several other modern themes) ship
 * an aggressive `button { border-color: ... }` rule whose specificity
 * matches a bare class, so our `.cas-btn` would inherit the theme's
 * accent — typically a red outline that breaks the banner palette.
 * Bumping the selector to `.cas-banner .cas-btn` lifts the specificity
 * above a single-tag theme rule, and explicit `border-style` /
 * `border-width` guard against shorthand-only overrides.
 */
.cas-banner .cas-btn {
	flex: 1 1 auto;
	min-width: 150px;
	min-height: 46px;
	padding: 12px 20px;
	font-size: 14px;
	font-weight: 600;
	font-family: inherit;
	text-align: center;
	border-style: solid;
	border-width: 2px;
	border-color: var(--cas-accent);
	border-radius: 8px;
	box-shadow: none;
	cursor: pointer;
	transition: filter 0.15s ease, transform 0.08s ease, background-color 0.15s ease;
}

/* Accept and reject stay identical in the default symmetric mode. */
.cas-banner .cas-btn--equal {
	background: var(--cas-accent);
	color: var(--cas-accent-text);
}

.cas-banner .cas-btn--ghost {
	background: transparent;
	color: var(--cas-accent);
}

.cas-banner .cas-btn--equal:hover {
	filter: brightness(0.93);
}

.cas-banner .cas-btn--ghost:hover {
	background: rgba(0, 0, 0, 0.05);
}

.cas-banner .cas-btn:active {
	transform: translateY(1px);
}

.cas-banner .cas-btn:focus-visible,
.cas-banner__link:focus-visible,
.cas-banner__back:focus-visible,
.cas-switch__input:focus-visible + .cas-switch__track {
	outline: 3px solid var(--cas-accent);
	outline-offset: 2px;
}

/* --- Discreet refuse mode (opt-in) ------------------------------------- */

.cas-banner--discreet [data-cas-action="reject_all"] {
	order: 9;
	flex: 0 0 100%;
	min-width: 0;
	min-height: 0;
	margin-top: 2px;
	padding: 6px;
	font-size: 13px;
	font-weight: 400;
	color: var(--cas-text);
	background: transparent;
	border: 0;
	border-radius: 0;
	opacity: 0.62;
	text-decoration: underline;
}

.cas-banner--discreet [data-cas-action="reject_all"]:hover {
	filter: none;
	opacity: 0.9;
}

.cas-banner--discreet [data-cas-action="reject_all"]:active {
	transform: none;
}

/* --- Customisation panel ----------------------------------------------- */

.cas-banner__panel-head {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.cas-banner__back {
	align-self: flex-start;
	padding: 4px 6px;
	font-size: 13px;
	font-family: inherit;
	color: var(--cas-accent);
	background: transparent;
	border: 0;
	cursor: pointer;
	text-decoration: underline;
}

.cas-categories {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.cas-category {
	padding: 14px 0;
	border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.cas-category:first-child {
	border-top: 0;
}

.cas-category__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin: 0;
	cursor: pointer;
}

.cas-category__name {
	font-size: 15px;
	font-weight: 600;
}

.cas-category__state {
	font-size: 12px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	opacity: 0.7;
}

.cas-category__desc {
	margin: 6px 0 0;
	font-size: 13px;
	opacity: 0.82;
}

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

.cas-switch {
	position: relative;
	flex: 0 0 auto;
	width: 46px;
	height: 26px;
}

.cas-switch__input {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	margin: 0;
	opacity: 0;
	cursor: pointer;
	z-index: 2;
}

.cas-switch__track {
	position: absolute;
	inset: 0;
	background: #b9bcc2;
	border-radius: 999px;
	transition: background 0.15s ease;
}

.cas-switch__track::after {
	content: "";
	position: absolute;
	top: 3px;
	left: 3px;
	width: 20px;
	height: 20px;
	background: #ffffff;
	border-radius: 50%;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
	transition: transform 0.15s ease;
}

.cas-switch__input:checked + .cas-switch__track {
	background: var(--cas-accent);
}

.cas-switch__input:checked + .cas-switch__track::after {
	transform: translateX(20px);
}

/* --- Reopen button ----------------------------------------------------- */

.cas-reopen {
	/* Floating launcher: every box-model + paint property is forced with
	   !important because themes (Hello / Elementor base CSS) impose their own
	   button min-width, padding, background and border. Without this the button
	   is stretched into a wide ellipse (border-radius:50% on a wide box) and
	   recoloured. A class beats a bare `button` selector even at equal
	   !important, so this wins on any theme. */
	position: fixed !important;
	left: 18px !important;
	right: auto !important;
	bottom: 18px !important;
	top: auto !important;
	z-index: 99989 !important;
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	/* Discreet by default (the button only shows once the visitor has
	   answered): small with a semi-transparent background. It grows back to full
	   size and opacity on hover/focus so it stays easy to find. */
	width: 44px !important;
	height: 44px !important;
	min-width: 0 !important;
	max-width: none !important;
	min-height: 0 !important;
	max-height: none !important;
	padding: 0 !important;
	margin: 0 !important;
	color: #ffffff !important;
	/* Concrete colour: the button lives outside #cas-banner, so the --cas-*
	   custom properties set there are unavailable here. The `background`
	   shorthand also clears any theme gradient/image. */
	background: rgba(34, 113, 177, 0.7) !important;
	border: none !important;
	border-radius: 50% !important;
	outline: none;
	-webkit-appearance: none;
	appearance: none;
	box-shadow: 0 3px 12px -3px rgba(15, 18, 22, 0.3) !important;
	line-height: 1 !important;
	cursor: pointer !important;
	transition: transform 0.12s ease, width 0.12s ease, height 0.12s ease,
		background-color 0.15s ease, box-shadow 0.15s ease;
}

.cas-reopen:hover,
.cas-reopen:focus-visible {
	width: 52px !important;
	height: 52px !important;
	background: rgba(34, 113, 177, 1) !important;
	box-shadow: 0 4px 16px -2px rgba(15, 18, 22, 0.4) !important;
	transform: translateY(-2px);
}

/* Never inherit the theme's (often red) default focus outline: kill it on
   plain focus, and draw our own concrete-colour ring for keyboard users. */
.cas-reopen:focus {
	outline: none;
}

.cas-reopen:focus-visible {
	outline: 3px solid rgba(34, 113, 177, 0.55) !important;
	outline-offset: 2px;
}

.cas-reopen__icon {
	display: block;
	flex: 0 0 auto;
	width: 24px !important;
	height: 24px !important;
}

/* --- Manage-consent shortcode button ----------------------------------- */

.cas-manage-consent {
	font: inherit;
	color: inherit;
	background: transparent;
	border: 0;
	padding: 0;
	cursor: pointer;
	text-decoration: underline;
}

/* --- Responsive -------------------------------------------------------- */

@media (max-width: 600px) {
	.cas-btn {
		flex: 1 1 100%;
	}

	.cas-banner--bottom_bar .cas-banner__box,
	.cas-banner--top_bar .cas-banner__box {
		padding: 18px 16px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.cas-banner__box,
	.cas-btn,
	.cas-reopen,
	.cas-switch__track,
	.cas-switch__track::after {
		animation: none;
		transition: none;
	}
}
