/**
 * Cookie Butter — banner styles.
 *
 * All rules scoped to #pilot-cc-root to minimize theme collisions. Uses CSS custom
 * properties for theming — the PHP class injects --pilot-cc-primary / --text / --bg.
 */

#pilot-cc-root {
	--pilot-cc-primary: #2d6cdf;
	--pilot-cc-primary-contrast: #ffffff;
	--pilot-cc-text: #1a1a1a;
	--pilot-cc-muted: #5e6470;
	--pilot-cc-bg: #ffffff;
	--pilot-cc-border: #e5e7eb;
	--pilot-cc-radius: 10px;
	--pilot-cc-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
	--pilot-cc-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

	font-family: var(--pilot-cc-font);
	color: var(--pilot-cc-text);
	font-size: 14px;
	line-height: 1.5;
}

#pilot-cc-root:not(.pilot-cc-visible) {
	display: none;
}

#pilot-cc-root * {
	box-sizing: border-box;
}

/* ------------------------------------------------------------------
 * Modal layout (default for opt-in mode)
 * ------------------------------------------------------------------ */

#pilot-cc-root.pilot-cc-visible[data-style="modal"] {
	position: fixed;
	inset: 0;
	background: rgba(15, 23, 42, 0.5);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 999999;
	padding: 20px;
}

#pilot-cc-root.pilot-cc-visible[data-style="modal"] .pilot-cc-banner,
#pilot-cc-root.pilot-cc-visible[data-style="modal"] .pilot-cc-preferences {
	background: var(--pilot-cc-bg);
	border-radius: var(--pilot-cc-radius);
	box-shadow: var(--pilot-cc-shadow);
	max-width: 560px;
	width: 100%;
	max-height: 90vh;
	overflow-y: auto;
	padding: 28px;
}

#pilot-cc-root.pilot-cc-visible[data-style="modal"] .pilot-cc-preferences {
	max-width: 720px;
}

/* ------------------------------------------------------------------
 * Bottom bar layout (default for opt-out mode)
 * ------------------------------------------------------------------ */

#pilot-cc-root.pilot-cc-visible[data-style="bottom-bar"] {
	position: fixed;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 999999;
	background: var(--pilot-cc-bg);
	border-top: 1px solid var(--pilot-cc-border);
	box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.08);
}

#pilot-cc-root.pilot-cc-visible[data-style="bottom-bar"] .pilot-cc-banner {
	max-width: 1280px;
	margin: 0 auto;
	padding: 16px 24px;
	display: flex;
	align-items: center;
	gap: 24px;
	flex-wrap: wrap;
}

/* Compact typography for both horizontal bars. !important so these keep
 * winning over the hardened base rules in "Shared typography" below AND over
 * any theme !important — specificity here (1 id, 3 class/attr) tops both. */
#pilot-cc-root.pilot-cc-visible[data-style="bottom-bar"] .pilot-cc-title,
#pilot-cc-root.pilot-cc-visible[data-style="top-bar"] .pilot-cc-title {
	font-size: 15px !important;
	margin: 0 0 4px !important;
}

#pilot-cc-root.pilot-cc-visible[data-style="bottom-bar"] .pilot-cc-body,
#pilot-cc-root.pilot-cc-visible[data-style="top-bar"] .pilot-cc-body {
	margin: 0 !important;
	flex: 1 1 320px;
	color: var(--pilot-cc-muted) !important;
	font-size: 13px !important;
}

#pilot-cc-root.pilot-cc-visible[data-style="bottom-bar"] .pilot-cc-actions,
#pilot-cc-root.pilot-cc-visible[data-style="top-bar"] .pilot-cc-actions {
	flex: 0 0 auto;
}

/* When the user opens preferences from a bottom-bar banner, switch to modal layout */
#pilot-cc-root.pilot-cc-visible[data-style="bottom-bar"][data-view="preferences"] {
	inset: 0;
	background: rgba(15, 23, 42, 0.5);
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
	border-top: 0;
}

#pilot-cc-root.pilot-cc-visible[data-style="bottom-bar"][data-view="preferences"] .pilot-cc-preferences {
	background: var(--pilot-cc-bg);
	border-radius: var(--pilot-cc-radius);
	box-shadow: var(--pilot-cc-shadow);
	max-width: 720px;
	width: 100%;
	max-height: 90vh;
	overflow-y: auto;
	padding: 28px;
}

/* ------------------------------------------------------------------
 * Top bar layout
 * ------------------------------------------------------------------ */

