/* Cookie Consent Manager — front-end styles */

#ccm-root {
	--ccm-primary: #2563eb;
	--ccm-bg: #ffffff;
	--ccm-text: #1f2937;
	--ccm-muted: #6b7280;
	--ccm-border: #e5e7eb;
	--ccm-radius: 12px;
	--ccm-shadow: 0 8px 30px rgba(0, 0, 0, 0.18);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	color: var(--ccm-text);
}

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

/* Ensure the hidden attribute always beats the display rules below, so the
   modal/banner/reopen elements are truly removed until JS reveals them. */
#ccm-root [hidden] {
	display: none !important;
}

/* --- Banner --- */
.ccm-banner {
	position: fixed;
	left: 50%;
	transform: translateX(-50%);
	width: calc(100% - 32px);
	max-width: 960px;
	z-index: 999999;
	background: var(--ccm-bg);
	border: 1px solid var(--ccm-border);
	border-radius: var(--ccm-radius);
	box-shadow: var(--ccm-shadow);
}

.ccm-pos-bottom { bottom: 20px; }
.ccm-pos-top    { top: 20px; }

.ccm-banner-inner {
	display: flex;
	align-items: center;
	gap: 20px;
	padding: 20px 24px;
	flex-wrap: wrap;
}

.ccm-banner-text { flex: 1 1 320px; }

.ccm-title {
	margin: 0 0 6px;
	font-size: 17px;
	font-weight: 700;
	line-height: 1.3;
}

.ccm-message {
	margin: 0;
	font-size: 14px;
	line-height: 1.55;
	color: var(--ccm-muted);
}

.ccm-policy-link {
	color: var(--ccm-primary);
	text-decoration: underline;
	white-space: nowrap;
}

.ccm-banner-actions {
	display: flex;
	gap: 10px;
	flex-wrap: wrap;
	align-items: center;
}

/* --- Buttons --- */
.ccm-btn {
	appearance: none;
	border: 1px solid transparent;
	border-radius: 8px;
	padding: 10px 18px;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	line-height: 1.2;
	transition: background-color 0.15s ease, opacity 0.15s ease;
}

.ccm-btn-primary {
	background: var(--ccm-primary);
	color: #fff;
}
.ccm-btn-primary:hover { opacity: 0.9; }

.ccm-btn-ghost {
	background: transparent;
	color: var(--ccm-text);
	border-color: var(--ccm-border);
}
.ccm-btn-ghost:hover { background: #f3f4f6; }

.ccm-btn:focus-visible {
	outline: 2px solid var(--ccm-primary);
	outline-offset: 2px;
}

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

.ccm-modal-overlay {
	position: absolute;
	inset: 0;
	background: rgba(17, 24, 39, 0.55);
}

.ccm-modal-box {
	position: relative;
	z-index: 1;
	background: var(--ccm-bg);
	border-radius: var(--ccm-radius);
	box-shadow: var(--ccm-shadow);
	width: 100%;
	max-width: 520px;
	max-height: 85vh;
	overflow-y: auto;
	padding: 28px;
}

.ccm-modal-box h2 {
	margin: 0 0 8px;
	font-size: 20px;
	font-weight: 700;
}

.ccm-modal-intro {
	margin: 0 0 18px;
	font-size: 14px;
	color: var(--ccm-muted);
	line-height: 1.55;
}

.ccm-modal-close {
	position: absolute;
	top: 12px;
	right: 14px;
	background: none;
	border: none;
	font-size: 26px;
	line-height: 1;
	cursor: pointer;
	color: var(--ccm-muted);
}
.ccm-modal-close:hover { color: var(--ccm-text); }

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

.ccm-category-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
}

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

.ccm-category-desc {
	margin: 6px 0 0;
	font-size: 13px;
	color: var(--ccm-muted);
	line-height: 1.5;
}

.ccm-modal-actions {
	display: flex;
	gap: 10px;
	flex-wrap: wrap;
	justify-content: flex-end;
	margin-top: 22px;
	padding-top: 18px;
	border-top: 1px solid var(--ccm-border);
}

/* --- Toggle switch --- */
.ccm-switch {
	position: relative;
	display: inline-block;
	width: 44px;
	height: 24px;
	flex: 0 0 auto;
}
.ccm-switch input { opacity: 0; width: 0; height: 0; }

.ccm-slider {
	position: absolute;
	inset: 0;
	background: #cbd5e1;
	border-radius: 999px;
	transition: background 0.15s ease;
}
.ccm-slider::before {
	content: "";
	position: absolute;
	height: 18px;
	width: 18px;
	left: 3px;
	top: 3px;
	background: #fff;
	border-radius: 50%;
	transition: transform 0.15s ease;
}
.ccm-switch input:checked + .ccm-slider { background: var(--ccm-primary); }
.ccm-switch input:checked + .ccm-slider::before { transform: translateX(20px); }
.ccm-switch input:disabled + .ccm-slider { opacity: 0.6; }
.ccm-switch input:focus-visible + .ccm-slider {
	outline: 2px solid var(--ccm-primary);
	outline-offset: 2px;
}

/* --- Reopen button --- */
.ccm-reopen {
	position: fixed;
	left: 18px;
	bottom: 18px;
	z-index: 999998;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	background: var(--ccm-bg);
	color: var(--ccm-text);
	border: 1px solid var(--ccm-border);
	border-radius: 999px;
	padding: 9px 14px;
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
}
.ccm-reopen:hover { background: #f3f4f6; }
.ccm-reopen span[aria-hidden="true"] { font-size: 16px; }

/* --- Responsive --- */
@media (max-width: 600px) {
	.ccm-banner-inner { padding: 18px; }
	.ccm-banner-actions { width: 100%; }
	.ccm-banner-actions .ccm-btn { flex: 1 1 auto; text-align: center; }
	.ccm-reopen-label { display: none; }
	.ccm-reopen { padding: 12px; }
}

/* --- Reduced motion --- */
@media (prefers-reduced-motion: reduce) {
	#ccm-root * { transition: none !important; }
}
