/*
 * EV Cookie Consent - front-end styles.
 *
 * Every rule is scoped to #evcc-notice so theme styles cannot leak in. Colours
 * come only from the --evcc-* custom properties, which PHP sets on #evcc-notice
 * from the settings page. Fonts are inherited; nothing is loaded.
 */

#evcc-notice,
#evcc-notice * {
	box-sizing: border-box;
}

#evcc-notice[hidden] {
	display: none !important;
}

/* Neutralise rules a theme may apply to every element (body *, div, p, ...). */
#evcc-notice,
#evcc-notice .evcc-inner,
#evcc-notice .evcc-message,
#evcc-notice .evcc-button,
#evcc-notice .evcc-link {
	letter-spacing: normal;
	word-spacing: normal;
	text-indent: 0;
	text-shadow: none;
	text-transform: none;
	font-style: normal;
	float: none;
}

#evcc-notice,
#evcc-notice .evcc-inner,
#evcc-notice .evcc-message {
	overflow: visible;
	height: auto;
	min-height: 0;
}

#evcc-notice .evcc-inner,
#evcc-notice .evcc-message {
	border: 0;
	border-radius: 0;
	background: none;
	box-shadow: none;
	position: static;
	width: auto;
	max-width: none;
	color: var(--evcc-text);
}

/* ---------- Desktop / tablet: the bubble ---------- */
#evcc-notice {
	position: fixed;
	z-index: 99990; /* below the WP admin bar (99999) */
	bottom: 24px;
	left: 24px;
	right: auto;
	width: max-content;
	max-width: 360px;
	max-width: min(360px, calc(100% - 48px));
	margin: 0;
	padding: 18px 28px;
	border: 1px solid var(--evcc-border);
	border-radius: 999px;
	background: var(--evcc-bg);
	color: var(--evcc-text);
	box-shadow: 0 8px 28px var(--evcc-shadow), 0 1px 3px var(--evcc-shadow);
	font-family: inherit;
	font-size: 15px;
	font-weight: 400;
	line-height: 1.45;
	letter-spacing: normal;
	text-align: center;
	text-transform: none;
	opacity: 0;
	transform: translateX(-120%) scale(.8);
	transition: transform 250ms ease-in, opacity 250ms ease-in; /* exit */
}

#evcc-notice.evcc-pos-right {
	left: auto;
	right: 24px;
	transform: translateX(120%) scale(.8);
}

/* At rest. Declared after the position rules so it wins at equal specificity. */
#evcc-notice.evcc-visible {
	opacity: 1;
	transform: translateX(0) scale(1);
	transition: transform 550ms cubic-bezier(.34, 1.56, .64, 1), opacity 200ms ease-out; /* entrance */
}

#evcc-notice .evcc-inner {
	display: grid;
	grid-template-columns: auto auto;
	align-items: center;
	justify-content: center;
	gap: 10px 16px;
	margin: 0;
	padding: 0;
}

#evcc-notice .evcc-message {
	grid-column: 1 / -1;
	margin: 0;
	padding: 0;
	color: var(--evcc-text);
	font: inherit;
	text-align: inherit;
}

#evcc-notice .evcc-message a,
#evcc-notice .evcc-message a:hover,
#evcc-notice .evcc-message a:visited {
	color: var(--evcc-link);
	text-decoration: underline;
}

/* The button: unset everything the theme might have set, then restyle. */
#evcc-notice .evcc-button {
	all: unset;
	box-sizing: border-box;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 38px;
	padding: 0 22px;
	border-radius: 999px;
	background: var(--evcc-btn-bg);
	color: var(--evcc-btn-text);
	font: inherit;
	font-size: 14px;
	font-weight: 700;
	line-height: 1.2;
	text-align: center;
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
}

#evcc-notice .evcc-button:last-child {
	grid-column: 1 / -1;
	justify-self: center; /* no link: centre the button */
}

#evcc-notice .evcc-button:hover {
	filter: brightness(1.08);
}

#evcc-notice .evcc-button:focus-visible,
#evcc-notice .evcc-link:focus-visible {
	outline: 2px solid var(--evcc-accent);
	outline-offset: 2px;
}

#evcc-notice .evcc-link,
#evcc-notice .evcc-link:visited {
	all: unset;
	box-sizing: border-box;
	display: inline-block;
	color: var(--evcc-link);
	font: inherit;
	font-size: 13px;
	line-height: 1.2;
	text-decoration: underline;
	text-underline-offset: 2px;
	cursor: pointer;
}

/* ---------- Mobile: the discreet panel (class set by the script) ---------- */
#evcc-notice.evcc-is-mobile {
	left: 12px;
	right: 12px;
	bottom: 12px;
	bottom: calc(12px + env(safe-area-inset-bottom, 0px));
	width: auto;
	max-width: none;
	padding: 12px 14px;
	border-radius: 12px;
	font-size: 14px;
	line-height: 1.4;
	text-align: left;
	transform: translateY(120%);
}

#evcc-notice.evcc-is-mobile.evcc-visible {
	transform: translateY(0);
	transition: transform 400ms cubic-bezier(.34, 1.56, .64, 1), opacity 200ms ease-out;
}

#evcc-notice.evcc-is-mobile .evcc-inner {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	grid-template-areas: "msg btn" "lnk btn";
	align-items: center;
	justify-content: stretch;
	gap: 2px 14px;
}

#evcc-notice.evcc-is-mobile .evcc-message {
	grid-area: msg;
}

#evcc-notice.evcc-is-mobile .evcc-button,
#evcc-notice.evcc-is-mobile .evcc-button:last-child {
	grid-area: btn;
	justify-self: stretch;
	min-height: 44px;
	padding: 0 20px;
	border-radius: 10px;
}

#evcc-notice.evcc-is-mobile .evcc-link {
	grid-area: lnk;
	justify-self: start;
	/* 44px tap target without adding height to the panel. */
	padding: 14px 0;
	margin: -14px 0;
}

/* ---------- Reduced motion: no travel, no spring, just a short fade ---------- */
@media (prefers-reduced-motion: reduce) {
	#evcc-notice,
	#evcc-notice.evcc-pos-right,
	#evcc-notice.evcc-is-mobile,
	#evcc-notice.evcc-visible,
	#evcc-notice.evcc-is-mobile.evcc-visible {
		transform: none;
		transition: opacity 150ms linear;
	}
}
