/*!
 * Cookie consent + preferences dialog for garage-theme.
 * Uses the theme design tokens so it inherits site branding.
 * No hardcoded brand names or colors beyond the token variables.
 */

.mfc {
	--mfc-bg: var(--g-surface, #ffffff);
	--mfc-text: var(--g-text, #22262e);
	--mfc-muted: var(--g-muted, #5b6470);
	--mfc-line: var(--g-line, #e3e6eb);
	--mfc-accent: var(--g-accent, #e8480c);
	--mfc-radius: var(--g-radius, 16px);
	position: fixed;
	inset: 0;
	z-index: 99999;
	pointer-events: none;
}

.mfc *,
.mfc *::before,
.mfc *::after {
	box-sizing: border-box;
}

.mfc [hidden] {
	display: none !important;
}

.mfc button {
	font: inherit;
	cursor: pointer;
}

.mfc:focus-visible {
	outline: none;
}

/* Banner */
.mfc-banner {
	position: fixed;
	left: 50%;
	bottom: 16px;
	transform: translateX(-50%);
	width: min(680px, calc(100vw - 24px));
	background: var(--mfc-bg);
	color: var(--mfc-text);
	border-radius: var(--mfc-radius);
	box-shadow: var(--g-shadow-md, 0 10px 30px rgba(22, 24, 29, 0.12));
	border: 1px solid var(--g-line, #e3e6eb);
	padding: 20px 22px;
	pointer-events: auto;
	animation: mfc-rise 0.22s ease-out;
}

@keyframes mfc-rise {
	from {
		opacity: 0;
		transform: translate(-50%, 12px);
	}
	to {
		opacity: 1;
		transform: translate(-50%, 0);
	}
}

.mfc-banner__inner {
	display: flex;
	flex-direction: column;
	gap: 14px;
}

.mfc-title {
	font-size: 1.05rem;
	font-weight: 700;
	line-height: 1.35;
	margin: 0 0 4px;
	color: var(--mfc-text);
}

.mfc-text {
	font-size: 0.88rem;
	line-height: 1.55;
	color: var(--mfc-muted);
	margin: 0 0 6px;
}

.mfc-link {
	font-size: 0.86rem;
	font-weight: 600;
	color: var(--mfc-accent);
	text-decoration: underline;
	text-underline-offset: 2px;
}

.mfc-link:hover,
.mfc-link:focus-visible {
	text-decoration-thickness: 2px;
}

.mfc-banner__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	align-items: center;
}

/* Buttons */
.mfc-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	border-radius: var(--g-radius-sm, 10px);
	padding: 10px 18px;
	font-size: 0.9rem;
	font-weight: 600;
	line-height: 1.2;
	border: 1px solid transparent;
	transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.mfc-btn:focus-visible,
.mfc-toggle__track:focus-visible,
.mfc-dialog__close:focus-visible {
	outline: 3px solid var(--mfc-accent);
	outline-offset: 2px;
}

.mfc-btn--primary {
	background: var(--mfc-accent);
	color: #ffffff;
}

.mfc-btn--primary:hover {
	background: var(--g-accent-dark, #c63b08);
}

.mfc-btn--ghost {
	background: transparent;
	border-color: var(--mfc-line);
	color: var(--mfc-text);
}

.mfc-btn--ghost:hover {
	border-color: var(--mfc-accent);
	color: var(--mfc-accent);
}

.mfc-btn--link {
	background: transparent;
	color: var(--mfc-accent);
	padding-left: 10px;
	padding-right: 10px;
	text-decoration: underline;
	text-underline-offset: 2px;
}

.mfc-btn--link:hover {
	color: var(--g-accent-dark, #c63b08);
}

/* Dialog */
.mfc-dialog {
	position: fixed;
	inset: 0;
	z-index: 99999;
	pointer-events: auto;
}

.mfc-dialog__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(22, 24, 29, 0.55);
	opacity: 0;
	animation: mfc-fade 0.18s ease forwards;
}

@keyframes mfc-fade {
	from {
		opacity: 0;
	}
	to {
		opacity: 1;
	}
}

.mfc-dialog__panel {
	position: absolute;
	left: 50%;
	top: 50%;
	transform: translate(-50%, -50%);
	width: min(540px, calc(100vw - 24px));
	max-height: calc(100vh - 48px);
	overflow-y: auto;
	background: var(--mfc-bg);
	color: var(--mfc-text);
	border-radius: var(--mfc-radius);
	box-shadow: var(--g-shadow-md, 0 10px 30px rgba(22, 24, 29, 0.12));
	padding: 22px 24px;
	animation: mfc-rise 0.2s ease-out;
}

.mfc-dialog__header {
	display: flex;
	justify-content: space-between;
	gap: 16px;
	align-items: flex-start;
	margin-bottom: 16px;
}

.mfc-dialog__close {
	background: transparent;
	border: none;
	font-size: 1.4rem;
	line-height: 1;
	width: 36px;
	height: 36px;
	border-radius: 50%;
	color: var(--mfc-muted);
}

.mfc-dialog__close:hover {
	background: var(--g-bg, #f5f6f8);
	color: var(--mfc-text);
}

/* Categories + toggles */
.mfc-categories {
	display: grid;
	gap: 10px;
	margin: 18px 0;
}

.mfc-category {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	border: 1px solid var(--mfc-line);
	border-radius: var(--g-radius-sm, 10px);
	padding: 12px 14px;
}

.mfc-category__name {
	display: block;
	font-size: 0.9rem;
	font-weight: 700;
	margin-bottom: 2px;
}

.mfc-category__desc {
	font-size: 0.82rem;
	line-height: 1.5;
	color: var(--mfc-muted);
	margin: 0;
}

.mfc-toggle {
	position: relative;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	cursor: pointer;
	flex-shrink: 0;
}

.mfc-toggle input {
	position: absolute;
	opacity: 0;
	width: 0;
	height: 0;
}

.mfc-toggle__track {
	position: relative;
	width: 44px;
	height: 26px;
	border-radius: 999px;
	background: var(--mfc-muted);
	transition: background 0.15s ease;
	display: inline-block;
}

.mfc-toggle__track::after {
	content: "";
	position: absolute;
	top: 3px;
	left: 3px;
	width: 20px;
	height: 20px;
	border-radius: 50%;
	background: #ffffff;
	transition: transform 0.15s ease;
	box-shadow: 0 1px 2px rgba(22, 24, 29, 0.25);
}

.mfc-toggle input:checked + .mfc-toggle__track {
	background: var(--mfc-accent);
}

.mfc-toggle input:checked + .mfc-toggle__track::after {
	transform: translateX(18px);
}

.mfc-toggle input:focus-visible + .mfc-toggle__track {
	outline: 3px solid var(--mfc-accent);
	outline-offset: 2px;
}

.mfc-toggle__label {
	position: absolute !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
}

.mfc-toggle--locked {
	cursor: not-allowed;
}

.mfc-toggle--locked .mfc-toggle__track {
	background: var(--mfc-line);
}

.mfc-toggle--locked .mfc-toggle__track::after {
	background: var(--mfc-muted);
}

/* Dialog footer */
.mfc-dialog__footer {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	justify-content: flex-end;
	border-top: 1px solid var(--mfc-line);
	padding-top: 16px;
}

@media (max-width: 560px) {
	.mfc-banner__actions,
	.mfc-dialog__footer {
		flex-direction: column;
		align-items: stretch;
	}

	.mfc-btn {
		width: 100%;
	}
}

@media (prefers-reduced-motion: reduce) {
	.mfc-banner,
	.mfc-dialog__panel,
	.mfc-dialog__backdrop {
		animation: none;
	}
}