/**
 * EVH Consent Popup - frontend styles.
 * Colors come from CSS custom properties set inline by the plugin from
 * the admin settings (see class-evh-consent-popup.php::build_dynamic_css).
 * Any admin-supplied "Additional CSS" is appended after this file loads,
 * so it can override anything here.
 */

:root {
	--evh-overlay-color: rgba(0, 0, 0, 0.6);
	--evh-popup-max-width: 480px;
	--evh-popup-bg: #ffffff;
	--evh-title-color: #0a0a0a;
	--evh-text-color: #3c3c3c;
	--evh-toggle-bg: #2271b1;
	--evh-toggler-color: #ffffff;
}

.evh-consent-overlay {
	position: fixed;
	inset: 0;
	background: var( --evh-overlay-color );
	opacity: 0;
	transition: opacity 0.2s ease;
	z-index: 100000;
}

.evh-consent-overlay.is-visible {
	opacity: 1;
}

.evh-consent-popup {
	position: fixed;
	left: 50%;
	bottom: 24px;
	transform: translate( -50%, 16px );
	width: min( var( --evh-popup-max-width ), calc(100% - 32px) );
	height: auto;
	max-height: calc(100vh - 48px);
	overflow-y: auto;
	background: var( --evh-popup-bg );
	color: var( --evh-text-color );
	border-radius: 12px;
	box-shadow: 0 10px 40px rgba( 0, 0, 0, 0.25 );
	opacity: 0;
	transition: opacity 0.2s ease, transform 0.2s ease;
	z-index: 100001;
}

.evh-consent-popup.is-visible {
	opacity: 1;
	transform: translate( -50%, 0 );
}

.evh-consent-popup-inner {
	padding: 24px;
}

.evh-consent-title {
	margin: 0 0 12px;
	color: var( --evh-title-color );
	font-size: 1.25em;
	font-weight: 700;
}

.evh-consent-description {
	margin: 0 0 16px;
	color: var( --evh-text-color );
	font-size: 0.95em;
	line-height: 1.5;
}

.evh-consent-description a {
	color: inherit;
	text-decoration: underline;
}

.evh-consent-types {
	border-top: 1px solid rgba( 0, 0, 0, 0.1 );
	margin-bottom: 16px;
}

.evh-consent-type {
	border-bottom: 1px solid rgba( 0, 0, 0, 0.1 );
	padding: 10px 0;
}

.evh-consent-type-row {
	display: flex;
	align-items: center;
	gap: 12px;
}

.evh-consent-type-title {
	flex: 1;
	text-align: left;
	background: none;
	border: none;
	padding: 4px 0;
	margin: 0;
	font-size: 1em;
	font-weight: 600;
	color: var( --evh-title-color );
	cursor: pointer;
}

.evh-consent-type-title:focus-visible {
	outline: 2px solid var( --evh-toggle-bg );
	outline-offset: 2px;
}

.evh-consent-type-desc {
	max-height: 0;
	overflow: hidden;
	transition: max-height 0.2s ease;
}

.evh-consent-type-desc.is-open {
	max-height: 240px;
}

.evh-consent-type-desc p {
	margin: 8px 0 0;
	color: var( --evh-text-color );
	font-size: 0.9em;
	line-height: 1.5;
}

/* Toggle switch */
.evh-switch {
	position: relative;
	display: inline-block;
	width: 44px;
	height: 24px;
	flex: 0 0 auto;
}

.evh-switch input {
	opacity: 0;
	width: 0;
	height: 0;
}

.evh-slider {
	position: absolute;
	inset: 0;
	background-color: #ccc;
	border-radius: 999px;
	cursor: pointer;
	transition: background-color 0.2s ease;
}

.evh-slider::before {
	content: '';
	position: absolute;
	width: 18px;
	height: 18px;
	left: 3px;
	bottom: 3px;
	background-color: var( --evh-toggler-color );
	border-radius: 50%;
	transition: transform 0.2s ease;
}

.evh-switch input:checked + .evh-slider {
	background-color: var( --evh-toggle-bg );
}

.evh-switch input:checked + .evh-slider::before {
	transform: translateX( 20px );
}

.evh-switch input:disabled + .evh-slider {
	cursor: not-allowed;
	opacity: 0.9;
}

.evh-consent-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
}

.evh-btn {
	appearance: none;
	border: 1px solid var( --evh-toggle-bg );
	border-radius: 6px;
	padding: 10px 18px;
	font-size: 0.95em;
	font-weight: 600;
	cursor: pointer;
	transition: opacity 0.15s ease;
}

.evh-btn:hover {
	opacity: 0.9;
}

.evh-btn-primary {
	background: var( --evh-toggle-bg );
	color: var( --evh-toggler-color );
}

.evh-btn-secondary {
	background: transparent;
	color: var( --evh-title-color );
}

@media ( max-width: 480px ) {
	.evh-consent-popup {
		bottom: 0;
		border-radius: 12px 12px 0 0;
	}
}
