/**
 * Global Consent Mode - Banner styles
 */

:root {
	--global-consent-primary: #2563eb;
	--global-consent-bg: #ffffff;
	--global-consent-text: #1f2937;
	--global-consent-btn-text: #ffffff;
	--global-consent-border: rgba(0, 0, 0, 0.1);
	--global-consent-shadow: 0 -4px 24px rgba(0, 0, 0, 0.12);
}

@media (prefers-color-scheme: dark) {
	:root:not([data-global-consent-theme="light"]) {
		--global-consent-bg: #111827;
		--global-consent-text: #f3f4f6;
		--global-consent-border: rgba(255, 255, 255, 0.12);
		--global-consent-shadow: 0 -4px 24px rgba(0, 0, 0, 0.4);
	}
}

html.global-consent-pending body {
	padding-bottom: env(safe-area-inset-bottom, 0);
}

.global-consent-banner {
	position: fixed;
	bottom: 0;
	left: 0;
	right: 0;
	z-index: 999999;
	background: var(--global-consent-bg);
	color: var(--global-consent-text);
	box-shadow: var(--global-consent-shadow);
	border-top: 1px solid var(--global-consent-border);
	transform: translateY(0);
	opacity: 1;
	transition: transform 0.3s ease, opacity 0.3s ease;
}

.global-consent-banner[hidden] {
	transform: translateY(100%);
	opacity: 0;
	pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
	.global-consent-banner {
		transition: none;
	}
}

.global-consent-banner__inner {
	max-width: 1200px;
	margin: 0 auto;
	padding: 1rem 1.25rem;
	display: flex;
	flex-wrap: wrap;
	gap: 1rem;
	align-items: center;
	justify-content: space-between;
}

.global-consent-banner__title {
	font-weight: 600;
	margin: 0 0 0.25rem;
	font-size: 1rem;
}

.global-consent-banner__message {
	margin: 0;
	font-size: 0.875rem;
	line-height: 1.5;
	max-width: 640px;
}

.global-consent-banner__policy {
	font-size: 0.8125rem;
	display: inline-block;
	margin-top: 0.5rem;
	color: var(--global-consent-primary);
}

.global-consent-banner__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	align-items: center;
}

.global-consent-btn {
	font: inherit;
	cursor: pointer;
	border: none;
	border-radius: 6px;
	padding: 0.625rem 1rem;
	font-size: 0.875rem;
	font-weight: 500;
	line-height: 1.2;
	white-space: nowrap;
	transition: opacity 0.15s ease;
}

.global-consent-btn:focus-visible {
	outline: 2px solid var(--global-consent-primary);
	outline-offset: 2px;
}

.global-consent-btn--primary {
	background: var(--global-consent-primary);
	color: var(--global-consent-btn-text);
}

.global-consent-btn--secondary {
	background: transparent;
	color: var(--global-consent-text);
	border: 1px solid var(--global-consent-border);
}

.global-consent-btn:hover {
	opacity: 0.9;
}

.global-consent-modal {
	position: fixed;
	inset: 0;
	z-index: 1000000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 1rem;
}

.global-consent-modal[hidden] {
	display: none;
}

.global-consent-modal__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.5);
}

.global-consent-modal__panel {
	position: relative;
	background: var(--global-consent-bg);
	color: var(--global-consent-text);
	border-radius: 12px;
	max-width: 520px;
	width: 100%;
	max-height: 90vh;
	overflow-y: auto;
	padding: 1.5rem;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

.global-consent-modal__title {
	margin: 0 0 1rem;
	font-size: 1.25rem;
}

.global-consent-category {
	display: flex;
	justify-content: space-between;
	align-items: flex-start;
	gap: 1rem;
	padding: 0.75rem 0;
	border-bottom: 1px solid var(--global-consent-border);
}

.global-consent-category:last-child {
	border-bottom: none;
}

.global-consent-category p {
	margin: 0.25rem 0 0;
	font-size: 0.8125rem;
	opacity: 0.85;
}

.global-consent-toggle {
	position: relative;
	display: inline-block;
	width: 44px;
	height: 24px;
	flex-shrink: 0;
}

.global-consent-toggle input {
	opacity: 0;
	width: 0;
	height: 0;
}

.global-consent-toggle__slider {
	position: absolute;
	cursor: pointer;
	inset: 0;
	background: #ccc;
	border-radius: 24px;
	transition: background 0.2s;
}

.global-consent-toggle__slider::before {
	content: "";
	position: absolute;
	height: 18px;
	width: 18px;
	left: 3px;
	bottom: 3px;
	background: #fff;
	border-radius: 50%;
	transition: transform 0.2s;
}

.global-consent-toggle input:checked + .global-consent-toggle__slider {
	background: var(--global-consent-primary);
}

.global-consent-toggle input:checked + .global-consent-toggle__slider::before {
	transform: translateX(20px);
}

.global-consent-toggle input:disabled + .global-consent-toggle__slider {
	opacity: 0.6;
	cursor: not-allowed;
}

.global-consent-modal__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	margin-top: 1.25rem;
	justify-content: flex-end;
}

body.global-consent-modal-open {
	overflow: hidden;
}

.global-consent-reopen {
	position: fixed;
	bottom: 1rem;
	left: 1rem;
	z-index: 999998;
	font: inherit;
	font-size: 0.75rem;
	padding: 0.5rem 0.75rem;
	border-radius: 6px;
	border: 1px solid var(--global-consent-border);
	background: var(--global-consent-bg);
	color: var(--global-consent-text);
	cursor: pointer;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.global-consent-reopen:focus-visible {
	outline: 2px solid var(--global-consent-primary);
	outline-offset: 2px;
}

.global-consent-preferences-link {
	background: none;
	border: none;
	color: var(--global-consent-primary);
	cursor: pointer;
	text-decoration: underline;
	font: inherit;
	padding: 0;
}

.screen-reader-text {
	clip: rect(1px, 1px, 1px, 1px);
	clip-path: inset(50%);
	height: 1px;
	width: 1px;
	margin: -1px;
	overflow: hidden;
	padding: 0;
	position: absolute;
	word-wrap: normal !important;
}

@media (max-width: 640px) {
	.global-consent-banner__inner {
		flex-direction: column;
		align-items: stretch;
	}

	.global-consent-banner__actions {
		flex-direction: column;
	}

	.global-consent-banner__actions .global-consent-btn {
		width: 100%;
		text-align: center;
	}
}
