/**
 * Cookie consent manager — banner + preferences modal.
 *
 * Theme-native styling: ink #1d1d1d, accent (AA-contrast) #BE403F, Poppins.
 * Namespaced under .noile-cc so it never collides with theme/plugin CSS.
 * All interactive controls expose visible focus states and AA contrast.
 *
 * @package Noile
 */

.noile-cc {
	--cc-ink: #1d1d1d;
	--cc-paper: #ffffff;
	--cc-accent: #be403f;        /* AA contrast (5:1) with white button text */
	--cc-accent-hover: #a5322f;
	--cc-focus: #be403f;         /* brand-red focus ring (was Google blue #1a73e8) */
	--cc-muted: #5c5d63;
	--cc-line: #e4e6eb;
	--cc-canvas: #f5f6f8;
	--cc-radius: 14px;
	--cc-font: 'Poppins', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.noile-cc[hidden] {
	display: none;
}

/* Self-contained box model so the component never depends on a theme reset. */
.noile-cc,
.noile-cc *,
.noile-cc *::before,
.noile-cc *::after {
	box-sizing: border-box;
}

/* ===========================================================================
   Banner
   =========================================================================== */
.noile-cc__banner {
	position: fixed;
	z-index: 99999;
	left: 16px;
	right: 16px;
	bottom: 16px;
	margin: 0 auto;
	max-width: 1180px;
	background: var(--cc-paper);
	color: var(--cc-ink);
	border: 1px solid var(--cc-line);
	border-radius: var(--cc-radius);
	box-shadow: 0 18px 50px rgba(29, 29, 29, 0.18);
	padding: 22px 24px;
	font-family: var(--cc-font);
	animation: noile-cc-rise 320ms ease;
}

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

.noile-cc__banner[hidden] { display: none; }

/* The banner (tabindex="-1") is programmatically focused when it opens; recolor
   its focus ring from the browser-default blue to brand red. Negative offset
   keeps the ring INSIDE the popup edge (follows the rounded corners). */
.noile-cc__banner:focus,
.noile-cc__banner:focus-visible {
	outline: 2px solid var(--cc-focus);
	outline-offset: -4px;
}

.noile-cc__banner-inner {
	display: flex;
	align-items: center;
	gap: 28px;
	flex-wrap: wrap;
}

.noile-cc__copy { flex: 1 1 340px; min-width: 260px; }

.noile-cc__title {
	margin: 0 0 6px;
	font-family: var(--cc-font);
	font-size: 18px;
	font-weight: 700;
	line-height: 1.3;
	color: var(--cc-ink);
}

.noile-cc__text {
	margin: 0;
	font-size: 14px;
	line-height: 1.6;
	color: var(--cc-muted);
}

.noile-cc__text a {
	color: var(--cc-accent);
	text-decoration: underline;
	font-weight: 600;
}

.noile-cc__actions {
	display: flex;
	gap: 12px;
	flex: 0 1 auto;
	flex-wrap: wrap;
	align-items: center;
}

/* ===========================================================================
   Buttons — Accept All / Reject All carry equal visual weight (no dark
   patterns: same size, same font-weight, both solid). Manage is an outline
   button of identical dimensions.
   =========================================================================== */
.noile-cc__btn {
	appearance: none;
	-webkit-appearance: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 46px;
	padding: 12px 24px;
	font-family: var(--cc-font);
	font-size: 14px;
	font-weight: 600;
	line-height: 1;
	border-radius: 8px;
	border: 2px solid transparent;
	cursor: pointer;
	text-align: center;
	transition: background-color 200ms ease, color 200ms ease, border-color 200ms ease, transform 120ms ease;
}

.noile-cc__btn:hover { transform: translateY(-1px); }

.noile-cc__btn:focus-visible {
	outline: 3px solid var(--cc-focus);
	outline-offset: 2px;
}

.noile-cc__btn--primary {
	background: var(--cc-accent);
	color: #ffffff;
	border-color: var(--cc-accent);
}
.noile-cc__btn--primary:hover {
	background: var(--cc-accent-hover);
	border-color: var(--cc-accent-hover);
}

.noile-cc__btn--secondary {
	background: var(--cc-ink);
	color: #ffffff;
	border-color: var(--cc-ink);
}
.noile-cc__btn--secondary:hover { background: #000000; border-color: #000000; }

.noile-cc__btn--ghost {
	background: transparent;
	color: var(--cc-ink);
	border-color: #c7c9d0;
}
.noile-cc__btn--ghost:hover { border-color: var(--cc-ink); background: var(--cc-canvas); }

/* ===========================================================================
   Preferences modal
   =========================================================================== */
.noile-cc__modal {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
	font-family: var(--cc-font);
}
.noile-cc__modal[hidden] { display: none; }

.noile-cc__overlay {
	position: absolute;
	inset: 0;
	background: rgba(15, 15, 16, 0.62);
	animation: noile-cc-fade 220ms ease;
}

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

.noile-cc__dialog {
	position: relative;
	width: 100%;
	max-width: 560px;
	max-height: calc(100vh - 48px);
	display: flex;
	flex-direction: column;
	background: var(--cc-paper);
	border-radius: var(--cc-radius);
	box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
	overflow: hidden;
	animation: noile-cc-rise 260ms ease;
}

/* Dialog (tabindex="-1") is focused on open — brand-red ring, not browser blue. */
.noile-cc__dialog:focus,
.noile-cc__dialog:focus-visible {
	outline: 3px solid var(--cc-focus);
	outline-offset: -3px;
}

.noile-cc__dialog-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding: 22px 26px;
	border-bottom: 1px solid var(--cc-line);
}

.noile-cc__dialog-head h2 {
	margin: 0;
	font-size: 19px;
	font-weight: 700;
	color: var(--cc-ink);
}

.noile-cc__close {
	appearance: none;
	-webkit-appearance: none;
	border: 0;
	background: var(--cc-canvas);
	width: 38px;
	height: 38px;
	border-radius: 50%;
	cursor: pointer;
	color: var(--cc-ink);
	font-size: 20px;
	line-height: 1;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: none;
	transition: background-color 200ms ease;
}
.noile-cc__close:hover { background: #e9eaee; }
.noile-cc__close:focus-visible { outline: 3px solid var(--cc-focus); outline-offset: 2px; }

.noile-cc__dialog-body {
	padding: 22px 26px;
	overflow-y: auto;
}

.noile-cc__modal-intro {
	margin: 0 0 18px;
	font-size: 14px;
	line-height: 1.6;
	color: var(--cc-muted);
}
.noile-cc__modal-intro a { color: var(--cc-accent); text-decoration: underline; font-weight: 600; }

.noile-cc__row {
	border: 1px solid var(--cc-line);
	border-radius: 10px;
	padding: 16px 18px;
	margin-bottom: 12px;
	background: #fcfcfd;
}

.noile-cc__row-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 14px;
}

.noile-cc__cat-title {
	margin: 0;
	font-size: 15px;
	font-weight: 600;
	color: var(--cc-ink);
}

.noile-cc__cat-desc {
	margin: 8px 0 0;
	font-size: 13px;
	line-height: 1.6;
	color: var(--cc-muted);
}

.noile-cc__always {
	font-size: 13px;
	font-weight: 600;
	color: var(--cc-accent);
	white-space: nowrap;
}

/* Accessible toggle switch (real checkbox, visually styled) */
.noile-cc__switch {
	position: relative;
	display: inline-flex;
	align-items: center;
	flex: none;
	cursor: pointer;
}
.noile-cc__switch input {
	position: absolute;
	opacity: 0;
	width: 46px;
	height: 26px;
	margin: 0;
	cursor: pointer;
}
.noile-cc__slider {
	width: 46px;
	height: 26px;
	border-radius: 999px;
	background: #c4c6cd;
	position: relative;
	transition: background-color 200ms ease;
	flex: none;
}
.noile-cc__slider::after {
	content: "";
	position: absolute;
	top: 3px;
	left: 3px;
	width: 20px;
	height: 20px;
	border-radius: 50%;
	background: #ffffff;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
	transition: transform 200ms ease;
}
.noile-cc__switch input:checked + .noile-cc__slider { background: var(--cc-accent); }
.noile-cc__switch input:checked + .noile-cc__slider::after { transform: translateX(20px); }
.noile-cc__switch input:focus-visible + .noile-cc__slider { outline: 3px solid var(--cc-focus); outline-offset: 2px; }

.noile-cc__dialog-foot {
	display: flex;
	gap: 12px;
	flex-wrap: wrap;
	padding: 18px 26px;
	border-top: 1px solid var(--cc-line);
	background: var(--cc-canvas);
}
.noile-cc__dialog-foot .noile-cc__btn { flex: 1 1 auto; }

/* ===========================================================================
   Reopen link (footer "Cookie settings")
   =========================================================================== */
.noile-cc-reopen {
	background: none;
	border: 0;
	padding: 0;
	font: inherit;
	color: inherit;
	cursor: pointer;
	text-decoration: none;
}
.noile-cc-reopen:hover { text-decoration: underline; }

/* ===========================================================================
   Responsive — phones/tablets: stack copy over full-width buttons
   =========================================================================== */
@media (max-width: 782px) {
	.noile-cc__banner {
		left: 10px;
		right: 10px;
		bottom: 10px;
		padding: 20px;
	}
	.noile-cc__banner-inner { gap: 18px; }
	.noile-cc__actions { width: 100%; }
	.noile-cc__actions .noile-cc__btn { flex: 1 1 100%; width: 100%; }
	.noile-cc__dialog-foot { flex-direction: column; }
}

@media (min-width: 783px) and (max-width: 1024px) {
	.noile-cc__actions .noile-cc__btn { flex: 1 1 auto; }
}

/* Honour reduced-motion preference */
@media (prefers-reduced-motion: reduce) {
	.noile-cc__banner,
	.noile-cc__dialog,
	.noile-cc__overlay,
	.noile-cc__btn,
	.noile-cc__slider::after { animation: none !important; transition: none !important; }
}

/* High-contrast / forced-colors mode */
@media (forced-colors: active) {
	.noile-cc__btn { border: 2px solid ButtonText; }
	.noile-cc__slider { border: 1px solid ButtonText; }
}
