/* แบนเนอร์ขอความยินยอมคุกกี้ (PDPA) — _cookie_consent.php + js/cookie-consent.js */
:root {
	--cc-red: #CE0001;
	--cc-red-dark: #8D0104;
	--cc-on: #16a34a;
	--cc-text: #1f1f1f;
	--cc-muted: #5f5f5f;
	--cc-line: #e6e6e6;
}

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

/* ---------- แบนเนอร์ ---------- */
.cc-banner {
	position: fixed;
	left: 20px;
	bottom: 20px;
	z-index: 1050;
	width: calc(100% - 40px);
	max-width: 470px;
	padding: 18px 20px 16px;
	background: #FFF;
	color: var(--cc-text);
	border: 1px solid rgba(0, 0, 0, .06);
	border-radius: 18px;
	box-shadow: 0 18px 50px rgba(0, 0, 0, .2), 0 3px 10px rgba(0, 0, 0, .08);
	animation: cc-rise .35s ease-out;
}

@keyframes cc-rise {
	from { opacity: 0; transform: translateY(16px); }
	to   { opacity: 1; transform: none; }
}

.cc-banner-body {
	display: flex;
	gap: 14px;
	align-items: flex-start;
}

.cc-banner-icon {
	flex: none;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 42px;
	height: 42px;
	border-radius: 50%;
	background: #fdecec;
	color: var(--cc-red);
	font-size: 20px;
}

.cc-title {
	font-size: 17px;
	font-weight: 700;
	line-height: 1.4;
	margin-bottom: 4px;
}

.cc-banner p.cc-desc {
	font-size: 14px;
	line-height: 1.65 !important;
	color: var(--cc-muted) !important;
}

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

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

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

.cc-btn:focus-visible {
	outline: 3px solid #ffb400;
	outline-offset: 2px;
}

.cc-btn-primary {
	background: linear-gradient(120deg, var(--cc-red) 0%, var(--cc-red-dark) 100%);
	color: #FFF;
}

.cc-btn-primary:hover { box-shadow: 0 6px 16px rgba(206, 0, 1, .3); }

.cc-btn-outline {
	background: #FFF;
	color: var(--cc-text);
	border-color: #cfcfcf;
}

.cc-btn-outline:hover { border-color: #8a8a8a; }

.cc-btn-link {
	background: transparent;
	color: var(--cc-muted);
	text-decoration: underline;
	padding-left: 8px;
	padding-right: 8px;
	margin-right: auto;
}

.cc-btn-link:hover { color: var(--cc-text); }

/* ---------- หน้าต่างตั้งค่า ---------- */
.cc-modal {
	position: fixed;
	inset: 0;
	z-index: 1060;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
}

.cc-modal-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(15, 15, 15, .55);
	animation: cc-fade .2s ease-out;
}

@keyframes cc-fade {
	from { opacity: 0; }
	to   { opacity: 1; }
}

.cc-modal-dialog {
	position: relative;
	display: flex;
	flex-direction: column;
	width: 100%;
	max-width: 580px;
	max-height: calc(100vh - 32px);
	background: #FFF;
	color: var(--cc-text);
	border-radius: 20px;
	box-shadow: 0 24px 60px rgba(0, 0, 0, .3);
	animation: cc-rise .25s ease-out;
}

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

.cc-modal-title {
	font-size: 20px;
	font-weight: 700;
}

.cc-close {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	border: 0;
	border-radius: 50%;
	background: #f2f2f2;
	color: #444;
	font-size: 18px;
	cursor: pointer;
}

.cc-close:hover { background: #e6e6e6; }

.cc-modal-body {
	padding: 16px 22px;
	overflow-y: auto;
}

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

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

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

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

.cc-cat-head label {
	margin: 0;
	cursor: pointer;
}

.cc-cat-head strong {
	font-size: 16px;
	color: var(--cc-text);
}

.cc-always {
	flex: none;
	font-size: 13px;
	font-weight: 600;
	color: var(--cc-on);
}

.cc-switch {
	position: relative;
	flex: none;
	width: 46px;
	height: 26px;
}

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

.cc-switch span {
	position: absolute;
	inset: 0;
	border-radius: 999px;
	background: #cdcdcd;
	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 1px 3px rgba(0, 0, 0, .25);
	transition: transform .2s ease;
}

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

.cc-switch input:focus-visible + span {
	outline: 3px solid #ffb400;
	outline-offset: 2px;
}

.cc-modal-foot {
	display: flex;
	flex-wrap: wrap;
	justify-content: flex-end;
	gap: 8px;
	padding: 14px 22px 18px;
	border-top: 1px solid var(--cc-line);
}

body.cc-modal-open { overflow: hidden; }

/* ---------- เนื้อหาภายนอกที่ยังไม่ได้รับความยินยอม (เช่น Google Maps) ---------- */
.cc-blocked {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	min-height: 220px;
	padding: 24px;
	text-align: center;
	background: #f6f6f6;
	border: 1.5px dashed #cfcfcf;
	border-radius: 14px;
}

.cc-blocked-inner { max-width: 440px; }

.cc-blocked-inner i {
	font-size: 30px;
	color: var(--cc-red);
	margin-bottom: 10px;
}

.cc-blocked-inner p {
	font-size: 15px;
	line-height: 1.6 !important;
	color: var(--cc-muted) !important;
	margin-bottom: 14px !important;
}

.cc-blocked-inner .cc-btn { margin: 3px; }

@media (prefers-reduced-motion: reduce) {
	.cc-banner, .cc-modal-dialog, .cc-modal-backdrop { animation: none; }
}

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

	.cc-banner-icon { display: none; }

	.cc-actions .cc-btn-outline,
	.cc-actions .cc-btn-primary { flex: 1 1 0; }

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

	.cc-modal-dialog {
		max-height: 92vh;
		border-radius: 20px 20px 0 0;
	}

	.cc-modal-foot .cc-btn { flex: 1 1 100%; }
}

/* ซ่อนกรอบว่างของเนื้อหาภายนอกระหว่างรอผลความยินยอม */
[data-consent-src]:not([src]) { display: none; }