#pilot-cc-root.pilot-cc-visible[data-style="top-bar"] {
	position: fixed;
	left: 0;
	right: 0;
	top: 0;
	z-index: 999999;
	background: var(--pilot-cc-bg);
	border-bottom: 1px solid var(--pilot-cc-border);
	box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
}

#pilot-cc-root.pilot-cc-visible[data-style="top-bar"] .pilot-cc-banner {
	max-width: 1280px;
	margin: 0 auto;
	padding: 16px 24px;
	display: flex;
	align-items: center;
	gap: 24px;
	flex-wrap: wrap;
}

/* ------------------------------------------------------------------
 * Corner popup layout
 * ------------------------------------------------------------------ */

#pilot-cc-root.pilot-cc-visible[data-style="corner"] {
	position: fixed;
	z-index: 999999;
	max-width: 400px;
	padding: 20px;
}

#pilot-cc-root.pilot-cc-visible[data-style="corner"][data-position="bottom-left"]  { bottom: 0; left: 0; }
#pilot-cc-root.pilot-cc-visible[data-style="corner"][data-position="bottom-right"] { bottom: 0; right: 0; }
#pilot-cc-root.pilot-cc-visible[data-style="corner"][data-position="top-left"]     { top: 0; left: 0; }
#pilot-cc-root.pilot-cc-visible[data-style="corner"][data-position="top-right"]    { top: 0; right: 0; }

#pilot-cc-root.pilot-cc-visible[data-style="corner"] .pilot-cc-banner {
	background: var(--pilot-cc-bg);
	border-radius: var(--pilot-cc-radius);
	box-shadow: var(--pilot-cc-shadow);
	padding: 20px;
}

/* When the user opens preferences from a corner popup, switch to centered modal layout */
#pilot-cc-root.pilot-cc-visible[data-style="corner"][data-view="preferences"] {
	inset: 0;
	max-width: none;
	background: rgba(15, 23, 42, 0.5);
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
}

#pilot-cc-root.pilot-cc-visible[data-style="corner"][data-view="preferences"] .pilot-cc-preferences {
	background: var(--pilot-cc-bg);
	border-radius: var(--pilot-cc-radius);
	box-shadow: var(--pilot-cc-shadow);
	max-width: 720px;
	width: 100%;
	max-height: 90vh;
	overflow-y: auto;
	padding: 28px;
}

/* Same for top-bar */
#pilot-cc-root.pilot-cc-visible[data-style="top-bar"][data-view="preferences"] {
	inset: 0;
	background: rgba(15, 23, 42, 0.5);
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
	border-bottom: 0;
}

#pilot-cc-root.pilot-cc-visible[data-style="top-bar"][data-view="preferences"] .pilot-cc-preferences {
	background: var(--pilot-cc-bg);
	border-radius: var(--pilot-cc-radius);
	box-shadow: var(--pilot-cc-shadow);
	max-width: 720px;
	width: 100%;
	max-height: 90vh;
	overflow-y: auto;
	padding: 28px;
}

/* ------------------------------------------------------------------
 * Shared typography
 *
 * Hardened in v2.4.1: themes routinely style bare h2/p with selectors that
 * out-rank our single-class rules (e.g. `.my-theme h2 { font-size: 80px;
 * color: #fff; margin: 2rem 0; }`), which blew the banner title up to a
 * 123px-tall invisible heading on Sounder and wrecked spacing in every
 * layout (corner, top-bar, modal). Same theme-CSS-interference family as
 * the v1.3.3 close-button and v2.0.1 checkbox fixes, same cure: ID-scoped
 * selectors + !important on every load-bearing property. A theme can only
 * beat this with !important at higher specificity targeting OUR ids/classes,
 * which no generic theme rule does.
 * ------------------------------------------------------------------ */

#pilot-cc-root .pilot-cc-title {
	margin: 0 0 10px !important;
	padding: 0 !important;
	border: 0 !important;
	background: none !important;
	min-height: 0 !important;
	height: auto !important;
	max-width: none !important;
	font-family: inherit !important;
	font-size: 18px !important;
	font-weight: 600 !important;
	line-height: 1.3 !important;
	letter-spacing: normal !important;
	text-transform: none !important;
	text-indent: 0 !important;
	text-shadow: none !important;
	text-align: start !important;
	color: var(--pilot-cc-text) !important;
	display: block !important;
	position: static !important;
	float: none !important;
	opacity: 1 !important;
	visibility: visible !important;
}

/* Kill decorative flourishes (underline bars, counters) themes attach to headings. */
#pilot-cc-root .pilot-cc-title::before,
#pilot-cc-root .pilot-cc-title::after {
	content: none !important;
	display: none !important;
}

