/* Duwe Consent — banner styling. Scoped under .duwe-consent. */

.duwe-consent {
	--duwe-consent-accent: #2271b1;
	--duwe-consent-bg: #fff;
	position: fixed;
	z-index: 99999;
	left: 1rem;
	right: 1rem;
	max-width: 540px;
	margin: 0 auto;
	background: var( --duwe-consent-bg );
	color: #1d2327;
	border: 1px solid #d6d6d6;
	border-radius: 10px;
	overflow: hidden;
	box-shadow: 0 8px 30px rgba( 0, 0, 0, 0.18 );
	font-size: 14px;
	line-height: 1.5;
}

/* 3×3 placement grid. Vertical row… */
.duwe-consent--top-left,
.duwe-consent--top-centre,
.duwe-consent--top-right { top: 1rem; }

.duwe-consent--bottom-left,
.duwe-consent--bottom-centre,
.duwe-consent--bottom-right { bottom: 1rem; }

.duwe-consent--centre-left,
.duwe-consent--centre,
.duwe-consent--centre-right {
	top: 50%;
	transform: translateY( -50% );
}

/* …horizontal column. Left/right pin to a side; the centre column keeps the
   base auto-centred bar (left:1rem; right:1rem; margin:0 auto). */
.duwe-consent--top-left,
.duwe-consent--centre-left,
.duwe-consent--bottom-left {
	left: 1rem;
	right: auto;
	margin: 0;
}
.duwe-consent--top-right,
.duwe-consent--centre-right,
.duwe-consent--bottom-right {
	right: 1rem;
	left: auto;
	margin: 0;
}

.duwe-consent__inner { padding: 1.1rem 1.25rem 1.25rem; }

.duwe-consent__logo {
	display: block;
	max-width: 160px;
	max-height: 48px;
	width: auto;
	height: auto;
	margin: 0 0 0.7rem;
}

.duwe-consent__title {
	margin: 0 0 0.4rem;
	font-size: 1.05rem;
	font-weight: 700;
}

.duwe-consent__msg { margin: 0 0 0.9rem; }
.duwe-consent__msg a { color: var( --duwe-consent-accent ); }

.duwe-consent__smallprint {
	margin: -0.4rem 0 0.9rem;
	font-size: 0.82em;
	opacity: 0.7;
}

/* Non-interactive "always on" indicator for the necessary category (shown
   instead of a pre-ticked checkbox, which would read as pre-given consent). */
.duwe-consent__lock {
	display: inline-block;
	flex: 0 0 auto;
	width: 18px;
	height: 18px;
	border-radius: 3px;
	background: var( --duwe-consent-accent );
	opacity: 0.45;
	position: relative;
}
.duwe-consent__lock::after {
	content: "";
	position: absolute;
	left: 6px;
	top: 2px;
	width: 4px;
	height: 9px;
	border: solid #fff;
	border-width: 0 2px 2px 0;
	transform: rotate( 45deg );
}

.duwe-consent__prefs {
	margin: 0 0 0.9rem;
	max-height: 40vh;
	overflow-y: auto;
	border-top: 1px solid #eee;
	padding-top: 0.6rem;
}

.duwe-consent__cat {
	display: block;
	margin-bottom: 0.75rem;
	cursor: pointer;
}
.duwe-consent__cat--locked { cursor: default; }

.duwe-consent__cat-head {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	font-weight: 600;
}
.duwe-consent__cat-head input[type="checkbox"] {
	flex: 0 0 auto;
	width: 18px;
	height: 18px;
	margin: 0;
	accent-color: var( --duwe-consent-accent );
}
.duwe-consent__cat--locked .duwe-consent__cat-head input { cursor: not-allowed; }
.duwe-consent__cat-name em { font-weight: 400; opacity: 0.7; }

.duwe-consent__cat-desc {
	display: block;
	margin: 0.2rem 0 0 1.6rem;
	font-size: 0.88em;
	opacity: 0.8;
}

.duwe-consent__cookies {
	display: block;
	margin: 0.25rem 0 0 1.6rem;
	font-size: 0.8em;
	opacity: 0.65;
	word-break: break-word;
}

.duwe-consent__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	justify-content: flex-end;
	align-items: center;
}

