/*-------------------------------------------------------------------
  fab.css — ปุ่มลอยติดต่อเรา (Floating Action Button) รุ่นใหม่

  ของเดิม : ใช้ปลั๊กอิน kc.fab ต้องกดปุ่ม + ก่อน เมนูจึงกางออก
  ของใหม่ : กางออกพร้อมใช้ทันที เห็นเบอร์โทร / LINE ตั้งแต่เปิดหน้าเว็บ
            - จอคอม  : ปุ่มเรียงลงมาที่มุมขวาล่าง เห็นข้อความครบ
            - มือถือ : กลายเป็นแถบปุ่มเต็มความกว้างด้านล่าง กดง่ายด้วยนิ้วโป้ง
            เขียนด้วย CSS ล้วน ไม่ต้องพึ่ง jQuery plugin
-------------------------------------------------------------------*/

:root {
	--fab-phone-1: #ff8a00;
	--fab-phone-2: #ff6a00;
	--fab-line-1: #06c755;
	--fab-line-2: #04a445;
	--fab-msg-1: #00b2ff;
	--fab-msg-2: #006aff;
	--fab-map-1: #ea4335;
	--fab-map-2: #c5221f;
	--fab-radius: 999px;
	--fab-gap: 10px;
}

/*===============================================================
  โครงหลัก
===============================================================*/
.fab-dock {
	position: fixed;
	right: 18px;
	bottom: 18px;
	z-index: 9000;
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: var(--fab-gap);
	pointer-events: none; /* ให้คลิกทะลุช่องว่างระหว่างปุ่มได้ */
}

.fab-dock * {
	box-sizing: border-box;
}

/*===============================================================
  ปุ่มแต่ละอัน
===============================================================*/
.fab-item {
	pointer-events: auto;
	display: inline-flex;
	align-items: center;
	gap: 10px;
	min-height: 52px;
	padding: 8px 20px 8px 8px;
	border-radius: var(--fab-radius);
	text-decoration: none !important;
	color: #fff !important;
	font-family: 'Kodchasan', sans-serif;
	font-size: 15px;
	font-weight: 600;
	line-height: 1.2;
	white-space: nowrap;
	border: 1px solid rgba(255, 255, 255, .28);
	box-shadow:
		0 6px 16px rgba(0, 0, 0, .18),
		0 2px 4px rgba(0, 0, 0, .12),
		inset 0 1px 0 rgba(255, 255, 255, .22);
	background-image: linear-gradient(135deg, var(--c1), var(--c2));
	transition: transform .22s cubic-bezier(.34, 1.56, .64, 1),
		box-shadow .22s ease,
		filter .22s ease;
	animation: fabIn .5s cubic-bezier(.22, 1, .36, 1) both;
}

/* ไอคอนในวงกลมขาวโปร่ง */
.fab-item i {
	flex: 0 0 auto;
	width: 36px;
	height: 36px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	background: rgba(255, 255, 255, .20);
	font-size: 17px;
	line-height: 1;
}

.fab-item:hover,
.fab-item:focus-visible {
	transform: translateY(-3px) scale(1.03);
	filter: saturate(1.12);
	box-shadow:
		0 12px 26px rgba(0, 0, 0, .24),
		0 3px 8px rgba(0, 0, 0, .14),
		inset 0 1px 0 rgba(255, 255, 255, .3);
	color: #fff !important;
}

.fab-item:focus-visible {
	outline: 3px solid #fff;
	outline-offset: 2px;
}

.fab-item:active {
	transform: translateY(-1px) scale(.99);
}

/* ข้อความบรรยายใต้หัวข้อ */
.fab-text {
	display: flex;
	flex-direction: column;
}

.fab-label {
	font-size: 11px;
	font-weight: 400;
	opacity: .85;
	letter-spacing: .2px;
}

.fab-value {
	font-size: 15px;
	font-weight: 700;
}

