/**
 * Creatif Consent — front-end styles.
 * All colours/sizes come from CSS variables on .cc-root so themes/settings can
 * reskin without editing this file.
 *
 * @package Creatif_Consent
 */

.cc-root {
	--cc-bg: #ffffff;
	--cc-text: #121211;
	--cc-border: #e7e6e2;
	--cc-btn-bg: #121211;
	--cc-btn-text: #ffffff;
	--cc-btn2-bg: transparent;
	--cc-btn2-text: #121211;
	--cc-btn2-border: #e7e6e2;
	--cc-link: #121211;
	--cc-overlay: rgba(18, 18, 17, .5);
	--cc-radius: 4px;
	--cc-maxw: 380px;

	font-family: inherit;
	color: var(--cc-text);
}

.cc-root *,
.cc-root *::before,
.cc-root *::after {
	box-sizing: border-box;
}

/* Our own display rules (grid/flex) would otherwise override the browser's
   default [hidden] { display: none }, leaving the banner and modal stuck open. */
.cc-root [hidden],
.cc-banner[hidden],
.cc-modal[hidden] {
	display: none !important;
}

/* -------------------------------------------------- Banner */
.cc-banner {
	position: fixed;
	z-index: 2147483000;
	background: var(--cc-bg);
	color: var(--cc-text);
	border: 1px solid var(--cc-border);
	border-radius: var(--cc-radius);
	box-shadow: 0 20px 44px -24px rgba(18, 18, 17, .5);
	padding: 20px 22px;
}

.cc-pos-bar .cc-banner {
	left: 0;
	right: 0;
	bottom: 0;
	border-radius: 0;
	border-left: 0;
	border-right: 0;
	border-bottom: 0;
	display: grid;
	grid-template-columns: 1fr auto;
	align-items: center;
	gap: 16px 24px;
}

.cc-pos-box-left .cc-banner {
	left: 20px;
	bottom: 20px;
	width: var(--cc-maxw);
	max-width: calc(100vw - 40px);
}

.cc-pos-box-right .cc-banner {
	right: 20px;
	bottom: 20px;
	width: var(--cc-maxw);
	max-width: calc(100vw - 40px);
}

.cc-pos-center .cc-banner {
	left: 50%;
	bottom: 20px;
	transform: translateX(-50%);
	width: var(--cc-maxw);
	max-width: calc(100vw - 40px);
}

.cc-banner__title {
	margin: 0 0 6px;
	font-size: 15px;
	font-weight: 700;
}

.cc-pos-bar .cc-banner__title {
	grid-column: 1;
	grid-row: 1;
	align-self: end;
}

.cc-banner__message {
	margin: 0;
	font-size: 13.5px;
	line-height: 1.55;
}

.cc-pos-bar .cc-banner__message {
	grid-column: 1;
	grid-row: 2;
	align-self: start;
}

.cc-banner__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin-top: 16px;
}

.cc-pos-bar .cc-banner__actions {
	grid-column: 2;
	grid-row: 1 / span 2;
	align-self: center;
	margin-top: 0;
	flex-wrap: nowrap;
}

/* -------------------------------------------------- Buttons */
.cc-root .cc-btn {
	min-height: 44px;
	padding: 0 18px;
	font: 600 12.5px/1 inherit;
	letter-spacing: .01em;
	border-radius: 999px;
	border: 1px solid transparent;
	cursor: pointer;
	text-decoration: none;
	text-transform: none;
	box-shadow: none;
	transition: background .25s ease, color .25s ease, border-color .25s ease;
}

.cc-root .cc-btn--primary {
	background: var(--cc-btn-bg) !important;
	color: var(--cc-btn-text) !important;
	border-color: var(--cc-btn-bg) !important;
}

.cc-root .cc-btn--secondary {
	background: var(--cc-btn2-bg) !important;
	color: var(--cc-btn2-text) !important;
	border-color: var(--cc-btn2-border) !important;
}