.duwe-consent__btn {
	appearance: none;
	border: 1px solid var( --duwe-consent-accent );
	border-radius: 6px;
	padding: 0.5rem 0.95rem;
	font-size: 0.9rem;
	font-weight: 600;
	line-height: 1.2;
	white-space: nowrap;
	cursor: pointer;
	transition: opacity 0.15s ease;
}
.duwe-consent__btn:hover { opacity: 0.85; }
.duwe-consent__btn:focus-visible {
	outline: 2px solid var( --duwe-consent-accent );
	outline-offset: 2px;
}

.duwe-consent__btn--primary {
	background: var( --duwe-consent-accent );
	color: #fff;
}
.duwe-consent__btn--ghost {
	background: transparent;
	color: var( --duwe-consent-accent );
}

/* Reopen FAB — circular, icon-only */
.duwe-consent-reopen {
	--duwe-consent-accent: #2271b1;
	position: fixed;
	bottom: 1rem;
	left: 1rem;
	z-index: 99998;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	background: var( --duwe-consent-accent );
	color: #fff;
	border: 0;
	border-radius: 50%;
	cursor: pointer;
	box-shadow: 0 3px 12px rgba( 0, 0, 0, 0.25 );
	opacity: 0.9;
	transition: opacity 0.15s ease, transform 0.15s ease;
}
.duwe-consent-reopen svg { display: block; }
.duwe-consent-reopen:hover { opacity: 1; transform: scale( 1.05 ); }
.duwe-consent-reopen:focus-visible {
	outline: 2px solid var( --duwe-consent-accent );
	outline-offset: 2px;
}

@media ( prefers-reduced-motion: reduce ) {
	.duwe-consent-reopen { transition: none; }
	.duwe-consent-reopen:hover { transform: none; }
}

@media ( prefers-reduced-motion: reduce ) {
	.duwe-consent__btn { transition: none; }
}

/* Mobile: full-width dialog and stacked, full-width buttons (primary first). */
@media ( max-width: 600px ) {
	/* Whatever the chosen position, collapse to a full-width bottom sheet on
	   small screens. Equal specificity + later source order overrides the grid
	   rules above. */
	.duwe-consent {
		left: 0.5rem;
		right: 0.5rem;
		max-width: none;
		top: auto;
		bottom: 0.5rem;
		margin: 0;
		transform: none;
		/* Never taller than the screen — the inner content scrolls and the
		   action buttons stay pinned, so Accept/Reject are always reachable. */
		max-height: calc( 100vh - 1rem );
		max-height: calc( 100dvh - 1rem );
		display: flex;
		flex-direction: column;
	}
	.duwe-consent__inner {
		flex: 1 1 auto;
		min-height: 0;
		overflow-y: auto;
		-webkit-overflow-scrolling: touch;
	}
	/* Let the whole banner scroll as one — no nested scroll area for prefs. */
	.duwe-consent__prefs { max-height: none; }

	/* Pin the buttons to the bottom of the scrolling area. */
	.duwe-consent__actions {
		position: sticky;
		bottom: 0;
		flex-direction: column;
		align-items: stretch;
		gap: 0.5rem;
		margin: 0.6rem -1.25rem 0;
		padding: 0.7rem 1.25rem calc( 1.25rem + env( safe-area-inset-bottom ) );
		background: var( --duwe-consent-bg );
		border-top: 1px solid #eee;
	}
	.duwe-consent__btn {
		width: 100%;
		padding: 0.7rem 1rem;
		font-size: 0.95rem;
		white-space: normal;
	}
	/* Most prominent action on top, regardless of DOM order. */
	.duwe-consent__btn--primary[data-act="accept"] { order: 1; }
	.duwe-consent__btn--primary[data-act="save"]   { order: 1; }
	.duwe-consent__btn--ghost[data-act="reject"]   { order: 2; }
	.duwe-consent__btn--ghost[data-act="manage"]   { order: 3; }
}

@media ( prefers-color-scheme: dark ) {
	.duwe-consent {
		--duwe-consent-bg: #1e1e1e;
		color: #e8e8e8;
		border-color: #3a3a3a;
	}
	.duwe-consent__prefs { border-top-color: #333; }
	.duwe-consent__actions { border-top-color: #333; }
}
