/**
 * Nút liên hệ nổi.
 *
 * File riêng, không gộp vào main.css: trang landing có tuỳ chọn gỡ CSS
 * của theme, gộp chung thì nút này mất sạch định dạng.
 */

.ccontact {
	position: fixed;
	bottom: var(--cct-bottom, 24px);
	z-index: 9000;
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 12px;
	font-family: inherit;
}

.ccontact--right { right: 20px; }
.ccontact--left  { left: 20px; align-items: flex-start; }

/* ------------------------------------------------------------ nút chính */

.ccontact__btn {
	position: relative;
	display: inline-flex;
	align-items: center;
	gap: 10px;
	padding: 0;
	border: 0;
	background: none;
	cursor: pointer;
	color: #fff;
	font: inherit;
}

.ccontact__btn .ccontact__ico {
	position: relative;
	display: grid;
	place-items: center;
	width: 56px;
	height: 56px;
	border-radius: 50%;
	background: var(--cct-main, #2F6D4F);
	box-shadow: 0 8px 24px rgba(0, 0, 0, .28);
	flex: none;
}

.ccontact__btn .ccontact__ico svg,
.ccontact__btn .ccontact__ico img {
	grid-area: 1 / 1;
	transition: opacity .25s ease, transform .35s ease;
}

/* Icon chat và dấu X nằm chồng nhau, chỉ đổi cái nào hiện. */
.ccontact__btn .ccontact__ico > :last-child { opacity: 0; transform: rotate(-90deg); }
.ccontact.is-open .ccontact__btn .ccontact__ico > :first-child { opacity: 0; transform: rotate(90deg); }
.ccontact.is-open .ccontact__btn .ccontact__ico > :last-child  { opacity: 1; transform: rotate(0); }

.ccontact__label {
	order: -1;
	padding: 8px 14px;
	border-radius: 100px;
	background: #fff;
	color: #1b1b1b;
	font-size: 14px;
	font-weight: 600;
	white-space: nowrap;
	box-shadow: 0 4px 16px rgba(0, 0, 0, .16);
}
.ccontact--left .ccontact__label { order: 1; }

.ccontact--lbl-hover .ccontact__label {
	opacity: 0;
	transform: translateX(8px);
	transition: opacity .25s ease, transform .25s ease;
	pointer-events: none;
}
.ccontact--lbl-hover .ccontact__btn:hover .ccontact__label,
.ccontact--lbl-hover .ccontact__btn:focus-visible .ccontact__label {
	opacity: 1;
	transform: none;
}

/* Vòng sóng lan toả. Chỉ một vòng, chậm — nhiều vòng nhấp nháy ở góc màn
   hình gây rối mắt suốt cả phiên xem. */
.ccontact__btn.has-pulse .ccontact__ico::after {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: 50%;
	background: var(--cct-main, #2F6D4F);
	animation: cct-pulse 2.4s ease-out infinite;
	z-index: -1;
}

@keyframes cct-pulse {
	0%   { transform: scale(1);   opacity: .55; }
	70%  { transform: scale(1.7); opacity: 0; }
	100% { transform: scale(1.7); opacity: 0; }
}

.ccontact.is-open .ccontact__btn.has-pulse .ccontact__ico::after { animation: none; }

/* ------------------------------------------------------- danh sách kênh */

.ccontact__list {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 10px;
	margin: 0;
	padding: 0;
	list-style: none;
}
.ccontact--left .ccontact__list { align-items: flex-start; }

.ccontact__list li {
	opacity: 0;
	transform: translateY(14px) scale(.9);
	pointer-events: none;
	transition: opacity .28s ease, transform .28s cubic-bezier(.22, .61, .36, 1);
	/* Nở lần lượt từ dưới lên, mục gần nút chính ra trước. */
	transition-delay: calc(var(--cct-i, 0) * 45ms);
}

.ccontact.is-open .ccontact__list li {
	opacity: 1;
	transform: none;
	pointer-events: auto;
}

.ccontact__list a {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	text-decoration: none;
	color: #fff;
}

.ccontact__name {
	padding: 7px 13px;
	border-radius: 100px;
	background: #fff;
	color: #1b1b1b;
	font-size: 13.5px;
	font-weight: 600;
	white-space: nowrap;
	box-shadow: 0 4px 14px rgba(0, 0, 0, .16);
}
.ccontact--left .ccontact__name { order: 1; }

.ccontact__list .ccontact__ico {
	display: grid;
	place-items: center;
	width: 46px;
	height: 46px;
	border-radius: 50%;
	background: var(--cct-c, #2F6D4F);
	box-shadow: 0 6px 18px rgba(0, 0, 0, .22);
	flex: none;
	overflow: hidden;
}

.ccontact__ico svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ccontact__ico img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ------------------------------------------------------------- mobile */

@media (max-width: 1100px) {
	.ccontact__btn .ccontact__ico { width: 50px; height: 50px; }
	.ccontact__list .ccontact__ico { width: 42px; height: 42px; }
	.ccontact--right { right: 14px; }
	.ccontact--left  { left: 14px; }
}

/* Trang sản phẩm trên mobile có thanh mua hàng cố định ở đáy — không
   đẩy nút lên thì hai cái chồng lên nhau, bấm nhầm nhau. */
@media (max-width: 1100px) {
	body.single-product .ccontact { bottom: calc(var(--cct-bottom, 24px) + 68px); }
}

@media (prefers-reduced-motion: reduce) {
	.ccontact__btn.has-pulse .ccontact__ico::after { animation: none; }
	.ccontact__list li { transition: opacity .2s linear; transform: none; }
}
