/* QC Cookie Consent Banner + preferences dialog.
 *
 * No Figma frame exists for this component; it reuses the QC palette and the
 * announcement-popup card language (Cairo, #911731 primary, 16px radius,
 * soft shadow) so it reads as part of the site. Logical properties only, so
 * the same rules mirror under dir="rtl". Mobile is a stacked layout with
 * full-width buttons, not a shrunken desktop row. Accept and Reject share the
 * same size and weight (no nudging toward Accept).
 */

.qc-cc-banner,
.qc-cc-overlay {
	--qc-cc-bg: #ffffff;
	--qc-cc-fg: #1d1d1b;
	--qc-cc-muted: #4a4a49;
	--qc-cc-border: #e4e4e3;
	--qc-cc-brand: #911731;
	--qc-cc-brand-hover: #7a1329;
	--qc-cc-link: #911731;
	--qc-cc-track: #c4c4c3;
	--qc-cc-focus: #911731;

	font-family: "Cairo", system-ui, -apple-system, "Segoe UI", sans-serif;
	color: var(--qc-cc-fg);
	text-align: start;
}

.qc-cc-banner *,
.qc-cc-overlay *,
.qc-cc-banner *::before,
.qc-cc-overlay *::before,
.qc-cc-banner *::after,
.qc-cc-overlay *::after {
	box-sizing: border-box;
}

/* ------------------------------------------------------------- banner */

