/* Cookie consent (PDPA) — ใช้คู่กับ _cookie_consent.php และ js/cookie-consent.js */

:root {
	--cc-gold: #B48732;
	--cc-gold-2: #E9D36D;
	--cc-ink: #1f1f1f;
	--cc-muted: #5f5f5f;
	--cc-line: #ece6d8;
}

#cc-root, .cc-btn { font-family: 'Noto Sans Thai', sans-serif; }

#cc-root [hidden] { display: none !important; }

.cc-banner {
	position: fixed;
	left: 20px;
	bottom: calc(20px + var(--pk-fab-bar-h, 0px));
	z-index: 10010;
	display: flex;
	gap: 14px;
	width: calc(100% - 40px);
	max-width: 460px;
	padding: 18px 18px 16px;
	background: #fff;
	color: var(--cc-ink);
	border-radius: 18px;
	border: 1px solid var(--cc-line);
	box-shadow: 0 20px 50px rgba(30, 22, 5, .18);
	opacity: 0;
	transform: translateY(20px);
	transition: opacity .35s ease, transform .35s ease;
}
.cc-banner.cc-show { opacity: 1; transform: none; }

.cc-banner-icon {
	flex: 0 0 44px;
	height: 44px;
	border-radius: 12px;
	display: grid;
	place-items: center;
	font-size: 22px;
	color: #fff;
	background: linear-gradient(135deg, var(--cc-gold), var(--cc-gold-2));
}

.cc-title { font-weight: 700; font-size: 17px; margin-bottom: 4px; color: var(--cc-ink); }
.cc-text { font-size: 14px !important; line-height: 1.6 !important; color: var(--cc-muted) !important; margin: 0 0 12px !important; }
.cc-text a { color: var(--cc-gold); text-decoration: underline; }

.cc-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.cc-btn {
	appearance: none;
	border: 1.5px solid transparent;
	border-radius: 999px;
	padding: 8px 16px;
	font: inherit;
	font-size: 14px;
	font-weight: 600;
	line-height: 1.3;
	cursor: pointer;
	transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.cc-btn:focus-visible { outline: 3px solid rgba(180, 135, 50, .35); outline-offset: 2px; }
.cc-btn-primary { color: #fff; background: linear-gradient(120deg, var(--cc-gold), #cfa94a); box-shadow: 0 6px 16px rgba(180, 135, 50, .35); }
.cc-btn-primary:hover { transform: translateY(-1px); box-shadow: 0 10px 22px rgba(180, 135, 50, .4); }
.cc-btn-outline { color: var(--cc-ink); background: #fff; border-color: #d9cfb8; }
.cc-btn-outline:hover { background: #faf6ec; }
.cc-btn-link { color: var(--cc-gold); background: none; padding-left: 6px; padding-right: 6px; text-decoration: underline; }

/* Modal */
.cc-modal { position: fixed; inset: 0; z-index: 10020; display: grid; place-items: center; padding: 16px; }
.cc-modal-backdrop { position: absolute; inset: 0; background: rgba(20, 16, 8, .55); backdrop-filter: blur(3px); }
.cc-modal-box {
	position: relative;
	width: 100%;
	max-width: 560px;
	max-height: calc(100vh - 32px);
	display: flex;
	flex-direction: column;
	background: #fff;
	border-radius: 20px;
	box-shadow: 0 30px 80px rgba(0, 0, 0, .3);
	overflow: hidden;
	animation: cc-pop .25s ease;
}
@keyframes cc-pop { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }

.cc-modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--cc-line); }
.cc-modal-head .cc-title { margin: 0; }
.cc-modal-head .cc-title i { color: var(--cc-gold); margin-right: 6px; }
.cc-close { border: 0; background: #f3efe5; width: 34px; height: 34px; border-radius: 50%; font-size: 22px; line-height: 1; cursor: pointer; color: var(--cc-ink); }
.cc-modal-body { padding: 18px 20px; overflow-y: auto; }
.cc-modal-foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--cc-line); background: #fcfaf5; }

.cc-cat { border: 1px solid var(--cc-line); border-radius: 14px; padding: 14px; margin-bottom: 10px; }
.cc-cat-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 0; cursor: pointer; font-weight: normal; }
.cc-cat-name { font-weight: 700; font-size: 15px; color: var(--cc-ink); }
.cc-cat-desc { font-size: 13px; line-height: 1.55; color: var(--cc-muted); margin-top: 2px; }
.cc-always { flex: none; font-size: 12px; font-weight: 700; color: #2e7d32; background: #e8f5e9; padding: 4px 10px; border-radius: 999px; }

.cc-switch { position: relative; flex: none; width: 46px; height: 26px; }
.cc-switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.cc-switch span { position: absolute; inset: 0; background: #d6d1c4; border-radius: 999px; transition: background .2s ease; }
.cc-switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, .2); transition: transform .2s ease; }
.cc-switch input:checked + span { background: var(--cc-gold); }
.cc-switch input:checked + span::after { transform: translateX(20px); }
.cc-switch input:focus-visible + span { outline: 3px solid rgba(180, 135, 50, .35); outline-offset: 2px; }

html.cc-lock { overflow: hidden; }

/* กล่องแทนที่เนื้อหาจาก Facebook ก่อนได้รับความยินยอม */
.consent-placeholder {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 10px;
	min-height: 220px;
	padding: 24px;
	text-align: center;
	border: 1.5px dashed #d9cfb8;
	border-radius: 16px;
	background: #fcfaf5;
	font-family: 'Noto Sans Thai', sans-serif;
	font-size: 14px;
	color: #5f5f5f;
}
.consent-placeholder[hidden] { display: none; }
.consent-placeholder i { font-size: 30px; color: #1877f2; }

@media (max-width: 575px) {
	.cc-banner { left: 10px; right: 10px; bottom: calc(10px + var(--pk-fab-bar-h, 0px)); width: auto; max-width: none; padding: 14px; }
	.cc-banner-icon { display: none; }
	.cc-actions .cc-btn-primary, .cc-actions .cc-btn-outline { flex: 1 1 auto; }
	.cc-modal-foot .cc-btn { flex: 1 1 100%; }
}

@media (prefers-reduced-motion: reduce) {
	.cc-banner, .cc-modal-box, .cc-btn, .cc-switch span, .cc-switch span::after { transition: none; animation: none; }
}
