/**
 * Simple Cookie Consent — front-end styles.
 *
 * Everything is driven by CSS custom properties written inline by PHP, so the
 * admin appearance settings map straight onto these values.
 */

/* -------------------------------------------------------------------------
 * Root / visibility
 * ---------------------------------------------------------------------- */

#scc-root[hidden] {
	display: none !important;
}

#scc-root {
	font-family: var( --scc-font, inherit );
	font-size: var( --scc-font-size, 14px );
	line-height: 1.55;
	color: var( --scc-text, #4b5563 );
}

#scc-root *,
#scc-root *::before,
#scc-root *::after {
	box-sizing: border-box;
}

/* Banner is hidden until JS has read the consent cookie. This is what keeps
   the plugin safe behind a full-page HTML cache. */
#scc-root .scc-banner {
	display: none;
}

#scc-root.scc-show-banner .scc-banner {
	display: block;
}

/* -------------------------------------------------------------------------
 * Overlay
 * ---------------------------------------------------------------------- */

#scc-root .scc-overlay {
	display: none;
	position: fixed;
	inset: 0;
	background: var( --scc-overlay, rgba( 0, 0, 0, 0.5 ) );
	z-index: calc( var( --scc-z, 999999 ) - 1 );
}

#scc-root.scc-show-banner.scc-has-overlay .scc-overlay {
	display: block;
}

/* -------------------------------------------------------------------------
 * Banner shell
 * ---------------------------------------------------------------------- */

#scc-root .scc-banner {
	position: fixed;
	z-index: var( --scc-z, 999999 );
	background: var( --scc-bg, #fff );
	color: var( --scc-text, #4b5563 );
	box-shadow: var( --scc-shadow, 0 10px 25px -5px rgba( 0, 0, 0, 0.12 ) );
	border: 1px solid var( --scc-border, #e5e7eb );
	border-radius: var( --scc-radius, 12px );
	padding: var( --scc-padding, 20px );
}

#scc-root .scc-banner-inner {
	display: flex;
	align-items: center;
	gap: 24px;
	margin: 0 auto;
	max-width: var( --scc-max-width, 1200px );
}

#scc-root .scc-banner-copy {
	flex: 1 1 auto;
	min-width: 0;
}

#scc-root .scc-title {
	margin: 0 0 6px;
	font-size: var( --scc-title-size, 16px );
	font-weight: 600;
	line-height: 1.3;
	color: var( --scc-title, #111827 );
}

#scc-root .scc-text,
#scc-root .scc-text p {
	margin: 0;
	font-size: var( --scc-font-size, 14px );
	color: var( --scc-text, #4b5563 );
}

#scc-root .scc-text p + p {
	margin-top: 8px;
}

#scc-root .scc-policy-link,
#scc-root .scc-text a {
	color: var( --scc-link, #2563eb );
	text-decoration: underline;
	text-underline-offset: 2px;
}

#scc-root .scc-policy-link {
	display: inline-block;
	margin-top: 6px;
}

#scc-root .scc-banner-actions {
	display: flex;
	align-items: center;
	gap: 10px;
	flex: 0 0 auto;
	flex-wrap: wrap;
	justify-content: flex-end;
}

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

#scc-root .scc-btn {
	appearance: none;
	-webkit-appearance: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	white-space: nowrap;
	cursor: pointer;
	margin: 0;
	padding: 10px 18px;
	font-family: inherit;
	font-size: var( --scc-font-size, 14px );
	font-weight: 500;
	line-height: 1.2;
	border: 1px solid transparent;
	border-radius: var( --scc-btn-radius, 8px );
	transition: opacity 0.15s ease, transform 0.15s ease, filter 0.15s ease;
	text-decoration: none;
	min-height: 40px;
}

#scc-root .scc-btn:hover {
	filter: brightness( 0.94 );
}

#scc-root .scc-btn:active {
	transform: translateY( 1px );
}

#scc-root .scc-btn:focus-visible {
	outline: 2px solid var( --scc-link, #2563eb );
	outline-offset: 2px;
}

