/* Cookie Consent (PDPA) — widget-cookie-consent.php */

.cc-banner[hidden],
.cc-modal[hidden] {
	display: none !important;
}

.cc-banner,
.cc-modal {
	--cc-primary: #174EBD;
	--cc-primary-hover: #0f3d99;
	--cc-text: #1f2937;
	--cc-muted: #4b5563;
	--cc-border: #e5e7eb;
	font-family: 'Sarabun', sans-serif;
	color: var(--cc-text);
}

/* ---- แบนเนอร์ ---- */
.cc-banner {
	position: fixed;
	left: 20px;
	bottom: 20px;
	z-index: 1060;
	width: calc(100% - 40px);
	max-width: 460px;
	padding: 20px;
	background: #FFF;
	border: 1px solid var(--cc-border);
	border-radius: 16px;
	box-shadow: 0 20px 50px rgba(15, 23, 42, 0.22);
	opacity: 0;
	transform: translateY(16px);
	transition: opacity 0.3s ease, transform 0.3s ease;
}

.cc-banner.is-visible {
	opacity: 1;
	transform: none;
}

.cc-banner__body {
	display: flex;
	gap: 14px;
}

.cc-banner__icon {
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	width: 42px;
	height: 42px;
	border-radius: 12px;
	background: #fff4e0;
	color: #d97706;
	font-size: 20px;
}

.cc-banner p {
	margin: 0 !important;
}

.cc-banner__title {
	font-size: 17px;
	font-weight: 700;
	color: var(--cc-text) !important;
	margin-bottom: 4px !important;
}

.cc-banner__text {
	font-size: 14px;
	line-height: 1.6 !important;
	color: var(--cc-muted) !important;
}

.cc-banner a,
.cc-modal a {
	color: var(--cc-primary);
	text-decoration: underline;
}

.cc-banner__actions {
	display: flex;
	flex-wrap: wrap;
	justify-content: flex-end;
	gap: 8px;
	margin-top: 16px;
}

/* ---- ปุ่ม ---- */
.cc-btn {
	padding: 9px 18px;
	border: 1px solid transparent;
	border-radius: 999px;
	background: none;
	font-family: inherit;
	font-size: 15px;
	font-weight: 600;
	line-height: 1.2;
	cursor: pointer;
	transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.cc-btn:focus-visible {
	outline: 3px solid rgba(23, 78, 189, 0.35);
	outline-offset: 2px;
}

.cc-btn--primary {
	background: var(--cc-primary);
	color: #FFF;
}

.cc-btn--primary:hover {
	background: var(--cc-primary-hover);
}

.cc-btn--ghost {
	border-color: #cbd5e1;
	color: var(--cc-text);
}

.cc-btn--ghost:hover {
	border-color: var(--cc-primary);
	color: var(--cc-primary);
}

.cc-btn--link {
	margin-right: auto;
	padding-left: 4px;
	padding-right: 4px;
	color: var(--cc-primary);
	text-decoration: underline;
}

/* ---- หน้าต่างตั้งค่า ---- */
html.cc-modal-open {
	overflow: hidden;
}

.cc-modal {
	position: fixed;
	inset: 0;
	z-index: 1070;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
}

.cc-modal__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(15, 23, 42, 0.55);
}

.cc-modal__panel {
	position: relative;
	display: flex;
	flex-direction: column;
	width: 100%;
	max-width: 560px;
	max-height: calc(100vh - 32px);
	background: #FFF;
	border-radius: 18px;
	box-shadow: 0 30px 60px rgba(15, 23, 42, 0.3);
	outline: none;
	animation: cc-pop 0.25s ease both;
}

.cc-modal__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 18px 22px;
	border-bottom: 1px solid var(--cc-border);
}

.cc-modal__head h3 {
	margin: 0;
	font-size: 20px;
	font-weight: 700;
	line-height: 1.3;
	color: var(--cc-text);
}

.cc-modal__close {
	width: 36px;
	height: 36px;
	border: 0;
	border-radius: 50%;
	background: #f1f5f9;
	color: var(--cc-muted);
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
}

.cc-modal__close:hover {
	background: #e2e8f0;
}

.cc-modal__body {
	padding: 18px 22px;
	overflow-y: auto;
}

