/* HeyChef Consent — floating card + preferences sheet (--rfy-* fallbacks) */

.hc-consent,
.hc-consent-modal {
	--hc-consent-bg: var(--rfy-background, #f8f4ef);
	--hc-consent-surface: var(--rfy-surface, #fff);
	--hc-consent-fg: var(--rfy-foreground, #2b1a10);
	--hc-consent-muted: var(--rfy-muted, #6b5a4e);
	--hc-consent-border: var(--rfy-border, rgba(61, 35, 24, 0.14));
	--hc-consent-primary: var(--rfy-primary, #c45c3e);
	--hc-consent-radius: var(--rfy-radius-md, 16px);
	--hc-consent-shadow: var(--rfy-shadow-lg, 0 18px 45px rgba(61, 35, 24, 0.16));
	--hc-consent-transition: var(--rfy-transition, 0.2s ease);
}

.hc-consent {
	position: fixed;
	z-index: 997;
	inset-inline-start: 12px;
	inset-inline-end: auto;
	bottom: calc(12px + env(safe-area-inset-bottom, 0px));
	width: min(calc(100vw - 24px), 360px);
	max-width: 360px;
	pointer-events: none;
}

.hc-consent[hidden],
.hc-consent-modal[hidden] {
	display: none !important;
}

.hc-consent__card {
	pointer-events: auto;
	display: flex;
	flex-direction: column;
	gap: 12px;
	padding: 14px 16px;
	background-color: var(--hc-consent-surface);
	border: 1px solid var(--hc-consent-border);
	border-radius: var(--hc-consent-radius);
	box-shadow: var(--hc-consent-shadow);
}

.hc-consent__text {
	margin: 0;
	font-size: 0.875rem;
	line-height: 1.45;
	color: var(--hc-consent-fg);
}

.hc-consent__link {
	color: var(--hc-consent-primary);
	text-decoration: underline;
	text-underline-offset: 2px;
	font-weight: 600;
}

.hc-consent__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	align-items: center;
}

.hc-consent__btn {
	min-height: 44px;
	min-width: 44px;
	font-size: 0.9375rem;
	font-weight: 700;
	cursor: pointer;
	border-radius: var(--rfy-radius-sm, 10px);
}

.hc-consent__btn--prefs {
	flex: 1 1 auto;
	min-width: 0;
	background: transparent;
	border: none;
	color: var(--hc-consent-primary);
	text-decoration: underline;
	text-underline-offset: 2px;
	padding: 8px 6px;
	font-size: 0.875rem;
	font-weight: 600;
}

.hc-consent__btn--prefs:focus-visible {
	outline: none;
	box-shadow: var(--rfy-focus-ring, 0 0 0 3px rgba(212, 168, 83, 0.5));
}

.hc-consent__btn--reject,
.hc-consent__btn--accept {
	flex: 1 1 calc(50% - 6px);
	justify-content: center;
}

/* Plugin fallbacks when theme button classes are absent */
.hc-consent__btn--accept.rfy-btn--primary,
.hc-consent__btn--accept:not(.rfy-btn) {
	background: var(--rfy-gradient-cta-gold, linear-gradient(135deg, #e8c56a 0%, #d4a853 100%));
	color: var(--rfy-primary-dark, #3d2318);
	border: 2px solid transparent;
	box-shadow: var(--rfy-shadow-cta, 0 10px 24px rgba(212, 168, 83, 0.35));
	padding: 8px 14px;
}

.hc-consent__btn--reject.rfy-btn--outline,
.hc-consent__btn--reject:not(.rfy-btn) {
	background: transparent;
	border: 2px solid var(--hc-consent-primary);
	color: var(--hc-consent-primary);
	padding: 8px 14px;
}

/* ── Preferences modal / sheet ── */

.hc-consent-modal {
	position: fixed;
	inset: 0;
	z-index: 1000;
	display: flex;
	flex-direction: column;
	justify-content: flex-end;
}

.hc-consent-modal__overlay {
	position: absolute;
	inset: 0;
	background: rgba(43, 26, 16, 0.5);
	backdrop-filter: blur(2px);
}

.hc-consent-modal__panel {
	position: relative;
	z-index: 1;
	display: flex;
	flex-direction: column;
	width: 100%;
	max-height: min(88vh, 560px);
	overflow: hidden;
	background-color: var(--hc-consent-bg);
	border: 1px solid var(--hc-consent-border);
	border-radius: var(--rfy-radius-lg, 20px) var(--rfy-radius-lg, 20px) 0 0;
	box-shadow: var(--hc-consent-shadow);
}

.hc-consent-modal__header {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 12px;
	padding: 16px 18px;
	border-block-end: 1px solid var(--hc-consent-border);
	background-color: var(--hc-consent-surface);
}

.hc-consent-modal__title {
	margin: 0;
	font-size: 1.0625rem;
	font-weight: 700;
	color: var(--hc-consent-fg);
}

.hc-consent-modal__intro {
	margin: 0;
	padding: 12px 18px 0;
	font-size: 0.875rem;
	line-height: 1.45;
	color: var(--hc-consent-muted);
}

.hc-consent-modal__body {
	flex: 1 1 auto;
	overflow: auto;
	padding: 12px 18px 4px;
}

.hc-consent-modal__close {
	flex-shrink: 0;
	min-width: 44px;
	min-height: 44px;
	border: 1px solid var(--hc-consent-border);
	border-radius: 10px;
	background-color: var(--hc-consent-surface);
	font-size: 1.375rem;
	line-height: 1;
	cursor: pointer;
	color: var(--hc-consent-fg);
}

.hc-consent-modal__footer {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	padding: 14px 18px calc(14px + env(safe-area-inset-bottom, 0px));
	border-block-start: 1px solid var(--hc-consent-border);
	background-color: var(--hc-consent-surface);
	justify-content: stretch;
}

.hc-consent-modal__footer .hc-consent__btn--reject,
.hc-consent-modal__footer .hc-consent__btn--accept {
	flex: 1 1 calc(50% - 4px);
}

.hc-consent-pref {
	padding: 12px 14px;
	margin-block-end: 10px;
	background-color: var(--hc-consent-surface);
	border: 1px solid var(--hc-consent-border);
	border-radius: 12px;
}

.hc-consent-pref:last-child {
	margin-block-end: 0;
}

.hc-consent-pref__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-block-end: 4px;
}

.hc-consent-pref__label {
	display: flex;
	align-items: center;
	gap: 8px;
	cursor: pointer;
}

.hc-consent-pref__title {
	font-size: 0.9375rem;
	font-weight: 700;
	color: var(--hc-consent-fg);
}

.hc-consent-pref__desc {
	margin: 0;
	font-size: 0.8125rem;
	line-height: 1.45;
	color: var(--hc-consent-muted);
}

.hc-consent-pref__badge {
	font-size: 0.75rem;
	font-weight: 700;
	padding: 4px 8px;
	border-radius: 999px;
	background: rgba(61, 35, 24, 0.08);
	color: var(--hc-consent-muted);
}

/* Toggle switch */
.hc-consent-switch {
	position: relative;
	display: inline-flex;
	align-items: center;
	flex-shrink: 0;
	width: 44px;
	height: 28px;
}

.hc-consent-switch__input {
	position: absolute;
	inset: 0;
	opacity: 0;
	width: 44px;
	height: 28px;
	margin: 0;
	cursor: pointer;
	z-index: 1;
}

.hc-consent-switch__track {
	position: relative;
	display: block;
	width: 44px;
	height: 28px;
	border-radius: 999px;
	background: rgba(61, 35, 24, 0.18);
	transition: background var(--hc-consent-transition);
}

.hc-consent-switch__thumb {
	position: absolute;
	inset-block-start: 4px;
	inset-inline-start: 4px;
	width: 20px;
	height: 20px;
	border-radius: 50%;
	background: #fff;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
	transition: transform var(--hc-consent-transition);
}

.hc-consent-switch__input:checked + .hc-consent-switch__track {
	background: var(--hc-consent-primary);
}

.hc-consent-switch__input:checked + .hc-consent-switch__track .hc-consent-switch__thumb {
	transform: translateX(16px);
}

[dir="rtl"] .hc-consent-switch__input:checked + .hc-consent-switch__track .hc-consent-switch__thumb {
	transform: translateX(-16px);
}

.hc-consent-switch__input:focus-visible + .hc-consent-switch__track {
	box-shadow: var(--rfy-focus-ring, 0 0 0 3px rgba(212, 168, 83, 0.5));
}

.hc-consent-footer-link {
	background: none;
	border: none;
	padding: 0;
	font: inherit;
	color: inherit;
	cursor: pointer;
	text-align: inherit;
	text-decoration: none;
	display: block;
}

.hc-consent-footer-link:hover,
.hc-consent-footer-link:focus-visible {
	text-decoration: underline;
}

@media (max-width: 767px) {
	.hc-consent {
		bottom: calc(68px + 12px + env(safe-area-inset-bottom, 0px));
		width: min(calc(100vw - 20px), 340px);
	}
}

@media (min-width: 768px) {
	.hc-consent {
		inset-inline-start: 20px;
		bottom: 20px;
		width: min(calc(100vw - 40px), 380px);
		max-width: 380px;
	}

	.hc-consent-modal {
		align-items: center;
		justify-content: center;
		padding: 24px;
	}

	.hc-consent-modal__panel {
		width: min(100%, 440px);
		max-height: min(85vh, 520px);
		border-radius: var(--hc-consent-radius);
	}
}

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

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

@media (prefers-reduced-motion: reduce) {
	.hc-consent-switch__track,
	.hc-consent-switch__thumb {
		transition: none;
	}
}
