/*-------------------------------------------------------------------
  cookie-consent.css
  แถบขอความยินยอมคุกกี้ + หน้าต่างตั้งค่าคุกกี้ (PDPA)
-------------------------------------------------------------------*/

:root {
	--cc-primary: #0088cc;
	--cc-primary-dark: #006fa6;
	--cc-text: #2b3440;
	--cc-muted: #6b7785;
	--cc-border: #e3e8ee;
}

.cc-root * {
	box-sizing: border-box;
}

/* ตั้งฟอนต์ที่ตัวแม่ แล้วให้ลูกสืบทอดเอา
   ห้ามใช้ .cc-root * { font-family } เพราะจะไปทับฟอนต์ของ Font Awesome
   ทำให้ไอคอนกลายเป็นกล่องสี่เหลี่ยมว่าง */
.cc-root {
	font-family: 'Kodchasan', sans-serif;
}

.cc-root button,
.cc-root input,
.cc-root select,
.cc-root textarea {
	font-family: inherit;
}

/*===============================================================
  แถบด้านล่าง
===============================================================*/
.cc-banner {
	position: fixed;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 9500;
	background: rgba(255, 255, 255, .97);
	-webkit-backdrop-filter: blur(12px);
	backdrop-filter: blur(12px);
	border-top: 3px solid var(--cc-primary);
	box-shadow: 0 -8px 32px rgba(0, 0, 0, .14);
	padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
	transform: translateY(100%);
	transition: transform .4s cubic-bezier(.22, 1, .36, 1);
}

.cc-banner.is-open {
	transform: none;
}

.cc-banner[hidden] {
	display: none;
}

.cc-banner-inner {
	max-width: 1180px;
	margin: 0 auto;
	display: flex;
	align-items: center;
	gap: 22px;
	flex-wrap: wrap;
}

.cc-banner-icon {
	flex: 0 0 auto;
	width: 48px;
	height: 48px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 22px;
	color: #fff;
	background-image: linear-gradient(135deg, #ffb24d, #ff8a00);
	box-shadow: 0 4px 12px rgba(255, 138, 0, .35);
}

.cc-banner-body {
	flex: 1 1 420px;
	min-width: 260px;
}

.cc-banner-title {
	font-size: 17px;
	font-weight: 700;
	color: var(--cc-text);
	margin: 0 0 4px;
}

.cc-banner-text {
	font-size: 14px;
	line-height: 1.65;
	color: var(--cc-muted);
	margin: 0;
}

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

.cc-banner-actions {
	flex: 0 0 auto;
	display: flex;
	gap: 10px;
	flex-wrap: wrap;
}

/*===============================================================
  ปุ่ม
===============================================================*/
.cc-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 7px;
	min-height: 44px;
	padding: 10px 20px;
	border-radius: 999px;
	border: 1.5px solid transparent;
	font-size: 14.5px;
	font-weight: 600;
	cursor: pointer;
	white-space: nowrap;
	text-decoration: none !important;
	transition: transform .18s ease, box-shadow .18s ease, background-color .18s ease;
}

.cc-btn:hover {
	transform: translateY(-2px);
}

.cc-btn:active {
	transform: none;
}

.cc-btn:focus-visible {
	outline: 3px solid var(--cc-primary);
	outline-offset: 2px;
}