.cc-modal__body p {
	margin: 0 !important;
	font-size: 14px;
	line-height: 1.6 !important;
	color: var(--cc-muted);
}

.cc-modal__intro {
	margin-bottom: 14px !important;
}

.cc-cat {
	padding: 14px 16px;
	margin-top: 10px;
	border: 1px solid var(--cc-border);
	border-radius: 12px;
}

.cc-cat__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 6px;
}

.cc-cat__head strong {
	font-size: 16px;
}

.cc-badge {
	display: inline-block;
	margin-left: 6px;
	padding: 2px 8px;
	border-radius: 999px;
	background: #e7f6ec;
	color: #15803d;
	font-size: 12px;
	font-weight: 600;
	vertical-align: middle;
}

.cc-modal__foot {
	display: flex;
	flex-wrap: wrap;
	justify-content: flex-end;
	gap: 8px;
	padding: 16px 22px;
	border-top: 1px solid var(--cc-border);
}

/* สวิตช์เปิด/ปิด */
.cc-switch {
	position: relative;
	flex-shrink: 0;
	width: 46px;
	height: 26px;
	margin: 0;
	cursor: pointer;
}

.cc-switch input {
	position: absolute;
	opacity: 0;
	width: 100%;
	height: 100%;
	margin: 0;
	cursor: pointer;
}

.cc-switch span {
	position: absolute;
	inset: 0;
	border-radius: 999px;
	background: #cbd5e1;
	transition: background 0.2s ease;
	pointer-events: none;
}

.cc-switch span::after {
	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, 0.25);
	transition: transform 0.2s ease;
}

.cc-switch input:checked + span {
	background: var(--cc-primary);
}

.cc-switch input:checked + span::after {
	transform: translateX(20px);
}

.cc-switch input:disabled + span {
	background: #86c79b;
	cursor: not-allowed;
}

.cc-switch input:focus-visible + span {
	box-shadow: 0 0 0 3px rgba(23, 78, 189, 0.35);
}

/* เนื้อหาภายนอก (iframe) ที่รอความยินยอม เช่น เพจ Facebook หน้าแรก */
.consent-embed {
	--cc-primary: #174EBD;
	--cc-primary-hover: #0f3d99;
	position: relative;
	overflow: hidden;
	border-radius: 12px;
	background: #f1f5f9;
	font-family: 'Sarabun', sans-serif;
}

.consent-embed iframe {
	display: block;
	width: 100%;
	height: 100%;
}

.consent-embed__placeholder {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 12px;
	padding: 24px;
	text-align: center;
}

.consent-embed__placeholder i {
	color: #1877F2;
	font-size: 44px;
}

.consent-embed__placeholder p {
	margin: 0 !important;
	color: #475569 !important;
	font-size: 15px;
	line-height: 1.6 !important;
}

.consent-embed__placeholder a {
	color: #174EBD;
	font-size: 14px;
	text-decoration: underline;
}

.consent-embed.is-loaded .consent-embed__placeholder {
	display: none;
}

@keyframes cc-pop {
	from { opacity: 0; transform: translateY(12px) scale(0.98); }
	to { opacity: 1; transform: none; }
}

/* มือถือ: แบนเนอร์อยู่เหนือแถบปุ่มติดต่อด้านล่าง (css/fab.css) */
@media (max-width: 767px) {
	.cc-banner {
		left: 10px;
		right: 10px;
		bottom: calc(var(--fab-bar-h, 0px) + env(safe-area-inset-bottom, 0px) + 10px);
		width: auto;
		max-width: none;
		padding: 16px;
	}

	.cc-banner__icon {
		display: none;
	}

	.cc-banner__actions .cc-btn--ghost,
	.cc-banner__actions .cc-btn--primary {
		flex: 1 1 0;
	}

	.cc-banner__actions .cc-btn--link {
		flex-basis: 100%;
		order: 3;
		margin: 0;
		text-align: center;
	}

	.cc-modal {
		align-items: flex-end;
		padding: 0;
	}

	.cc-modal__panel {
		max-width: none;
		max-height: 88vh;
		border-radius: 18px 18px 0 0;
	}

	.cc-modal__foot .cc-btn {
		flex: 1 1 auto;
	}
}

@media (prefers-reduced-motion: reduce) {
	.cc-banner,
	.cc-modal__panel {
		transition: none;
		animation: none;
	}
}