#scc-root .scc-btn-accept {
	background: var( --scc-accept-bg, #111827 );
	color: var( --scc-accept-text, #fff );
	border-color: var( --scc-accept-bg, #111827 );
}

#scc-root .scc-btn-reject {
	background: var( --scc-reject-bg, #f3f4f6 );
	color: var( --scc-reject-text, #111827 );
	border-color: var( --scc-reject-bg, #f3f4f6 );
}

#scc-root .scc-btn-settings {
	background: var( --scc-settings-bg, transparent );
	color: var( --scc-settings-text, #111827 );
	border-color: var( --scc-border, #e5e7eb );
}

/* -------------------------------------------------------------------------
 * Positions
 * ---------------------------------------------------------------------- */

#scc-root.scc-pos-bottom-bar .scc-banner {
	left: 0;
	right: 0;
	bottom: 0;
	border-radius: 0;
	border-left: 0;
	border-right: 0;
	border-bottom: 0;
}

#scc-root.scc-pos-top-bar .scc-banner {
	left: 0;
	right: 0;
	top: 0;
	border-radius: 0;
	border-left: 0;
	border-right: 0;
	border-top: 0;
}

#scc-root.scc-pos-bottom-left .scc-banner,
#scc-root.scc-pos-bottom-right .scc-banner,
#scc-root.scc-pos-top-left .scc-banner,
#scc-root.scc-pos-top-right .scc-banner {
	width: var( --scc-box-width, 420px );
	max-width: calc( 100vw - 32px );
}

#scc-root.scc-pos-bottom-left .scc-banner {
	left: 16px;
	bottom: 16px;
}

#scc-root.scc-pos-bottom-right .scc-banner {
	right: 16px;
	bottom: 16px;
}

#scc-root.scc-pos-top-left .scc-banner {
	left: 16px;
	top: 16px;
}

#scc-root.scc-pos-top-right .scc-banner {
	right: 16px;
	top: 16px;
}

#scc-root.scc-pos-center .scc-banner {
	top: 50%;
	left: 50%;
	transform: translate( -50%, -50% );
	width: var( --scc-box-width, 420px );
	max-width: calc( 100vw - 32px );
	max-height: calc( 100vh - 32px );
	overflow-y: auto;
}

/* Box layouts stack their content vertically. */
#scc-root.scc-pos-bottom-left .scc-banner-inner,
#scc-root.scc-pos-bottom-right .scc-banner-inner,
#scc-root.scc-pos-top-left .scc-banner-inner,
#scc-root.scc-pos-top-right .scc-banner-inner,
#scc-root.scc-pos-center .scc-banner-inner {
	display: block;
}

#scc-root.scc-pos-bottom-left .scc-banner-actions,
#scc-root.scc-pos-bottom-right .scc-banner-actions,
#scc-root.scc-pos-top-left .scc-banner-actions,
#scc-root.scc-pos-top-right .scc-banner-actions,
#scc-root.scc-pos-center .scc-banner-actions {
	margin-top: 16px;
	justify-content: stretch;
}

#scc-root.scc-pos-bottom-left .scc-banner-actions .scc-btn,
#scc-root.scc-pos-bottom-right .scc-banner-actions .scc-btn,
#scc-root.scc-pos-top-left .scc-banner-actions .scc-btn,
#scc-root.scc-pos-top-right .scc-banner-actions .scc-btn,
#scc-root.scc-pos-center .scc-banner-actions .scc-btn {
	flex: 1 1 auto;
}

/* -------------------------------------------------------------------------
 * Animations
 * ---------------------------------------------------------------------- */

