/* =============================================================================
   cookie-consent.css — PM Space Cookie Consent Banner & Modal
   Enqueued on every frontend page via PMS_Cookie_Consent::enqueue_assets().

   Design tokens (inherited from pmspace-theme / theme.json)
   ─────────────────────────────────────────────────────────
   --global-palette1   Terracotta  — primary brand / CTA background
   --global-palette3   Dark Blue   — headings / body text
   --global-palette7   Steel Gray  — borders / muted backgrounds
   --global-palette8   Pale Blue   — subtle panel backgrounds
   --global-palette9   White       — button text / toggle thumb
   ============================================================================= */


/* =============================================================================
   1. Banner (centered dialog box)
   ============================================================================= */

#pms-cookie-banner {
	position: fixed;
	top: 50%;
	left: 50%;
	z-index: 99998;
	width: calc(100% - 2rem);
	max-width: 480px;
	background: #fff;
	border-radius: 8px;
	/* border: 2px solid var(--global-palette1, #c0392b); */
	box-shadow: 0 8px 40px rgba(0, 0, 0, 0.22);

	/* Entry animation: start slightly below centre, faded out. */
	transform: translate(-50%, calc(-50% + 24px));
	opacity: 0;
	transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
	pointer-events: none;
}

#pms-cookie-banner[aria-hidden="false"] {
	transform: translate(-50%, -50%);
	opacity: 1;
	pointer-events: auto;
}

.pms-cc-inner {
	display: flex;
	flex-direction: column;
	gap: 1.25rem;
	padding: 1.5rem;
}

