/* ============================================================
   fab.css
   ------------------------------------------------------------
   ปุ่มติดต่อลอย (Float Action Button)
   ------------------------------------------------------------
   ข้อกำหนด : ต้องแสดงข้อมูลออกมาเลย ไม่ต้องกดปุ่มเปิด
   -> ทุกปุ่มกางออกพร้อมป้ายข้อความเบอร์โทร / LINE ให้เห็นทันที
      ไม่มีปุ่ม toggle ให้ต้องกดก่อนอีกต่อไป

   ดีไซน์
   - เป็นแคปซูลแก้วฝ้า (glass) เงานุ่ม โทนสีเดียวกับเว็บ (เหลือง #FCDF15)
   - จอคอม / แท็บเล็ต : ลอยมุมขวาล่าง เรียงลงมาเป็นแถว
   - มือถือ            : กลายเป็นแถบเต็มความกว้างติดขอบล่าง กดด้วยนิ้วง่าย
   ============================================================ */

.cfab {
	position: fixed;
	right: 18px;
	bottom: 18px;
	z-index: 9990;
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 10px;
	/* กันทับกับแถบคุกกี้ตอนมันโผล่มา */
	transition: transform .3s ease, opacity .3s ease;
}

/* หัวข้อเล็ก ๆ ด้านบนชุดปุ่ม */
.cfab__title {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	background: rgba(32,32,32,.88);
	color: #FCDF15;
	font-size: 12.5px;
	font-weight: 500;
	letter-spacing: .3px;
	padding: 6px 13px;
	border-radius: 20px;
	backdrop-filter: blur(8px);
	box-shadow: 0 4px 14px rgba(0,0,0,.25);
	white-space: nowrap;
	line-height: 1.4;
}

/* ---------- ปุ่มแต่ละอัน ---------- */
.cfab__btn {
	display: inline-flex;
	align-items: center;
	gap: 11px;
	min-height: 52px;
	padding: 8px 20px 8px 8px;
	border-radius: 999px;
	text-decoration: none !important;
	background: rgba(255,255,255,.96);
	color: #202020 !important;
	box-shadow: 0 6px 20px rgba(0,0,0,.22), 0 1px 3px rgba(0,0,0,.12);
	backdrop-filter: blur(10px);
	border: 1px solid rgba(0,0,0,.06);
	transition: transform .22s cubic-bezier(.2,.8,.2,1), box-shadow .22s ease, background .22s ease;
	max-width: 290px;
}

.cfab__btn:hover,
.cfab__btn:focus-visible {
	transform: translateX(-4px);
	box-shadow: 0 12px 30px rgba(0,0,0,.32);
	background: #fff;
	color: #202020 !important;
	text-decoration: none !important;
}

.cfab__btn:focus-visible { outline: 3px solid #FCDF15; outline-offset: 3px; }
.cfab__btn:active { transform: scale(.97); }

/* วงกลมไอคอน */
.cfab__icon {
	flex: 0 0 auto;
	width: 36px;
	height: 36px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 16px;
	color: #fff;
	box-shadow: 0 2px 6px rgba(0,0,0,.2);
}

/* ข้อความในปุ่ม — แสดงออกมาเลย ไม่ซ่อน */
.cfab__text {
	display: flex;
	flex-direction: column;
	line-height: 1.25;
	min-width: 0;
}

.cfab__label {
	font-size: 11px;
	color: #777;
	font-weight: 400;
}

.cfab__value {
	font-size: 15.5px;
	font-weight: 600;
	color: #202020;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

/* ---------- สีประจำช่องทางติดต่อ ---------- */
.cfab__icon--tel   { background: linear-gradient(135deg, #e0373a, #b81f22); }
.cfab__icon--tel2  { background: linear-gradient(135deg, #f0820d, #d16500); }
.cfab__icon--line  { background: linear-gradient(135deg, #37cf4d, #06961f); }
.cfab__icon--fb    { background: linear-gradient(135deg, #4a7bea, #1f49a8); }
.cfab__icon--mail  { background: linear-gradient(135deg, #6b7280, #434852); }
.cfab__icon--top   { background: linear-gradient(135deg, #2a2a2a, #000); }

/* จังหวะหัวใจเบา ๆ ที่ปุ่มโทร ให้สะดุดตาแต่ไม่กวน */
.cfab__btn--primary .cfab__icon--tel {
	animation: cfab-pulse 2.6s ease-in-out infinite;
}

@keyframes cfab-pulse {
	0%, 100% { box-shadow: 0 2px 6px rgba(0,0,0,.2), 0 0 0 0 rgba(224,55,58,.55); }
	50%      { box-shadow: 0 2px 6px rgba(0,0,0,.2), 0 0 0 11px rgba(224,55,58,0); }
}

/* ---------- ปุ่มขึ้นบนสุด (โผล่เมื่อเลื่อนลงมาแล้ว) ---------- */
.cfab__top {
	align-self: flex-end;
	width: 42px;
	height: 42px;
	min-height: 0;
	padding: 0;
	justify-content: center;
	opacity: 0;
	visibility: hidden;
	transform: translateY(8px);
}

.cfab__top.is-visible { opacity: 1; visibility: visible; transform: translateY(0); }

/* ---------- มือถือ : แถบติดขอบล่าง ---------- */
@media (max-width: 767px) {

	.cfab {
		right: 0;
		left: 0;
		bottom: 0;
		flex-direction: row;
		align-items: stretch;
		gap: 0;
		padding: 6px 6px calc(6px + env(safe-area-inset-bottom, 0px));
		background: rgba(255,255,255,.97);
		backdrop-filter: blur(14px);
		box-shadow: 0 -3px 18px rgba(0,0,0,.18);
		border-top: 2px solid #FCDF15;
	}

	/* หัวข้อกับปุ่มขึ้นบนสุด ไม่ต้องแสดงบนแถบล่าง */
	.cfab__title { display: none; }

	.cfab__btn {
		flex: 1 1 0;
		min-width: 0;
		flex-direction: column;
		gap: 3px;
		padding: 7px 4px;
		min-height: 58px;
		border-radius: 12px;
		background: transparent;
		box-shadow: none;
		border: 0;
		max-width: none;
		justify-content: center;
		text-align: center;
	}

	.cfab__btn:hover,
	.cfab__btn:focus-visible { transform: none; box-shadow: none; background: rgba(0,0,0,.05); }

	.cfab__icon  { width: 28px; height: 28px; font-size: 13px; }
	.cfab__label { display: none; }

	.cfab__value {
		font-size: 11.5px;
		font-weight: 500;
		max-width: 100%;
	}

	.cfab__top { display: none; }

	/* เว้นที่ด้านล่างหน้าเว็บ ไม่ให้แถบไปทับเนื้อหาส่วนท้าย */
	body.has-cfab-bar #footer { padding-bottom: 76px; }
}

/* ---------- จอเล็กมาก ย่อขนาดลงอีก ---------- */
@media (max-width: 360px) {
	.cfab__value { font-size: 10.5px; }
	.cfab__icon  { width: 25px; height: 25px; font-size: 12px; }
}

/* ---------- เคารพการตั้งค่าลดการเคลื่อนไหว ---------- */
@media (prefers-reduced-motion: reduce) {
	.cfab, .cfab__btn, .cfab__top { transition: none; }
	.cfab__btn--primary .cfab__icon--tel { animation: none; }
}

/* ---------- ตอนสั่งพิมพ์หน้าเว็บ ไม่ต้องมีปุ่มลอย ---------- */
@media print { .cfab { display: none !important; } }