.cc-btn-accept {
	background-image: linear-gradient(135deg, #22c55e, #16a34a);
	color: #fff !important;
	box-shadow: 0 5px 16px rgba(22, 163, 74, .32);
}

.cc-btn-reject {
	background: #fff;
	color: var(--cc-text) !important;
	border-color: var(--cc-border);
}

.cc-btn-reject:hover {
	border-color: #c9d2dc;
}

.cc-btn-settings {
	background: transparent;
	color: var(--cc-primary) !important;
	border-color: transparent;
	text-decoration: underline !important;
	padding-left: 10px;
	padding-right: 10px;
}

.cc-btn-save {
	background-image: linear-gradient(135deg, #38a9e4, var(--cc-primary-dark));
	color: #fff !important;
	box-shadow: 0 5px 16px rgba(0, 136, 204, .32);
}

/*===============================================================
  หน้าต่างตั้งค่าคุกกี้
===============================================================*/
.cc-modal {
	position: fixed;
	inset: 0;
	z-index: 9600;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
	background: rgba(17, 24, 33, .55);
	-webkit-backdrop-filter: blur(3px);
	backdrop-filter: blur(3px);
	opacity: 0;
	transition: opacity .25s ease;
}

.cc-modal[hidden] {
	display: none;
}

.cc-modal.is-open {
	opacity: 1;
}

.cc-modal-card {
	width: 100%;
	max-width: 620px;
	max-height: 88vh;
	overflow-y: auto;
	background: #fff;
	border-radius: 18px;
	box-shadow: 0 24px 64px rgba(0, 0, 0, .3);
	transform: translateY(18px) scale(.97);
	transition: transform .3s cubic-bezier(.22, 1, .36, 1);
}

.cc-modal.is-open .cc-modal-card {
	transform: none;
}

.cc-modal-head {
	display: flex;
	align-items: flex-start;
	gap: 12px;
	padding: 22px 24px 14px;
	border-bottom: 1px solid var(--cc-border);
}

.cc-modal-head h2 {
	flex: 1;
	margin: 0;
	font-size: 19px;
	font-weight: 700;
	color: var(--cc-text);
}

.cc-modal-close {
	flex: 0 0 auto;
	width: 34px;
	height: 34px;
	border: 0;
	border-radius: 50%;
	background: #f1f4f8;
	color: var(--cc-muted);
	font-size: 15px;
	cursor: pointer;
	transition: background-color .18s ease;
}

.cc-modal-close:hover {
	background: #e3e8ee;
}

.cc-modal-body {
	padding: 18px 24px;
}

.cc-modal-intro {
	font-size: 14px;
	line-height: 1.7;
	color: var(--cc-muted);
	margin: 0 0 18px;
}

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

/*===============================================================
  รายการประเภทคุกกี้
===============================================================*/
.cc-group {
	border: 1px solid var(--cc-border);
	border-radius: 13px;
	padding: 15px 17px;
	margin-bottom: 11px;
	transition: border-color .2s ease;
}

.cc-group:hover {
	border-color: #cfd8e3;
}

.cc-group-top {
	display: flex;
	align-items: center;
	gap: 12px;
}

.cc-group-name {
	flex: 1;
	font-size: 15px;
	font-weight: 700;
	color: var(--cc-text);
}

.cc-group-desc {
	margin: 9px 0 0;
	font-size: 13px;
	line-height: 1.65;
	color: var(--cc-muted);
}

.cc-always {
	font-size: 12.5px;
	font-weight: 600;
	color: #16a34a;
	background: #e9f9ef;
	padding: 5px 11px;
	border-radius: 999px;
	white-space: nowrap;
}

/*===============================================================
  สวิตช์เปิด/ปิด
===============================================================*/
.cc-switch {
	flex: 0 0 auto;
	position: relative;
	display: inline-block;
	width: 50px;
	height: 28px;
}

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

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

.cc-slider::before {
	content: "";
	position: absolute;
	top: 3px;
	left: 3px;
	width: 22px;
	height: 22px;
	background: #fff;
	border-radius: 50%;
	box-shadow: 0 1px 4px rgba(0, 0, 0, .25);
	transition: transform .22s cubic-bezier(.34, 1.56, .64, 1);
}

.cc-switch input:checked + .cc-slider {
	background-image: linear-gradient(135deg, #38a9e4, var(--cc-primary));
}

.cc-switch input:checked + .cc-slider::before {
	transform: translateX(22px);
}

.cc-switch input:focus-visible + .cc-slider {
	outline: 3px solid var(--cc-primary);
	outline-offset: 2px;
}

/*===============================================================
  ลิงก์ "ตั้งค่าคุกกี้" ที่ footer
===============================================================*/
.cc-reopen {
	background: none;
	border: 0;
	padding: 0;
	font: inherit;
	color: inherit;
	text-decoration: underline;
	cursor: pointer;
}

/*===============================================================
  จอเล็ก
===============================================================*/
@media (max-width: 767px) {

	.cc-banner {
		padding: 15px 14px calc(15px + env(safe-area-inset-bottom));
		max-height: 82vh;
		overflow-y: auto;
	}

	.cc-banner-inner {
		gap: 13px;
	}

	.cc-banner-icon {
		width: 38px;
		height: 38px;
		font-size: 17px;
	}

	.cc-banner-body {
		flex: 1 1 100%;
	}

	.cc-banner-title {
		font-size: 15.5px;
	}

	.cc-banner-text {
		font-size: 13px;
	}

	.cc-banner-actions {
		width: 100%;
		flex-direction: column-reverse;
	}

	.cc-banner-actions .cc-btn {
		width: 100%;
	}

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

@media (prefers-reduced-motion: reduce) {

	.cc-banner,
	.cc-modal,
	.cc-modal-card,
	.cc-btn,
	.cc-slider,
	.cc-slider::before {
		transition: none;
	}
}

/*===============================================================
  กล่องแทนที่เนื้อหาจากภายนอก (Facebook ฯลฯ)
  แสดงเมื่อผู้ใช้ยังไม่ยินยอมคุกกี้เพื่อการตลาด
===============================================================*/
.fb-consent-placeholder {
	width: 340px;
	max-width: 100%;
	height: 500px;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 9px;
	text-align: center;
	padding: 26px 22px;
	border: 1.5px dashed #c8d5e2;
	border-radius: 13px;
	background: #f7fafd;
	font-family: 'Kodchasan', sans-serif;
}

.fb-consent-placeholder > i {
	font-size: 40px;
	color: #1877f2;
	opacity: .75;
	margin-bottom: 3px;
}

.fb-consent-title {
	font-size: 16.5px;
	font-weight: 700;
	color: #2b3440;
	margin: 0;
}

.fb-consent-text {
	font-size: 13.5px;
	line-height: 1.7;
	color: #6b7785;
	margin: 0 0 7px;
}

.fb-consent-btn {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 10px 21px;
	border: 0;
	border-radius: 999px;
	background-image: linear-gradient(135deg, #38a9e4, #006fa6);
	color: #fff;
	font-family: 'Kodchasan', sans-serif;
	font-size: 14.5px;
	font-weight: 600;
	cursor: pointer;
	box-shadow: 0 5px 14px rgba(0, 136, 204, .3);
	transition: transform .18s ease;
}

.fb-consent-btn:hover {
	transform: translateY(-2px);
}

.fb-consent-link {
	font-size: 13px;
	color: #0088cc;
	text-decoration: underline;
}

@media (max-width: 767px) {

	.fb-consent-placeholder {
		height: auto;
		min-height: 300px;
	}
}