.pms-cc-title {
	text-align:center;
	color: var(--global-palette1, #c0392b);
	margin: 0;
	font-size: 1.4rem;
	font-weight: 700;
}

.pms-cc-text {
	margin: 0;
	font-size: 0.9rem;
	line-height: 1.55;
	color: var(--global-palette3, #1e293b);
}

.pms-cc-privacy-link {
	color: var(--global-palette1, #c0392b);
	text-decoration: underline;
	text-underline-offset: 2px;
}

.pms-cc-privacy-link:hover {
	opacity: 0.8;
}

.pms-cc-actions {
	display: flex;
	align-items: center;
	gap: 0.6rem;
	flex-wrap: wrap;
	justify-content: flex-end;
}


/* =============================================================================
   2. Shared button styles
   ============================================================================= */

.pms-cc-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0.5rem 1.1rem;
	border-radius: 3px;
	font-size: 0.8rem;
	font-weight: 600;
	line-height: 1;
	cursor: pointer;
	border: 2px solid transparent;
	transition: opacity 0.15s ease, background-color 0.15s ease;
	white-space: nowrap;
}

/* Ghost — text-only */
.pms-cc-btn-ghost {
	background-color: transparent;
	color: var(--global-palette3, #1e293b);
	border-color: transparent;
	text-decoration: underline;
	text-underline-offset: 2px;
	cursor: pointer;
	padding: 0.5rem 0.9rem;
}

.pms-cc-btn-ghost:hover {
	background: var(--global-palette2, #FFB416);
	opacity: 0.7;
}


/* =============================================================================
   3. Modal overlay + box
   ============================================================================= */

#pms-cookie-modal {
	display: none;
}

#pms-cookie-modal[aria-hidden="false"] {
	display: block;
}

.pms-cc-overlay {
	position: fixed;
	inset: 0;
	z-index: 99999;
	background: rgba(0, 0, 0, 0.55);
}

.pms-cc-modal-box {
	position: fixed;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	z-index: 100000;
	width: 100%;
	max-width: 500px;
	max-height: 90vh;
	display: flex;
	flex-direction: column;
	background: #fff;
	border-radius: 8px;
	box-shadow: 0 8px 40px rgba(0, 0, 0, 0.22);
	overflow: hidden;
}

/* Prevent body scroll when banner or modal is displayed */
body.pms-cc-banner-open,
body.pms-cc-modal-open {
	overflow: hidden;
}

/* ── Modal header ── */

.pms-cc-modal-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 1.1rem 1.4rem;
	border-bottom: 1px solid var(--global-palette7, #e2e8f0);
	flex-shrink: 0;
}

.pms-cc-modal-title {
	margin: 0;
	font-size: 1.1rem;
	font-weight: 700;
	color: var(--global-palette3, #1e293b);
}

.pms-cc-modal-close {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	border: none;
	background: transparent;
	border-radius: 4px;
	font-size: 1rem;
	cursor: pointer;
	color: var(--global-palette3, #1e293b);
	flex-shrink: 0;
	transition: background-color 0.15s;
}

.pms-cc-modal-close:hover {
	background-color: var(--global-palette8, #f0f4f8);
}

.pms-cc-modal-close:focus-visible {
	outline: 3px solid var(--global-palette3, #1e407a);
	outline-offset: 2px;
}

/* ── Modal body (scrollable) ── */

.pms-cc-modal-body {
	padding: 0.5rem 1.4rem;
	overflow-y: auto;
	flex: 1 1 auto;
}

/* ── Category rows ── */

.pms-cc-category {
	padding: 1rem 0;
	border-bottom: 1px solid var(--global-palette7, #e2e8f0);
}

.pms-cc-category:last-child {
	border-bottom: none;
}

.pms-cc-category-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem;
	margin-bottom: 0.4rem;
}

.pms-cc-category-label {
	font-weight: 600;
	font-size: 0.925rem;
	color: var(--global-palette3, #1e293b);
}

.pms-cc-always-on {
	font-size: 0.78rem;
	font-weight: 600;
	color: #059669; /* accessible green */
	background-color: #ecfdf5;
	border: 1px solid #6ee7b7;
	border-radius: 20px;
	padding: 0.2rem 0.65rem;
	white-space: nowrap;
	flex-shrink: 0;
}

.pms-cc-category-desc {
	margin: 0;
	font-size: 0.845rem;
	line-height: 1.55;
	color: var(--global-palette3, #475569);
}

/* ── Category toggle (pill) — mirrors .pms-toggle in contact-form.css ── */

.pms-cc-toggle {
	display: inline-flex;
	align-items: center;
	cursor: pointer;
	flex-shrink: 0;
}

/* Hide native checkbox accessibly */
.pms-cc-toggle input[type="checkbox"] {
	position: absolute;
	width: 1px;
	height: 1px;
	opacity: 0;
	pointer-events: none;
}

.pms-cc-toggle-track {
	position: relative;
	display: inline-block;
	width: 44px;
	height: 24px;
	background-color: var(--global-palette7, #cbd5e1);
	border-radius: 12px;
	transition: background-color 0.2s ease;
}

.pms-cc-toggle-thumb {
	position: absolute;
	top: 3px;
	left: 3px;
	width: 18px;
	height: 18px;
	background: #fff;
	border-radius: 50%;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
	transition: transform 0.2s ease;
}

.pms-cc-toggle input:checked + .pms-cc-toggle-track {
	background-color: var(--global-palette1, #c0392b);
}

.pms-cc-toggle input:checked + .pms-cc-toggle-track .pms-cc-toggle-thumb {
	transform: translateX(20px);
}

.pms-cc-toggle input:focus-visible + .pms-cc-toggle-track {
	outline: 3px solid var(--global-palette3, #1e407a);
	outline-offset: 2px;
}

/* ── Modal footer ── */

.pms-cc-modal-footer {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	padding: 1rem 1.4rem;
	border-top: 1px solid var(--global-palette7, #e2e8f0);
	flex-shrink: 0;
}


/* =============================================================================
   4. Re-open trigger (fixed bottom-right icon button, always visible post-consent)
   ============================================================================= */

#pms-cc-trigger {
	/* Hidden by default; JS reveals it once consent has been recorded. */
	display: none;
}

#pms-cc-trigger[aria-hidden="false"] {
	display: block;
	position: fixed;
	bottom: 1.25rem;
	right: 1.25rem;
	z-index: 99997;
}

.pms-cc-reopen-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 42px;
	height: 42px;
	padding: 0;
	border: none;
	border-radius: 50%;
	background: var(--global-palette1, #c0392b);
	color: #fff;
	cursor: pointer;
	box-shadow: 0 3px 12px rgba(0, 0, 0, 0.22);
	transition: opacity 0.15s ease, transform 0.15s ease;
}

.pms-cc-reopen-btn:hover {
	color: var(--global-palette3, #2C5980);
	background: var(--global-palette2, #FFB416);
	opacity: 0.88;
	transform: scale(1.08);
}

.pms-cc-reopen-btn:focus-visible {
	outline: 3px solid var(--global-palette3, #1e407a);
	outline-offset: 3px;
}

.pms-cc-reopen-btn .pm-icons {
	font-size: 1.25rem;
	line-height: 1;
	pointer-events: none;
}


/* =============================================================================
   5. Page overlay (visual dim — shown while banner awaits a decision)
   ============================================================================= */

#pms-cc-page-dim {
	position: fixed;
	inset: 0;
	z-index: 99996; /* Below banner (99998) and modal overlay (99999) */
	background: rgba(0, 0, 0, 0.6);
	pointer-events: none; /* Never blocks scroll or clicks */
	opacity: 0;
	transition: opacity 0.3s ease;
}

#pms-cc-page-dim.pms-cc-active {
	opacity: 1;
	pointer-events: auto; /* Blocks background clicks while banner awaits a decision */
}


/* =============================================================================
   6. Responsive
   ============================================================================= */

@media (max-width: 600px) {

	.pms-cc-inner {
		gap: 0.85rem;
		padding: 1rem;
	}

	.pms-cc-actions {
		width: 100%;
	}

	.pms-cc-btn {
		flex: 1 1 auto;
		justify-content: center;
	}

	.pms-cc-modal-box {
		max-height: 95vh;
		border-radius: 8px 8px 0 0;
		top: auto;
		bottom: 0;
		left: 0;
		right: 0;
		transform: none;
		max-width: 100%;
	}

	.pms-cc-modal-footer {
		flex-direction: column;
	}

	.pms-cc-modal-footer .pms-cc-btn {
		width: 100%;
	}

}
