/*
 * PSN cookie consent (PDPA) + หน้านโยบาย
 * - แบนเนอร์คุกกี้ด้านล่าง + หน้าต่างตั้งค่า (สร้างโดย js/cookie-consent.js)
 * - กล่องแทนที่เนื้อหาที่ต้องได้รับความยินยอมก่อน (เช่น ปุ่ม Facebook)
 * - สไตล์หน้า privacy-policy / cookie-policy / terms
 */
:root {
	--psn-cc-primary: #0468bf;
	--psn-cc-primary-dark: #03518f;
	--psn-cc-text: #2b2f36;
	--psn-cc-muted: #5f6672;
	--psn-cc-border: #e3e7ed;
	--psn-cc-bg-soft: #f4f7fb;
}

/* ---------- แบนเนอร์ ---------- */
.psn-cc-banner {
	position: fixed;
	left: 16px;
	right: 16px;
	bottom: 16px;
	z-index: 10050; /* สูงกว่าปุ่มลอย (kc_fab 9999) */
	max-width: 1080px;
	margin: 0 auto;
	background: #fff;
	color: var(--psn-cc-text);
	border-radius: 14px;
	border-top: 4px solid var(--psn-cc-primary);
	box-shadow: 0 10px 40px rgba(0, 0, 0, .18), 0 2px 8px rgba(0, 0, 0, .08);
	font-family: 'Kanit', sans-serif;
	font-size: 15px;
	line-height: 1.6;
	transform: translateY(0);
	opacity: 1;
	transition: transform .3s ease, opacity .3s ease;
}
.psn-cc-banner[hidden] { display: none !important; }
.psn-cc-banner.psn-cc-enter { transform: translateY(24px); opacity: 0; }

.psn-cc-banner__inner {
	display: flex;
	align-items: center;
	gap: 20px;
	padding: 18px 22px;
}
.psn-cc-banner__text { flex: 1 1 auto; min-width: 0; }
.psn-cc-banner__title {
	display: block;
	font-size: 17px;
	font-weight: 600;
	color: var(--psn-cc-primary);
	margin: 0 0 4px;
}
.psn-cc-banner__desc { margin: 0; color: var(--psn-cc-muted); }
.psn-cc-banner a,
.psn-cc-modal a {
	color: var(--psn-cc-primary);
	text-decoration: underline;
}

.psn-cc-actions {
	display: flex;
	flex: 0 0 auto;
	flex-wrap: wrap;
	gap: 8px;
	align-items: center;
	justify-content: flex-end;
}

/* ---------- ปุ่ม ---------- */
.psn-cc-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 42px;
	padding: 8px 18px;
	border-radius: 8px;
	border: 2px solid var(--psn-cc-primary);
	font-family: 'Kanit', sans-serif;
	font-size: 15px;
	font-weight: 500;
	line-height: 1.2;
	cursor: pointer;
	white-space: nowrap;
	transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}