#pilot-cc-root .pilot-cc-body {
	margin: 0 0 16px !important;
	padding: 0 !important;
	border: 0 !important;
	background: none !important;
	min-height: 0 !important;
	max-width: none !important;
	font-family: inherit !important;
	font-size: 14px !important;
	font-weight: 400 !important;
	line-height: 1.5 !important;
	letter-spacing: normal !important;
	text-transform: none !important;
	text-indent: 0 !important;
	text-shadow: none !important;
	text-align: start !important;
	color: var(--pilot-cc-muted) !important;
	display: block !important;
	position: static !important;
	float: none !important;
	opacity: 1 !important;
	visibility: visible !important;
}

#pilot-cc-root .pilot-cc-gpc-notice {
	margin: 0 0 16px !important;
	padding: 10px 12px !important;
	background: #f0f9ff !important;
	border: 0 !important;
	border-left: 3px solid var(--pilot-cc-primary) !important;
	color: #0c4a6e !important;
	font-size: 13px !important;
	line-height: 1.5 !important;
	text-indent: 0 !important;
	text-transform: none !important;
	border-radius: 4px !important;
}

.pilot-cc-privacy-link {
	display: inline-block;
	margin-top: 12px;
	color: var(--pilot-cc-primary);
	font-size: 12px;
	text-decoration: underline;
}

/* ------------------------------------------------------------------
 * Buttons
 * ------------------------------------------------------------------ */

.pilot-cc-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	align-items: center;
}

.pilot-cc-btn {
	appearance: none;
	border: 0;
	font: inherit;
	font-weight: 500;
	padding: 10px 18px;
	border-radius: 6px;
	cursor: pointer;
	transition: opacity 0.15s ease, background-color 0.15s ease;
	white-space: nowrap;
}

.pilot-cc-btn:hover { opacity: 0.9; }
.pilot-cc-btn:focus-visible {
	outline: 2px solid var(--pilot-cc-primary);
	outline-offset: 2px;
}

.pilot-cc-btn-primary {
	background: var(--pilot-cc-primary);
	color: var(--pilot-cc-primary-contrast);
}

.pilot-cc-btn-secondary {
	background: transparent;
	color: var(--pilot-cc-text);
	border: 1px solid var(--pilot-cc-border);
}

.pilot-cc-btn-link {
	background: transparent;
	color: var(--pilot-cc-primary);
	padding: 10px 8px;
	text-decoration: underline;
}

/* ------------------------------------------------------------------
 * Preferences drawer
 * ------------------------------------------------------------------ */

.pilot-cc-categories {
	margin: 20px 0;
	display: flex;
	flex-direction: column;
	gap: 16px;
}

.pilot-cc-category {
	border: 1px solid var(--pilot-cc-border);
	border-radius: 8px;
	padding: 14px 16px;
}

.pilot-cc-category-header {
	display: flex;
	align-items: center;
	gap: 10px;
}

.pilot-cc-category-label {
	display: flex;
	align-items: center;
	gap: 10px;
	cursor: pointer;
	flex: 1;
}

/* Checkbox hardening: many themes apply a global `input[type=checkbox]{appearance:none}`
 * (or opacity:0 / display:none) to restyle their own checkboxes, which wipes out ours and
 * leaves the category toggles invisible. We force the native control back with an
 * ID-scoped, !important rule so it beats theme selectors regardless of their specificity. */
#pilot-cc-root input.pilot-cc-category-toggle {
	-webkit-appearance: checkbox !important;
	-moz-appearance: checkbox !important;
	appearance: auto !important;
	width: 18px !important;
	height: 18px !important;
	min-width: 18px !important;
	min-height: 18px !important;
	margin: 0 !important;
	padding: 0 !important;
	opacity: 1 !important;
	visibility: visible !important;
	position: static !important;
	display: inline-block !important;
	clip: auto !important;
	clip-path: none !important;
	box-shadow: none !important;
	background: none !important;
	flex: 0 0 auto;
	cursor: pointer;
	accent-color: var(--pilot-cc-primary);
}

#pilot-cc-root input.pilot-cc-category-toggle:disabled {
	cursor: not-allowed;
	opacity: 0.6 !important;
}

.pilot-cc-category-name {
	font-weight: 600;
	font-size: 15px;
}

/* Also a bare <p> — needs the same theme-proofing as .pilot-cc-body. */
#pilot-cc-root .pilot-cc-category-desc {
	margin: 8px 0 0 28px !important;
	padding: 0 !important;
	color: var(--pilot-cc-muted) !important;
	font-size: 13px !important;
	line-height: 1.5 !important;
	text-indent: 0 !important;
	background: none !important;
}

