/**
 * CookieGate — DPDP Cookie Consent & Data Principal Rights
 * Developed & maintained by: Vijaya Kumar L, Lead Application Engineering, CIEL HR
 * © 2026 CIEL HR. Internal use only — not for sale or redistribution.
 *
 * ckg-panel.css: the floating cookie icon + Cookie Preferences panel + revoke flow,
 * loaded into the panel's Shadow DOM so the theme can never touch it. Colour tokens come
 * from :host variables set by ckg-panel.js (mirrors ckg-banner.css conventions).
 */

/* Self-hosted Inter so the panel is pixel-identical whatever font the theme uses
 * (the panel shadow root only links THIS stylesheet). url() resolves relative to assets/css/. */
@font-face { font-family: "Inter"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/inter-400.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 500; font-display: swap; src: url("../fonts/inter-500.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 600; font-display: swap; src: url("../fonts/inter-600.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 700; font-display: swap; src: url("../fonts/inter-700.woff2") format("woff2"); }

.ckg-scope {
	--ckg-primary: #0363fc;
	--ckg-primary-text: #ffffff;
	--ckg-surface: #ffffff;
	--ckg-text: #0a1931;
	--ckg-muted: #5b6475;
	--ckg-border: #e2e6ed;
	--ckg-success: #0d7a5f;
	--ckg-warning: #c47a00;
	--ckg-danger: #c62828;
	--ckg-radius: 14px;
	--ckg-top: 0px; /* WP admin-bar height; set by ckg-panel.js */
	--ckg-font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	/* Fixed base so the panel never follows the theme's html font-size. */
	font-size: 14px;
	font-family: var(--ckg-font);
	color: var(--ckg-text);
	line-height: 1.45;
	-webkit-font-smoothing: antialiased;
}
/* Form controls don't inherit font-family — force Inter on them (but NOT a universal rule,
 * so the monospace consent-ID / CW-code elements keep their own font). */
.ckg-scope button,
.ckg-scope input,
.ckg-scope textarea,
.ckg-scope select { font-family: var(--ckg-font); }

.ckg-scope *,
.ckg-scope *::before,
.ckg-scope *::after { box-sizing: border-box; }

/* ---- floating icon ---------------------------------------------------- */
.ckg-fab {
	position: fixed;
	bottom: calc(16px + env(safe-area-inset-bottom, 0px));
	width: 44px;
	height: 44px;
	border-radius: 999px;
	border: none;
	background: var(--ckg-primary);
	color: var(--ckg-primary-text);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 6px 20px rgba(2, 10, 30, 0.28);
	z-index: 2147483000;
	transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.ckg-fab-left { left: 16px; }
.ckg-fab-right { right: 16px; }
.ckg-fab:hover { transform: translateY(-2px); box-shadow: 0 10px 26px rgba(2, 10, 30, 0.34); }
.ckg-fab:focus-visible { outline: 3px solid var(--ckg-primary); outline-offset: 2px; }
.ckg-fab .ckg-ico { width: 22px; height: 22px; }
.ckg-fab .ckg-ico svg { width: 100%; height: 100%; }

/* ---- overlay + panel -------------------------------------------------- */
.ckg-panel-overlay {
	position: fixed;
	inset: 0;
	z-index: 2147483001;
	display: flex;
}
.ckg-panel {
	position: fixed;
	bottom: calc(16px + env(safe-area-inset-bottom, 0px));
	width: 400px;
	max-width: calc(100vw - 32px);
	max-height: min(80vh, calc(100vh - var(--ckg-top, 0px) - 32px));
	background: var(--ckg-surface);
	border: 1px solid var(--ckg-border);
	border-radius: var(--ckg-radius);
	box-shadow: 0 18px 50px rgba(2, 10, 30, 0.35);
	display: flex;
	flex-direction: column;
	overflow: hidden;
}
.ckg-panel-left { left: 16px; }
.ckg-panel-right { right: 16px; }

.ckg-ico svg, .ckg-ico-sm svg { display: block; }
.ckg-ico { width: 20px; height: 20px; }
.ckg-ico-sm { width: 16px; height: 16px; }

/* ---- header ----------------------------------------------------------- */
.ckg-panel-head {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 16px 18px;
	border-bottom: 1px solid var(--ckg-border);
	position: sticky;
	top: 0;
	background: var(--ckg-surface);
}
.ckg-head-ico {
	width: 34px;
	height: 34px;
	border-radius: 9px;
	background: var(--ckg-primary);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
}
.ckg-head-ico .ckg-ico { width: 18px; height: 18px; }
.ckg-panel-title {
	flex: 1;
	margin: 0;
	font-size: 16px;
	font-weight: 700;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	padding-right: 8px;
}
.ckg-panel-title:focus { outline: none; }
.ckg-panel-close {
	width: 40px;
	height: 40px;
	flex-shrink: 0;
	border: none;
	background: transparent;
	color: var(--ckg-muted);
	cursor: pointer;
	border-radius: 8px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
}
.ckg-panel-close:hover { background: rgba(0, 0, 0, 0.05); color: var(--ckg-text); }
.ckg-panel-close:focus-visible { outline: 2px solid var(--ckg-primary); outline-offset: 1px; }

.ckg-drag-handle { display: none; }

/* ---- scroll body ------------------------------------------------------ */
.ckg-panel-scroll {
	overflow-y: auto;
	padding: 16px 18px 20px;
	scrollbar-width: thin;
}
.ckg-panel-scroll::-webkit-scrollbar { width: 8px; }
.ckg-panel-scroll::-webkit-scrollbar-thumb { background: var(--ckg-border); border-radius: 999px; }

/* ---- status block ----------------------------------------------------- */
.ckg-status {
	border: 1px solid var(--ckg-border);
	border-radius: 12px;
	padding: 12px 14px;
	margin-bottom: 14px;
	background: #f8fafc;
}
.ckg-st-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 3px 0; }
.ckg-st-k { color: var(--ckg-muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.03em; }
.ckg-st-v { font-weight: 600; font-size: 13px; text-align: right; }
.ckg-tone-success { color: var(--ckg-success); }
.ckg-tone-warning { color: var(--ckg-warning); }
.ckg-tone-muted { color: var(--ckg-muted); }
.ckg-minor-pill {
	display: inline-flex;
	align-items: center;
	align-self: flex-start;
	max-width: 100%;
	margin: 8px 0 0;
	background: #fdf3e2;
	color: var(--ckg-warning);
	border: 1px solid #f2d79b;
	border-radius: 999px;
	padding: 4px 12px;
	font-size: 12px;
	font-weight: 600;
	line-height: 1.3;
}
.ckg-id-chip {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	max-width: 65%;
}
.ckg-id-chip code {
	font-family: ui-monospace, Menlo, monospace;
	font-size: 12px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.ckg-copy {
	border: none;
	background: transparent;
	color: var(--ckg-primary);
	cursor: pointer;
	padding: 2px;
	display: inline-flex;
}
.ckg-copy.is-copied { color: var(--ckg-success); }
.ckg-copy:focus-visible { outline: 2px solid var(--ckg-primary); outline-offset: 1px; }

/* ---- category summary ------------------------------------------------- */
.ckg-cat-sum { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.ckg-cat-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.ckg-cat-name { font-weight: 600; font-size: 14px; }
.ckg-cat-pill { border-radius: 999px; padding: 2px 10px; font-size: 12px; font-weight: 600; }
.ckg-cat-pill.is-always { background: #eef2f7; color: var(--ckg-muted); border: 1px solid var(--ckg-border); }
.ckg-cat-pill.is-granted { background: #e7f5ef; color: var(--ckg-success); border: 1px solid #bfe6d6; }
.ckg-cat-pill.is-denied { background: #f3f4f6; color: var(--ckg-muted); border: 1px solid var(--ckg-border); }

/* ---- customize toggles ------------------------------------------------ */
.ckg-customize { display: flex; flex-direction: column; gap: 12px; margin-bottom: 14px; }
.ckg-tg-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.ckg-tg-title { display: block; font-weight: 600; font-size: 14px; }
.ckg-always { color: var(--ckg-muted); font-weight: 600; font-size: 12px; }
.ckg-tg-desc { display: block; color: var(--ckg-muted); font-size: 12px; margin-top: 2px; }/* toggle switch (compact 36x20) — IDENTICAL in every visitor stylesheet so the combined
 * web-app bundle (which concatenates them) has no conflicting rule. Markup:
 * label.ckg-switch > input + span.ckg-switch-track > span.ckg-switch-thumb. */
.ckg-switch { position: relative; display: inline-block; width: 36px; height: 20px; flex: 0 0 auto; vertical-align: middle; }
.ckg-switch input { position: absolute; inset: 0; width: 36px; height: 20px; opacity: 0; margin: 0; cursor: pointer; }
.ckg-switch.is-locked input { cursor: not-allowed; }
.ckg-switch-track { position: absolute; inset: 0; background: #cbd2dd; border: 1px solid #b4bdcc; border-radius: 999px; box-sizing: border-box; transition: background 0.15s ease, border-color 0.15s ease; }
.ckg-switch-thumb { position: absolute; top: 50%; inset-inline-start: 2px; width: 14px; height: 14px; background: #fff; border-radius: 50%; transform: translateY(-50%); transition: transform 0.15s ease; box-shadow: 0 1px 3px rgba(10, 25, 49, 0.35); }
.ckg-switch input:checked + .ckg-switch-track { background: var(--ckg-primary); border-color: var(--ckg-primary); }
.ckg-switch input:checked + .ckg-switch-track .ckg-switch-thumb { transform: translate(16px, -50%); }
.ckg-switch.is-locked .ckg-switch-track { background: var(--ckg-primary); border-color: var(--ckg-primary); opacity: 0.9; }
.ckg-switch.is-locked .ckg-switch-thumb { transform: translate(16px, -50%); }
.ckg-switch input:focus-visible + .ckg-switch-track { outline: 2px solid var(--ckg-primary); outline-offset: 2px; }
[dir="rtl"] .ckg-switch-thumb { inset-inline-start: auto; inset-inline-end: 2px; }
[dir="rtl"] .ckg-switch input:checked + .ckg-switch-track .ckg-switch-thumb,
[dir="rtl"] .ckg-switch.is-locked .ckg-switch-thumb { transform: translate(-16px, -50%); }

.ckg-save-btn {
	margin-top: 4px;
	background: var(--ckg-primary);
	color: var(--ckg-primary-text);
	border: none;
	border-radius: 10px;
	padding: 10px 16px;
	font-weight: 700;
	font-size: 14px;
	cursor: pointer;
}
.ckg-save-btn:focus-visible { outline: 2px solid var(--ckg-primary); outline-offset: 2px; }

/* ---- action list ------------------------------------------------------ */
.ckg-action-list { border: 1px solid var(--ckg-border); border-radius: 12px; overflow: hidden; margin-bottom: 14px; }
.ckg-action-item {
	display: flex;
	align-items: center;
	gap: 12px;
	width: 100%;
	min-height: 48px;
	padding: 0 14px;
	background: transparent;
	border: none;
	border-bottom: 1px solid var(--ckg-border);
	cursor: pointer;
	font-size: 14px;
	color: var(--ckg-text);
	text-align: left;
}
.ckg-action-item:last-child { border-bottom: none; }
.ckg-action-item:hover { background: rgba(3, 99, 252, 0.05); }
.ckg-action-item:focus-visible { outline: 2px solid var(--ckg-primary); outline-offset: -2px; }
.ckg-action-ico { color: var(--ckg-primary); width: 18px; height: 18px; flex-shrink: 0; }
.ckg-action-label { flex: 1; }
.ckg-action-chev { color: var(--ckg-muted); width: 16px; height: 16px; flex-shrink: 0; }

/* ---- revoke button + footer ------------------------------------------- */
.ckg-revoke-btn {
	width: 100%;
	min-height: 44px;
	border: 1.5px solid var(--ckg-danger);
	background: transparent;
	color: var(--ckg-danger);
	border-radius: 10px;
	font-weight: 700;
	font-size: 14px;
	cursor: pointer;
	margin-bottom: 14px;
}
.ckg-revoke-btn:hover { background: var(--ckg-danger); color: #fff; }
.ckg-revoke-btn:focus-visible { outline: 2px solid var(--ckg-danger); outline-offset: 2px; }
.ckg-panel-foot { font-size: 12px; color: var(--ckg-muted); margin: 0 0 6px; line-height: 1.6; }
.ckg-flink { color: var(--ckg-primary); text-decoration: none; }
.ckg-flink:hover { text-decoration: underline; }
.ckg-gpc-line { font-size: 11px; color: var(--ckg-muted); margin: 0; }

/* ====================== shared revoke flow ====================== */
.ckg-rv { display: flex; flex-direction: column; gap: 12px; }
.ckg-rv-warn {
	margin: 0;
	padding: 12px 14px;
	background: #fdeaea;
	color: var(--ckg-danger);
	border: 1px solid #f2b8b8;
	border-radius: 10px;
	font-size: 13px;
	line-height: 1.5;
}
.ckg-rv-check { display: flex; align-items: flex-start; gap: 8px; font-size: 14px; }
.ckg-rv-check input { margin-top: 2px; }
.ckg-rv-field { display: flex; flex-direction: column; gap: 4px; }
.ckg-rv-label { font-size: 13px; font-weight: 600; }
.ckg-rv-input {
	background: #ffffff;
	color: #0a1931;
	border: 1px solid var(--ckg-border);
	border-radius: 8px;
	padding: 9px 11px;
	font-size: 14px;
	font-family: inherit;
	width: 100%;
}
.ckg-rv-input::placeholder { color: #8b93a4; opacity: 1; }
.ckg-rv-input:focus, .ckg-rv-input:focus-visible { outline: 2px solid var(--ckg-primary); outline-offset: 1px; border-color: var(--ckg-primary); }
.ckg-rv-input[aria-invalid="true"] { border-color: var(--ckg-danger); }
/* Keep autofilled inputs white with dark text. */
.ckg-rv-input:-webkit-autofill,
.ckg-rv-input:-webkit-autofill:hover,
.ckg-rv-input:-webkit-autofill:focus {
	-webkit-text-fill-color: #0a1931;
	box-shadow: 0 0 0 1000px #ffffff inset;
}
.ckg-rv-textarea { resize: vertical; min-height: 54px; }
.ckg-rv-counter { font-size: 11px; color: var(--ckg-muted); align-self: flex-end; }
.ckg-rv-err { color: var(--ckg-danger); font-size: 12px; }
.ckg-rv-hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.ckg-rv-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ckg-rv-actions-single { grid-template-columns: 1fr; }
.ckg-rv-btn {
	min-height: 44px;
	border-radius: 10px;
	font-weight: 700;
	font-size: 14px;
	cursor: pointer;
	border: 1.5px solid transparent;
}
.ckg-rv-btn[disabled] { opacity: 0.6; cursor: default; }
.ckg-rv-btn-primary { background: var(--ckg-primary); color: var(--ckg-primary-text); border-color: var(--ckg-primary); }
.ckg-rv-btn-outline { background: transparent; color: var(--ckg-text); border-color: var(--ckg-border); }
.ckg-rv-btn-danger { background: var(--ckg-danger); color: #fff; border-color: var(--ckg-danger); }
.ckg-rv-btn:focus-visible { outline: 2px solid var(--ckg-primary); outline-offset: 2px; }
@media (max-width: 339px) {
	.ckg-rv-actions { grid-template-columns: 1fr; gap: 12px; }
}

/* ---- revoke success --------------------------------------------------- */
.ckg-rv-done { align-items: center; text-align: center; }
.ckg-rv-check .ckg-ico { width: 40px; height: 40px; }
.ckg-rv-title { margin: 6px 0 2px; font-size: 17px; font-weight: 700; }
.ckg-rv-body { margin: 0; color: var(--ckg-muted); font-size: 13px; }
.ckg-rv-local { margin: 6px 0 0; color: var(--ckg-danger); font-size: 13px; }
.ckg-rv-emailed { margin: 2px 0 0; color: var(--ckg-success); font-size: 13px; }
.ckg-code-box {
	width: 100%;
	border: 1px dashed var(--ckg-primary);
	background: rgba(3, 99, 252, 0.06);
	border-radius: 12px;
	padding: 14px;
	margin: 6px 0;
}
.ckg-code-label { display: block; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ckg-muted); }
.ckg-code-row { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 6px 0; }
.ckg-code { font-family: ui-monospace, Menlo, monospace; font-size: 22px; font-weight: 700; letter-spacing: 0.04em; }
.ckg-code-copy {
	border: 1px solid var(--ckg-primary);
	background: #fff;
	color: var(--ckg-primary);
	border-radius: 8px;
	padding: 4px 10px;
	font-size: 12px;
	font-weight: 600;
	cursor: pointer;
}
.ckg-code-copy:focus-visible { outline: 2px solid var(--ckg-primary); outline-offset: 1px; }
.ckg-code-save { margin: 4px 0 0; font-size: 12px; color: var(--ckg-muted); }

/* ====================== mobile bottom sheet ====================== */
@media (max-width: 639px) {
	.ckg-panel-overlay { background: rgba(2, 10, 30, 0.45); }
	.ckg-panel {
		left: 0 !important;
		right: 0 !important;
		bottom: 0 !important;
		width: 100%;
		max-width: 100%;
		max-height: 85vh;
		border-radius: var(--ckg-radius) var(--ckg-radius) 0 0;
		padding-bottom: env(safe-area-inset-bottom, 0px);
	}
	.ckg-drag-handle {
		display: block;
		width: 40px;
		height: 4px;
		border-radius: 999px;
		background: var(--ckg-border);
		margin: 8px auto 0;
	}
}

/* --- dark scheme (A3): tokens come from ckg-panel.js; override the few hardcoded light
 * surfaces so the floating panel's dark mode looks designed. ----------------- */
:host([data-scheme="dark"]) .ckg-rv-input { background: color-mix(in srgb, var(--ckg-text) 8%, var(--ckg-surface)); color: var(--ckg-text); }
:host([data-scheme="dark"]) .ckg-rv-input::placeholder { color: var(--ckg-muted); }
:host([data-scheme="dark"]) .ckg-rv-input:-webkit-autofill,
:host([data-scheme="dark"]) .ckg-rv-input:-webkit-autofill:hover,
:host([data-scheme="dark"]) .ckg-rv-input:-webkit-autofill:focus { -webkit-text-fill-color: var(--ckg-text); box-shadow: 0 0 0 1000px #1E2A44 inset; }
:host([data-scheme="dark"]) .ckg-rv-warn { background: #2A1414; border-color: #5A2A2A; }
:host([data-scheme="dark"]) .ckg-code-copy { background: color-mix(in srgb, var(--ckg-text) 8%, var(--ckg-surface)); }