/* ยอมรับ / ปฏิเสธ ใช้สไตล์เดียวกัน เพื่อให้มีความเด่นเท่ากัน */
.psn-cc-btn--choice {
	background: var(--psn-cc-primary);
	color: #fff;
}
.psn-cc-btn--choice:hover { background: var(--psn-cc-primary-dark); border-color: var(--psn-cc-primary-dark); color: #fff; }
.psn-cc-btn--ghost {
	background: #fff;
	color: var(--psn-cc-primary);
}
.psn-cc-btn--ghost:hover { background: var(--psn-cc-bg-soft); }
.psn-cc-btn:focus-visible,
.psn-cc-close:focus-visible,
.psn-cc-toggle:focus-visible,
.psn-cc-banner a:focus-visible,
.psn-cc-modal a:focus-visible {
	outline: 3px solid #ffb400;
	outline-offset: 2px;
}

/* ---------- หน้าต่างตั้งค่า ---------- */
html.psn-cc-lock,
html.psn-cc-lock body { overflow: hidden; }

.psn-cc-overlay {
	position: fixed;
	inset: 0;
	top: 0; right: 0; bottom: 0; left: 0;
	z-index: 10060;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
	background: rgba(10, 20, 35, .55);
	font-family: 'Kanit', sans-serif;
}
.psn-cc-overlay[hidden] { display: none !important; }

.psn-cc-modal {
	position: relative;
	display: flex;
	flex-direction: column;
	width: 100%;
	max-width: 580px;
	max-height: calc(100vh - 32px);
	background: #fff;
	color: var(--psn-cc-text);
	border-radius: 14px;
	box-shadow: 0 20px 60px rgba(0, 0, 0, .3);
	font-size: 15px;
	line-height: 1.6;
	outline: none;
}
.psn-cc-modal__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 16px 20px;
	border-bottom: 1px solid var(--psn-cc-border);
}
.psn-cc-modal__title {
	margin: 0;
	font-size: 20px;
	font-weight: 600;
	line-height: 1.3;
	color: var(--psn-cc-primary);
	font-family: 'Kanit', sans-serif;
	letter-spacing: 0;
	text-transform: none;
}
.psn-cc-close {
	flex: 0 0 auto;
	width: 38px;
	height: 38px;
	border: 0;
	border-radius: 50%;
	background: var(--psn-cc-bg-soft);
	color: var(--psn-cc-text);
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
}
.psn-cc-close:hover { background: #e6ecf4; }
.psn-cc-modal__body {
	padding: 16px 20px;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
}
.psn-cc-modal__intro { margin: 0 0 12px; color: var(--psn-cc-muted); }

.psn-cc-cat {
	padding: 12px 14px;
	margin-bottom: 10px;
	border: 1px solid var(--psn-cc-border);
	border-radius: 10px;
	background: #fff;
}
.psn-cc-cat__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
}
.psn-cc-cat__title {
	margin: 0;
	font-weight: 600;
	font-size: 16px;
	color: var(--psn-cc-text);
	cursor: pointer;
}
.psn-cc-cat__badge {
	display: inline-block;
	margin-left: 6px;
	padding: 0 8px;
	border-radius: 20px;
	background: var(--psn-cc-bg-soft);
	color: var(--psn-cc-primary);
	font-size: 12px;
	font-weight: 500;
	vertical-align: middle;
}
.psn-cc-cat__desc { margin: 6px 0 0; color: var(--psn-cc-muted); font-size: 14px; }

/* สวิตช์เปิด/ปิด (checkbox จริง เพื่อรองรับ screen reader และคีย์บอร์ด) */
.psn-cc-toggle {
	-webkit-appearance: none;
	-moz-appearance: none;
	appearance: none;
	position: relative;
	flex: 0 0 auto;
	width: 46px;
	height: 26px;
	margin: 0;
	border-radius: 26px;
	background: #c3cad4;
	cursor: pointer;
	transition: background-color .2s ease;
}
.psn-cc-toggle::before {
	content: "";
	position: absolute;
	top: 3px;
	left: 3px;
	width: 20px;
	height: 20px;
	border-radius: 50%;
	background: #fff;
	box-shadow: 0 1px 3px rgba(0, 0, 0, .3);
	transition: transform .2s ease;
}
.psn-cc-toggle:checked { background: var(--psn-cc-primary); }
.psn-cc-toggle:checked::before { transform: translateX(20px); }
.psn-cc-toggle:disabled { cursor: not-allowed; opacity: .6; }

.psn-cc-modal__foot {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	justify-content: flex-end;
	padding: 14px 20px;
	border-top: 1px solid var(--psn-cc-border);
	background: #fafbfd;
	border-radius: 0 0 14px 14px;
}
.psn-cc-modal__links { margin: 12px 0 0; font-size: 14px; color: var(--psn-cc-muted); }