.pilot-cc-badge {
	font-size: 11px;
	padding: 3px 8px;
	border-radius: 999px;
	background: #f3f4f6;
	color: var(--pilot-cc-muted);
	font-weight: 500;
	text-transform: uppercase;
	letter-spacing: 0.3px;
}

.pilot-cc-badge-gpc {
	background: #fef3c7;
	color: #92400e;
}

/* ------------------------------------------------------------------
 * Cookie details table
 * ------------------------------------------------------------------ */

.pilot-cc-cookie-details {
	margin: 12px 0 0 28px;
	font-size: 12px;
}

.pilot-cc-cookie-details summary {
	cursor: pointer;
	color: var(--pilot-cc-primary);
	font-weight: 500;
	padding: 4px 0;
}

.pilot-cc-cookie-table {
	width: 100%;
	margin-top: 8px;
	border-collapse: collapse;
}

.pilot-cc-cookie-table th,
.pilot-cc-cookie-table td {
	text-align: left;
	padding: 6px 8px;
	border-bottom: 1px solid var(--pilot-cc-border);
	font-size: 12px;
	vertical-align: top;
}

.pilot-cc-cookie-table th {
	font-weight: 600;
	color: var(--pilot-cc-muted);
	text-transform: uppercase;
	letter-spacing: 0.3px;
	font-size: 11px;
}

.pilot-cc-cookie-table code {
	background: #f3f4f6;
	padding: 1px 5px;
	border-radius: 3px;
	font-size: 11px;
}

.pilot-cc-cookie-desc-row td {
	color: var(--pilot-cc-muted);
	padding-top: 0;
	padding-bottom: 10px;
	font-style: italic;
}

.pilot-cc-sharing-flag {
	margin-left: 6px;
	color: #b45309;
	cursor: help;
}

/* ------------------------------------------------------------------
 * Footer "Cookie Settings" link (shortcode output)
 * ------------------------------------------------------------------ */

.pilot-cc-settings-link {
	cursor: pointer;
	text-decoration: underline;
}

/* ------------------------------------------------------------------
 * Responsive
 * ------------------------------------------------------------------ */

@media (max-width: 640px) {
	#pilot-cc-root.pilot-cc-visible[data-style="bottom-bar"] .pilot-cc-banner,
	#pilot-cc-root.pilot-cc-visible[data-style="top-bar"] .pilot-cc-banner {
		flex-direction: column;
		align-items: stretch;
	}

	.pilot-cc-actions {
		width: 100%;
	}

	.pilot-cc-btn {
		flex: 1 1 auto;
		text-align: center;
	}
}

/* Hotfix: force banner root above third-party chat widgets that create
 * their own stacking context (e.g. via transform, will-change, isolation).
 * isolation:isolate + a high z-index guarantees we sit at the top of the
 * document stacking order regardless of how the chat widget is positioned.
 *
 * The [data-style] attribute is intentional: each per-style rule above
 * (modal/bottom-bar/top-bar/corner) sets z-index:999999 at specificity
 * (1 id + 1 class + 1 attr). Without the attribute selector here this rule
 * would be LESS specific and the 999999 would win, leaving the override
 * dead. Matching [data-style] ties the specificity, and source order (this
 * rule is last) breaks the tie in our favour — no !important required. */
#pilot-cc-root.pilot-cc-visible[data-style] {
    isolation: isolate;
    z-index: 2147483647; /* max 32-bit signed int — the browser z-index ceiling */
}


/* ------------------------------------------------------------------
 * Close (X) button — CCPA / opt-out banner dismiss
 * ------------------------------------------------------------------ */
.pilot-cc-banner {
	position: relative;
}

.pilot-cc-close {
	position: absolute;
	top: 8px;
	right: 8px;
	width: 28px;
	height: 28px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	margin: 0;
	border: 0;
	background: transparent;
	color: var(--pilot-cc-muted);
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
	border-radius: 4px;
	transition: color 0.15s ease, background-color 0.15s ease;
}

.pilot-cc-close:hover {
	color: var(--pilot-cc-text);
	background: rgba(0, 0, 0, 0.06);
}

.pilot-cc-close:focus-visible {
	outline: 2px solid var(--pilot-cc-primary);
	outline-offset: 2px;
}

/* Give the horizontal bar layouts room so the X never overlaps content. */
#pilot-cc-root.pilot-cc-visible[data-style="bottom-bar"] .pilot-cc-banner,
#pilot-cc-root.pilot-cc-visible[data-style="top-bar"] .pilot-cc-banner {
	padding-right: 44px;
}