/*===============================================================
  สีแต่ละปุ่ม
===============================================================*/
.fab-phone { --c1: var(--fab-phone-1); --c2: var(--fab-phone-2); }
.fab-line  { --c1: var(--fab-line-1);  --c2: var(--fab-line-2);  }
.fab-msg   { --c1: var(--fab-msg-1);   --c2: var(--fab-msg-2);   }
.fab-map   { --c1: var(--fab-map-1);   --c2: var(--fab-map-2);   }

/*===============================================================
  วงแหวนกระพริบที่ปุ่มโทร เพื่อเรียกสายตา
===============================================================*/
.fab-phone i::after {
	content: "";
	position: absolute;
	width: 36px;
	height: 36px;
	border-radius: 50%;
	border: 2px solid rgba(255, 255, 255, .9);
	animation: fabRing 2.2s ease-out infinite;
}

@keyframes fabRing {
	0%   { transform: scale(.85); opacity: .85; }
	70%  { transform: scale(1.5); opacity: 0; }
	100% { transform: scale(1.5); opacity: 0; }
}

.fab-phone i {
	position: relative;
}

/*===============================================================
  อนิเมชันตอนเข้าหน้า (ไล่ขึ้นมาทีละปุ่ม)
===============================================================*/
@keyframes fabIn {
	from { opacity: 0; transform: translateY(14px) scale(.94); }
	to   { opacity: 1; transform: none; }
}

.fab-dock .fab-item:nth-child(1) { animation-delay: .05s; }
.fab-dock .fab-item:nth-child(2) { animation-delay: .13s; }
.fab-dock .fab-item:nth-child(3) { animation-delay: .21s; }
.fab-dock .fab-item:nth-child(4) { animation-delay: .29s; }

/*===============================================================
  ขยับขึ้น เมื่อแถบคุกกี้ยังแสดงอยู่ (ไม่ให้ทับกัน)
===============================================================*/
body.has-consent-banner .fab-dock {
	bottom: 188px;
}

/*===============================================================
  มือถือ / จอเล็ก : เปลี่ยนเป็นแถบปุ่มด้านล่าง
===============================================================*/
@media (max-width: 767px) {

	.fab-dock {
		right: 0;
		left: 0;
		bottom: 0;
		flex-direction: row;
		align-items: stretch;
		gap: 0;
		padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
		background: rgba(255, 255, 255, .86);
		-webkit-backdrop-filter: saturate(180%) blur(14px);
		backdrop-filter: saturate(180%) blur(14px);
		border-top: 1px solid rgba(0, 0, 0, .07);
		box-shadow: 0 -4px 20px rgba(0, 0, 0, .10);
	}

	.fab-item {
		flex: 1 1 0;
		min-width: 0;
		flex-direction: column;
		justify-content: center;
		gap: 3px;
		min-height: 56px;
		padding: 7px 4px;
		margin: 0 3px;
		border-radius: 16px;
		font-size: 12px;
	}

	.fab-item i {
		width: 24px;
		height: 24px;
		font-size: 14px;
		background: none;
	}

	/* บนมือถือ แสดงแค่ชื่อปุ่มสั้น ๆ ไม่ต้องโชว์เบอร์ */
	.fab-value {
		font-size: 12px;
		font-weight: 600;
	}

	.fab-label {
		display: none;
	}

	.fab-phone i::after {
		display: none;
	}

	.fab-item:hover,
	.fab-item:focus-visible {
		transform: none;
	}

	/* เว้นที่ด้านล่างให้ footer ไม่ถูกแถบปุ่มทับ */
	body.has-fab-bar {
		padding-bottom: 74px;
	}

	body.has-consent-banner .fab-dock {
		bottom: 0;
	}
}

/*===============================================================
  ผู้ใช้ที่ตั้งค่าไม่ชอบอนิเมชัน
===============================================================*/
@media (prefers-reduced-motion: reduce) {

	.fab-item {
		animation: none;
		transition: none;
	}

	.fab-phone i::after {
		animation: none;
		opacity: 0;
	}
}

/* ซ่อนร่องรอยปลั๊กอินเดิม เผื่อมี markup ค้างอยู่ */
.kc_fab_wrapper {
	display: none !important;
}