.qc-cc-banner {
	position: fixed;
	inset-inline: 24px;
	inset-block-end: 24px;
	z-index: 99990;
	display: flex;
	align-items: center;
	gap: 32px;
	max-width: 1280px;
	margin-inline: auto;
	padding: 24px 32px;
	background: var(--qc-cc-bg);
	border: 1px solid var(--qc-cc-border);
	border-radius: 16px;
	box-shadow: 0 0 32px rgba(29, 29, 27, 0.25);
	animation: qc-cc-rise 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.qc-cc-banner-body {
	flex: 1 1 auto;
	min-width: 0;
}

.qc-cc-title {
	margin: 0 0 6px;
	font-size: 20px;
	font-weight: 700;
	line-height: 1.4;
	color: var(--qc-cc-fg);
}

.qc-cc-msg {
	margin: 0;
	font-size: 15px;
	line-height: 1.6;
	color: var(--qc-cc-muted);
}

.qc-cc-policy {
	color: var(--qc-cc-link);
	font-weight: 600;
	text-decoration: underline;
	text-underline-offset: 2px;
}

.qc-cc-actions {
	display: flex;
	flex: 0 0 auto;
	flex-wrap: wrap;
	align-items: center;
	gap: 12px;
}

/* ------------------------------------------------------------ buttons */

.qc-cc-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 48px;
	min-width: 140px;
	margin: 0;
	padding: 10px 22px;
	border: 2px solid var(--qc-cc-brand);
	border-radius: 999px;
	font: inherit;
	font-size: 15px;
	font-weight: 700;
	line-height: 1.2;
	white-space: nowrap;
	cursor: pointer;
	text-decoration: none;
	transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.qc-cc-btn-primary {
	background: var(--qc-cc-brand);
	color: #ffffff;
}

.qc-cc-btn-secondary {
	background: transparent;
	color: var(--qc-cc-brand);
}

.qc-cc-btn-ghost {
	min-width: 0;
	padding-inline: 8px;
	border-color: transparent;
	background: transparent;
	color: var(--qc-cc-fg);
	text-decoration: underline;
	text-underline-offset: 3px;
}

@media (hover: hover) and (pointer: fine) {
	.qc-cc-btn-primary:hover {
		background: var(--qc-cc-brand-hover);
		border-color: var(--qc-cc-brand-hover);
	}

	.qc-cc-btn-secondary:hover {
		background: var(--qc-cc-brand);
		color: #ffffff;
	}

	.qc-cc-btn-ghost:hover {
		color: var(--qc-cc-brand);
	}
}

.qc-cc-btn:focus-visible,
.qc-cc-x:focus-visible,
.qc-cc-policy:focus-visible,
.qc-cc-switch input:focus-visible + .qc-cc-switch-track {
	outline: 3px solid var(--qc-cc-focus);
	outline-offset: 2px;
}

/* ------------------------------------------------------------- dialog */

.qc-cc-overlay {
	position: fixed;
	inset: 0;
	z-index: 100001;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px;
	background: rgba(29, 29, 27, 0.55);
	-webkit-backdrop-filter: blur(2px);
	backdrop-filter: blur(2px);
	animation: qc-cc-fade 0.2s ease-out;
}

.qc-cc-dialog {
	display: flex;
	flex-direction: column;
	gap: 20px;
	width: 100%;
	max-width: 640px;
	max-height: calc(100vh - 48px);
	overflow-y: auto;
	padding: 32px;
	background: var(--qc-cc-bg);
	border-radius: 16px;
	box-shadow: 0 0 32px rgba(29, 29, 27, 0.3);
}

.qc-cc-dialog-head {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 16px;
}

.qc-cc-dialog-head .qc-cc-title {
	margin: 0;
}

.qc-cc-x {
	display: inline-flex;
	flex: 0 0 auto;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	margin: -4px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: var(--qc-cc-muted);
	cursor: pointer;
}

.qc-cc-x svg {
	width: 24px;
	height: 24px;
}

.qc-cc-cats {
	display: flex;
	flex-direction: column;
	border: 1px solid var(--qc-cc-border);
	border-radius: 12px;
}

.qc-cc-cat {
	padding: 16px 20px;
}

.qc-cc-cat + .qc-cc-cat {
	border-block-start: 1px solid var(--qc-cc-border);
}

.qc-cc-cat-head {
	display: flex;
	align-items: center;
	gap: 12px;
}

.qc-cc-cat-title {
	flex: 1 1 auto;
	margin: 0;
	font-size: 16px;
	font-weight: 700;
	color: var(--qc-cc-fg);
	cursor: pointer;
}

.qc-cc-always {
	font-size: 13px;
	font-weight: 600;
	color: var(--qc-cc-brand);
}

.qc-cc-cat-desc {
	margin: 6px 0 0;
	font-size: 14px;
	line-height: 1.6;
	color: var(--qc-cc-muted);
}

/* Switch: the real checkbox stays focusable and clickable over the track. */
.qc-cc-switch {
	position: relative;
	flex: 0 0 auto;
	width: 48px;
	height: 28px;
}

.qc-cc-switch input {
	position: absolute;
	inset: 0;
	z-index: 1;
	width: 100%;
	height: 100%;
	margin: 0;
	opacity: 0;
	cursor: pointer;
}

.qc-cc-switch input:disabled {
	cursor: not-allowed;
}

.qc-cc-switch-track {
	position: absolute;
	inset: 0;
	border-radius: 999px;
	background: var(--qc-cc-track);
	transition: background-color 0.15s ease;
}

.qc-cc-switch-track::after {
	content: "";
	position: absolute;
	inset-block-start: 3px;
	inset-inline-start: 3px;
	width: 22px;
	height: 22px;
	border-radius: 50%;
	background: #ffffff;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
	transition: inset-inline-start 0.15s ease;
}

.qc-cc-switch input:checked + .qc-cc-switch-track {
	background: var(--qc-cc-brand);
}

.qc-cc-switch input:checked + .qc-cc-switch-track::after {
	inset-inline-start: 23px;
}

.qc-cc-switch input:disabled + .qc-cc-switch-track {
	opacity: 0.6;
}

.qc-cc-dialog .qc-cc-actions {
	justify-content: flex-end;
}

.qc-cc-sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* ------------------------------------------------------------- mobile */

@media (max-width: 991px) {
	.qc-cc-banner {
		flex-direction: column;
		align-items: stretch;
		gap: 16px;
		inset-inline: 12px;
		inset-block-end: 12px;
		max-height: calc(100vh - 24px);
		overflow-y: auto;
		padding: 20px;
	}

	.qc-cc-title {
		font-size: 18px;
	}

	.qc-cc-msg {
		font-size: 14px;
	}

	.qc-cc-actions {
		display: grid;
		grid-template-columns: 1fr 1fr;
		gap: 10px;
	}

	.qc-cc-btn {
		min-width: 0;
		width: 100%;
		white-space: normal;
	}

	/* Settings spans the row under the two equal Accept / Reject buttons. */
	.qc-cc-banner .qc-cc-btn-ghost {
		grid-column: 1 / -1;
		order: 3;
	}

	.qc-cc-overlay {
		align-items: flex-end;
		padding: 0;
	}

	.qc-cc-dialog {
		max-width: none;
		max-height: 92vh;
		padding: 24px 20px;
		border-radius: 16px 16px 0 0;
	}

	.qc-cc-dialog .qc-cc-actions {
		grid-template-columns: 1fr;
	}
}

/* ------------------------------------------------------------- motion */

@keyframes qc-cc-rise {
	from {
		opacity: 0;
		transform: translateY(16px);
	}

	to {
		opacity: 1;
		transform: none;
	}
}

@keyframes qc-cc-fade {
	from {
		opacity: 0;
	}

	to {
		opacity: 1;
	}
}

@media (prefers-reduced-motion: reduce) {
	.qc-cc-banner,
	.qc-cc-overlay {
		animation: none;
	}

	.qc-cc-btn,
	.qc-cc-switch-track,
	.qc-cc-switch-track::after {
		transition: none;
	}
}

/* ---------------------------------------------------------- dark mode */

/* The accessibility panel sets data-theme="dark" on <html> (qc-dark-mode);
   same palette as the announcement popup's dark card. */
:root[data-theme="dark"] .qc-cc-banner,
:root[data-theme="dark"] .qc-cc-overlay {
	--qc-cc-bg: #1d1d1b;
	--qc-cc-fg: #ffffff;
	--qc-cc-muted: #d0d0d0;
	--qc-cc-border: #4a4a49;
	--qc-cc-link: #e0738b;
	--qc-cc-track: #7c7b7b;
	--qc-cc-focus: #e0738b;
}

:root[data-theme="dark"] .qc-cc-btn-secondary {
	border-color: #e0738b;
	color: #ffffff;
}

:root[data-theme="dark"] .qc-cc-always {
	color: #e0738b;
}

@media (hover: hover) and (pointer: fine) {
	:root[data-theme="dark"] .qc-cc-btn-secondary:hover {
		background: #911731;
		border-color: #911731;
	}

	:root[data-theme="dark"] .qc-cc-btn-ghost:hover {
		color: #e0738b;
	}
}