@media ( prefers-reduced-motion: no-preference ) {

	#scc-root.scc-anim-fade.scc-show-banner .scc-banner {
		animation: scc-fade 0.28s ease both;
	}

	#scc-root.scc-anim-slide.scc-show-banner.scc-pos-bottom-bar .scc-banner,
	#scc-root.scc-anim-slide.scc-show-banner.scc-pos-bottom-left .scc-banner,
	#scc-root.scc-anim-slide.scc-show-banner.scc-pos-bottom-right .scc-banner {
		animation: scc-slide-up 0.32s cubic-bezier( 0.16, 1, 0.3, 1 ) both;
	}

	#scc-root.scc-anim-slide.scc-show-banner.scc-pos-top-bar .scc-banner,
	#scc-root.scc-anim-slide.scc-show-banner.scc-pos-top-left .scc-banner,
	#scc-root.scc-anim-slide.scc-show-banner.scc-pos-top-right .scc-banner {
		animation: scc-slide-down 0.32s cubic-bezier( 0.16, 1, 0.3, 1 ) both;
	}

	#scc-root.scc-anim-slide.scc-show-banner.scc-pos-center .scc-banner,
	#scc-root.scc-anim-fade.scc-show-banner.scc-pos-center .scc-banner {
		animation: scc-pop 0.28s cubic-bezier( 0.16, 1, 0.3, 1 ) both;
	}
}

@keyframes scc-fade {

	from {
		opacity: 0;
	}

	to {
		opacity: 1;
	}
}

@keyframes scc-slide-up {

	from {
		opacity: 0;
		transform: translateY( 18px );
	}

	to {
		opacity: 1;
		transform: translateY( 0 );
	}
}

@keyframes scc-slide-down {

	from {
		opacity: 0;
		transform: translateY( -18px );
	}

	to {
		opacity: 1;
		transform: translateY( 0 );
	}
}

@keyframes scc-pop {

	from {
		opacity: 0;
		transform: translate( -50%, -50% ) scale( 0.96 );
	}

	to {
		opacity: 1;
		transform: translate( -50%, -50% ) scale( 1 );
	}
}

/* -------------------------------------------------------------------------
 * Preferences modal
 * ---------------------------------------------------------------------- */

#scc-root .scc-modal-wrap[hidden] {
	display: none;
}

#scc-root .scc-modal-wrap {
	position: fixed;
	inset: 0;
	z-index: calc( var( --scc-z, 999999 ) + 10 );
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
}

#scc-root .scc-modal-overlay {
	position: absolute;
	inset: 0;
	background: rgba( 0, 0, 0, 0.55 );
}

#scc-root .scc-modal {
	position: relative;
	width: 100%;
	max-width: 560px;
	max-height: min( 82vh, 720px );
	display: flex;
	flex-direction: column;
	background: var( --scc-bg, #fff );
	color: var( --scc-text, #4b5563 );
	border: 1px solid var( --scc-border, #e5e7eb );
	border-radius: var( --scc-radius, 12px );
	box-shadow: 0 25px 50px -12px rgba( 0, 0, 0, 0.4 );
	overflow: hidden;
}

@media ( prefers-reduced-motion: no-preference ) {

	#scc-root .scc-modal {
		animation: scc-fade 0.2s ease both;
	}
}

#scc-root .scc-modal-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 18px 20px;
	border-bottom: 1px solid var( --scc-border, #e5e7eb );
}

#scc-root .scc-modal-title {
	margin: 0;
	font-size: calc( var( --scc-title-size, 16px ) + 2px );
	font-weight: 600;
	color: var( --scc-title, #111827 );
	line-height: 1.3;
}

#scc-root .scc-modal-close {
	appearance: none;
	-webkit-appearance: none;
	background: none;
	border: 0;
	cursor: pointer;
	font-size: 26px;
	line-height: 1;
	padding: 4px 8px;
	color: var( --scc-text, #4b5563 );
	border-radius: 6px;
}

#scc-root .scc-modal-close:hover {
	background: var( --scc-border, #e5e7eb );
}

#scc-root .scc-modal-body {
	padding: 20px;
	overflow-y: auto;
	flex: 1 1 auto;
	-webkit-overflow-scrolling: touch;
}

#scc-root .scc-modal-intro,
#scc-root .scc-modal-intro p {
	margin: 0 0 18px;
	font-size: var( --scc-font-size, 14px );
}

#scc-root .scc-cat {
	padding: 14px 0;
	border-top: 1px solid var( --scc-border, #e5e7eb );
}

#scc-root .scc-cat:first-of-type {
	border-top: 0;
	padding-top: 0;
}

#scc-root .scc-cat-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	margin-bottom: 6px;
}

