/*
 * Hanuman PDPA — cookie banner.
 * Every rule is scoped to .hnpdpa-ck / .hnpdpa-ck-fab so themes are not touched,
 * and the few properties themes love to override on buttons are reset here.
 * Variables use the --hnpdpack- prefix (not --hnpdpa-) so they never clash with admin tokens.
 */

.hnpdpa-ck {
	--hnpdpack-accent: #233275;
	--hnpdpack-bg: #ffffff;
	--hnpdpack-ink: #1f2937;
	--hnpdpack-muted: #4b5563;
	--hnpdpack-line: #e5e7eb;
	position: fixed;
	z-index: 2147483000;
	left: 0;
	right: 0;
	bottom: 0;
	font: 15px/1.6 system-ui, -apple-system, "Segoe UI", "Sarabun", "Noto Sans Thai", sans-serif;
	color: var(--hnpdpack-ink);
	box-sizing: border-box;
}
.hnpdpa-ck *, .hnpdpa-ck *::before, .hnpdpa-ck *::after { box-sizing: border-box; }
.hnpdpa-ck[hidden], .hnpdpa-ck [hidden], .hnpdpa-ck-fab[hidden] { display: none !important; }

.hnpdpa-ck__banner {
	background: var(--hnpdpack-bg);
	border-top: 1px solid var(--hnpdpack-line);
	box-shadow: 0 -6px 24px rgba(15, 23, 42, .12);
	padding: 16px;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 12px 24px;
}
.hnpdpa-ck__text { flex: 1 1 420px; min-width: 0; }
.hnpdpa-ck__title { margin: 0 0 4px; font-weight: 700; font-size: 16px; color: var(--hnpdpack-ink); }
.hnpdpa-ck__msg { margin: 0; color: var(--hnpdpack-muted); }
.hnpdpa-ck__link { color: var(--hnpdpack-accent); text-decoration: underline; white-space: nowrap; }

.hnpdpa-ck__btns { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

/* The two decision buttons are deliberately identical. */
.hnpdpa-ck__btn,
.hnpdpa-ck__more,
.hnpdpa-ck__x {
	font: inherit;
	margin: 0;
	cursor: pointer;
	text-transform: none;
	letter-spacing: normal;
	line-height: 1.2;
	-webkit-appearance: none;
	appearance: none;
}
.hnpdpa-ck__btn {
	min-height: 44px;
	min-width: 140px;
	padding: 10px 18px;
	border: 2px solid var(--hnpdpack-accent);
	border-radius: 8px;
	background: var(--hnpdpack-accent);
	color: #fff;
	font-weight: 600;
}
.hnpdpa-ck__btn:hover { filter: brightness(1.1); }
.hnpdpa-ck__more {
	min-height: 44px;
	padding: 10px 12px;
	border: 0;
	background: transparent;
	color: var(--hnpdpack-accent);
	text-decoration: underline;
	font-weight: 600;
}
.hnpdpa-ck__btn:focus-visible,
.hnpdpa-ck__more:focus-visible,
.hnpdpa-ck__x:focus-visible,
.hnpdpa-ck__toggle:focus-visible,
.hnpdpa-ck__link:focus-visible,
.hnpdpa-ck-fab:focus-visible {
	outline: 3px solid #f59e0b;
	outline-offset: 2px;
}

/* Box position: a card bottom-left on wide screens. */
@media (min-width: 640px) {
	.hnpdpa-ck--box { left: 16px; right: auto; bottom: 16px; max-width: 440px; }
	.hnpdpa-ck--box .hnpdpa-ck__banner { border: 1px solid var(--hnpdpack-line); border-radius: 12px; box-shadow: 0 8px 30px rgba(15, 23, 42, .18); }
	.hnpdpa-ck--box .hnpdpa-ck__text { flex-basis: 100%; }
}

/* Settings panel: centred dialog over a dimmed page. */
.hnpdpa-ck__panel {
	position: fixed;
	inset: 0;
	background: rgba(15, 23, 42, .5);
	display: flex;
	align-items: flex-end;
	justify-content: center;
	padding: 0;
}
.hnpdpa-ck__panel-in {
	background: var(--hnpdpack-bg);
	width: 100%;
	max-width: 560px;
	max-height: 90vh;
	overflow-y: auto;
	border-radius: 12px 12px 0 0;
	padding: 18px;
	box-shadow: 0 10px 40px rgba(15, 23, 42, .3);
}
@media (min-width: 640px) {
	.hnpdpa-ck__panel { align-items: center; padding: 16px; }
	.hnpdpa-ck__panel-in { border-radius: 12px; }
}
.hnpdpa-ck__panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.hnpdpa-ck__panel-head .hnpdpa-ck__title { margin: 0; font-size: 18px; }
.hnpdpa-ck__panel-head .hnpdpa-ck__title:focus { outline: none; }
.hnpdpa-ck__x {
	width: 44px;
	height: 44px;
	border: 0;
	border-radius: 8px;
	background: transparent;
	color: var(--hnpdpack-muted);
	font-size: 26px;
	padding: 0;
}
.hnpdpa-ck__x:hover { background: #f3f4f6; }
.hnpdpa-ck__cats { list-style: none; margin: 0 0 16px; padding: 0; }
.hnpdpa-ck__cat { border-top: 1px solid var(--hnpdpack-line); padding: 12px 0; margin: 0; }
.hnpdpa-ck__cat-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; cursor: pointer; margin: 0; }
.hnpdpa-ck__cat-name { font-weight: 600; }
.hnpdpa-ck__cat-desc { margin: 4px 0 0; color: var(--hnpdpack-muted); font-size: 14px; }
.hnpdpa-ck__always { font-size: 13px; font-weight: 600; color: #166534; white-space: nowrap; }
.hnpdpa-ck__toggle { width: 22px; height: 22px; margin: 0; flex: 0 0 auto; accent-color: var(--hnpdpack-accent); cursor: pointer; }
.hnpdpa-ck__status { margin: 10px 0 0; color: var(--hnpdpack-muted); font-size: 14px; min-height: 1em; }

/* Narrow phones: decision buttons share the row equally. */
@media (max-width: 480px) {
	.hnpdpa-ck__btns .hnpdpa-ck__btn { flex: 1 1 0; min-width: 0; }
	.hnpdpa-ck__btns .hnpdpa-ck__more { flex: 1 1 100%; }
}

/* Re-open button. */
.hnpdpa-ck-fab {
	position: fixed;
	z-index: 2147482999;
	left: 16px;
	bottom: 16px;
	width: 44px;
	height: 44px;
	margin: 0;
	padding: 0;
	border: 1px solid #e5e7eb;
	border-radius: 50%;
	background: #fff;
	color: var(--hnpdpack-accent, #233275);
	box-shadow: 0 4px 14px rgba(15, 23, 42, .18);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
}
.hnpdpa-ck-fab:hover { transform: scale(1.05); }

@media print {
	.hnpdpa-ck, .hnpdpa-ck-fab { display: none !important; }
}
@media (prefers-reduced-motion: reduce) {
	.hnpdpa-ck-fab:hover { transform: none; }
}