.cc-root .cc-btn--ghost {
	background: transparent !important;
	color: var(--cc-text) !important;
	border-color: transparent !important;
	text-decoration: underline;
	min-height: 44px;
	padding: 0 8px;
}

.cc-root .cc-link {
	color: var(--cc-link) !important;
	text-decoration: underline;
}

.cc-btn:focus-visible,
.cc-toggle:focus-visible + .cc-switch__track,
.cc-reopen:focus-visible,
.cc-float:focus-visible {
	outline: 2px solid var(--cc-link);
	outline-offset: 2px;
}

/* -------------------------------------------------- Modal */
.cc-modal {
	position: fixed;
	inset: 0;
	z-index: 2147483100;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
}

.cc-modal__overlay {
	position: absolute;
	inset: 0;
	background: var(--cc-overlay);
}

.cc-modal__card {
	position: relative;
	background: var(--cc-bg);
	color: var(--cc-text);
	border: 1px solid var(--cc-border);
	border-radius: calc(var(--cc-radius) * 2);
	width: 100%;
	max-width: 560px;
	max-height: calc(100vh - 40px);
	overflow-y: auto;
	padding: 28px;
	box-shadow: 0 30px 60px -30px rgba(18, 18, 17, .6);
}

.cc-modal__close {
	position: absolute;
	top: 14px;
	right: 16px;
	width: 32px;
	height: 32px;
	font-size: 22px;
	line-height: 1;
	background: transparent;
	border: 0;
	color: var(--cc-text);
	cursor: pointer;
}

.cc-modal__title {
	margin: 0 0 12px;
	font-size: 20px;
	font-weight: 700;
	padding-right: 28px;
}

.cc-modal__intro {
	margin: 0 0 20px;
	font-size: 13.5px;
	line-height: 1.6;
}

/* -------------------------------------------------- Categories */
.cc-cats {
	list-style: none;
	margin: 0 0 22px;
	padding: 0;
}

.cc-cat {
	padding: 16px 0;
	border-top: 1px solid var(--cc-border);
}

.cc-cat__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
}

.cc-cat__label {
	font-size: 14px;
	font-weight: 600;
}

.cc-cat__always {
	font-size: 11px;
	font-weight: 600;
	letter-spacing: .04em;
	text-transform: uppercase;
	opacity: .6;
}

.cc-cat__desc {
	margin: 8px 0 0;
	font-size: 13px;
	line-height: 1.55;
	opacity: .85;
}

/* -------------------------------------------------- Toggle switch */
.cc-switch {
	position: relative;
	display: inline-flex;
	flex: 0 0 auto;
	cursor: pointer;
}

.cc-toggle {
	position: absolute;
	opacity: 0;
	width: 44px;
	height: 26px;
	margin: 0;
	cursor: pointer;
}

.cc-switch__track {
	width: 44px;
	height: 26px;
	border-radius: 999px;
	background: var(--cc-border);
	border: 1px solid var(--cc-border);
	transition: background .25s ease;
	position: relative;
}

.cc-switch__track::after {
	content: "";
	position: absolute;
	top: 2px;
	left: 2px;
	width: 20px;
	height: 20px;
	border-radius: 50%;
	background: #fff;
	transition: transform .25s ease;
}

.cc-toggle:checked + .cc-switch__track {
	background: var(--cc-btn-bg);
}

.cc-toggle:checked + .cc-switch__track::after {
	transform: translateX(18px);
}

.cc-switch__sr {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
}

.cc-modal__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	justify-content: flex-end;
}

/* -------------------------------------------------- Reopen + floating tab */
.cc-reopen {
	background: transparent;
	border: 0;
	color: var(--cc-link);
	text-decoration: underline;
	cursor: pointer;
	font: inherit;
	padding: 0;
}

.cc-float {
	position: fixed;
	left: 16px;
	bottom: 16px;
	z-index: 2147483000;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	min-height: 44px;
	padding: 0 16px;
	background: var(--cc-bg);
	color: var(--cc-text);
	border: 1px solid var(--cc-border);
	border-radius: 999px;
	box-shadow: 0 12px 26px -18px rgba(18, 18, 17, .5);
	cursor: pointer;
	font: 600 12px/1 inherit;
}