#scc-root .scc-cat-label {
	font-weight: 600;
	color: var( --scc-title, #111827 );
	font-size: var( --scc-font-size, 14px );
}

#scc-root .scc-cat-locked {
	font-size: calc( var( --scc-font-size, 14px ) - 2px );
	opacity: 0.65;
	white-space: nowrap;
}

#scc-root .scc-cat-desc {
	margin: 0;
	font-size: calc( var( --scc-font-size, 14px ) - 1px );
	opacity: 0.9;
}

#scc-root .scc-modal-foot {
	display: flex;
	gap: 10px;
	flex-wrap: wrap;
	justify-content: flex-end;
	padding: 16px 20px;
	border-top: 1px solid var( --scc-border, #e5e7eb );
	background: var( --scc-bg, #fff );
}

/* -------------------------------------------------------------------------
 * Toggle switch
 * ---------------------------------------------------------------------- */

#scc-root .scc-toggle {
	position: relative;
	display: inline-flex;
	flex: 0 0 auto;
	cursor: pointer;
}

#scc-root .scc-toggle input {
	position: absolute;
	opacity: 0;
	width: 100%;
	height: 100%;
	margin: 0;
	cursor: pointer;
}

#scc-root .scc-toggle-track {
	display: block;
	width: 44px;
	height: 24px;
	border-radius: 999px;
	background: var( --scc-border, #e5e7eb );
	transition: background 0.18s ease;
	position: relative;
}

#scc-root .scc-toggle-thumb {
	position: absolute;
	top: 3px;
	left: 3px;
	width: 18px;
	height: 18px;
	border-radius: 50%;
	background: #fff;
	box-shadow: 0 1px 3px rgba( 0, 0, 0, 0.25 );
	transition: transform 0.18s ease;
}

#scc-root .scc-toggle input:checked + .scc-toggle-track {
	background: var( --scc-toggle-on, #111827 );
}

#scc-root .scc-toggle input:checked + .scc-toggle-track .scc-toggle-thumb {
	transform: translateX( 20px );
}

#scc-root .scc-toggle input:focus-visible + .scc-toggle-track {
	outline: 2px solid var( --scc-link, #2563eb );
	outline-offset: 2px;
}

/* -------------------------------------------------------------------------
 * Floating re-open badge
 * ---------------------------------------------------------------------- */

#scc-root .scc-badge[hidden] {
	display: none;
}

#scc-root .scc-badge {
	position: fixed;
	z-index: calc( var( --scc-z, 999999 ) - 2 );
	width: 44px;
	height: 44px;
	padding: 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border: 0;
	border-radius: 50%;
	cursor: pointer;
	background: var( --scc-badge-bg, #111827 );
	color: var( --scc-badge-icon, #fff );
	box-shadow: 0 4px 14px rgba( 0, 0, 0, 0.22 );
	transition: transform 0.15s ease, opacity 0.15s ease;
	opacity: 0.85;
}

#scc-root .scc-badge:hover {
	opacity: 1;
	transform: scale( 1.06 );
}

#scc-root .scc-badge-bottom-left {
	left: 16px;
	bottom: 16px;
}

#scc-root .scc-badge-bottom-right {
	right: 16px;
	bottom: 16px;
}

/* -------------------------------------------------------------------------
 * Mobile
 * ---------------------------------------------------------------------- */

@media ( max-width: 782px ) {

	#scc-root .scc-banner-inner {
		display: block;
	}

	#scc-root .scc-banner-actions {
		margin-top: 14px;
		justify-content: stretch;
	}

	#scc-root .scc-banner-actions .scc-btn {
		flex: 1 1 auto;
	}

	#scc-root.scc-pos-bottom-left .scc-banner,
	#scc-root.scc-pos-bottom-right .scc-banner {
		left: 10px;
		right: 10px;
		bottom: 10px;
		width: auto;
	}

	#scc-root.scc-pos-top-left .scc-banner,
	#scc-root.scc-pos-top-right .scc-banner {
		left: 10px;
		right: 10px;
		top: 10px;
		width: auto;
	}

	#scc-root .scc-modal-foot .scc-btn {
		flex: 1 1 100%;
	}
}
