/*
 * Flavor Consent — banner styles.
 *
 * Uses CSS variables exposed by flavor-starter (main.css :root). Falls
 * back to safe defaults for themes that do not ship the token set,
 * so the plugin stays visually acceptable in a swap-out scenario.
 */

.flavor-consent {
	--fc-bg:         var(--color-white, #fff);
	--fc-text:       var(--color-neutral-900, #1a1a1a);
	--fc-muted:      var(--color-neutral-600, #525252);
	--fc-border:     var(--color-neutral-200, #e5e5e5);
	--fc-primary:    var(--color-primary, #0d6b6e);
	--fc-primary-hv: var(--color-primary-hover, #0a5557);
	--fc-accent:     var(--color-neutral-100, #f5f5f5);
	--fc-radius:     var(--radius-lg, 0.75rem);
	--fc-shadow:     var(--shadow-xl, 0 20px 25px -5px rgba(0,0,0,.08));
	--fc-font:       var(--font-body, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif);

	position: fixed;
	inset: 0;
	z-index: 2147483000;
	font-family: var(--fc-font);
	color: var(--fc-text);
}

.flavor-consent[hidden] {
	display: none !important;
}

/* --- Bottom overlay mode --- */
.flavor-consent[data-mode="bottom_overlay"] {
	inset: auto 0 0 0;
	pointer-events: none;
}
.flavor-consent[data-mode="bottom_overlay"] .flavor-consent__backdrop {
	display: none;
}
.flavor-consent[data-mode="bottom_overlay"] .flavor-consent__panel {
	pointer-events: auto;
	margin: 0 auto;
	max-width: 1100px;
	width: calc(100% - 2rem);
	margin-bottom: 1rem;
	border-radius: var(--fc-radius);
}

/* --- Modal center mode --- */
.flavor-consent[data-mode="modal_center"] {
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 1rem;
}
.flavor-consent[data-mode="modal_center"] .flavor-consent__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(26,26,26,.55);
}
.flavor-consent[data-mode="modal_center"] .flavor-consent__panel {
	position: relative;
	max-width: 560px;
	width: 100%;
	border-radius: var(--fc-radius);
}

/* --- Panel --- */
.flavor-consent__panel {
	background: var(--fc-bg);
	color: var(--fc-text);
	padding: 1.5rem;
	box-shadow: var(--fc-shadow);
	border: 1px solid var(--fc-border);
	max-height: 85vh;
	overflow-y: auto;
}

.flavor-consent__title {
	font-size: 1.125rem;
	font-weight: 600;
	margin: 0 0 .5rem;
	color: var(--fc-text);
}

.flavor-consent__body {
	font-size: .9375rem;
	line-height: 1.55;
	margin: 0 0 1rem;
	color: var(--fc-muted);
}

.flavor-consent__policy {
	color: var(--fc-primary);
	text-decoration: underline;
	text-underline-offset: 2px;
}
.flavor-consent__policy:hover { color: var(--fc-primary-hv); }

/* --- Actions --- */
.flavor-consent__actions {
	display: flex;
	gap: .5rem;
	flex-wrap: wrap;
	justify-content: flex-end;
	margin-top: .75rem;
}

.flavor-consent__btn {
	appearance: none;
	border: 1px solid transparent;
	border-radius: var(--radius-md, .5rem);
	padding: .625rem 1rem;
	font-size: .9375rem;
	font-weight: 500;
	cursor: pointer;
	font-family: inherit;
	transition: background-color .15s ease, border-color .15s ease, color .15s ease;
	line-height: 1.2;
	min-height: 40px;
}

.flavor-consent__btn--primary {
	background: var(--fc-primary);
	color: var(--color-white, #fff);
}
.flavor-consent__btn--primary:hover,
.flavor-consent__btn--primary:focus-visible {
	background: var(--fc-primary-hv);
}

.flavor-consent__btn--secondary {
	background: var(--fc-accent);
	color: var(--fc-text);
	border-color: var(--fc-border);
}
.flavor-consent__btn--secondary:hover,
.flavor-consent__btn--secondary:focus-visible {
	background: var(--color-neutral-200, #e5e5e5);
}

.flavor-consent__btn--ghost {
	background: transparent;
	color: var(--fc-muted);
	text-decoration: underline;
	text-underline-offset: 2px;
	padding: .625rem .5rem;
}
.flavor-consent__btn--ghost:hover,
.flavor-consent__btn--ghost:focus-visible {
	color: var(--fc-text);
}

.flavor-consent__btn:focus-visible {
	outline: 2px solid var(--fc-primary);
	outline-offset: 2px;
}

/* --- Details view (categories) --- */
.flavor-consent__categories {
	display: flex;
	flex-direction: column;
	gap: .75rem;
	margin: 1rem 0;
}

.flavor-consent__cat {
	display: block;
	padding: .875rem 1rem;
	border: 1px solid var(--fc-border);
	border-radius: var(--radius-md, .5rem);
	cursor: pointer;
	background: var(--color-neutral-50, #fafaf8);
}

.flavor-consent__cat-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	font-weight: 600;
	color: var(--fc-text);
}

.flavor-consent__cat-title { font-size: .9375rem; }

.flavor-consent__cat-desc {
	display: block;
	margin-top: .375rem;
	font-size: .8125rem;
	color: var(--fc-muted);
	font-weight: 400;
	line-height: 1.5;
}

/* --- Toggle switch --- */
.flavor-consent__toggle {
	position: relative;
	display: inline-block;
	width: 38px;
	height: 22px;
	flex: 0 0 38px;
}

.flavor-consent__toggle input {
	opacity: 0;
	width: 0;
	height: 0;
	position: absolute;
}

.flavor-consent__toggle-slider {
	position: absolute;
	inset: 0;
	background: var(--color-neutral-300, #d4d4d4);
	border-radius: 999px;
	transition: background-color .2s ease;
}

.flavor-consent__toggle-slider::before {
	content: "";
	position: absolute;
	left: 3px;
	top: 3px;
	width: 16px;
	height: 16px;
	background: #fff;
	border-radius: 50%;
	transition: transform .2s ease;
	box-shadow: 0 1px 2px rgba(0,0,0,.2);
}

.flavor-consent__toggle input:checked + .flavor-consent__toggle-slider {
	background: var(--fc-primary);
}
.flavor-consent__toggle input:checked + .flavor-consent__toggle-slider::before {
	transform: translateX(16px);
}
.flavor-consent__toggle input:disabled + .flavor-consent__toggle-slider {
	opacity: .55;
	cursor: not-allowed;
}
.flavor-consent__toggle input:focus-visible + .flavor-consent__toggle-slider {
	outline: 2px solid var(--fc-primary);
	outline-offset: 2px;
}

/* --- Reopen trigger (fixed bottom-left) --- */
.flavor-consent-reopen {
	position: fixed;
	bottom: 1rem;
	left: 1rem;
	z-index: 2147482000;
	display: none; /* banner.js toggles this only once a choice is recorded */
	align-items: center;
	gap: .375rem;
	padding: .5rem .75rem;
	background: var(--color-white, #fff);
	color: var(--color-neutral-800, #2d2d2d);
	border: 1px solid var(--color-neutral-200, #e5e5e5);
	border-radius: 999px;
	font-size: .8125rem;
	font-family: var(--font-body, system-ui, sans-serif);
	cursor: pointer;
	box-shadow: var(--shadow-md, 0 4px 6px -1px rgba(0,0,0,.06));
	transition: background-color .15s ease;
}
.flavor-consent-reopen:hover { background: var(--color-neutral-50, #fafaf8); }
.flavor-consent-reopen.is-visible { display: inline-flex; }

.flavor-consent-reopen-link {
	color: inherit;
	text-decoration: underline;
	text-underline-offset: 2px;
	cursor: pointer;
}

/* --- Mobile --- */
@media (max-width: 640px) {
	.flavor-consent__panel { padding: 1.25rem; }
	.flavor-consent__actions { justify-content: stretch; }
	.flavor-consent__actions .flavor-consent__btn { flex: 1 1 auto; }
	.flavor-consent__btn--ghost { flex: 1 1 100%; order: 3; }
	.flavor-consent-reopen .flavor-consent-reopen__label { display: none; }
	.flavor-consent-reopen { padding: .625rem; font-size: 1rem; }
}