/* ---------- กล่องแทนที่เนื้อหาที่ต้องได้รับความยินยอม ---------- */
.psn-consent-placeholder {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px 12px;
	padding: 10px 14px;
	border: 1px dashed #b9c6d6;
	border-radius: 10px;
	background: var(--psn-cc-bg-soft);
	color: var(--psn-cc-muted);
	font-family: 'Kanit', sans-serif;
	font-size: 14px;
	line-height: 1.5;
}
.psn-consent-placeholder[hidden] { display: none !important; }
.psn-consent-placeholder__icon { font-size: 22px; color: #1877f2; }
.psn-consent-placeholder__text { flex: 1 1 200px; }

/* ---------- หน้านโยบาย ---------- */
.psn-policy {
	background: #fff;
	border-radius: 10px;
	padding: 20px;
	box-shadow: 0 5px 20px #e1e1e1;
	color: #3a3f47;
	font-size: 16px;
	line-height: 1.8;
}
.psn-policy h2 {
	margin: 32px 0 12px;
	padding-top: 4px;
	font-size: 22px;
	line-height: 1.4;
	color: var(--psn-cc-primary);
	scroll-margin-top: 140px;
}
.psn-policy h3 { margin: 20px 0 8px; font-size: 18px; color: #2b2f36; }
.psn-policy p,
.psn-policy li { color: #3a3f47; }
.psn-policy ul,
.psn-policy ol { padding-left: 1.4em; }
.psn-policy li { margin-bottom: 6px; }
.psn-policy a { color: var(--psn-cc-primary); text-decoration: underline; }
.psn-policy-meta { color: var(--psn-cc-muted); font-size: 14px; margin-bottom: 16px; }
.psn-policy-nav {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-bottom: 20px;
}
.psn-policy-nav a {
	display: inline-block;
	padding: 6px 14px;
	border-radius: 20px;
	border: 1px solid var(--psn-cc-primary);
	color: var(--psn-cc-primary);
	text-decoration: none;
	font-size: 14px;
	line-height: 1.5;
}
.psn-policy-nav a:hover { background: var(--psn-cc-bg-soft); }
.psn-policy-nav a[aria-current="page"] { background: var(--psn-cc-primary); color: #fff; }
.psn-policy-toc {
	background: var(--psn-cc-bg-soft);
	border-left: 4px solid var(--psn-cc-primary);
	border-radius: 8px;
	padding: 14px 18px;
	margin: 16px 0 8px;
}
.psn-policy-toc strong { display: block; margin-bottom: 6px; color: #2b2f36; }
.psn-policy-toc ol { margin: 0; padding-left: 1.4em; }
.psn-policy-toc li { margin-bottom: 2px; }
.psn-policy-table { font-size: 15px; margin-bottom: 8px; }
.psn-policy-table th { background: var(--psn-cc-bg-soft); color: #2b2f36; white-space: nowrap; }
.psn-policy-table th,
.psn-policy-table td { vertical-align: top; }
.psn-policy-table code { color: #b0306a; white-space: nowrap; }
.psn-policy-contact {
	background: var(--psn-cc-bg-soft);
	border-radius: 8px;
	padding: 14px 18px;
}
.psn-policy-contact p { margin-bottom: 4px; }
.psn-policy-status {
	display: block;
	margin: 8px 0 12px;
	color: var(--psn-cc-muted);
	font-size: 14px;
}

/* ---------- มือถือ ---------- */
@media (max-width: 767px) {
	.psn-cc-banner { left: 8px; right: 8px; bottom: 8px; font-size: 14px; }
	.psn-cc-banner__inner { flex-direction: column; align-items: stretch; gap: 12px; padding: 14px 16px; }
	.psn-cc-banner__title { font-size: 16px; }
	.psn-cc-banner__desc { max-height: 30vh; overflow-y: auto; }
	.psn-cc-actions { display: grid; grid-template-columns: 1fr 1fr; }
	.psn-cc-actions .psn-cc-btn { width: 100%; white-space: normal; }
	.psn-cc-actions .psn-cc-btn--ghost { grid-column: 1 / -1; }
	.psn-cc-overlay { padding: 8px; align-items: flex-end; }
	.psn-cc-modal { max-height: calc(100vh - 16px); }
	.psn-cc-modal__foot { display: grid; grid-template-columns: 1fr 1fr; }
	.psn-cc-modal__foot .psn-cc-btn { width: 100%; white-space: normal; }
	.psn-cc-modal__foot [data-psn-cc="save"] { grid-column: 1 / -1; }
	.psn-policy { padding: 16px; font-size: 15px; }
	.psn-policy h2 { font-size: 19px; }
}

@media (prefers-reduced-motion: reduce) {
	.psn-cc-banner,
	.psn-cc-toggle,
	.psn-cc-toggle::before { transition: none; }
}

@media print {
	.psn-cc-banner,
	.psn-cc-overlay { display: none !important; }
}