.cc-float--right {
	left: auto;
	right: 16px;
}

.cc-no-shadow .cc-banner,
.cc-no-shadow .cc-modal__card {
	box-shadow: none;
}

/* -------------------------------------------------- Overlay-on-first-visit */
.cc-root.cc-blocking::before {
	content: "";
	position: fixed;
	inset: 0;
	z-index: 2147482900;
	background: var(--cc-overlay);
}

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

/* Tablet: the bar's side-by-side layout runs out of room, so stack the
   actions under the text and let them wrap. */
@media (max-width: 1024px) {
	.cc-root .cc-banner {
		padding: 18px;
	}

	.cc-pos-bar .cc-banner {
		grid-template-columns: 1fr;
		gap: 12px;
	}

	.cc-pos-bar .cc-banner__title,
	.cc-pos-bar .cc-banner__message,
	.cc-pos-bar .cc-banner__actions {
		grid-column: 1;
		grid-row: auto;
		align-self: auto;
	}

	.cc-pos-bar .cc-banner__actions {
		flex-wrap: wrap;
		margin-top: 4px;
	}

	.cc-pos-box-left .cc-banner,
	.cc-pos-box-right .cc-banner,
	.cc-pos-center .cc-banner {
		width: min(var(--cc-maxw), calc(100vw - 32px));
	}

	.cc-modal__card {
		max-width: 520px;
		padding: 24px;
	}
}

/* Mobile: one full-width sheet at the bottom, full-width tappable buttons,
   and never taller than the screen. */
@media (max-width: 640px) {
	.cc-root .cc-banner {
		left: 0;
		right: 0;
		bottom: 0;
		width: auto;
		max-width: none;
		margin: 0;
		transform: none;
		border-radius: var(--cc-radius) var(--cc-radius) 0 0;
		border-left: 0;
		border-right: 0;
		border-bottom: 0;
		padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
		max-height: 85vh;
		overflow-y: auto;
	}

	.cc-banner__title {
		font-size: 14px;
	}

	.cc-banner__message {
		font-size: 13px;
	}

	.cc-banner__actions {
		flex-direction: column;
		align-items: stretch;
		gap: 8px;
		margin-top: 14px;
	}

	.cc-pos-bar .cc-banner__actions {
		flex-wrap: wrap;
		margin-top: 14px;
	}

	.cc-root .cc-btn {
		width: 100%;
		padding: 0 14px;
	}

	/* Keep the reading order sensible: accept first on a stacked layout. */
	.cc-banner__actions .cc-btn--primary {
		order: 1;
	}

	.cc-banner__actions .cc-btn--secondary {
		order: 2;
	}

	.cc-banner__actions .cc-btn--ghost {
		order: 3;
	}

	.cc-modal {
		padding: 0;
		align-items: flex-end;
	}

	.cc-modal__card {
		max-width: 100%;
		width: 100%;
		max-height: 90vh;
		border-radius: calc(var(--cc-radius) * 2) calc(var(--cc-radius) * 2) 0 0;
		border-left: 0;
		border-right: 0;
		border-bottom: 0;
		padding: 22px 18px calc(22px + env(safe-area-inset-bottom));
	}

	.cc-modal__title {
		font-size: 18px;
	}

	.cc-modal__actions {
		flex-direction: column;
		align-items: stretch;
	}

	.cc-modal__actions .cc-btn {
		width: 100%;
	}

	.cc-cat__head {
		gap: 10px;
	}

	.cc-float {
		left: 12px;
		right: auto;
		bottom: calc(12px + env(safe-area-inset-bottom));
	}

	.cc-float--right {
		left: auto;
		right: 12px;
	}
}

/* -------------------------------------------------- Reduced motion */
@media (prefers-reduced-motion: reduce) {
	.cc-btn,
	.cc-switch__track,
	.cc-switch__track::after {
		transition: none;
	}
}
